Printing direct descendants of a category with WP_Query

So I'm having trouble printing just the direct children of a category on a page. Here's my code:                $category_id = get_cat_ID('destinations');      $args = array('child_of'   => $category_id);      $categories = get_categories($args);      $args = array (         'category__and'                    => $categories->$cat_ID     );        $recent_posts = new WP_Query($args);     if ($recent_posts->have_posts())  : while ($recent_posts->have_posts()) : $recent_posts->the_post();      This code prints every category regardless of who's the parent. If I change this: $recent_posts = new WP_Query('cat=43'); It prints out the right category, but also all of it's children and children's children(obviously). I just want the directly related children printed. I went ahead and echoed a serialize($categories) which returned the correct array. However when I serialize($args) AFTER the 2nd declaration, it gives me:               a:1:{s:13:"category__and";N;}      This is definitely weird. Why on Earth is it returning an 'N' for $categories->$cat_ID? I've been trying to do this all day and have been unsuccessful. I've also tried to find another method to do what I want but nothing came up. Any ideas?


How to list users and their post amount?

I want to list all the users of my site and the amount of posts each user has. So far I have the function below, but I don't know how to pull in each user's ID to use in the count_user_posts...
     <?php foreach ( get_users('order=DESC&orderby=post_count') as $user ) : ?>
         <?php echo $user->display_name; ?> as <?php echo $user->user_nicename; ?> (<?php echo $user->post_count; ?> Posts)
         <?php echo 'Posts made: ' . count_user_posts(1); ?>

     <?php endforeach; ?>
      I have foreach function going, but count_user_posts requires an integer I don't pull in each individual user ID to grab their post amount. I would appreciate some help with this. I know it's probably something simple... I'm kind of new to php :D. Thanks a lot.


Displaying search results in the widget itself?

I am new to wordpress, so if this question was already answered I apologize in advance. I have a search form in wordpress which looks like this:               <form action="wordpress/action.php" id="search_form" method="get">     <label for="s" class="hidden"></label>     <input type="text" size="30" id="s" name="s" value="">     <input type="submit" value="Search" id="searchsubmit">     </form>      The file _action.php_ looks up a given string (in this case a name) in a database and returns an array of "similar" written names. After hitting the submit button I want the results to be proposed in a clickable proper list to the user. I thought of listing the items in the same widget. Here the structure I was thinking of.               SEARCH FIELD HERE | SUBMIT BUTTON HERE          John Doe     John Dö     Johnny Doe     etc.      Then the user can click the prefered name and information to this name will be shown in the main part of the page. Is there something that already realizes that? Or do I have to write that on my own. In the second cas: What would be the best approach for that? # Update I was thinking about using sessions to store the result of a query of a user. Redirecting to the same page would let php read the list and print it to the widget. Would this be a usable approach? Well, I still need to know where to tell php to echo inside the text widget, though...


Site is broken after transferring to adminer

I have a very serious problem.. I have this dev site done using PhpMyAdmin http://dev.freelanceu.net/mjl/clickzac/ and my client wants me to transfer the site. But their server don't have PhpMyAdmin and had to use Adminer, after transferring the database the website becomes like this http://kjrias.com I really don't know what's happening.. I tried to fix it on my own but I did not even made it... Steps for transferring the site:   1. on my server, I zipped and donwloaded the wp-content.    2. i downloaded the sql file of the database..    3. using text editor, I replaced the dev.freelanceu.net/mjl/clickzac with kjrias.com    4. On their site, I uploaded the adminer-3.3.4-en.php inside the wordress folder.    5. replaced the wp-content with my wp-content and then imported the database


How to get current-menu-item title as variable?

Is possible to get current-menu-item as a php variable? I'm listing the category museums via the menu item 'museums we support' so i'd like the get 'museums we support' bit and display it somewhere? Any help appreciated!


Wordpress theme options framework, I can't read them in my templates

I successfully created my theme options page using this framework: https://github.com/devinsays/options-framework-theme The problems Is that when, for example, I try to load the Option: 'logo_image'               global $options; var_dump($options); /* dumps NULL */      and               foreach ($options as $value) {          if (get_settings( $value['id'] ) === FALSE) {             $$value['id'] = $value['std'];         } else {             $$value['id'] = get_settings( $value['id'] );         }          echo $$value['id']; /*prints nothing*/     }      And               echo get_option(‘logo_image’);   /* also prints nothing */      This is how I am calling the framework in my functions.php               if ( !function_exists( 'optionsframework_init' ) ) {         define( 'OPTIONS_FRAMEWORK_DIRECTORY', get_template_directory_uri() . '/inc/' );         require_once dirname( __FILE__ ) . '/inc/options-framework.php';     }      What am I missing?


Getting an ordered list of tags - via wp_tag_cloud or not?

I'm trying to output an ordered list of the top five tags for my site into the sidebar. At the moment, I'm using `wp_tag_cloud` like this to get it to output a nice `<ul>`: `wp_tag_cloud('smallest=12&largest=12&orderby=count&order=DESC&format=list&unit=px&number=5');` However, I'd like it to output as an `<ol>` instead of a `<ul>`. Is it possible to do this without hacking the core? Presumably via functions.php or the like? Also, in the output from `wp_tag_cloud`, the font size is being set by inline styles. Seeing as I don't need the tag cloud to actually function as a tag cloud, is there any way to simply remove all inline styling from it? Finally, if there's an easier or less convoluted way of getting an ordered list of tags, please let me know. Thanks.


Making a site URL

I've used WordPress before but only through the website. This is the first time I've actually installed WP and I'm loving all of the customization options that are available to me now. I'm a bit confused about how to actually make my blog accessible to the public though. I'm working through MAMP on Mac OS. Under wp-admin, the WordPress Address and Site Address are both set to `http://localhost/wordpress`. I'm aware of this link but I'm not sure I'm following. Should I leave the Site Address at localhost/wordpress and only change the WordPress Address? Also, if I want to create the url `http://test_site.wordpress.com`, for example, do I have to make an account with wordpress.com for that URL first? And does the username and password I created when installing WordPress come into play at all?


Is it save to replace <input type="submit" > with <button type="submit"> in WordPress search form

I am asking because of a large userbase and possible conflicts with plugins. I mean the 2013 theme for example targets the button with `.searchform [type="submit"]` even of it has the `.searchsubmit` class anyway. Maybe because some CSS specificity and something the was declared don't know. But on the first look it makes not much sense to me. But anyway it's not about themes. How many plug-ins do you guess would fail because the target this not by the class? I need would prefer the button because It works correctly with the bootstrap `.input-group` stuff and input does not. The Value in not respected for the width its cut off. The text needs to be variable so I cant just set a fixed with on it. As far as the tag goes I will include the html5 shiv anyway so that should not be a problem.


Sorting UL Listing Within the TinyMCE Visual Editor in Wordpress

