question stringlengths 0 34.8k | answer stringlengths 0 28.3k | title stringlengths 7 150 | forum_tag stringclasses 12
values |
|---|---|---|---|
I cant access wp-admin at all after changing wp-config folder permission for hardening my security. The content for the site load find, i cant access wp-admin at all, all i get is 404 message. anyone know how to fix this, I need a fix FAST. | Delete .htaccess type in domain.com/wp-login.php login. Dashboard -> Settings -> Permalinks -> Save. (just automatically recreates your .htaccess again). If the problem persists. Try disabling plugins. Enable plugins 1 by 1 until the problem occurs again. That will narrow down the faulty plugin. | Im getting a 404 message when i try to access wpadmin | wordpress |
I've got two taxonomies: "type of guide", and "tools". They look something like this: Type of guide <code> - Article - Video - Cheat sheet </code> Tool — Learning Management System Quiz Tool <code> - Hide a grades column (article) - Creating a Gradebook (article) - Long Answer Question Steps (article) - Matching Questi... | This helper function will return the ID of the term you are currently viewing (from any taxonomy - you can limit just to a specific taxonomy, or the built-in tag and category taxonomies). It will return false if you are not on a taxonomy term archive page. <code> function wpse52578_get_current_term_id(){ if( !is_tax() ... | Querying two taxonomies | wordpress |
I have a widget which displays the latest projects as thumbnails on my website. When I mouse over a thumbnail the project title appears; this is the code for title: <code> <h2><?php echo get_the_title(); ?></h2> </code> So, I'm thinking to display also the tags from that specific project, to be someth... | By what code you've posted, it seems like you've got a secondary loop set up (using a <code> WP_Query </code> object). So to display the current' posts tags you can use: <code> the_tags </code> - to print a list of the post's tags <code> wp_tag_cloud </code> - to print a tag cloud. <code> get_the_tags </code> - to retu... | displaying tags in a widget | wordpress |
Could someone tell me how i could make this work? i have a loop, and i would like to create another loop to find the other posts from the same category : but this does not work : <code> <?php while ( have_posts() ) : the_post(); ?> <?php /* How to display all other posts. */ ?> <?php $monid = the_ID(); $... | Okay, it works like that : <code> <?php while ( have_posts() ) : the_post(); ?> <?php $cats = get_the_category(); $cat_obj = array_shift($cats); var_dump($cat_obj); $cat_id = (int) $cat_obj->cat_ID; $qq = query_posts( 'cat=$cat_id&posts_per_page=1' ); //var_dump($qq); foreach($qq as $q2){ var_dump($q2-&... | loop inside a loop : search for posts in the same category | wordpress |
I have created some custom fields with Advanced Custom Fields and set them to appear in my custom post type named X (post type is equal to X). But I only need them to display on a particular single page from this custom post type, not on all of them. How would I do that? | Couldn't you do this through ACF settings page? You can select Post and set it equal to the title. Edit Updated image for clarification Edit 2 It turns out ACF does not query for custom type when display the title drop down. To include all post type, in /core/admin/meta_box_location.php, change <code> <div rel="post... | Show ACF fields only on certain page in the backend | wordpress |
I have a problem. I'm using a custom shortcode to try to get the url. If the shortcode is inside a post then it gets the post url. When I open the post on a category list, this post shortcode works correctly. <code> extract(shortcode_atts(array( 'gurl' => get_permalink(), ), $atts)); </code> But when i try to add th... | Depending on how the page's query and loop are constructed, when you access the post object from the sidebar or footer, you sometimes get the last post in the loop rather than the page itself. You can ensure you're getting the original (page) object by running wp_reset_query() from inside your widget (before you access... | page url in shortcode | wordpress |
I have created a theme that uses a featured image on every page. In settings, I have setup my "Posts Page" to be "news"...how do I get the featured image from "news" to display? The following will display the id of my posts page: <code> <?php $page_for_posts = get_option( 'page_for_posts' ); echo $page_for_posts; ?&... | I feel like such an idiot!! I was trouble-shooting this last night and I guess I removed the featured image for the news page...so, of course, the image wasn't showing up! I added the featured image and the following code: <code> <?php if(is_home()) { ?> <?php $page_for_posts = get_option( 'page_for_posts' ); ... | Posts Page Featured Image | wordpress |
Does anyone know if there's a WP plugin that shows you stats about your ads (like clicks, earnings, etc) ? I've been looking around and most plugins I've found only let's you manage the actual ad code. I found this one but it doesn't work. Thanks in advance! | Probably Wordpress Ad-Manager plugin will help you. Pay attention that the plugin is not free, but it provides information that you need and makes even more. | Google adsense stats plugin? | wordpress |
How can I make $before (Books:) a translateable string <code> <?php echo get_the_term_list( $post->ID, 'book', 'Books: ',', ', ' ', '' ); ?> </code> with this method?: <code> <?php the_content(__('Read more...', "ft")); ?> </code> | Use the <code> __() </code> function, just as you see in the <code> the_content() </code> example: <code> <?php echo get_the_term_list( // ID $post->ID, // taxonomy 'book', // Before __( 'Books: ', 'ft' ), // Separator, see http://core.trac.wordpress.org/ticket/7897 __( ', ' ), // After ' ', // Looks like you've ... | How to translate "$before" with get text in get_the_term_list? | wordpress |
Since I won't be using the built-in links feature of wordpress, I see no reason in keeping its related menu items on the admin ui causing nothing but clutter. How do I do that? | In your theme's functions.php : <code> function wpse52464_admin_ui_fixes() { remove_menu_page('link-manager.php'); } add_action('admin_menu', 'wpse52464_admin_ui_fixes'); </code> | how do I get rid of the links and all the links related menu items on the admin ui? | wordpress |
I am creating a widget plugin that a user could potentially use multiple iterations of the widget multiple times on a single widget-area / multiple widget-areas on a single page. Because of its functionality there will be differing widget-level variables that I will need to individually pass from PHP to JavaScript to t... | It's not true that you have to use <code> wp_localise_script </code> before the wp_head . Since 3.3 you can use <code> wp_enqueue_script </code> in the body of the document (i.e. in a widget or shortcode callback) and the script is loaded in the footer . Here's a skeleton class I've used for adding variables for each i... | Is it possible to enqueue a script from a widget method (of extended WP_Widget object)? | wordpress |
I'm getting nags on google speed test regarding the querystrings in my scripts. So, I'm trying to remove them by passing false as the argument for that parameter. However, it does not seem to have effect: <code> wp_register_script('myscript', get_bloginfo('template_directory').'/scripts.myversionnumber.js',false,false,... | I think you have to pass NULL as the 4th parameter. <code> wp_register_script( 'myscript', get_bloginfo('template_directory').'/scripts.myversionnumber.js', false, NULL, true); wp_enqueue_script('myscript'); </code> | Remove ?ver= from wp_register_script | wordpress |
I've got a front end post editing page located at mysite/post_id/edit and am trying to redirect users that are not the author back to the post. Here's the code I'm working with: <code> <?php global $current_user; get_currentuserinfo(); if($post->post_author != $current_user->ID): wp_redirect( the_permalink() )... | Fully working ANSWER: <code> global $current_user; get_currentuserinfo(); if($post->post_author != $current_user->ID){ wp_redirect(get_post_permalink($post->ID)); exit(); } </code> | Where does wp_redirect need to be placed to make it work? | wordpress |
Are featured thumbs uploaded the same as other images and have their own attachment post url? I'm trying to utilize the 3.0+ post formats and am using the featured image when creating a post under the 'image' post format. I would like to link the image from the blog loop to its attachment page, which I have already cus... | Question 1: How do you link Featured Image to its Attachment Page In the loop: <code> <?php if( has_post_thumbnail() ) : ?> <a href="<?php echo get_attachment_link( get_post_thumbnail_id() ); ?>"> <?php the_post_thumbnail(); ?> </a> <?php endif; ?> </code> Question 2: Post Format Tem... | Link Featured Thumb to Attachment Page, If Possible | wordpress |
I was reading stackexchange-url ("Stephen Harris")'s excellent answer to stackexchange-url ("this question") regarding the use of WP_query(), query_posts() and pre_get_posts. He says "pre_get_posts is a filter, for altering any query. It is most often used to alter only the 'main query'." It is possible to use pre_get_... | The simplest way is to add the action right before the query and remove it immediately after. <code> add_action('pre_get_posts', 'some_function_in_functionsphp'); $my_secondary_loop = new WP_Query(...); remove_action('pre_get_posts', 'some_function_in_functionsphp'); if( $my_secondary_loop->have_posts() ): while( $m... | Using pre_get_posts with WP_Query | wordpress |
I am using wordpress 3.2 and I did a query post like this: <code> <?php query_posts("posts_per_page=1post=type&page=post_parent=10");?> </code> Then I try to echo out the date of this post I queried like this. <code> <?php echo the_date(); ?> </code> It gives me the title of the post and the excerpt and... | See this special note about using the `the_date' SPECIAL NOTE: When there are multiple posts on a page published under the SAME DAY, the_date() only displays the date for the first post (that is, the first instance of the_date()). To repeat the date for posts published under the same day, you should use the Template Ta... | the_date() not working | wordpress |
This is really weird. In attempting to solve stackexchange-url ("this problem") i ended up with an almost perfect use of paginate_links() instead of a custom pagination function: <code> $myquery = new WP_Query($args); $paged = get_query_var('page'); ($paged == 0 ? $paged = 1 : $paged = $paged); $pagination = paginate_l... | Have you tried specifying the <code> base </code> and <code> format </code> arguments for <code> paginate_links() </code> ? It assumes the default values of: <code> 'base' => '%_%', 'format' => '?page=%#%', </code> Your <code> base </code> should be something like <code> /parent-page/child-page/%_% </code> ; then... | paginate_links() adds empty href to first page and previous link | wordpress |
I've set some meta variables on my WP posts. I want to be able to sort by these variables, and everything is working great except when I sort by either "views" or "likes". When I sort by either of those two fields, WP doesn't generate my nav (wp_nav_menu). I've tried "resetting" the $wp_query variable surrounding my wp... | Nav menus are also generated by a WP_Query, so in your <code> pre_get_posts </code> callback function you need to check if the <code> $query </code> you're altering is the main query. The easiest way to do this would probably be to do this right at the beginning of the function: <code> if ( ! $query->is_main_query()... | Wordpress Menu Disappears when $query-> query_vars['meta_key'] is set | wordpress |
Hi I was translating one of my plugins in "CodeStyling Localization". when I update my plugin my translation erased. Is there anyway to find it ? And How can I backup my translation (I don't want to waste my time next time :)) | You should move the po- and mo-file with the translation of your plugin outside your plugin's directory. Whenever you update your plugin, your plugin files are replaced causing any file that is not part of the default plugin package to be deleted. (If you are translating your own plugin, you could as well add the trans... | How to save a translation of a plugin in "CodeStyling Localization"? | wordpress |
This has most probably been asked before, but I really need to show WooCommerce products in my template, but I don't know what hooks to add where. It's my first time working with WooCommerce. Can anybody maybe help me out? Quick step by steps of the process are all I'm asking? And a little more advice would be greatly ... | Generally, Woo is integrated by the use of shortcodes in pages. This is to say, if you want a page to have the cart, create a "Cart" page and put the <code> [woocommerce_cart] </code> shortcode in the content. In fact, Woo adds two new buttons to your WYSIWYG editor to insert the shortcodes for you! This wouldn't be a ... | How did you incorporate WooCommerce in your own WordPress theme? | wordpress |
My theme is currently activated and showing only the background image and the "home" link. I believe the issue lies within header.php, but I can't quite figure out what. Any ideas? (Also, is there a php validator I could run my code through, or would a WP theme's code be too WP specific?) <code> <!DOCTYPE html> &... | <code> wp_lists_pages </code> is not a valid function, it's <code> wp_list_pages </code> (no s at end of list ). enable debugging in your <code> wp-config.php </code> file to see php errors Edit: additional ifo To answer your other question most advanced editors will check the syntax in your code and will flag errors. ... | unknown issue in 'header.php' preventing theme from displaying fully | wordpress |
this is my structure.... State1 <code> CT1-1 - Car_Model Post-CT1-1 (the posts of child) - Car_Model Post-CT1-2 CT2-1 - Car_Model Post-CT2-2 CT3-1 - Car_Model Post-CT3-1 </code> State2 <code> CT1-2 CT2-2 CT3-2 </code> State3 <code> CT1-3 CT2-3 CT3-3 </code> Here is the logic of what i have done to display triple drop d... | i solved the problem <code> if(isset($_POST['main_brand_id'])) { $term_id .= $_POST['main_brand_id']; $term = get_term( $term_id, 'state' ); $slug = $term->slug; global $post; $post_id = $post->ID; $args = array( 'post_type' =>'dealers','taxonomy'=>'state', 'term' => $slug ); $myposts = get_posts( $args ... | Query posts from a child taxonomy term id | wordpress |
When I click on post images it redirects in a page with a url like this: <code> http://localhost/?attachment_id=897 </code> . Can I set the default image link like <code> http://localhost/wp-content/uploads/2012/05/dice.jpg </code> instead of <code> http://localhost/?attachment_id=818 </code> ? Also how to style the at... | Navigate to: Dashboard -> Settings -> Media Check this box: Organize my uploads into month- and year-based folders. Save changes. then Navigate to: Dashboard -> Settings -> Permalinks Select "Post name" under "Common Settings" Save changes. As far as styling an attachment page, you can either open up your page template... | How would one change the default url structure of attachments? | wordpress |
For a single site wordpress, the language must be set from <code> wp-config.php </code> 's <code> WPLANG </code> , but is it possible to set from my plugin which override the default value? | In <code> wp-includes/l10n.php </code> you will find the function <code> get_locale() </code> . It offers a filter; you can set the language and ignore the constant: <code> function get_locale() { global $locale; if ( isset( $locale ) ) return apply_filters( 'locale', $locale ); // WPLANG is defined in wp-config. if ( ... | Setting WPLANG from a plugin | wordpress |
I want to make a new blog which only has a brief description of the article on the main page, instead of a shortened version of it. I want to make the brief description of the article myself. Is there any way to do this, or any plugin which allows it? | You need to turn on Excerpts . They are hidden onder the 'screen options' in the right top corner of add/edit screens. And on the front page call <code> the_exerpt() </code> instead of <code> the_content() </code> . | Is there a way to make the main page only display a brief description of the full article? | wordpress |
How can I count words in a post? Something like the one displayed just below the post? Can someone please show me the code for getting this. I have been searching everywhere. | How hard did you search? I searched Google for "wordpress count words in post" and found a function for it in the first result! Put this in <code> functions.php </code> : <code> function prefix_wcount(){ ob_start(); the_content(); $content = ob_get_clean(); return sizeof(explode(" ", $content)); } </code> Then call it ... | Counting words in a post | wordpress |
I am trying to create a dashboard in post section of wordpress admin area. I want it just underneath the Publish dashboard. like for example this code here place a dashboard in immediately when I log into the admin area. <code> // Create the function to output the contents of our Dashboard Widget function example_dashb... | You'll want to look into the <code> add_menu_page() </code> function and then use the <code> $position </code> parameter to place it in the menu where you want it. | how can I go about creating a dashboard in the post section of wordpress admin | wordpress |
<code> function hotlinkers_wp_query($query) { if ( !$query->is_admin && $query->is_search) { $search_query = str_replace('-',' ', $query->query_vars['s']); $query->set('s', $search_query); } return $query; } add_action('pre_get_posts', 'hotlinkers_wp_query'); </code> this is for the search results f... | Like others have said you can't use pre get posts since there is no way of knowing if the search returned any posts. I would also say that the if else is a very clean way to do it and might be the better choice if anyone else is going to be working on this. But if you really wanted to do it with a filter on either the ... | using pre_get_posts for search results not found | wordpress |
I have a post ID stored in a variable from my first query and I'd like to use that to highlight the post with the same ID in my second query, but it's not working. First loop: <code> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php foreach(get_field('relationship') as $post_object): ?> ... | The primary loop query post ID is stored in <code> $current </code> . This variable is equivalent to <code> $post->ID </code> . The secondary loop query post ID is available within the loop as <code> $post->ID </code> . Thus, you just need a simple <code> if </code> statement in side your secondary loop: <code> &... | Use post object from first query in second query | wordpress |
This question may look foolish to everyone or novice , but i am working on a theme . It will be basically a news publishing theme . Right now , In my home page all posts are showing one after another like a usual WordPress theme. No extra coding has been implemented on the theme . But i want to make different sections ... | You can run a foreach loop through all your categories then run a query for the latest posts in each category. You can do this by setting your home page to a static page then put this in a custom template. This is just a basic example: <code> $categories = get_the_categories(); foreach ( $categories as $cat ) { $exclud... | How to make multiple sections in home pulling posts category wise? | wordpress |
There have been some recent additions to the WordPress.org plugin repository. Most notably the changes to the plugin page and the author profile page which now shows an authors favorite plugins . I want to create a sidebar widget plugin that shows a plugin authors favorites. I know how to use the API to get plugin stat... | The favorited plugins has been added to the WordPress.org API. There is a new feature in 3.5 that allows you to access your favorites from the plugin installer. See http://core.trac.wordpress.org/ticket/22002 for info on how it is being used in core. The API allows you to retrieve an object that contains contains each ... | WordPress.org API - Get plugin authors favorite plugins | wordpress |
I'm using a get_posts() call to pull a list of posts in a specific category. However, the recordset also includes posts in subcategories of the target category. How can I exclude subcategories from the query? <code> $cat = get_query_var( 'cat' ); $catHidden=get_cat_ID('hidden'); $args = array('cat' => "$cat,-$catHid... | If you use <code> category__in </code> and <code> category__not_in </code> instead, it will only pull the posts that are in that category, not the subcategories as well. For your code, this would look something like this: <code> $args = array( 'category__in' => $cat, 'category__not_in' => $catHidden ); </code> No... | How to pull a list of posts in a category while exluding posts in subcategories of the category | wordpress |
I don't get whats happening here. I'm on a child-page template, generating a WP_Query for Custom Post Types on the fly, like this: <code> $notrel = new WP_Query(array( 'post_type' => $type, 'posts_per_page' => $perpage, 'monthnum' => $mes, 'year' => $ano, 'paged' => $paged )); </code> Loops and $_GET fil... | I didn't really solve it, but got around with the help of stackexchange-url ("Passing custom args in paginate_links") and stackexchange-url ("Custom paging function"). Initially I even thought of writing a patch to <code> next_posts_link </code> , but as it turns out, the URL formatting problem lies way below in the fu... | WP_Query pagination using only numbers instead of /page/1 on URL | wordpress |
I am creating a theme from scratch and the navigation menu is disturbing me because it is displaying the permalinks after the menu item name. See this picture http://imagebin.org/212406 Link name (#permalink) is the result of <code> wp_nav_menu() </code> Setting e.g. <code> $before/$after </code> - yields text before/a... | Since the (#url) isn't displayed in the source, I suspect this is being placed there by CSS with a rule like: <code> #menu a:after { content: "#"attr(href); } </code> If I had to guess it's a print stylesheet run amok, possibly from a plugin. | Navigation menu displays permalinks | wordpress |
I'm making a widget that shows a set of images from recent custom posts. I want to run the following query: <code> SELECT p.* FROM wp_posts p WHERE post_type='attachment' AND post_mime_type LIKE 'image%' AND post_parent IN ( SELECT ID FROM wp_posts WHERE post_type ='my_custom_post_type' ) ORDER BY post_date DESC LIMIT ... | It seems like a bit of a waste to run through two loops just to use some built in API functions that weren't designed for a use case like this. I think you're better off to use your SQL combined with the wpdb class -- faster and cleaner. Example (with modified SQL): <code> <?php function wpse52315_get_attach() { glo... | get attachments for all posts of particular post type | wordpress |
I want to remove the <code> #minor-publishing </code> <code> div </code> from the Publish admin metabox. I came across stackexchange-url ("How to HIDE everything in PUBLISH metabox except Move to Trash & PUBLISH button") and http://wordpress.org/extend/plugins/adminimize/ but they either remove it by css or custom-... | In short- no. The html in question is hard-coded in the <code> post_submit_meta_box </code> callback function. You can, of course de-register the publish metabox and re-register your own which mimics <code> post_submit_meta_box </code> (but making your alterations) and being sure to keep the names of the inputs exactly... | Remove "minor-publishing" div from Publish admin metabox | wordpress |
I recently setup a WordPress multisite install using subdomains and the WordPress MU domain mapping plugin. When I initially setup the domain mapping plugin, I set the root (http://domain.com) and http://www.domain.com to redirect to blog ID 2 (ie. www.domain.com). However, when I do this the redirect on the root preve... | I was in a similar situation recently. I ended up putting the root site on a random subdomain (eg <code> ms.domain.com </code> ) With the intention of never using the root site. With that done, I created a plugin to activate only on the main (root) site. The plugin hooks into a action that fires only on the front end (... | Hide root site in Multisite install | wordpress |
Following a Wordpress Pagination tutorial, <code> wp_logout_url( get_permalink() ); </code> no longer redirects to the correct page. Instead of redirecting to say <code> domain.com/page/2/ </code> , it redirects me to one of the posts in the listed category. Is there a way to fix this? <code> global $wp_query; $total_p... | It's not clear, but I'm assuming you want a 'log out' url, that brings the user back to the current page? <code> get_permalink() </code> however, get's the permalink of the current post in the loop (if you're using it outside the loop, you'll find that it takes the user to the last post in the loop after they log out).... | wp_logout_url redirects to incorrect page because of pagination | wordpress |
I have a custom widget with a WP_Query loop that's using <code> get_template_part() </code> to include some standard information that I also use in theme files. However, I need to make one small change to the widget's output that differs from the template file I grab with <code> get_template_part() </code> . I know I c... | Well, if you insist using get_template_part, the only solution I see is to define a global variable in your widget's widget() function, and set it to true or something. After you call get_template_part in your widget, set this variable to false. Within your template check for that variable, and if it's true, it means y... | Closest thing to an is_widget() tag? | wordpress |
I have a type of attachments that need full screen display. So, I need to put the comments form somewhere else. How can I tell WP those comments belongs to a post? | Most starter themes now, like Twenty Eleven , come with separate files for each template — for example, <code> single.php </code> and <code> content-single.php </code> represent the Single (Post) template in Twenty Eleven. The starter theme I use, Reddle ( ddl ), has the same template hierarchy, and here's the solution... | Can I seperate comments from post? | wordpress |
I have the following: <code> <?php if ( array( 'is_category', 'is_tag' ) ) { ?> </code> What I want to do is (that doesn't quite work): <code> <?php if ( array( 'is_category('13')', 'is_tag' ) ) { ?> </code> So what I'm asking is, how can I include that ID in code that will work? That's how I would do it an... | As Geert pointed out, your current conditional will always be true. An if() construct needs to be fed an expression . You're feeding it a valid array, so that's true . Always. So far this is basic PHP, regardless of whether in a WP environment or not. As can be read in Chris_O's comment <code> if ( is_category('some-ca... | How to define category ID in an array? | wordpress |
I am trying to create a custom meta box where the user can add fields as needed. I followed this tutorial: http://wp.tutsplus.com/tutorials/reusable-custom-meta-boxes-part-1-intro-and-basic-fields/ I would like to expand on this tutorial and create a repeatable field that allows two inputs. For Example: Name and URL. H... | The serialized array your meta boxes are saving is deformed. I made a few slight changes to your code to get it to work. I created a new post and here is what was saved after being unserialized. Note: WordPress will automatically unserialize an an array stored in post_meta. Use an online unserializer if you ever want t... | Custom Meta Boxes: Store two values in one repeatable field | wordpress |
I am working on a project that has a dropdown of custom taxonomy values called "Disciplines", there are only 4 of them in the dropdown. The way it has been designed is that you can select more than one discipline to filter by. The idea is you check the checkbox and it will filter the posts via the value specified in th... | Wrap the whole thing within a form and add a submit button in it: <code> <form method="POST" action=""> <ul class="filter-sub-dropdown"> ... </form> </code> Use term IDs as checkbox values instead of slugs (you'll save a little server resources): <code> $discipline->slug; </code> > <code> $discipli... | Sorting Posts Via Custom Taxonomy Values Using Checkboxes? | wordpress |
I'm customizing a theme for a client and I want to leverage post formats. On the quote post format I would like <code> the_content(); </code> to be wrapped in a two spans that contains quotation marks that I could style and position. Is this possible? Thanks. | Try <code> $content = get_the_content(); $content = '<span>"</span>'.$content.'<span>"</span>'; echo apply_filters('the_content', $content); </code> CSS Solution: <code> <blockquote> <?php the_content(); ?> </blockquote> blockquote:before{ content: '"'; } blockquote:after{ cont... | Filter the_content() in the Quote Post Format to Display Quotes | wordpress |
I'm very new to WordPress, and from the get-go I need to implement custom post types. Not sure I have all my WordPress marbles in one tin, so I'm asking for a bit of constructive criticism and above all patience. I want something similar to this: http://wp-types.com/documentation/user-guides/creating-post-type-relation... | One post type can be the child of another post type: attachments for example are children of posts or pages. The association is described in the posts table in a field <code> post_parent </code> that holds a post ID. But … what you want can be solved in many different ways. You don't have to use the <code> post_parent ... | Show child custom post types on single-{parent}.php? | wordpress |
I am trying to add a filter on my custom theme based on post month, similar with the archives but with some differences. What is the best way to get a list of months in witch we have posts? Thanks, Alex I used the following query: <code> $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date)... | Core can't help you here. You'll have to do a… Custom Query Here's a save query, that I use on admin UI screens to get the total amounts of month with posts to use them in the custom pagination. Pay attention that I query not only for the published posts, but take into consideration that there might be some rest... | Get list of months with posts | wordpress |
I have my awesome wordpress website here that I have been working on for weeks now and all is great with it except for one thing! For some reason when you try to look at the archives pages the whole page's font gets smaller. I mean, any navigation link, text link, paragraphs, titles, etc. I've checked my CSS and files ... | You're applying a font size of 12px to any objects with the class <code> .date </code> , but, this class is being applied to the body element because it's a date archive. So make your <code> .date </code> rule more specific. Protip: Using a non-IE browser, press f12 to bring up the dev tools and inspect the elements | Archive pages have smaller font then the rest of my website | wordpress |
I need to edit the function <code> get_comment_reply_link() </code> in <code> wp-includes/comments-template.php </code> . All I really wanna do is take out the "log in to reply" text is puts in every comment for logged out users which is disturbing to me. How can I do this the right way? Here's the function. <code> fun... | You can filter the output for the comment reply link on … wait for it! … <code> 'comment_reply_link' </code> . Just do the same checks as the core function but return something else, in your case: nothing. <code> <?php # -*- coding: utf-8 -*- /** * Plugin Name: T5 No Comment Log In Link * Plugin URI: stackexchange-u... | How to remove or replace the log-in link for comment replies? | wordpress |
In WordPress source code, there is one point I can not understand. In /wp-blog-header.php, there is a call to wp() function. However, I can not find any definition for that function. How this call don't cause error? | Just follow the code :). Before calling <code> wp() </code> , <code> /wp-blog-header.php </code> loads <code> /wp-load.php </code> (which assuming you have correctly installed WordPress) loads <code> /wp-config.php </code> . At the bottom of that file, it calls <code> /wp-settings.php </code> . This file loads a lot of... | Where is wp() function definition? | wordpress |
This is happening in two sites I've restored using BackupBuddy*. One is single, the other Multisite. .* this may render the question as "too localized", but maybe it could happen with any other backup/restore tool Whenever upgrading (single or bulk), the message appears: " The update process is starting ", the spin kee... | Don't know, but maybe the issue could be in file permissions? There could appear files with other owner or blocking permissions after restoring and it blocks upgrading process. | What would make the plugin update process to complete but don't report as such? | wordpress |
On a Twentyeleven child theme's functions.php file I attempted to add video post format support using: <code> add_theme_support('post-formats', array( 'aside', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video', 'audio')); </code> ...adding the 'video' format to the array. But it would not work until I dele... | try running your code with a lower priority: <code> add_action( 'after_setup_theme', 'my_twentyeleven_setup', 20 ); function my_twentyeleven_setup(){ add_theme_support('post-formats', array( 'aside', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video', 'audio', )); } </code> | Add Post Format Support to Twentyeleven Child Theme | wordpress |
We are using a jQuery UI accordian to render a menu in the sidebar. We've already written the markup and javascript and I am just trying to get the wp_nav_menu to output the same markup we've already written. I am creating a custom Walker Class extending Walker_Nav_Menu. Here is the markup we are going for <code> <h... | The easiest way is to extend the <code> Walker_Nav_Menu </code> class rather than the <code> Walker_Class </code> , (as the parent / ID fields are set and often you want to maintain some of the mark-up etc). The main methods are: <code> start_el </code> / <code> end_el </code> - responsible for displaying an element in... | WordPress Menu Custom Walker Class | wordpress |
We have a previous WPMU installation that has been upgraded to a WordPress Multisites installation. Since upgrading to 3.3.2 from 3.2.1 we have problem with editors/admin not being able to post on some of their blogs. They see a "Submit for review" button instead of "Publish" despite being admins or authors. My first h... | After a full day of investigating the problem I managed to find the culprit and solve the problem. I localized the problem by following these steps: Create a new blog and give your user admin or editor privileges. In MySQL copy all posts from one of the troubled blogs to the new blog. Now the new blog has the same prob... | How do I fix problems with users not being able to publish and only submit for review after upgrade of Multisites installation? | wordpress |
I use WordPress Multisite and in the sidebar i have a box that shows a list of blogs the logged in user is a member of. I'm looking for a way to exclude the mainblog from this list. The main blog ID is 1 Here is parts of the code I use: <code> <?php // Gets user-info ?> <?php global $current_user; get_currentu... | If you drop this line in your code, you will see all the properties of $user_blogs. <code> echo '<pre>'.print_r($user_blogs,true).'</pre>'; </code> One of them is <code> userblog_id </code> , so you just have to check against it before echoing the blogname. <code> <?php $user_blogs = get_blogs_of_user( $... | Exclude main blog from get_blogs_of_user | wordpress |
Hierarchical structure of custom post type "Book" (for example). When we are on <code> Post 2-95 </code> , I want to know: Does the post has this post ancestor( <code> Post 1-31 </code> )? Does it have child posts( <code> Post 3-19 </code> , <code> Post 3-10 </code> )? Then, if it has: an ancestor post: retrieve (objec... | Given a post represented by a post object <code> $p </code> , you can find out if post 31 is the parent via: <code> if($p->post_parent == 31){ // it is! } else { // it isn't } </code> To figure out the parents, something like: <code> $posts = get_posts(array( 'post_parent' => $p->ID, 'post_type' => $p->p... | Post Ancestor and Child Post in Custom Post Type | wordpress |
I need to add a search field at the end of a menu in a list item. I've been looking at walkers but finding it really hard to figure out what is the last item (or even get the total). Also where would i add the code for the custom item. I've currently got; <code> class mainNav_walker extends Walker_Nav_Menu { public fun... | You don't need a walker in this case. A filter called <code> wp_nav_menu_items </code> is available. It allows you to edit the list items of a menu. Just append your own list item with search field. <code> add_filter( 'wp_nav_menu_items', 'add_search_to_nav', 10, 2 ); function add_search_to_nav( $items, $args ) { $item... | Using a menu walker add a custom item at the end of the menu's items | wordpress |
A really simple thing, yet my images are uploaded as about 500px wide, I have them selected as full size, yet when I use the [gallery] shortcode, it crops the thumbnails to 100w x 75h. This isn't even the thumbnail size I have set in my media settings! My page is here | try <code> [gallery size="thumbnail"] </code> http://codex.wordpress.org/Gallery_Shortcode | How do I set the sizes of my thumbnails when inserting a [gallery]? | wordpress |
When there is no value for parameter "s" , it redirects automatically to homepage. Instead of this , I want to show all the information from my custom sql query. how can i do this?? | You can pass <code> s=%20 </code> as your search string, but thats kinda hackish. If what you are trying to achieve is to use your search.php template but with "controled" search results, consider using this: <code> <?php global $query_string; // fetch query string being used query_posts($query_string . '&posts_... | Need to do blank search. | wordpress |
before you say it, i know that in most situations it's easier to do this the other way around (i.e. upload via yt site then embed) but i need a plugin to upload/manage yt videos via the wordpress admin interface. ive scanned through the plugin directory but cant see any good options. can anyone suggest anything worthy?... | You can try the following plugin for uploading video to YouTube from your WordPress site. YouTube Uploader The plugin description says: This plugin allows you to upload your videos on youtube without leaving wordpress. Useful especially for video blogging sites. Though you need to enter your developer key and choose th... | plugin to upload to youtube via wordpress | wordpress |
my wp_enqueue_script does not seem to work, i can't understand why : i have a child theme of twenty ten, i wrote this in my functions.php file (in my theme) : <code> <?php function my_scripts_method() { wp_enqueue_script( 'patScript', get_stylesheet_directory_uri() . '/js/patScript.js', array('jquery') ); } add_acti... | Two things- When you enqueue a script, WordPress inserts the script tag in the call to <code> wp_head() </code> , so step one is to remove the script tag from your header. The second thing is the jQuery supplied with WordPress is in no conflict mode by default, so you should reference the jQuery object with <code> jQue... | wp_enqueue_script does not recognize my js file? | wordpress |
I used the code below to create a metabox for posts. These meta boxes are also seen in the custom fields. I do not want these meta boxes to show in custom fields. Is there any way to not show meta boxes in custom fields? <code> $meta_boxes_video = array( "hotel name1" => array( "name" => "hotel_name1", "type" =&g... | All post meta is shown in the custom fields, unless it begins with an underscore. So to 'remove' post meta from the custom fields metabox, you simply have to give it a name, beginning with an underscore. You'll then be responsible for saving/updating the post meta (adding your own metabox where necessary). | Create meta boxes that don't show in custom fields | wordpress |
On my website, I recently got a quite strange problem. I used to upload images via the nextGen Plugin. But since with this plugin google doesn't seem to index my pictures, I wanted to switch back to the native gallery. So, naturally, I started to recreate the galleries step by step. A week ago, this worked just fine. T... | The Problem was caused by the plugin "Post Types Order". It takes control over all post orders including the order within galleries. Since there does not seem to be an option to exclude galleries properly, you will have to deactivate the plugin to have control over the gallery order again. | Native gallery sorting is ignored | wordpress |
I know this is a dumb question, but for the love of my life, I can't get the code to work. I have three page templates: home, page and another page-by category. I have a slider that I want to excluded from the default page.php file but to show everywhere else. I have tried to do this with <code> is_page_template </code... | Did you consult the <code> is_page_template() </code> Codex entry ? If you want to query for the <code> page.php </code> page template, then you need to pass that filename to <code> is_page_template() </code> ; i.e.: <code> <?php if ( ! is_page_template( 'page.php' ) ) { // The current page template is NOT page.php;... | Want to exclude slider from page.php in header | wordpress |
I am adding fields to a custom post type. How can I have editing options in my meta data just as they are in the editor box? <code> add_action('add_meta_boxes', 'add_property'); function add_property(){ add_meta_box("description-meta", "Property Description", "desc_options", "property", "normal"); } function desc_optio... | Unfortunately you can't yet... see this trac ticket: http://core.trac.wordpress.org/ticket/19173 In particular it seems that: The problem is that TinyMCE, once initialized cannot be moved in the DOM, or rather the browsers cannot handle it being moved. That's why the errors are so inconsistent in different browsers. Mo... | Adding wp_editor to custom metabox | wordpress |
When you use the <code> register post type </code> and <code> register taxonomy </code> functions in your functions.php, where do all that setting info get stored in regards to the CT's and CPT's you are registering? I'm talking about the settings such as whether the CPT is public or not, which custom post types work w... | When you register post type it is stored in a global var name <code> $wp_post_types </code> and the taxonomies are stored in a global var named <code> $wp_taxonomies </code> Its all in the memory since you need it all and if it was stored in the database you would need to pull it from the database and then it would sti... | When we register a custom taxonomy or post type, does the WP database modified at all? | wordpress |
I´m trying to add something like a guestbook, where the user can write about our services, something like comments with few more content like country, facebook page... should i do this with a single page extending the default comments using with wordpress or i have to add a new content type? How can i give the user per... | The easiest way by far would be as you suggested to use a page coupled with comments. Restyle it so that it looks more like a guestbook. I'm sure there are plugins out there that do this but I don't see the point as you'll need to restyle them anyway and it just slows down your site. | Adding guestbook to my wordpress site | wordpress |
My problem is that wordpress isn't showing the two menu's as separate menus, it just outputs on menu to both positions. URL: http://www.msc-media.co.uk Check the header and footer for the links - I know the footer is ugly, need to sort out the css later. I've created two menus in the functions.php with this code. <code... | Try: <code> <?php wp_nav_menu(array('theme_location' => 'footermenu')); ?> <?php wp_nav_menu(array('theme_location' => 'topmenu')); ?> </code> See http://codex.wordpress.org/Function_Reference/wp_nav_menu | register_nav_menus and wp_nav_menu issue, not displaying independent menus | wordpress |
I'm trying to figure out why WP doesn't seem to recognize functions like get_the_post_thumbnail() inside a shortcode loop. For example, tried adding it to a fresh theme / plugin-less installation. Here's my functions.php: <code> <?php add_theme_support( 'post-thumbnails' ); function scRecentPhoto() { global $post; $... | Found a solution, just had to copy and paste the original functions from the WP core and rename them for functions.php. Not sure why this workaround worked in this instance for theme options, but it did. Thanks for all the help everyone. | Using thumbnail functions inside a shortcode | wordpress |
Is it possible to create a wordpress dashboard plugin that will span all the columns that the user has chosen to display? I know how to force the user to only display one column but I would rather leave them that freedom and span the number of columns that they have selected. Be it one, two, three or four. Thanks. | No you can't - a metabox cannot span more than one column, and so the width of the metabox is determined by how many columns there are. | Create wordpress dashboard metabox which spans all columns | wordpress |
Im trying to make a Twitter button on each article of my blog. This is the code I use on single.php <code> <a href="http://twitter.com/home?status=<?php echo urlencode(get_the_title()); ?>"> Tweet this! </a> </code> The problem is that I have a blog post with this title: Give format to “bodytext” and ... | The problem is that <code> get_the_title() </code> will pass the title through a filter that texturizes the quotes. So a regular " becomes a curly quote (“) and <code> urlencode() </code> will break it. So instead, write your own title function and use that: <code> function my_get_the_title() { global $post; retu... | Including a post title in a twitter link | wordpress |
I'm getting a page not found when I click on page 2 using wp-pagenavi. This is my code, is there anything obvious there that's wrong? <code> <div class="news-content-inner"> <?php $portfolioloop = new WP_Query( array( 'paged' => get_query_var('paged'), 'post_type' => 'news', 'posts_per_page' => 4 ) );... | I solved this by changing the urls... seems such a stupid mistake now! I had the same url for the page as the taxonomy and they were clashing. As soon as I renamed the page url the pagination worked. | Wp-pagenavi giving page not found on clicking page 2 | wordpress |
I'm using a custom field, formatted with "dd-mm-yyyy". I would like to use it with the Date Format defined in the Dashboard settings. It seems alright in English with <code> get_option('date_format'); </code> Or manually in French with <code> setlocale(LC_ALL, 'fr_FR'); $date_local = strftime("%d-%m-%Y",$date->forma... | actually I found the answer right after posting: <code> date_i18n(get_option('date_format') ,$timestamp); </code> it was in an example here | Localized Date Format for Custom Field | wordpress |
After seeing thousands of useful API functions in the WordPress core, I'm surprised to discover today that there ain't a function that would list the active plug-ins. I don't know you but I'm quite surprised at that. I was wondering if there is a reason for missing that? If so, I'd like to know about it. And, if there ... | <code> wp_get_active_and_valid_plugins() </code> <code> get_plugins() </code> and <code> get_option('active_plugins') </code> | What WordPress API function lists active/inactive plugins? | wordpress |
I try to get the collapsible-widget-area plugin so that every widget it creates inside the collapsible area has a unique id <code> <div> </code> after its title. <code> function get_args() { $this->args = apply_filters( 'collapsible-widget-area-args', array( 'name' => __( 'Collapsible Widget Area', 'collaps... | Looking at widget.php in trac <code> sprintf() </code> only runs on <code> before_widget </code> (Line 884): <code> $params[0]['before_widget'] = sprintf($params[0]['before_widget'], $id, $classname_); </code> Hence, it won't work for any of the other arguments. I wondered whether you could use the <code> dynamic_sideb... | Setting up widgets in wordpress with a unique ID for the after_title argument | wordpress |
If I use <code> get_posts() </code> like so I get a number of results with the value 1 for the <code> my_key </code> meta_key: <code> $posts = get_posts( array( 'post_type' => 'attachment', 'meta_key' => 'my_key', 'meta_value' => '1' ) ); //this has a bunch of results as expected print_r($posts); </code> Howev... | First, just pass your arguments to the constructor of <code> WP_Query </code> as this is both cleaner, and the way you're supposed to do it according to the Codex documentation of the class . You should be constructing things like this: <code> $my_key_query_args = array( 'post_type' => 'attachment', 'post_status' =&... | WP_Query not working as expected for attachments and custom meta_query | wordpress |
Conditions: Page have template, for example: /* Template name: News */ Explaining: We have many pages, and one page with assigned template (/* Template name: News */). I want on main page (index.php) retrieve page(News) url and title. | Let me try to summarize what you want and answer: I want on main page (index.php) retrieve page(News) url and title. So you have a "News" page that's using a specific template called "News" and you want to grab that page's ID, URL, and title to display on the front page, correct? Get a Page by Template There is no buil... | How to get from sql query page id and retrieve it url and title | wordpress |
I want to highlight the parent of a child page in the menu when the child page itself is not in the menu. I know this would work if you add the child as a sub page but that isn't the case. Any ideas? | Alrdy got it: <code> <?php //in functions.php add_filter('nav_menu_css_class', 'highlight_portfolio', 12, 2); function highlight_portfolio($classes, $item) { $parent = get_post_ancestors(); $parent_ID = $parent[0]; if ($parent_ID == $item->object_id) { array_push($classes, 'current-menu-ancestor'); } return $clas... | Highlight parent menu item when child is not in menu | wordpress |
Does wordpress 3+ brings a default images slider feature? Or is it just the template I downloaded? If it brings a pre-build slider, how should I customize, add more features to it? I want to modify it to allow some content sliding features (like on: http://www.iwebix.de/front-slider-wordpress-plugin/ ) and not only ima... | No, WordPress does not have a slider feature built in. It will be either a plugin or your theme that has added the slider. For modifying or adjusting your slider, please go to the support area for the plugin/theme you used. If you wish to develop your own, there are many, many tutorials out there you can use, ( I perso... | Wordpress pre-build slider | wordpress |
I'd like to know which contact form plugin has the best header and email creation so that Outlook does not filter it as junk mail. I'm using jigowatts simple php contact form. I am going to test the AJAX WP plugin version but would like to hear from everyone and what they use to get emails accepted by Outlook. Thanks | Contact Form 7 is working well and no emails are getting filtered as junk in outlook | Which contact form plugin passes Outlook junk / spam filters? | wordpress |
Is there an easy way to enqueue a JavaScript file with url_query values populated? I have a php file underneath my js directory with JavaScript headers that I want to generate some dynamic JavaScript depending on the url_query values. Thanks Gs UPDATE: Yes, in the widget class I added the following (as a test): (in the... | I can't get super specific without a more-detailed example from you, but I think you could combine <code> get_query_var() </code> and <code> wp_enqueue_script() </code> to do what you want like this: <code> add_action( 'wp_enqueue_scripts', 'sg_scripts' ); function sg_scripts() { $current_slug = get_query_var( 'page_na... | Enqueue script with url_query variables? | wordpress |
I plan on skipping the Posts post type once and for all. This is a brand new portal. It will have 100s of thousands of content in the form of articles, multimedia, and links. Instead of Posts, I will be using a custom post type called "Articles." Similarly, for my video, audio, and picture posts, I will be using anothe... | 1. how do you get rid of the post menu on the admin ui? Simple, just un-register the <code> post </code> post type. There isn't a default function to do this, but one of the core developers (Nacin) posted some sample code on a WP Trac ticket showing how it can be done: <code> if ( ! function_exists( 'unregister_post_ty... | Downsides to not using built-in "Posts" post type? | wordpress |
How can i programatically change the Category selection menu on wp-admin? is there a hook or filter to edit the Category List? My objective is to filter out specific categories for specific post-types, for example: I have the categories: Sports,Players and Coaches under the post-types: People and Activities I want to f... | i found the get_terms filter, that seemed to work fine for me: <code> function filterCats($listCats){ global $typenow; if($typenow=='People'){ foreach ($listCats as $k => $oCat) { if( $oCat->term_id == 6){//Sports Category id unset($listCats[$k]); } } } return $listCats; } add_filter('get_terms','filterCats'); </... | How to filter out Categories for specific post types on Wordpress Admin? | wordpress |
I need to run my function when a user deletes a media file from the media library. Is there a hook I can use? Would appreciate it if someone could please point me to the right direction. Thanks! | A more appropriate hook may be <code> delete_attachment($post_id) </code> . You may also need to hook <code> edit_attachment </code> . Note that the <code> post_id </code> is that of the attachment type post, not the page/blog post to which the media is attached (if any). In case you want to know when media is added, h... | Media Library, hook on delete user action | wordpress |
The following code will display the child taxonomy term of the parent only. <code> $terms = get_the_terms($wp_query->post->ID, 'propertytype'); $props = array(); foreach ($terms as $term) { if ($term->parent) $props[] = $term->name; } echo implode(', ', $props); </code> For example: London (Parent), West Lo... | You can check if the resulting term has any children before adding it to the array: <code> $terms = get_the_terms($wp_query->post->ID, 'propertytype'); $props = array(); foreach ($terms as $term) { $hasChildrenTest = get_term_children($term->ID, 'propertyType'); if ($term->parent) { if (empty($hasChildrenTe... | Implode Taxonomy to hide parents? | wordpress |
I made a few websites in WP (that was kind of my first serious web-related work where I started learning about more serious and concrete stuff other than homework type of programming exercises) and only now that some time has passed do I see some things that I did wrong in the first place that I would do differently no... | The key to upgrade-proof customizations is to never edit plugins directly. You should use actions and filters to hook into a plugin's code. Not everything is customizable through these hooks, though. The amount of useful hooks provided depends on the quality of the plugin code. Also see: stackexchange-url ("Hooking in ... | How to customize and keep things up-to-date? | wordpress |
I hope someone will help me............. I have a Post Type ----> Dealers Taxonomy ----> State how to write a sql query in this format <code> $catinfo1 = $wpdb->get_results("select t.*,(select count(tr.object_id) from $wpdb->term_relationships tr join $wpdb->posts p on p.ID=tr.object_id where tt.term_taxonomy_... | @Sisir linked you to the appropriate place, if you had read the question/answer and the linked Codex documentation you'd have seen that you could do something like the following: <code> $args = array( 'post_type' => 'dealers' 'tax_query' => array( array( 'taxonomy' => 'state', 'field' => 'slug', 'terms' =&g... | How to write sql query to get the posts from a custom taxonomy term name | wordpress |
Searching for a how-to on changing author slug, I found two methods: Change the <code> user_nicename </code> field in the MySQL database of your WordPress site to whatever you want the slug to be. stackexchange-url ("Changing the Author Slug from Username to Nickname") The (2) is out of question because I want the slug... | Providing you know what you're doing that shouldn't be a problem. You will however have to check that any author/user pages you may have are linked by id rather than name in the code: <code> $data = get_userdata( $userid ); </code> As opposed to <code> $data = get_userdata('Admin'); </code> Because the ID will never ch... | Is It A Good Idea To Change Author Slug (user_nicename field) Directly In MySQL DB? | wordpress |
i'm having some problem creating nice 1 query to be able to get search results which includes NOT only post_type POST but also attachments. BUT if search query return attachment, i want that it won't be returned if that's attachment's parent is NOT published. I'm using ajaxy-search plugin and i want to customize it to ... | Well since nobody helped with at first look such an easy problem, i used my way, and if somebody will need it here it is: I used this query: <code> $results = $wpdb->get_results( $wpdb->prepare( "select $wpdb->posts.ID, $wpdb->posts.post_status, $wpdb->posts.post_parent from $wpdb->posts where post_ti... | SQL: Search query to get attachments only of those parents which are published | wordpress |
I am building a wordpress website with dynamic wordpress menu + one level drop down menu (sub menu). since my drop down is a bit tricky and required special CSS I tried to remove the styling that wordpress automatically gives to menus by using this code: <code> function wp_nav_menu_remove_attributes( $menu ){ return $m... | For anybody interested in the code to remove any class you want. I Just worked with the Roots theme and they did the replacement like below. You can just add the class you want to replace in the list. <code> /** * Replace various active menu class names with "active" or nothing * */ function roots_wp_nav_menu($text) { ... | remove class "sub-menu" from wordpress drop down menu | wordpress |
I created a new custom post type 'Projects' and want the archive of all posts of this type to be available at mysite.com/projects. At the moment all project single posts are shown with a slug as follows mysite.com/projects/project-title, but when I go to mysite.com/projects I get a 404. Here is how I built the custom p... | Nothing appears to be incorrect - (and I assumed you've gone to saved your permalink structure to flush the rewrite rules as the comments suggest? :) ). I would recommend using this plug-in to determine problems with your url-redirection: http://wordpress.org/extend/plugins/monkeyman-rewrite-analyzer/ - update your que... | Slug for custom post type archive | wordpress |
I have been getting "HTTP error." messages seemingly randomly when I upload images. The frustrating part is that if I get the error on an image, then try the same image again a few minutes later, it works. It's hard to debug when it's not consistent. Has anyone else had this problem? | Pretty sure this is being caused by the Smush.it Plugin. Apparently their servers can't handle the traffic lately. | "HTTP error" randomly on image uploads | wordpress |
I'm using WpeMatico plugin which saves images in the post using: <code> $attach_id = wp_insert_attachment( $attachment, $filename, $postid ); </code> I looked inside <code> wp-includes/post.php </code> > <code> wp_insert_attachment </code> function, but couldn't quite figure how to resize images. I want ALL/ANY images ... | The original image size (i.e. 'full') is never modified. Intermediate image sizes are controlled in various places: Default image sizes ( <code> 'thumbnail' </code> , <code> 'medium' </code> , <code> 'large' </code> ): core settings, via Dashboard -> Settings -> Media Custom image sizes: Theme <code> functions.php </co... | Setting default image size | wordpress |
I am setting up a site for a non-profit that would like to have a 'members' area where certain users can swap files for meetings, events, etc. They essentially need a simple interface where they can upload/download files--one that is removed from the WordPress admin area. Some info: They would be uploading mostly text ... | You can have a look on the following plugin for this purpose: WordPress Download Monitor I have found this plugin very useful for uploading/downloading files. This plugin will store files in the web server. This has also built in Download Page function with built in sorting, pagination, search feature and many more. | Interface for logged-in users to upload/download files | wordpress |
Is it a way to get posts published between a date and today with <code> query_posts() </code> ? Example : All posts published since 2012-04-01 Thanks EDIT : How to add the filter date on this Query Posts ? <code> query_posts(array( array('post'), 'tax_query' => array(array( 'taxonomy' => 'post_format', 'field' =&... | Use the Time Parameters in WP_Query() Quoting example from the Codex: Return posts from the last 30 days: <code> // This takes your current query, that will have the filtering part added to. $query_string = array( 'post_type' => 'post', 'tax_query' => array(array( 'taxonomy' => 'post_format', 'field' => 'sl... | How to get posts published between a date and today? | wordpress |
As the question suggests, I'm looking for a plugin that can cycle through my latest five tweets one at a time, and via Javascript/jQuery, it automatically rotates between the tweets on a set interval. I've looked at quite a few, and all of them can only either show one or multiple, but with no automatic cycling. Thanks... | Nice idea for a plugin! I started to write one with Widget, Shortcode and Options page but will have to take on it later on... Meanwhile, I've published the bare bone, that is: a plugin for doing a Tweet Cycler Widget. https://github.com/brasofilo/tuit-cycler The CSS adjustments and the Cycle plugin configuration have ... | Looking for a Wordpress plugin to show five latest tweets one at a time? | wordpress |
Is it possible to redirect users to an admin page if they access another admin page? For example if they a user ever hits "all pages" /wp-admin/edit.php?post_type=page they would get redirected to "add New page" /wp-admin/post-new.php?post_type=page | <code> /** * Redirect admin pages. * * Redirect specific admin page to another specific admin page. * * @author Michael Ecklund * @access public * * @return void */ public function disallowed_admin_pages(){ global $pagenow; /* Check current admin page. */ if($pagenow == 'edit.php' && isset($_GET['post_type']) &... | admin page redirect | wordpress |
I created Custom post type named Regular pages . In that custom post type I created two pages About us and Services . Is there any way to add that posts into my custom menu I created in Appearance-> Menus? Perfect for my if all posts created in Regular pages automatically appears in menu. Can't add them like Custom lin... | Go to Screen Options and you should see a "Regular Pages" checkbox that will add a box from which you can add "Regular Pages" to the menu. | Custom post type post in custom menu | wordpress |
I added a Custom Post Type and fields. But when I enter values and save, they do not show up in the Wordpress edit screen. <code> <?php add_action( 'init', 'create_post_type' ); function create_post_type() { $supports = array('title', 'editor', 'thumbnail'); register_post_type( 'acme_property', array( 'labels' =>... | It seems the problem might be that you haven't added a nonce - so when the post is being saved, you are failing the nonce check. Try adding <code> <?php wp_nonce_field('my_meta_box_nonce','meta_box_nonce'); ?> </code> to your metabox. Remember the nonce action (in this case <code> my_meta_box_nonce </code> ) shou... | Meta box values not displaying in Post Edit Screen after save | wordpress |
Recently I changed the url of my site from atlas.site.com to site.com, one thing I just came across in the admin area for posts, custom post types, pages, where there are more than one page of posts, the arrows for next, previous, first & last page, are all pointing at atlas.site.com/wp-admin/... I've done a find a... | Ok so apparently this site is behind a firewall or proxy. On lines 491 and 658 in wp-admin/includes/class-wp-list-table.php, replace this line <code> $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; </code> with <code> if(!empty($_SERVER['HTTP_X_FORWARDED_HOST'])){... | Wrong url in sortable column headers & pagination in the admin, when behind a proxy | wordpress |
I need to customize the admin panel for my user. So how do I remove the entire admin menu? Not remove the menu item, I mean entirely remove the left vertical menu bar, include the design of the menu (eg, css, background..etc). I want it become blank. I can do it by css hack. But I prefer to use hook to do it. Any ideas... | The correct hook to use is <code> admin_menu </code> and then create a function to remove the menus you want to remove. The following 2 functions remove all the menus. <code> add_action( 'admin_menu', 'remove_admin_menus' ); add_action( 'admin_menu', 'remove_admin_submenus' ); //Remove top level admin menus function re... | How to remove entire admin menu? | wordpress |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.