I am trying to use _jQuery sortable_ within the _TinyMCE_ Visual Editor in WordPress. I have had some success in that I can get a UL list to sort, but only if I drag the mouse OUTSIDE of the actual editor. So to say: It seems that the mouse pointer to list element movement ratio is wrong. If I move (for e.g.) 10px with the pointer, the list element only moves 1px. You can see what I mean with this short 1 minute screencast video: ![enter image description here](http://i.stack.imgur.com/9kaKs.png) click image to see screencast Here is the code I am using to run this [ **note:** I have edited the code to a working version]:               (function() {        tinymce.create('tinymce.plugins.tinyMceSort', {           init : function(ed, url) {              ed.addButton('tinymcesort', {                 title : 'TinyMCE Sort',                 image : url+'/tiny_sort.png',                 onclick : function() {                      ed.execCommand('mceInsertContent', false, '\
\
One
\
Two
\
Three
\
Four
\
Five
\
\                     ');                   }               });                  ed.onVisualAid.add(function(ed, e, s) {                 jQuery('#content_ifr').contents().find('#list').sortable({ containment : 'parent', tolerance : 'pointer', cursor : 'move'}).css({'width' : '200px', 'padding' : '10px', 'list-style' : 'none', 'background-color' : '#333'});                 jQuery('#content_ifr').contents().find('li').css({'background-color' : 'grey', 'margin': '10px', 'padding': '10px'});                 jQuery('.wrap').sortable();           });               },         createControl : function(n, cm) {           return null;         },         getInfo : function() {           return {             longname : "Buildpress Columns",             author : 'Moshe Morris',             authorurl : 'http://getbuildpress.com/',             infourl : 'http://getbuildpress.com/',             version : "1.0"           };         },       });        tinymce.PluginManager.add('tinymcesort', tinymce.plugins.tinyMceSort);          })();      What I would like to know is what do I have do in order to sort the list WITHOUT having to move the mouse outside of the TinyMCE Editor area. **Edit:** Here is the other code that relates to the plugin:   _TINY-SORT.PHP FILE_               <?php     /*     Plugin Name: TinyMCE Sort     */          define( 'TINYMCE_SORT_URI', trailingslashit( plugin_dir_url( __FILE__ ) ) );     add_action('init', 'tinymce_sort_init');     function tinymce_sort_init() {       if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') && get_user_option('rich_editing') == 'true')       return;            add_filter("mce_external_plugins", "tinymce_sort_register_plugin");        add_filter('mce_buttons', 'tinymce_sort_add_tbutton');     }          function tinymce_sort_register_plugin($plugin_array) {         $plugin_array['tinymcesort'] = TINYMCE_SORT_URI . '/tinymce/editor_plugin.js';         return $plugin_array;     }          function tinymce_sort_add_tbutton($buttons) {       array_push( $buttons, "|", "tinymcesort" );       return $buttons;     }          add_filter( 'tiny_mce_version', 'my_refresh_mce');     function my_refresh_mce($ver) {       $ver += 3;       return $ver;     }          add_action( 'admin_enqueue_scripts', 'add_tinymce_sort_jquery' );     function add_tinymce_sort_jquery() {       wp_register_script( 'tinymce_sort_jquery_ui', TINYMCE_SORT_URI . 'js/jquery_ui.js', array('jquery'), false, '1.10.2');       wp_enqueue_script( 'tinymce_sort_jquery_ui');     }     ?>      **Final note:** You will notice that I am NOT using the jquery-ui version that is included with Wordpress - I couldn't get it to work. I simply copied and pasted from Google APIs. Here is the link for your convenience: ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js.


How to edit php code in WordPress Post file?

I have a wordpress page. In that wordpress page, user will have access to the following Window to `Publish` their Post in to the webpage. ![enter image description here](http://i.stack.imgur.com/VvqMS.jpg) If the user enters an URL in any of the three filed I have marked in red above, my php code will look in to those URLs and determine if they are spam or not. Therefore, I want to put my php code inside the `Publish` button, so I can either disallow or allow the post after my php code run and determine if those URLs are spam or not. Can you please tell me the name of the wordpress file I should edit in order to put my php code in. I am new to wordpress and don’t know too much about their file structure.


Twenty Twelve Theme pagination issue

I created a Wordpress blog over a year ago basing a child theme on the twenty twelve theme, I have made a few minor modifications. One of these modifications was to add custom portfolio content, so I can have a portfolio category page that links to individual posts within that category. **Issue:** Something that has recently become evident as my post numbers have grown, is when I click through the main menu/categories page it displays the first 10 post fine, but if there are more than 10 post, the 'Older post' link at the bottom of the page offers a click through, but the same 10 posts (newest posts) are displayed again, despite there being 13 posts, so it should roll over and show the oldest 3. This issue can be seen by going to this page link below, other catergories don't have more than 10 posts mainly. coder- tronics.com/categories/c-programming Now if I use the side bar Categories link choosing the C-Programming category, the Older and newer page links work fine displaying all 13 posts correctly, this link demonstrates the correct operation. http://coder-tronics.com/category/c-programming I have been trying to work out what I have done wrong, it was over a year ago I followed a tutorial to do this so not as familiar with Wordpress as I was. I have a custom-content.php which is based on the content.php, and also page templates for each portfolio category i.e. C programming etc. I have checked the custom-content.php and it appears ok as made some minor amendments and tried to remove this from being a problem, by having the portfolio page template for C programming use the content.php, this had no effect on the issue. Not posted any code but happy to do so, just unsure where the issue is at this time and didn't want to post irrelevant code. Thanks, Ant Edited added code reference Pieter comment below                   <?php     /*     Template Name: C Programming Category page     */          get_header(); ?>

                  <?php query_posts('category_name = C Programming'); ?>             <?php if ( have_posts() ) : ?>                                            <?php if ( category_description() ) : // Show an optional category description ?>
<?php echo category_description(); ?>
                 <?php endif; ?>                                  <?php                 /* Start the Loop */                 while ( have_posts() ) : the_post();                          /* Include the post format-specific template for the content. If you want to                      * this in a child theme then include a file called called content-___.php                      * (where ___ is the post format) and that will be used instead.                      */                     get_template_part( 'content-custom', get_post_format() );                      endwhile;                      twentytwelve_content_nav( 'nav-below' );                 ?>                  <?php else : ?>                 <?php get_template_part( 'content', 'none' ); ?>             <?php endif; ?>

          <?php get_sidebar(); ?>     <?php get_footer(); ?>


Wordpress plugin not automatic update

Sorry about this if dupplicate topic, but I checked all previous question and didn't see any answer for me. I'm using Wp 9.1 and have many plugin, recent I didnt see wordpress plugin not check new version. For example, the plugin: XML Generator now is 4.0.6, and my plugin is 4.0.4 But when I check update core, it say: " all plugins are up to date"??? Please help me to fix this? Thanks in advance. Andy


Where should I store disabled plugins?

I have several plugins that I occasionally use for maintenance/import tasks etc. but I don't need them available in the plugins admin most of the time. As my site has quite a large number of plugins, I was wondering if there is any advantage to moving them completely out of the 'wp-content/plugins' directory? I thought I might create a directory 'wp-content/plugins-disabled' and put them in there. Is it bad practice to create my own directories like this in 'wp-content'?


How to create .pot files with POedit?

I've spent hours today on what seemed like something really simple, which is to create a .pot file for a Wordpress theme that I'm creating. I've read the Smashing Magazine article, the Tutsplus article and few others on how to use Poedit to create .pot files for a theme, and then create .mo and .po files, but sadly, I'm still stuck at the first step. I installed Poedit and I find that the UI is completely different than that is shown in all of the the tutorials and it seems like there is no more an option to create .pot file. Only thing that is available is to create .po and .mo files from an existing .pot file, which is not what I need now. So can someone please tell me how can I create .pot files using Poedit or with some other method, I would really appreciate it. Thanks!


Adding title and description to subpage's featured image

Hej! I have a subpage to display it's subpage featured image. I would like to add the title and description to beneath the thumbnail. Today my code look like this > In the functions.php               function my_geturls($post = NULL, $which = 'both') {     first we get the post, if no post is passed we use global post     if ( empty( $post ) ) global $post;     if ( is_numeric($post) ) $post = get_post( $post );     if ( ! $post instanceof WP_Post ) return;     $children = FALSE;     $parent = FALSE;     // if we want children posts thumbnail...     if ( $which !== 'parent' ) {     // run a query to get attachment id set as thumbnail in children posts     global $wpdb;     $q = "SELECT {$wpdb->postmeta}.meta_value FROM {$wpdb->postmeta}     JOIN {$wpdb->posts} ON {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id     WHERE {$wpdb->postmeta}.meta_key = '_thumbnail_id'     AND {$wpdb->posts}.post_parent = %d";     $thumb_ids = $wpdb->get_col( $wpdb->prepare( $q, $post->ID ) );     // if some results, call wp_get_attachment_image_src on all ids to get image urls     if ( ! empty( $thumb_ids ) ) {       $children = array_map( function($tid) {          $img = wp_get_attachment_src( $tid ); // <-- SET SIZE HERE          return $img[0];       }, $thumb_ids );      }     }     // if we want parent post thumbnail...     if ( $which !== 'children' && $post->post_parent ) {     $tid = get_post_thumbnail_id( $post->post_parent );     if ( $img ) {       // get the url of parent post thumbnail       $urls = wp_get_attachment_src( $tid );  // <-- SET SIZE HERE       $parent = $img[0];           }     }     // if we want only children posts thumbnail return them     if ( $which === 'children' ) return $children;     // if we want only parent post thumbnail return it     if ( $which === 'parent' ) return $parent;     // if we want bot return an array with both     return array( 'children' => $children, 'parent' => $parent );     }      This is my code in the page.php file.                       <?php         global $post;         if ( is_page() ) {                $thumbnails = my_get_thumbnails();                if ( ! empty( $thumbnails['parent'] ) ) {             $format = '<a href="<?php echo get_page_link( $child_page->ID ); ?>

';             printf( $format, $thumbnails['parent'] );           }                if ( is_array( $thumbnails['children'] ) && ! empty( $thumbnails['children'] ) ) {             $open = '<a href="<?php echo get_page_link( $child_page->ID ); ?>">

';             echo $open . implode( $close . $open, $thumbnails['children'] ) . $close;           }              }         ?>      Thanks in advance! Hannes


Creating a page with complete user list data, integrated with plugin to extend registration data

I am using a plugin to extend the data given in the registration process (Cimy user extra fields). I now need to create a page where all users can see the registered users with their complete profiles and all information given. I tried the plugin Members List, but of course, it only shows the default info. Is there a way to show the extended data too? Maybe by clicking on the username (rather than showing their posts). Thank you.


Stop wordpress from creating multiple size images

I want wordpress to stop making multiple size images cause it's going to eat up my storage space. So I went Settings > Media and then set all the sizes to 0. When I uploaded a new image it still is making 2 copies for example:               achannel.jpg     achannel-346x288.jpg      although they are both full size images so why does it need to create another full size image?


How to change og:url in WordPress site?

I am using WordPress for my website. I have the All In One SEO plugin installed. I have activated the Open Graph meta tags in this plugin. I have 55 posts. I want to change the `og:url` on each post to a different URL (this URL will be different for each post). **Example:** Actual URL:               <meta content="http://leadershipandspirituality.com/wisdom/leadershipskill/" property="og:url"></meta>      Changed `og:url`:               <meta content="http://leadershipandspirituality.com/leadershipskill/" property="og:url"></meta>      I am using a redirector to redirect `http://leadershipandspirituality.com/leadershipskill/` to `http://leadershipandspirituality.com/wisdom/leadershipskill/` So in All in One SEO, where must I have to change the code?


Showing posts from 4 categories along with all latest posts

Currently in my theme i am running the default **query** that pulls all **recent posts/latest entries/latest published posts** . But i am looking for something more complex like i am gonna **setup** two sections . One is for all the **latest entries** and the other one is for the four **sub-sections which will show posts from 4 selected categories** but the posts of those selected categories wont be showed in the latest entries i mean the first query which was pulling all posts will **exclude** the posts of 4 **selected categories** . cause there will be duplication .. but i don't know the exact query/wp-query code for this type of setting . .


How can I debug what is wrong ? Featured images stopped showing

not sure when this happened, but my featured images are now not showing. Instead I see "NO THUMB" Any ideas how I can find the cause ? So far I have disabled and reenabled all plugins, to no avail. Thanks in advance EDIT : The images exist on the server in several sizes. WP_DEBUG is currently set to false. UPDATE : After checking the error_log file, it appears that the first critical error is this :               [09-Sep-2013 13:48:02] WordPress database error Table './myhosting_mydb/wp_postmeta' is marked as crashed and should be repaired for query SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN (1520) made by require('wp-blog-header.php'), wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts, update_post_caches, update_postmeta_cache, update_meta_cache      Not sure what to do with this, however....


External/non-WP rewrite rule without QSA

I'm trying to add a new external/non-WP rewrite rule to my `.htaccess` but WP keeps adding `[QSA,L]` to the end of the rule. How do I prevent the QSA part? This line adds the RewriteRule:               $wp_rewrite->add_external_rule('go/([0-9]+)/?.*$', 'wp-content/plugins/xswpc/redirect.php?id=$1');      And this is the resulting line in my `.htaccess`               RewriteRule ^go/([0-9]+)/?.*$ /wp-content/plugins/xswpc/redirect.php?id=$1 [QSA,L]      What I'd like is:               RewriteRule ^go/([0-9]+)/?.*$ /wp-content/plugins/xswpc/redirect.php?id=$1 [L]


Correct way to use a form to to filter custom posts by taxonomy terms?

This is a continuation of this post. I've built my form and managed to get the correct taxonomy terms listed as a dropdown, but I'm wondering what action I should be using in my form and how I can recall the options selected in the same form on the results page? This is the code I've written so far which sets query_posts() so that it fetches the custom posts 'ftevent' that have the taxonomy terms 'type', 'period' and 'duration' set to something the user chooses: Pastie link And this is the function osu_list_terms() that you'll see in that code which tries to recall the options selected in each dropdown:               function osu_list_terms($osu_tax, $osu_recall) {         // list terms in fttype taxonomy         $taxonomy = $osu_tax;         $tax_terms = get_terms($taxonomy);         foreach ($tax_terms as $tax_term) {             echo '<option' . $osu_recall . '>' . $tax_term->name . '</option>';         }     }      Now, this is a work in progress, so I'm sure there are a few other problems I'll come up against (such as ordering the custom posts by the custom field 'StartEventDate'), but at this point, I'm trying to work out how Wordpress works with something like this form. I'm used to using               <?php echo $_SERVER['PHP_SELF']; ?>      for forms so that the form submits to the same page. I was hoping I could do the same with this, but Wordpress redirects to a URL like this and uses the archive.php template instead of the current page template I've inserted this form into:               /?fttype=Group+walks&ftperiod=Weekday&ftduration=Half-day&showfilter=true      Is there a 'correct' way to do this? I'm a little confused as to how I can style a template for the search results as well as the results are displayed using the archive page (which is also used by tag-cloud results). Any tips you can offer? Thanks, osu


Pretty paged permalinks in custom post type loop

I must be annoying your with all these permalink questions :) The code I'm using for the loop is:               // hijack stupid WP globals to get pagination working...     global $wp_query;     $temp = $wp_query;          $paged = get_query_var('paged') ? get_query_var('paged') : 1;     $wp_query = new WP_Query();     $wp_query->query(array(       'post_parent' => get_the_ID(),       'post_type' => 'topic-reply',       'posts_per_page' => 10,       'order' => 'ASC',       'paged' => $paged,     ));     if($wp_query):       wp_pagenavi();       while ($wp_query->have_posts()):         $wp_query->the_post();         get_template_part('topic-reply');       endwhile;       wp_pagenavi();     endif;          $wp_query = $temp;     wp_reset_query();      The pagination works fine if permalinks are set to defaults, when clicking on page 2 link the URL I get is like: `http://localhost/wp/?topic=sometopictitle&paged=2` The problem comes when I set the permalinks to a custom structure; when clicking on page 2, I get the first page URL: `http://localhost/wp3/forum/general-discussion/topic/sometopictitle/` instead of `http://localhost/wp3/forum/general-discussion/topic/sometopictitle/page/2/` (A live example `here`) Does anyone know the rules I should add to set paged permalinks for the "topic-reply" post type?


I need basic help with custom post types

Basically here's my project: I have to create a back-end wordpress gui user input section. The user will enter details about their projects like name, location, what it is, some other details. A page will display the top 9 recent or so in a 3x3 grid. There will be a search bar to search projects for related tags. I have currently:   * used functions.php to setup my post type and it works    * used simple forms plugin to create forms on the add new page Background: I am a pretty entry level person in wordpress, and slightly overwhelmed right now. But, it's slowly coming together. Any input on structure or anything would be appreciated. Update: I have created the forms, but I need to know what to put in the single-projects.php to display the content from the forms. Thank you so much


Lose "Blog Archive" from page title

Right now the title of a post page on my blog reads like this... Blog Name >> Blog Archive >> Post Title I don't see the need for "Blog Archive" to be in there and would like to remove it. I've looked in single.php and style.css and I'm not seeing any reference to "Blog Archive" in there that I can remove. Any suggestions? Much appreciated. Eddie


Slow WP Site, theme.php not caching? Up to 25 second load time!

I have two WP subdirectories off of a Joomla domain. The Joomla load time is ok. However, the WPs are so so sooooo slow. The back end is slow too. I have w3 cache installed on both and I've copied the settings from some great resources, but they are still slow! Could someone please take a look? http://www.howlatthemoon.com/howl2go/ http://www.howlatthemoon.com/dueling_piano_bar/


Aggregate Summaries of Posts of Different Blogs in Multisite Instance

I have a Multisite Wordpress installation with 7 different blogs. I want to show an aggregate of the summaries of posts from those 7 blogs in the main blog. Do you know a good way to do this?


Get a permalink structure of /%posttype%/%category%/%postname%

I have a custom post type named Reportage, added in functions.php:               add_action( 'init', 'create_post_type' );     function create_post_type() {         register_post_type( 'reportage',             array(                 'labels' => array(                     'name' => __( 'Reportage' ),                     'singular_name' => __( 'Reportage' )                 ),                 'public' => true,                 'taxonomies' => array('category'),                 'query_var' => true             )         );              register_taxonomy_for_object_type('category', 'reportage');     }      Now I want to use this custom url structure: "/%posttype%/%category%/%postname%", but the permalinks gets generated as (and redirected to when visited) "/%posttype%/%postname%". How do I change the permalinks structure to "/%posttype%/%category%/%postname%"? I need to have "/%posttype%" to route to a regular page with the same name as the posttype (Reportage), this works fine now. I also need to "/%posttype%/%category%" to route to something like the category.php file. How can I make this work?


Use custom field as tag slug

I am trying to replace 'tag-slug' with a custom field value, so it will automatically pull the tags that match the custom field 'my-tag-slug' The code below does what I want                <?php if (get_post_meta(get_the_ID(), 'my-tag-slug', true)) { ?><?php echo get_post_meta(get_the_ID(), 'my-tag-slug', true); ?><?php } else { ?><?php } ?>      but how can I put it here:               <?php              $args=array(           'tag' => 'tag-slug',           'showposts'=>5,           'caller_get_posts'=>1         );         $my_query = new WP_Query($args);         if( $my_query->have_posts() ) {           echo '5 recent Posts with tag1';           while ($my_query->have_posts()) : $my_query->the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
            <?php           endwhile;         } //if ($my_query)       wp_reset_query();  // Restore global post data stomped by the_post().     ?>      thank you for your help


How to display only subcategory

I have categories: -Parent category   --Subcategory   ---Grandcategory How i can display parent category and only subccategory(not display grandcategory). My args:               $args = array(                                 'type'                     => 'product',                                 'child_of'                 => $category_ID,                                 'parent'                   => '',                                 'orderby'                  => 'name',                                 'order'                    => 'ASC',                                 'hide_empty'               => 0,                                 'hierarchical'             => 1,                                 'exclude'                  => '',                                 'include'                  => '',                                 'number'                   => '',                                 'taxonomy'                 => 'product_cat',                                 'pad_counts'               => true );      and i query :               $categories = get_categories( $args );


How to add php to custom link in the nav menu?

I simply want to add some php in as a custom link in the wordpress menu section. The code I want to use is `<?php bp_loggedin_user_domain(); ?>` which will generate that logged in user's buddypress profile page url. However, when I paste that in as a custom links, wp removes the opening and closing tags and removes all the white space. Any ideas?


wp_redirect and search engine bots

I have some pages and categories you have to be looged in to have access to. I am using wp_redirect to send anyone who is not logged in to the front page if they try to open those pages. Is it enough to block any search bots from indexing these pages?


Change layout of post depending on category

I am having two kinds of categories one is `events` and another is `no_category`. Posts of Event Calendar are placed under `events` category and rest are in `no_category`. As you know what is the default layout of all the posts. At the top Title of the post then below it reply then below it's content etc... Now I want to change the format for "event" category posts as in Excel format:               Title | Created Date | Created By | Details | Edit      How can I do this?


Make First post different from rest?

Hi i'm using the code below to call post from a certain Category under certain post types, But how do i style it so that i can make the first post different from the rest of the post.               <?php     $queryObject = new  Wp_Query( array(             'showposts' => 4,             'post_type' => array('pretty-little-liars', 'revenge', 'once-upon-a-time'),             'category_name' => celebrity,                 'orderby' => 1,             ));     // The Loop!     if ($queryObject->have_posts()) {     ?>          <?php     while ($queryObject->have_posts()){         $queryObject->the_post();         ?>          <a href="<?php the_permalink(); ?>" title="<?php printf(__( 'Read %s', 'wpbx' ), wp_specialchars(get_the_title(), 1)) ?>">                         <?php the_post_thumbnail('video-post'); ?>                                   <?php echo human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' ago'; ?>                         <a href="<?php the_permalink(); ?>"><?php the_title(); ?>               <?php     }     ?>     <?php wp_reset_postdata();     }     ?>


How to remove the index.php in the url?

I have installed wordpress in a subdirectory (`blog`). In the root directory I have installed Magento. Now the file directory is as following:               app     downloader     includes     media     ....     blog/wp-admin      My server is **nginx**. When I set the URL in the wordpress _Permalink Settings_ to:               http://www.example.com/blog/index.php/sample-post/       … all the posts are available. Now I want to remove the `index.php` from that URL. How should I do that? When I set the custom structure to …               http://www.example.com/blog/sample-post/      … the URLs are not resolved by WordPress and I get a 404.


Custom Image Thumbnails of different sizes

I have a post type which contains custom fields for uploading images of different types for a portfolio site. For example: (logos, websites, print- ads, etc...). I plan on uploading images of all different sizes and aspect ratios, but I need to have a smaller size (thumbnail) of a specific (and different) size for each image type. I also need functionality to crop these thumbnails manually. Logo thumbs -> 200x200 Website thumbs -> 450x200 print-ad thumbs -> 200X400 etc... I've been toying with a couple plugins: Post Thumbnail Editor, Multiple Post Thumbnails; but these seem to be buggy in WP-3.3 and they don't appear to do exactly what I want anyway I can, of course, just upload 2 different versions of each image, and use the crop tool in the backend to get them to the right size, but I would love a more elegant approach. So I guesse what I am really looking for is some advice.   * Should I keep fighting with existing plugins and try to get something working?    * Should I try to develop my own? (I'm pretty decent with php/javascript but have only written extremely simple wp plugins as of yet)?    * Should I give up and use the dirty (upload 2 versions of each) approach? I would be willing to spend the weekend on it (10-15 hours) if need be.


Is there a way to only show Custom Meta Data on single posts from certain catagories

I am trying to use this code to display something in the 'single.php' file on the theme when the post is of a certian catagory.               $cat = get_query_var('cat');     if ($cat == '4') {     echo "post";     } else {     echo "no data";     }      But it seems to ignore the $cat var query and as such on every post display the no data message. The cat var is not in the url.


plugin: 'init' hook, check if we're not in admin

I've tried this inside of my plugin ('init' hook) but it doesn't work:               if(is_front_page() || is_singular() || is_archive()) { ... }      How could I check it using init hook? Thanks.


How to remove menu from WP-Admin menu

I would like to hide option of template from the menu side in wp-admin. I tried this code but its not work , its no hide the option:-               //hide in admin menu     add_action( 'admin_menu', 'wpse121406_hide_pages_comments_m' );     function wpse121406_hide_pages_comments_m() {         remove_menu_page('admin.php?page=options-framework');     }      and try this and not work:-               function remove_menus(){       remove_menu_page( 'options-general.php' );        //Settings     }     add_action( 'admin_menu', 'remove_menus' );      So what can i do to hide this link :-               admin.php?page=options-framework


Limit Words in Category / Term Description - Admin Panel

I'm working with a Taxonomy where the Terms have lengthy descriptions. It makes the Admin Panel look really ugly when WordPress tries to display these descriptions for 10 categories. I'm trying to figure out a way to limit the number of words or characters displayed in the Category / Term Description Column but I cannot find the correct hook to get to the category description as it's displaying it. I'm using this list of Hooks as a guide, and the two hooks that seem to point to the right direction are: filter: `manage_taxonomies_for_{$post_type}_columns`               function funcy_test($empty = '', $column, $term_id)      {         return '';     }     add_filter('manage_taxonomies_for_cpt_products_columns', 'funcy_test', 10, 3);      I expected it to return empty columns all around but instead I didn't see a result. One possible solution is to remove the Description cateogry entirely and use the `custom_columns` hook to add my own description column but that just seems too much of a hassle. Is there a way to limit the words / characters for a term description in the Admin Panel?


Query to get all the posts of more than 2 meta_value having same meta_key?

Meta_value will have checkbox infront of them so when both the check box is selected posts related to both the meta_value will be displayed.


Custom WordPress Bootstrap Carousel issue

Hi I have been working on a carousel to display four posts inside a "slide", here is the code:

          <?php     $args = array( 'numberposts' => -1);     $posts= get_posts( $args );     if ($posts) {         foreach ( $posts as $post ) {             setup_postdata($post);              }     }     ?>
         <?php while(have_posts()): the_post(); ?>         <li data-target="#blogslide" data-slide-to="<?php echo $post->ID;?>">
         <?php endwhile; ?>
     <?php foreach($posts as $post) :?>             <div class="item" id="<?php echo $post->ID;?>" >
                                      <?php the_post_thumbnail('large'); ?>

<?php the_title(); ;?>

<?php $excerpt = get_the_excerpt(); echo string_limit_words($excerpt,15) . '...'; ?>
                                 <a href="<?php the_permalink() ?>" class="info">Read More >>

         <?php endforeach; ?>     <?php wp_reset_query() ?>

      To get it to display four items on the first slide i did this:               jQuery('#blogslide').find('.item:nth-child(odd)').addClass('active');      this works fine for first two slides, I then start to loose on post at a time until we only have one displaying. What I would like to know is how to have it at four every time and also as you saw in the code I tried to get the indicators to work also but with no joy. Thank you.


Update_user_meta fails with ajax when used multiple times quickly

I'm trying to update the status of the sidebar (visible or hidden) when the user clicks the hide/show button in the user_meta so that no matter what computer he's on, he'll see his settings saved. It's working great when I use the call slowly, but If I try to rapidly switch between statuses (open/closed) then the update_user_meta function fails. Here's my code: **header.php**               <?php $update_sidebar_nonce = wp_create_nonce('update_sidebar_nonce');?>     <div id="sidebar" class="<?php if($personal_settings['sidebar_status']):?>sidebar-closed<?php endif;?>" data-nonce="<?php echo $update_sidebar_nonce;?>">

                 <img src="<?php bloginfo('stylesheet_directory');?>/library/images/user-logo.png" class="user-logo img-circle" />                 Logged in as
                 <?php echo user_nicename();?>

                     <?php showcase_main_nav(); ?>

      **ajax-functions.php**               add_action("wp_ajax_update_sidebar", "update_sidebar");     function update_sidebar() {     global $current_user, $personal_settings;     get_currentuserinfo();          if ( !wp_verify_nonce( $_REQUEST['nonce'], "update_sidebar_nonce")) {         exit("Hmm....Something must've gone wrong. Try that again.");     }             $personal_settings = maybe_unserialize(get_user_meta($current_user->ID, "personal_settings", true));     if(is_array($personal_settings)){         $personal_settings['sidebar_status'] = $_REQUEST['sidebar_status'];     } else {         $personal_settings = array();         $personal_settings['sidebar_status'] = $_REQUEST['sidebar_status'];     }     $new_settings = serialize($personal_settings);     $personal_settings = $new_settings;          $update = update_user_meta($current_user->ID, "personal_settings", $new_settings );          if($update === false) {         $result['type'] = "error";         $result['settings'] = $personal_settings;     }     else {         $result['type'] = "success";         $result['settings'] = $new_settings;     }          if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {         $result = json_encode($result);         echo $result;     } else {         header("Location: ".$_SERVER["HTTP_REFERER"]);     }          die();          }      **scripts.js**               $('button.nav-toggle').click(function(){         $("#sidebar").toggle('slide');         $("#sidebar").toggleClass('sidebar-closed');         updateSidebarStatus();         $(".main-wrap").toggleClass('overflow-hidden');     });     function updateSidebarStatus(){         sidebar_status = ($("#sidebar").hasClass('sidebar-closed')) ? 1 : 0;         nonce = $("#sidebar").data('nonce');         $.ajax({             type: 'post',             dataType: 'json',             url: showcaseAjax.ajaxurl,             data: {action: 'update_sidebar', sidebar_status: sidebar_status, nonce: nonce},             success: function(response){                 console.log(response);             },             error: function(response){                 console.log(response);             }         });     }      I'm using wp_localize_script to get the showcaseAjax variable in the jQuery.ajax function. Again, everything works exactly as expected if I wait for the ajax response to finish before I click it again. But if I click the sidebar-close button repeatedly, while the animation of the sidebar opening and closing works, the ajax update_user_meta fails and the data is not saved.


How can I add comments to a page?

How can I allow people to post comments on a page? I've put this into my page template: `<?php comments_template(); ?>` but it just says at the bottom of my page "Comments closed". UPDATE: If I can allow comments for one specific template for a page that would be great.


Search pagination not working

I have a search box in my header, which shows the results in a page called search.php. The search itself is working, but pagination is not. So when I click to go to the next page, the front-page.php template is shown. The link for page 2 is `http://www.mydomain.com/page/2`, which structurally looks correct. Can anybody who has experience with this please give me some pointers? Thanks.               <div id="header-search">         <form name="search" action="<?php echo home_url(); ?>" id="search" method="POST">             <input type="text" id="s" name="s" value="Search..." />             <input type="submit" id="submit" name="submit" value="Go..." />         </form>     </div>      Here is a Pastebin containing my `loop-index.php` file that is used by `search.php`.


Personal log-in and page view for users

I'm trying to make some sort of a login-system on my website. I have the following requirements, hope you can help...   * Users log in not via wp, but via my website   * Users cannot make their own useraccounts, only I can   * Users can only see their personal page, not the pages of other users. A system so that I can decide which user sees which page would be ideal.   * Some sort of 'forgot password' solution.


URL Forwarding - wordpress links reverting back

Say I built a site at test.example.com, and I now have it set up so that when you arrive at example.com you really see test.example.com, my problem is all the internal links created by wordpress want to go to test.example.com. Is it because Site Address (URL) under settings is still test.example.com? Any way/best way to fix this?


get taxonomy name of current post

Hierarchical taxonomy of custom post type 'projects' > 'projects_category'. Two example 'projects_category' hierarchies would be: > Big Corporates > 1st Company Name > A Post Title > > Small Business > 2nd Company Name > Another Post Title I can get **'1st Company Name'** with the following:               <?php $terms = get_the_terms($post->ID, 'projects_category');foreach($terms as $term){echo $term->name;} ?>      How can I display 'Big Corporates' or 'Small Business' as appropriate in single.php ?


get $post in init filter or action?

It seems that $post is only available to hooks executing at certain times. I have an "init" hook that needs to pull some data from the database using the $post->ID. So far my only workaround has been to add another filter on the_content, that uses $post to get the information I need. Unfortunately, it also echoes the return value to the screen, and fails to actually return it to the function that called the filter originally. Here is the code that extracts the data I need, but echoes and fails to return the value:               add_filter('the_content', 'get_keyword');     function get_keyword()     {         global $post;         $keyword = get_post_meta( $post->ID, '_wpg_def_keyword', true );         return $keyword;     }      Does anyone have any suggestion on how to get what I need and have it pass back to the calling function for later use in the plugin? EDIT: To possibly make this more clear, I have a filter running at init, that needs to be able to retrieve information on the current post from the DB. To do this, it requires access to $post->ID. But that is not possible within init, so how can I get the result I need? Thanks, Jonathan **SOLVED: Turns out the answer was simply to use url_to_postid like this: $keyword = get_post_meta( url_to_postid( "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] ), '_wpg_def_keyword', true ); Works perfectly even from init.**


Retrieving list of a custom post type in a widget without using WP_Query?

I'm using the following widget to retrieve a list of the custom post type **jobs** :               class FeaturedJobsWidget extends WP_Widget     {       function FeaturedJobsWidget()       {         $widget_ops = array('classname' => 'FeaturedJobsWidget', 'description' => 'Displays a random post with thumbnail' );         $this->WP_Widget('FeaturedJobsWidget', 'Featured Jobs', $widget_ops);       }            function form($instance)       {         $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );         $title = $instance['title'];     ?>
<label for="<?php echo $this->get_field_id('title'); ?>">Title: <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" />
     <?php       }            function update($new_instance, $old_instance)       {         $instance = $old_instance;         $instance['title'] = $new_instance['title'];         return $instance;       }            function widget($args, $instance)       {         extract($args, EXTR_SKIP);              echo $before_widget;         $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);              if (!empty($title))           echo $before_title . $title . $after_title;;              // WIDGET CODE GOES HERE         ?>
           <?php // Create and run custom loop             $custom_posts = new WP_Query();             $custom_posts->query('post_type=jobs&posts_per_page=8');             while ($custom_posts->have_posts()) : $custom_posts->the_post();           ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
           <?php endwhile; ?>
See All Positions >>

         <?php              echo $after_widget;       }          }      The problem is that this part:                 <?php // Create and run custom loop         $custom_posts = new WP_Query();         $custom_posts->query('post_type=jobs&posts_per_page=8');         while ($custom_posts->have_posts()) : $custom_posts->the_post();       ?>      Seem to break other widgets (not sure if it is a bad practice to use `WP_Query` in a widget). Is there any other way of displaying a list of custom post types in a widget?


Is this the best way to complete disable category archive pages?

I wanted to disable category archive pages because content in my blog will be presented via a number of pages for which I have custom templates like this:                    add_action('page_template', 'select_page_template');          function select_page_template($template)     {         $pageName = get_query_var('pagename');              if ($pageName == "about")             $page_template = TEMPLATEPATH . '/page-templates/about.php';              return $page_template;     }         To do what I wanted, I coded the below so as to redirect all calls from http://www.mydomain.com/[CATEGORY-SLUG] to the 404.php page of the blog:                    add_action('category_template', 'select_category_template');          function select_category_template($template)     {         header("HTTP/1.0 404 Not Found");         $GLOBALS['wp_query']->is_404 = TRUE;         return TEMPLATEPATH . '/404.php';     }         Does it make sense, especially in respect to SEO? In theory, like this I'm getting the same result I get if I visit a no-page like: http://www.mydomain.com/abcdef


Possible to get feed to return latest updated posts rather than latest published?

Currently the RSS feed of my WordPress blog gives me the latest published posts. Is it possible to change this so that it returns the ones that are latest updated instead? So that the latest published are still in the feed, but if I update an old post it would pop up in a feed reader.


Why doesnt my tag page populate with this custom post type?

I have a tag page that is generated with the first image attachments from all of the posts. I call it in the loop with :               <img src="<?php echo get_first_attachment() ?>" />      and this is the function :               function get_first_attachment(){         $querystr =         "             SELECT                     wp_posts.post_excerpt AS 'imageTitle',                     wp_posts.guid AS 'imageGuid'             FROM                 wp_posts             WHERE                     wp_posts.post_parent = ".get_the_ID()."                 AND wp_posts.post_type = \"attachment\"             ORDER BY \"menu_order\"             LIMIT 1         ";         global $wpdb;         $url = get_bloginfo('url');         $post_item = $wpdb->get_row($querystr);         $first_attachment = $post_item->imageGuid;         $not_broken = @fopen("$first_attachment","r"); // checks if the image exists         if(empty($first_attachment) || !($not_broken)){ //Defines a default image             unset($first_attachment);         }else{             $first_attachment = str_replace($url, '', $first_attachment);         }         return $first_attachment;     }      This works great with regular posts but not my custom post types. Which are in the post_type portfolio.               $args = array(             'labels' => $labels,             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,             'query_var' => true,             'rewrite' => true,             'capability_type' => 'post',             'hierarchical' => false,             'menu_position' => 4,             'taxonomies' => array('post_tag','category'),             'supports' => array('title','editor','comments','trackbacks','revisions','custom-fields','page-attributes','thumbnail', 'excerpt', 'tags')           );               register_post_type( 'portfolio' , $args );     }      Looking at the tables Both post and portfolio share post_type = attachment, however different in that one has post_type = post and the other = portfolio. I do not understand the SELECT .. post_excerpt is a blank column and guid is just full of urls. I am confused. Thanks for any help. I figured out that the image attachment has nothing to do with it, my custom post type is not being included in the tag loop... I will post more code once I figure out what it is I am looking for.


I would like to give special promotion for the first 100 posts in my blog? Can anyone tell me how to do that?

My website is a multi author blog. I would like to give special promotion for the first 100 published posts in my blog? What is the proper way to implement it? I mean should i add some meta value for first 100 published posts and then query it later using that meta value? If yes can anyone tell me how? Thanks


Auto setup "permalink" or request notice

I am trying to find a function or how to do. When you install (or active) a theme.   1. I want to check if the link type is "permalink" or not.   2. If not, I want to make a notice saying "this theme is strongly recommend permalink"   or just setup permalink as default link.   How can I do that? please give me a tip. I can't really find any solution. Thanks


Shortcode content not displaying on Home page

Why don't shortcodes work when a post is view on Home page but they do when viewing single post. You can see the issue here. There are suppose to be two element's above the image - generated by JW Player and a custom shortcode, and one shortcode below the image - generated by Lightbox Evolution plugin.


Color Options from Theme Customizer API not returning via get_theme_mod()

I am working with the Theme Customizer API and am going crazy trying to find the stored values. The values successfully save and update on the front-end, so they are obviously registered successfully, however, I'm storing the options as theme specific via this method where `$this_theme` is set as `$this_theme = preg_split('/themes\//', get_stylesheet_directory_uri())[1];`. The following code is inside of a `foreach` loop and iterating over a multi- dimensional array with all of the variable metadata for each option (referenced below as `$param['foo']`). I'm using this method for dropdown options for font selection and also for colors, but when doing `get_theme_mod($this_theme . '_theme_options')` the returned results show the font dropdown options but not the `WP_Customize_Color_Control` options. I'm going crazy trying to find a divergence between the two and have not found any. Thanks so much!                   $wp_customize->add_setting( $this_theme . '_theme_options['. $setting .']', array(             'default' => $param['default'],             'sanitize_callback' => 'sanitize_hex_color',             'type' => 'option',             'capability' => 'edit_theme_options',             'priority' => $i              ) );              $wp_customize->add_control(             new WP_Customize_Color_Control(                 $wp_customize,                 $this_theme . '_theme_options_'. $setting,                 array(                     'label'     => $param['label'],                     'section'   => $param['section'],                     'settings'  => $this_theme . '_theme_options['. $setting  .']',                     'priority'  => $i                 )             )         );


Get custom field label

I've defined some custom fields using Advanced Custom Fields, and I display these fields as keys and values using `get_post_meta`, e.g.:               מחיר:     <?php echo get_post_meta($post->ID, 'price', true);?>     ,          מפה:     <?php echo get_post_meta($post->ID, 'map', true);?>     ...      This involves code duplication, because the Hebrew name of the field (e.g. `מפה`) is already defined as the custom field _label_. **Is there a way to programmatically retrieve the a custom field label?**


adding the category to the admin column for a custom post type?

I have built a custom post type called article and the information given on the admin summary screen is sparse. I was able to add the featured image post thumbnail image using the http://codex.wordpress.org/Plugin_API/Action_Reference/manage_posts_custom_column from a tutorial. However I would like to be able to get an overview of the categories and sub categories that these posts have had assigned to them on the admin page. ie adding a column for that part? Here is the code that I have used to register the taxonomy in the custom post types code


putting wp_query data into html table

I needed to display some data in a simple html table so I started with very basics of table. As shown in the code, the data needed was a list of custom- field-values of a meta_key _submitdate_ , from across all the posts, under a specific tag **"female"**. I wrote the following code and everything worked perfectly till the first `WP_Query`. UPDATE : Current code as suggested by @islam.

     NO.	     FEMALE DATA	     MALE DATA

               <?php     $fmargs = array ( 'tag' => 'female', 'posts_per_page' => -1 );     $female_query = new WP_Query( $fmargs );     while ( $female_query -> have_posts() ):     $female_query -> the_post(); ?>
     	          <?php  echo get_post_meta($post->ID, 'submitdate', true); ?>     	     <?php endwhile;     wp_reset_postdata(); //reset the first query     ?>               <?php     $margs = array ( 'tag' => 'male', 'posts_per_page' => -1 );     $male_query = new WP_Query( $margs );     while ( $male_query -> have_posts() ):     $male_query -> the_post(); ?>          <?php echo get_post_meta($post->ID, 'submitdate', true);?>
     <?php endwhile;     wp_reset_postdata(); //reset the second query     ?>

      Now, I needed a list of data filled in similar way into second column in the same table for another tag "male". When I tried a second similar `WP_Query`, it returns the data but it either fills up into the wrong row or a single cell or completely breaks out of table. as I tried endless varieties of `<tr> and <td>` . So, I am **unable to get the data listed into the second column** exactly as the first column. After writing so far I just realized that this question could be categorized as non-wordpress issue, so if you feel I should definitely ask it somewhere, Please let me know, else a little helping hand is always appreciated. Here is a screenshot of the current result. Please help. ![enter image description here](http://i.stack.imgur.com/QGaGI.jpg)


'all' hook and get_option issue

code listing: http://pastebin.com/0LEqgRUZ I ran into a trouble with my plugin. (It is a class based plugin actually) I'm trying to use `get_option` function. When I just make `var_dump(get_option('option_name', 1))` somewhere in `plugin_options` function (you'll see the code listing) - it outputs `int(1)` The problem is that I cannot use `get_option` inside my `log_to` method. The `log_to` method is bound to 'all' hook. So I guess that's why it doesn't work. (even `wp` is not loading at all) Anyone knows the resolution?


Image media upload metabox

I've created my first image upload metabox but seem to be having problems.   1. The data doesn't get saved when I add an image then update the page - I'm sure this is a typo on my end which I'm failing to see.   2. The second input box's upload image button doesn't load the media library box like the first one does - Js issue possibly? Here is my code               <?php          /*     Plugin Name: Meta Box Media Library Image      Plugin URI:      Description: Adds the ability to select an image from the media library     Version: 1.0     Author: Danny Wardle     Author URI: www.thevisionists.com     License: GPLv2     */          //second metabox          ?>     <?php      add_action( 'add_meta_boxes', 'dd_image_create' );          function dd_image_create() {          //create a custom meta image box     add_meta_box ( 'dd-meta-image', 'Display chosen image', 'dd_image_function', 'page', 'normal', 'high' );          }          ?>          <?php          function dd_image_function( $post ) {     $dd_image_one = get_post_meta ($post->ID, 'dd_image_one', true);     $dd_image_two = get_post_meta($post->ID, 'dd_image_two', true);     ?>     Image One     <input id="dd_image_one" type="text" size="75" name="dd_image_one" value="<?php echo esc_url( $dd_image_one ); ?>" />     <input id="upload_image_button" value="Media Library Upload" class="button-secondary" />
 Enter an image URL or use an image from the Media Library

     Image Two     <input id="dd_image_two" type="text" size="75" name="dd_image_two" value="<?php echo esc_url( $dd_image_two ); ?>" />     <input id="upload_image_button" value="Media Library Upload" class="button-secondary" />
 Enter an image URL or use an image from the Media Library          <?php          }          //script actions with page detection     add_action('admin_print_scripts-post.php', 'dd_image_admin_scripts');     add_action('admin_print_scripts-post-new.php', 'dd_image_admin_scripts');          function dd_image_admin_scripts() {     wp_enqueue_script( 'boj-image-upload',     plugins_url( '/dd-meta-box/dd-meta-image.js' ),     array( 'jquery', 'media-upload', 'thickbox' ) );     }          //style actions with page detection     add_action('admin_print_styles-post.php', 'dd_image_admin_styles');     add_action('admin_print_styles-post-new.php', 'dd_image_admin_styles');          function dd_image_admin_styles() {     wp_enqueue_style( 'thickbox' );     }          // hook to save the meta data           add_action ( 'save_post', 'dd_image_save_meta' );          function dd_image_save_meta( $post_id ) {     //save the metadata          //verify the metadata is set     if ( isset ($_POST['dd_image_one'])) {     //save the metadata     update_post_meta( $post_id, 'dd_image_one', esc_url_raw( $_POST['dd_image']));          }          if ( isset ($_POST['dd_image_two'])) {         update_post_meta( $post_id, 'dd_image_two', esc_url_raw( $_POST['dd_image']));     }          }          ?>      js file code               jQuery(document).ready(function($) {     var formfield = null;          $('#upload_image_button').click(function() {     $('html').addClass('Image');     formfield = $('#dd_image').attr('name');     tb_show('', 'media-upload.php?type=image&TB_iframe=true');     return false;     });          // user inserts file into post.     //only run custom if user started process using the above process     // window.send_to_editor(html) is how wp normally handle the received data          window.original_send_to_editor = window.send_to_editor;     window.send_to_editor = function(html){     var fileurl;          if (formfield != null) {     fileurl = $('img',html).attr('src');     $('#dd_image').val(fileurl);     tb_remove();     $('html').removeClass('Image');     formfield = null;     } else {     window.original_send_to_editor(html);     }     };     });


Hook Scripts and Styles in WordPress

As explained in this page, I have created a WordPress custom dashboard. Everthing works fine right now. But now I can't hook scripts and styles. Here is my code for hooking scripts and styles.               add_action('wp_enqueue_scripts',array(&$this,'register_scripts_styles'));     function register_scripts_styles(){     wp_enqueue_script('jquery');     wp_register_script( 'virtual-script', plugins_url('js/virtual-script.js', __FILE__));     wp_register_style('virtual-css',plugins_url('css/virtual.css',__FILE__));*/      wp_enqueue_script( 'virtual-script');     wp_enqueue_style( 'virtual-css');          } //end registering scripts and styles


WooCommerce: List All Categories

I'm using the WooCommerce plugin with WordPress and within my theme I'd like to list all categories within a navigation menu with PHP. I've tried using `woocommerce_product_categories();` but I don't want the images, or other HTML elements, just their names (and maybe permalinks). How can I get that data?


How to allow user to add to, but not edit, a post?

I saw something very nifty on peerwise (basically a med students social network for making exam questions) that allows people to make additions to something but not edit the original post. I appreciate that isn't wordpress but was thinking I could do something similar with my p2 wordpress install. Basically add an unlimited number of (or e.g. 5) extra fields that are blank when writing the original post but can be 'edited' to add more content to a post. Does this seem like a plausible solution to allow users to add to but not edit a post? Are there better alternatives?


Unable to Upload Images on Local Windows Install

I am having the Famous `has failed to upload due to an error Unable to create directory` error that soo many people run into. Any search on Google of StackExchange will result is the common, change your file/folder permissions answer. Well I am running WordPress vs 3.5.1 on Windows 7. Permissions aren't as simple as setting `chmod 777` on Windows. I have check and even tried resetting the File permissions on Windows which from what I can tell is basically setting a user as the owner. Has anyone who has had this problem on Windows actually ever fixed it? All my searches never resulted in an answer for a Non- Linux or Mac ![enter image description here](http://i.stack.imgur.com/Wmti9.png) ![enter image description here](http://i.stack.imgur.com/4jrLJ.png)


Conditional Statement - Best Way to Remove Nav on Contact Page

I was thinking of removing navigation on my contact page. I was thinking of inserting a conditional statement and an inline CSS style to "display: none;" if the page template was the contact page. Is there a better way? I'm using Twenty Eleven as a parent theme.


W3 Total Cache CSS & JS files GZip issues

Having checked my site with google page speed and gzipwtf.com I have noticed that my css and js files are not getting compressed (although html is). Have tried unchecking " Prevent caching of objects after settings change " and have thus removed query strings from these files but that has had no effect. Have also tried adding the following (both above and below wordpress rules) in htaccess to no effect also:               # BEGIN GZIP     <ifmodule mod_deflate.c>     AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css     application/x-javascript application/javascript     </ifmodule>     # END GZIP      Would any one have any advice as to what I may be able to do to rectify this? Many thanks


How we get the success messages

How we can get the success messages like we can get the error messages by simple using the variable `$error` . So there is any other variable like `$success`. Currently i am using this code to register a new user. so after registeration i want to display success message.               if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'adduser' ) {         $user_pass = wp_generate_password();         $userdata = array(             'user_login' => esc_attr( $_POST['user_name'] ),             'user_pass' => esc_attr( $_POST['pass1'] ),             'user_email' => esc_attr( $_POST['email'] ),             'user_url' => esc_attr( $_POST['website'] ),             'description' => esc_attr( $_POST['description'] ),             'role' => get_option( 'default_role' ),         );              if ( !$userdata['user_login'] )             $error = __('A username is required for registration.', 'frontendprofile');         elseif ( username_exists($userdata['user_login']) )             $error = __('Sorry, that username already exists!', 'frontendprofile');              elseif ( !is_email($userdata['user_email'], true) )             $error = __('You must enter a valid email address.', 'frontendprofile');         elseif ( email_exists($userdata['user_email']) )             $error = __('Sorry, that email address is already used!', 'frontendprofile');         else if ( $_POST['pass1'] !== $_POST['pass2'] ) {             $error = __('Sorry, Passwords must match', 'frontendprofile');         }         else if ( strlen( $_POST['pass1'] ) < 6 ) {             $error = __('Sorry, Passwords must be at least six characters long', 'frontendprofile');         }         else{             $new_user = wp_insert_user( $userdata );             wp_new_user_notification($new_user, $user_pass);         }     }


how do I create a breadcrumb to work with multiple custom taxonomies

I have created several custom post types, and custom taxonomies to manage my large art portfolio. All of this is working very well. There is a post type for "art" and "design" as well as custom taxonomies for stuff like "color" I want to add breadcrumbs that will show the taxonomy the user clicked on to arrive at a particular image. For example: from the `achive-art.php` someone clicks on the custom taxonomy "color" and then the classification of purple they are taken to a `taxonomy-color.php` page that lists the results. When they click a thumbnail to see the full post I would like to see a breadcrumb that reads: art > purple > title of the post I've tried a ton of plug-ins but they only work with one taxonomy or will show: art > title of the post. I'm still kind of new to wordpress and trying to wrap my head around everything.


Alphabetically sort a taxonomy.php template by post title

Simply put, is it possible to sort a taxonomy.php template via the same methods you can with something like `wp_query` so that the archive shows all posts in an ascending order alphabetically by title?


Post photo galleries

Anyone know how to make a gallery post where you make one image the cover of the photo gallery and whenever it is clicked it links to the gallery? The use this method on thechive.com. I'm really not familiar with custom post types, is this where it is done?


Import sql data from a large file when installing plugin

I'm making my first plugin and I need to import about 31,000 records from a sql file into the wpdb when the plugin first gets installed by the user, but it is only importing about half of them only, around 18,000 records. In the install function I have these lines to INSERT the data:               $sql = file_get_contents(ABSPATH . 'wp-content/plugins/plugin-name/sql.sql');     dbDelta($sql);      Within the sql file I have this:               <? $sql = "CREATE TABLE IF NOT EXISTS $table_name (     `book` int(11) default NULL,      `chapter` int(11) default NULL,     `verse` int(11) default NULL,      `text` text     ) ENGINE=MyISAM DEFAULT CHARSET=utf8;          INSERT INTO $table_name VALUES      (4, 6, 27, 'text string here'),     (4, 6, 28, 'text string here'),     (4, 6, 29, 'text string here'),     (4, 6, 30, 'text string here');     "; ?>      I have tried using wpdb->query and wpdb->prepare but it is still not working. I have tried so many different ways and spent lots of hours trying to figure it out but it doesn't work. What can I do so that I can import 100% of the records when the plugin gets installed? Thank you in advance.


Add rel=lightbox to custom string

I'm using the following code in my functions.php to show thumbnails in my excerpt:               function pietergoosen_kry_eerste_prentjie() {     global $post;     $first_img = '';     $output = preg_match_all('//i', $post->post_content, $matches);     $first_img = $matches [1] [0];          return $first_img;     }          function pietergoosen_kyk_url_bestaan($url) {     $headers = wp_get_http_headers($url);          if (!is_array($headers)) :         return FALSE;     elseif (isset($headers["content-type"]) && (strpos($headers["content-type"],"image") !== false)) :         return TRUE;     else :         return FALSE;     endif;     }     function pietergoosen_verstel_prentjie_grootte($image, $alt, $newwidth, $newheight) {     if (!file_exists($image) && !pietergoosen_kyk_url_bestaan($image)) return '';     list($width, $height, $type, $attr) = getimagesize($image);     if (!$width || !$height) return '';          if ($newwidth)          $newheight = intval($newwidth/$width * $height);     else         $newwidth = intval($newheight/$height * $width);     return '';     }      I'm calling these functions into my content.php template just beneath the_excerpt like this:
             <a href="<?php the_permalink() ?>">               <?php echo pietergoosen_verstel_prentjie_grootte(pietergoosen_kry_eerste_prentjie(), get_the_title(), 125, 0); ?>
      What I now need to do is to add the rel="lightbox" attribute to the thumbnail displayed. Here is how I do it for all other images:               function pietergoosen_voeg_lightbox_rel_attribute_by_the_content($content) {        global $post;        $pattern ="//i";        $replacement = 'post_title.'"$6>';        $content = preg_replace($pattern, $replacement, $content);        return $content;     }          add_filter('the_content', 'pietergoosen_voeg_lightbox_rel_attribute_by_the_content');      I can't get this method to work on the excerpt thumbnails. Any ideas on how to get this to work.


Menu API not switching menus?

I am using the menus API, and I want to switch to a different menu, but it is holding the first one for some reason Here is my code in functions.php                   add_action( 'init', 'register_my_menus',10 );          function register_my_menus() {              register_nav_menu('main-navigation', 'Main Navigation');          }      Here is the code in my theme file (header.php)               <?php          $args = array(             'menu' => 'main-navigation',             'container_id' => 'navigation',             'fallback_cb' => 'wp_page_menu'             );         wp_nav_menu($args); ?>


Subscribe to a post's comments without posting a comment yourself

I've seen a few plugins (subscribe2, subscribe to comments) that allow people that have commented to receive emails containing follow up comments. What I want to do is slightly different. I want to post to have a 'Subscribe' button. Clicking this would then allow the user to receive by email subsequent comments to that post. They would not need to post a comment themselves. Is this possible with a plugin, code or a mix of the two?


remove <div class="textwidget"> from text-widget

When you add a text widget to a sidebar in Wordpress the widget includes this code               <div class="textwidget">      How do I remove this without editing the core? FYI - I think this line is located here: wp-includes/default-widgets.php (line 383)


the_post_thumbnail with lazyload JQ plugin

I need to modify the_post_thumbnail function to run "Lazyload" on it, i think there is two solutions : 1- modify the args to be something like this               the_post_thumbnail('product', array('data-original'=>$src, 'src'=>'grey.gif'));      (((NOT WORKING!))) 2- get only the image url from the function ... i've tried alot of snippets and nothing worked for me , like this one !               $thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), "size" );      any ideas?? thanks


How can I merge two authors?

I noticed on one of my WordPress installs I have two admin authors with the same email address. Both of them have posts attributed to them. They are both for the same person, so I'd like to combine the two accounts into one. How can I do this?


Sub-category single post styling?

*CLARIFICATION: I'm trying to style the single post view of some categories & sub categories. The suggested solution works, but only on a page of posts from the selected categories. Eg. If a post has a category 0f 59 (or is a child category of 59) then load a stylesheet. Here's what I've tried from the Codex-               <?php      // if the category is 59 or a 59 SUBcategory      if (cat_is_ancestor_of(59, $cat) or in_category(59)): ?>     <link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/products.css" type="text/css" media="screen" /><?php endif; ?>      Any ideas why it's not working? Thanks


Where is the changelog for 3.5? where is the list of added removed files?

This: http://codex.wordpress.org/Changelog/3.5 is not a changelog. This: http://codex.wordpress.org/Version_3.5 gives a few changes, etc, but no list of files added and removed. Where might I find a list of 'breaking changes'? Actions and Filters that work differently?


Woocommerce checkout error using cardsave extension

I am having a problem when integrating the cardsave payment gateway to the woocommerce plugin for WordPress. On the checkout page, I review my cart and select place order and the following error appears:               {         "result": "failure",         "messages": "          \n\t\t\t     Action failed. Please refresh the page and retry.<\/li>\n\t\t\t     First Name<\/strong> is a required field.<\/li>\n\t\t\t     Last Name<\/strong> is a required field.<\/li>\n\t\t\t     Address<\/strong> is a required field.<\/li>\n\t\t\t     Town\/City<\/strong> is a required field.<\/li>\n\t\t\t     Postcode<\/strong> is a required field.<\/li>\n\t\t\t     Country<\/strong> is a required field.<\/li>\n\t\t\t     Email Address<\/strong> is a required field.<\/li>\n\t\t\t     Phone<\/strong> is a required field.<\/li>\n\t\t\t     First Name<\/strong> is a required field.<\/li>\n\t\t\t     Last Name<\/strong> is a required field.<\/li>\n\t\t\t     Address<\/strong> is a required field.<\/li>\n\t\t\t     Town\/City<\/strong> is a required field.<\/li>\n\t\t\t     Postcode<\/strong> is a required field.<\/li>\n\t\t\t     Country<\/strong> is a required field.<\/li>\n\t\t\t     Invalid shipping method.<\/li>\n\t\t\t     Invalid payment method.<\/li>\n\t<\/ul>",         "refresh": "false"     }      I tried adding a paypal account which all works fine. The issue only occurs when I select the cardsave payment type. Any help much appreciated


Get image from post's gallery

Is there any possibility on Wordpress to get an image from a post gallery? Images are not inserted in the post, are on it's gallery. I'm trying to do a "galleries index" page and instead having the user set a "cover image" I'd like to take any of the attached to the post as part of a gallery. I tried the wp_get_attachment_image() with no luck, I think because it works for inserted images, not the ones on it's gallery. Thanks in advance. Juan.-


Trying to reorder posts by custom field

I'm running WooCommerce and am trying to get the default product display to be sorted by the sku field in ascending order. So far I've come up with this:               /* Order products by SKU */     function reorder_products_by_sku( $query ) {     if(is_shop() && ! is_admin() && $query->is_main_query()) {         $query->set('orderby', 'meta_value_num');         $query->set('meta_key', 'sku');         $query->set('order', 'ASC');     }     }     add_action( 'pre_get_posts', 'reorder_products_by_sku' );      This just tells me there are no products found which match my selection. Can anyone point me towards what I'm doing wrong? Thanks


Bought custom navigation menu from codecanyon, how to change feature.php?

I bought a nav-menu with css but not sure how to use this in my wordpress theme. Is there a standard way to implement it? Like this question:http://wordpress.stackexchange.com/questions/32186/how-to- create-a-custom-wordpress-navigation-menu-with-the-code Documentation that came with the navmenu: is this: http://www.hicengineering.com/navmenu.html


One post on frontpage and an archive page

I'm developing a theme using the underscores starter theme and I'd like to have a frontpage with just the last post and pagination, and then a separate page, with the "archive" slug, to show all posts with pagination. Is it possible to do this programmatically (adding filters and actions in the functions.php file) without creating extra templates? Thanks in advance **UPDATE:** @ialocin answered the `frontpage` part of my question. This is what I came up with for the `archives` part of my question:               function rewrite_init() {          add_rewrite_rule('archives', 'index.php?archives=yes', 'top');     }     add_action('init', 'rewrite_init');          function rewrite_query_vars($query_vars) {             $query_vars[] = 'archives';          return $query_vars;      }      add_action('query_vars', 'rewrite_query_vars');           function rewrite_template_include($template){              if (get_query_var('archives')) {                      $template = locate_template(array('archive.php'));         }         return $template;      }     add_filter('template_include', 'rewrite_template_include');


count posts from custom taxonomy terms by year

I want to build statistics-like tables with the count of posts in given custom taxonomy terms and display them by year along with the total post count from that year. For example: > **2014** > > |_Taxonomy Term A: 8 posts > > |_ Taxonomy Term B: 12 posts > > **Total posts in 2014:** 20 posts The function obviously needs to do the following:   * count posts from my-custom-post-type that have been published in 2014, 2013, ... (total count per year)   * count the posts in each taxonomy term from my-custom-taxonomy on the yearly base To make a **dynamic list for the years** , I used a snippet I found somewhere and it looks like this:               function posts_by_year() {       // array to use for results       $years = array();            // get posts from WP       $posts = get_posts(array(         'numberposts' => -1,         'orderby' => 'post_date',         'order' => 'ASC',         'post_type' => 'my-custom-post-type',         'post_status' => 'publish'       ));            // loop through posts, populating $years arrays       foreach($posts as $post) {         $years[date('Y', strtotime($post->post_date))][] = $post;       }            // reverse sort by year       krsort($years);       return $years;     }      In my custom page template, I use:               <?php foreach(posts_by_year() as $year => $posts) : ?>
<?php echo $year; ?>
     // the code that I need to display the post counts per year     <?php endforeach; ?>      **My question is:** How do I build the wp_query to be able to output the post count per taxonomy term per year? I'd be so glad if anyone helped me sort that out. PS: I already have a table counting ALL published posts from my-custom-post- type per taxonomy term, I found help here and used deflime's code. **Edit:** This is Pieter Goosen's snippet including my modifications:               $oldest = get_posts( 'post_type=my-custom-post-type&post_status=publish&posts_per_page=1&order=ASC' );     $oldest_date = $oldest[0]->post_date;          $first_date = date('Y', strtotime($oldest_date));     $todays_date = date('Y');          $year_range = range($todays_date, $first_date);          foreach ($year_range as $year) { // dynamic year-based tables         echo '
' . $year . '
';         $terms = get_terms('my-custom-taxonomy');         $total_posts = 0;              if ( !empty( $terms ) && !is_wp_error( $terms ) ) { // table body                  echo '

                 ';             echo '

                         Taxonomy Term	                         Percentage	                         Count

                 ';             echo '

                     Posts total	                     '.$total_posts.'

                 ';                  foreach ( $terms as $term ) { // setup table
 per taxonomy term                 $args = array(                     'posts_per_page'    => -1,                     'post_type'         => 'my-custom-post-type',                     'post_status'       => 'publish',                     'year'              => $year,                     'tax_query' => array(                         array(                             'taxonomy' => 'my-custom-taxonomy',                             'field'    => 'slug',                             'terms'    => $term->slug                         ),                     ),                 );                      $total_posts += $term->count;                 // Get  %, round to 2 decimal places                 $percentage = round( (($yearly_posts_per_term->post_count / $total_posts)*100), 2 );                 // will add up to 100 at the end?                 $total_check += $percentage;                      $yearly_posts_per_term = new WP_Query($args);                      echo '
                         '.$term->name.'

 '.$percentage.'%	                         '.$yearly_posts_per_term->post_count.'
                 ';                  } // endforeach             echo '

                 ';          } //end of table     } // end of year-based list


getting specific items from menu

In trying to build 2 linked menus, lets say the hierarchy is like this (In the menu options)               - A      -- B      -- C      -- D        -- D1        -- D2     - A1      The first menu I want it to be fixed so I fetched it with `'depth' => 1,`. And the second menu has to be change according the first menu (like if I press `A` it will show `B` and `C` AND `D` only and when I press `B` its still has to get open as `B`, `C`, `D` (same if I press `D1`). I think we got the point of how it should work. As I tried to build this, I only accoplishe to fetch the menu only when you choice from the main menu (Like `A` or `A1`). but as you choice deeper in the depth menu its showing hi's childrens. (like if I choice `D` the sub-menu gets to be `D1` and `D2`) and I dont want it, I tried to check in which depth the menu is, or get anything that will help me make this sort but I couldn't find anything. here is some code: the function:               function submenu_get_children_ids( $id, $items ) {              $ids = wp_filter_object_list( $items, array( 'menu_item_parent' => $id ), 'and', 'ID' );              foreach ( $ids as $id ) {                  $ids = array_merge( $ids, submenu_get_children_ids( $id, $items ) );         }              return $ids;     }      fetching the menu :               $menu = wp_nav_menu(array(         'container' => false,                           // remove nav container         'container_class' => 'right_menu',                 // class of container (should you choose to use it)         'menu' => __( 'top_main_nav', 'bonestheme' ),  // nav name         'menu_class' => 'main_bar_menu '.$lang.'',               // adding custom nav class         'theme_location' => 'main-nav',                 // where it's located in the theme         'before' => '',                                 // before the menu         'after' => '',                                  // after the menu         'link_before' => '',                            // before each link         'link_after' => '',                             // after each link         'depth' => 1,                                   // limit the depth of the nav         'fallback_cb' => ''                             // fallback function (if there is one)     ));                $current_page = 0;     // check if the current page has a menu.          foreach(wp_get_nav_menu_items('top_main_nav') as $pagec) {         if(get_the_title() == $pagec->title) {             $current_page = $pagec->title;         }     }          if($current_page === 0) {         $current_page = "Home";          }               $args = array(         'container' => false,         'container_class' => 'main_bar_menu',         'menu'    => 'top_main_nav',         'menu_class' => 'main_bar_menu',         'submenu' => $current_page,     );     wp_nav_menu( $args );       I'm trying to find a solution about 2 days now :\ if someone could guide me with that i'd be so thankful! thanks alot!


I can't seem to get excerpts showing inside get_pages and don't know why?

So, I have a foreach loop within get_pages that shows a list of child pages within a parent ID. The titles, featured image, and links come through fine, however I can't get excerpts to show up at all. I'm referencing http://codex.wordpress.org/Function_Reference/get_pages               $args = array(         'child_of'     => 16,         'title_li'     => '',         'depth'         => 0,         'sort_order'    => 'DESC',         'sort_column'   => 'menu_order'     );     $pages = get_pages( $args );     $output = '';     foreach($pages as $value){         $thumb = get_the_post_thumbnail( $value->ID, $attr = '' );         $output .= "

";         $output .= "
post_name . "' >" . $thumb . "
";         $output .= "
post_name . "' >" .  $value->post_title . "
";         $output .= "
". $value->post_excerpt . "
";         $output .= "

";     }      echo $output;      I can change `$value->post_excerpt` to `$value->post_content` and that works correctly, showing the entire page content. I've also tried with various variations including `get_the_excerpt()`, `the_excerpt()` and `post_excerpt` but to no avail. Is there something I'm missing? On the Codex page, it has `post_excerpt` listed as a correct return, so I'm not really sure why it's not showing. (By the way, yes I have added the MORE tag to my pages) UPDATE: `var_dump($value)`               object(WP_Post)[276]     public 'ID' => int 155     public 'post_author' => string '1' (length=1)     public 'post_date' => string '2014-08-07 09:40:53' (length=19)     public 'post_date_gmt' => string '2014-08-07 09:40:53' (length=19)     public 'post_content' => string '
Mobile phone tracking

Parents keen to know the location of their children, and businesses seeking to ensure safety of lone workers have since 2004, been able to purchase a mobile phone tracking service, designed and implemented by InverOak, in conjunction with Cybit for The Carphone Warehouse.

The Carphone Warehouse, Europe's leading independent retailer of mobile phones and services, asked InverOak to design a system that tracks the location of any mobile phone in the UK, '... (length=2656)     public 'post_title' => string 'The Carphone Warehouse' (length=22)     public 'post_excerpt' => string '' (length=0)     public 'post_status' => string 'publish' (length=7)     public 'comment_status' => string 'closed' (length=6)     public 'ping_status' => string 'closed' (length=6)     public 'post_password' => string '' (length=0)     public 'post_name' => string 'the-carphone-warehouse' (length=22)     public 'to_ping' => string '' (length=0)     public 'pinged' => string '' (length=0)     public 'post_modified' => string '2014-08-11 10:01:34' (length=19)     public 'post_modified_gmt' => string '2014-08-11 10:01:34' (length=19)     public 'post_content_filtered' => string '' (length=0)     public 'post_parent' => int 16     public 'guid' => string 'http://inveroak.local/?page_id=155' (length=34)     public 'menu_order' => int 0     public 'post_type' => string 'page' (length=4)     public 'post_mime_type' => string '' (length=0)     public 'comment_count' => string '0' (length=1)     public 'filter' => string 'raw' (length=3)      So, the post_excerpt is empty. But I don't fully understand why, if it's included in the return on the codex? UPDATE: So I've discovered the excerpt for pages was removed in 3.1 and have found a manual excerpt function added to the theme functions.php file:               add_post_type_support( 'page', 'excerpt' );      While this seems to work okay, is there any difference between this, and using the tag in the editor? Which is cleaner?


Iris color picker

i try to implement Iris color picker in my wordpress theme and it works fine, but when i include the Iris color picker's files i can't call a custom function via a tag. this is the Iris color picker files:                                    this is the js script in the header:                     and this is the link to the function:               Insert video      If i remove the Iris files the function run otherwise no.


save prevision data in the database on theme activation

I developed a theme for my client. Theme have predefined posts, pages and sliders etc. when some one activate the theme, theme does the following steps on theme activation action hook. 1:- Empty the current WordPress database to avoid any duplicate data entry issue. 2:- Inserts predefined data in the WordPress core tables and creates some other required custom tables with data. Everything is working fine accept one issue and that is my theme removes all the previous data in the database. so that client lost his all previous data. i need any idea or help to tackle this issue. User just want to add new theme using theme zip file and all the posts and pages each and everything should be done automatically. Any help or idea will be highly appreciated.


How to replace bloginfo(template_url)

Basically I've used `bloginfo(template_url)` in a WordPress theme, but when I run theme-checker, it recommends to replace `bloginfo(template_url)` with `get_template_directory_uri()`, however when I use `get_template_directory_uri()` it doesn't work. It works fine if I use it to replace `get_bloginfo(template_url)` but that's not what I want now. Is `bloginfo(template_url)` being deprecated? If it is, what is it's replacement? Thanks


How do i display the built-in gallery inside a widget?

I want to display a specific gallery (without a plugin = WordPress built-in gallery) inside a widget. I tried the shortcode `[gallery ids="717"]` but that doesn't work. Maybe a workaround could be enabling shortcodes inside widgets? if yes, how do I do that?


Can I have two submit buttons in one form?

I want to provide 2 buttons in one form. User click either button can submit the form but do different jobs-- one button is to import checked files, another button is to create fiels. Will this confuse Wordpress?


Plugin for custom posts and fields

I need a plugin to do the following:   * Add custom posttypes such as "Books" or "Cars"   * Add custom fields such as "Url", "Label", "Number of wheels", "Name of passenger" or "Age of passenger" There are some requirements   1. This should work on a multisite installation and it should be possible to fetch posts and the data for that post from an other site in the multisite network   2. Some fields needs to be grouped, eg. "Name of passenger" and "Age of passenger"   3. Some fields needs to be ordered (by the user), say for instance the user want to order the group of passenger-age, so when displayed the names will show up in that order Do you know any plugin that will do this?


Should I use Wordpress to skin a database website?

I am going to start programming a website which allows users to post adverts for aircraft for sale. (Think autotrader for planes). It will be free to use. There are a few websites that do this already but they are all flawed for different reasons. I am comfortable using php and mySQL so plan to use these to do the 'back- end'. I am also competent with HTML as a language but am terrible at graphics and making these look pretty. Therefore I would like to use some form a 'skin' to place over the code I build. I have considered using Wordpress as there are many free themes which are aesthetically pleasing. I have never used Wordpress before. I know it is a database website already. Is it suited to having custom databases/webservices built behind it and displaying search results etc... OR... Can I use the database that comes with it as the information store and allow users to create accounts and post items etc... Any thoughts/advice welcome.


wp_query, give first post different formatting

I want to be able to give the first post in a custom instance of `wp_query` different formatting to the rest. This is a sample of my current loop (With some bits simplified to shorten my code);               $args1 = array(         'post_type' => 'post',         'posts_per_page' => 4     );     $loop = new WP_Query($args);     while ($loop->have_posts()) : $loop->the_post();         echo '
'.the_title().'
';     endwhile; wp_reset_postdata();      But for the first post in this loop I want to formatting to be different so that I can show the post thumbnail, a short content excerpt, etc.


How to get the count for each taxonomy term

I know it is `$term[0]->count;` However, my terms are placed in the custom menu plugin. My terms are currently structured as               Parent       Child     Parent       Child      How do I append the term count of each term? I have been searching all over and haven't found a solution. My output should be:               Parent(2)       Child(1)     Parent(5)       Child(2)      I am still at a lost on how to approach this. So any help will be appreciated. EDIT: If someone knows where to find the file for the custom menu widget, I think I can edit its output.