title: Can't get a custom template taxonomy page to display

text:
I've been trying to wade my way through learning the ins and outs of taxonomies and how to integrate them into themes and I've run into a pretty basic issue that I can't seem to figure out. I started working on this in a BuddyPress install using More Taxonomies. After not being able to get the custom template to load (taxonomy-platform.php) using the rewrite slug of platform... www.mydomain.com/wpinstall/platform .... I deleted the taxonomies from More Taxonomies (but not the entries in the database for terms), uninstalled More Taxonomies and entered the Taxonomies into my buddypress functions.php. First I used                   //hook into the init action and call create_platform_taxonomies when it fires     add_action( 'init', 'create_platform_taxonomies', 0);     //create the non-heirarchical Platforms taxonomy     function create_platform_taxonomies()      {                 // Adding a taxonomy for Platforms, non heirarchical     $labels = array(         'name' => _x( 'Platforms', 'taxonomy general name' ),         'singular_name' => _x( 'Platform', 'taxonomy singular name' ),         'search_items' =>  __( 'Search Platforms' ),         'popular_items' => __( 'Popular Platforms' ),         'all_items' => __( 'All Platforms' ),         'parent_item' => null,         'parent_item_colon' => null,         'edit_item' => __( 'Edit Platform' ),          'update_item' => __( 'Update Platform' ),         'add_new_item' => __( 'Add New Platform' ),         'new_item_name' => __( 'New Platform Name' ),         'separate_items_with_commas' => __( 'Separate platforms with commas' ),         'add_or_remove_items' => __( 'Add or remove platforms' ),         'choose_from_most_used' => __( 'Choose from the most used platforms' ),         'menu_name' => __( 'Platforms' ),       );             register_taxonomy('platform',         array( 'post', 'page', 'mediapage', 'attachment', 'revision', 'nav_menu_item', 'cheats', 'reviews', 'tutorials' ),             array(                 'hierarchical' => false,                 'labels' => $labels,                 'show_ui' => true,                 'query_var' => true,                 'rewrite' => array( 'slug' => 'platform' ),       ));     }      but that still didn't allow it to work properly. *Let me note here that I have been over-zealous about flushing my rewrites using the Permalinks page save method during this entire process. I then rolled back to 2010, and entered that same code into functions.php, and tried again, same result. The taxonomy showed up under all the post types, it pulled the old term data from the database, entered into posts correctly, but I could not bring up the taxonomy-platform.php page, always getting a "that page could not be found" error. so now I wrote what I felt was a much more dumbed down taxonomy and tried that;                   add_action( 'init', 'create_testtax_taxonomies', 0);           function create_testtax_taxonomies()       {      register_taxonomy ( 'testtax', array( 'post', ),          array(             'hierarchical' => false,             'labels' => array( 'Testtax', ),             'show_ui' => true,             'query_var' => true,             'rewrite' => array( 'slug' => 'testtax' ),             ));           }      this showed up (although its titled as a second 'Post Tags' in my Posts post type but I figured that's cause I cut down on labeling so heavily), but displayed the same behavior when trying to navigate to www.mydomain.com/wpinstall/testtax this is my code for the taxonomy-testtax.php page               <?php          /* This is the custom template for     * the platforms taxonomy.      */          get_header(); ?>

     hello

          <?php get_sidebar(); ?>     <?php get_footer(); ?>      Again, for the moment as simple as possible, but I've also used copies of the index and other various loop-enabled pages. Any help would be appreciated, thanks in advance! Not sure if I'm missing something simple, or skipping a process in properly enabling taxonomies... just not sure. * * * * * * * * * Adding some more info to expand on some the answers/comments below (can't find a more efficient way to do this) I had seen a couple posts regarding this kind of issue I noticed some folks were able to flush an entire array of their soft re-write rules from WordPress. I figured I'd see if I could get the same sort of my print out myself. First I added;               add_action('wp_footer', 'show_rewrite_rules');     function show_rewrite_rules(){       global $wp_rewrite;       echo "
";       print_r($wp_rewrite->rules);       echo "
";     }      So, added that to my Functions.php in 2010 (I'm pretty much keeping my 2010 theme and my BuddyPress install/theme uptodate with all these possible fixes and changes and testing in both - also have disabled plugins again a couple times and done a save as I've tried some of the suggests below). I got this output;               Array     (         [categories/(.+)/search_type/(.+)/order/(.+)/page/(.+)] => index.php?cat=$matches[1]&search_type=$matches[2]&order=$matches[3]&paged=$matches[4]         [categories/(.+)/search_type/(.+)/order/(.+)] => index.php?cat=$matches[1]&search_type=$matches[2]&order=$matches[3]         [categories/(.+)/page/(.+)] => index.php?cat=$matches[1]&paged=$matches[2]         [categories/(.+)] => index.php?cat=$matches[1]         [promotion/?$] => index.php?post_type=ps_promotion         [promotion/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?post_type=ps_promotion&feed=$matches[1]         [promotion/(feed|rdf|rss|rss2|atom)/?$] => index.php?post_type=ps_promotion&feed=$matches[1]         [promotion/page/([0-9]{1,})/?$] => index.php?post_type=ps_promotion&paged=$matches[1]         [category/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?category_name=$matches[1]&feed=$matches[2]         [category/(.+?)/(feed|rdf|rss|rss2|atom)/?$] => index.php?category_name=$matches[1]&feed=$matches[2]         [category/(.+?)/page/?([0-9]{1,})/?$] => index.php?category_name=$matches[1]&paged=$matches[2]         [category/(.+?)/?$] => index.php?category_name=$matches[1]         [tag/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?tag=$matches[1]&feed=$matches[2]         [tag/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?tag=$matches[1]&feed=$matches[2]         [tag/([^/]+)/page/?([0-9]{1,})/?$] => index.php?tag=$matches[1]&paged=$matches[2]         [tag/([^/]+)/?$] => index.php?tag=$matches[1]         [type/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?post_format=$matches[1]&feed=$matches[2]         [type/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?post_format=$matches[1]&feed=$matches[2]         [type/([^/]+)/page/?([0-9]{1,})/?$] => index.php?post_format=$matches[1]&paged=$matches[2]         [type/([^/]+)/?$] => index.php?post_format=$matches[1]         [cheats/[^/]+/attachment/([^/]+)/?$] => index.php?attachment=$matches[1]         [cheats/[^/]+/attachment/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1         [cheats/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]         [cheats/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]         [cheats/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]         [cheats/([^/]+)/trackback/?$] => index.php?cheats=$matches[1]&tb=1         [cheats/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?cheats=$matches[1]&feed=$matches[2]         [cheats/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?cheats=$matches[1]&feed=$matches[2]         [cheats/([^/]+)/page/?([0-9]{1,})/?$] => index.php?cheats=$matches[1]&paged=$matches[2]         [cheats/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?cheats=$matches[1]&cpage=$matches[2]         [cheats/([^/]+)/entry(/(.*))?/?$] => index.php?cheats=$matches[1]&entry=$matches[3]         [cheats/([^/]+)(/[0-9]+)?/?$] => index.php?cheats=$matches[1]&page=$matches[2]         [cheats/[^/]+/([^/]+)/?$] => index.php?attachment=$matches[1]         [cheats/[^/]+/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1         [cheats/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]         [cheats/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]         [cheats/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]         [reviews/[^/]+/attachment/([^/]+)/?$] => index.php?attachment=$matches[1]         [reviews/[^/]+/attachment/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1         [reviews/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]         [reviews/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]         [reviews/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]         [reviews/([^/]+)/trackback/?$] => index.php?reviews=$matches[1]&tb=1         [reviews/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?reviews=$matches[1]&feed=$matches[2]         [reviews/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?reviews=$matches[1]&feed=$matches[2]         [reviews/([^/]+)/page/?([0-9]{1,})/?$] => index.php?reviews=$matches[1]&paged=$matches[2]         [reviews/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?reviews=$matches[1]&cpage=$matches[2]         [reviews/([^/]+)/entry(/(.*))?/?$] => index.php?reviews=$matches[1]&entry=$matches[3]         [reviews/([^/]+)(/[0-9]+)?/?$] => index.php?reviews=$matches[1]&page=$matches[2]         [reviews/[^/]+/([^/]+)/?$] => index.php?attachment=$matches[1]         [reviews/[^/]+/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1         [reviews/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]         [reviews/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]         [reviews/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]         [tutorials/[^/]+/attachment/([^/]+)/?$] => index.php?attachment=$matches[1]         [tutorials/[^/]+/attachment/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1         [tutorials/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]         [tutorials/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]         [tutorials/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]         [tutorials/([^/]+)/trackback/?$] => index.php?tutorials=$matches[1]&tb=1         [tutorials/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?tutorials=$matches[1]&feed=$matches[2]         [tutorials/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?tutorials=$matches[1]&feed=$matches[2]         [tutorials/([^/]+)/page/?([0-9]{1,})/?$] => index.php?tutorials=$matches[1]&paged=$matches[2]         [tutorials/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?tutorials=$matches[1]&cpage=$matches[2]         [tutorials/([^/]+)/entry(/(.*))?/?$] => index.php?tutorials=$matches[1]&entry=$matches[3]         [tutorials/([^/]+)(/[0-9]+)?/?$] => index.php?tutorials=$matches[1]&page=$matches[2]         [tutorials/[^/]+/([^/]+)/?$] => index.php?attachment=$matches[1]         [tutorials/[^/]+/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1         [tutorials/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]         [tutorials/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]         [tutorials/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]         [platform/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?platform=$matches[1]&feed=$matches[2]         [platform/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?platform=$matches[1]&feed=$matches[2]         [platform/([^/]+)/page/?([0-9]{1,})/?$] => index.php?platform=$matches[1]&paged=$matches[2]         [platform/([^/]+)/?$] => index.php?platform=$matches[1]         [testtax/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?testtax=$matches[1]&feed=$matches[2]         [testtax/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?testtax=$matches[1]&feed=$matches[2]         [testtax/([^/]+)/page/?([0-9]{1,})/?$] => index.php?testtax=$matches[1]&paged=$matches[2]         [testtax/([^/]+)/?$] => index.php?testtax=$matches[1]         [promotion/[^/]+/attachment/([^/]+)/?$] => index.php?attachment=$matches[1]         [promotion/[^/]+/attachment/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1         [promotion/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]         [promotion/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]         [promotion/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]         [promotion/([^/]+)/trackback/?$] => index.php?ps_promotion=$matches[1]&tb=1         [promotion/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?ps_promotion=$matches[1]&feed=$matches[2]         [promotion/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?ps_promotion=$matches[1]&feed=$matches[2]         [promotion/([^/]+)/page/?([0-9]{1,})/?$] => index.php?ps_promotion=$matches[1]&paged=$matches[2]         [promotion/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?ps_promotion=$matches[1]&cpage=$matches[2]         [promotion/([^/]+)/entry(/(.*))?/?$] => index.php?ps_promotion=$matches[1]&entry=$matches[3]         [promotion/([^/]+)(/[0-9]+)?/?$] => index.php?ps_promotion=$matches[1]&page=$matches[2]         [promotion/[^/]+/([^/]+)/?$] => index.php?attachment=$matches[1]         [promotion/[^/]+/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1         [promotion/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]         [promotion/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]         [promotion/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]         [promotions/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?promotion-categories=$matches[1]&feed=$matches[2]         [promotions/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?promotion-categories=$matches[1]&feed=$matches[2]         [promotions/([^/]+)/page/?([0-9]{1,})/?$] => index.php?promotion-categories=$matches[1]&paged=$matches[2]         [promotions/([^/]+)/?$] => index.php?promotion-categories=$matches[1]         [(.+)/entry/%entry%/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?%entry%$matches[1]&feed=$matches[2]         [(.+)/entry/%entry%/(feed|rdf|rss|rss2|atom)/?$] => index.php?%entry%$matches[1]&feed=$matches[2]         [(.+)/entry/%entry%/page/?([0-9]{1,})/?$] => index.php?%entry%$matches[1]&paged=$matches[2]         [(.+)/entry/%entry%/?$] => index.php?%entry%$matches[1]         [.*wp-atom.php$] => index.php?feed=atom         [.*wp-rdf.php$] => index.php?feed=rdf         [.*wp-rss.php$] => index.php?feed=rss         [.*wp-rss2.php$] => index.php?feed=rss2         [.*wp-feed.php$] => index.php?feed=feed         [.*wp-commentsrss2.php$] => index.php?feed=rss2&withcomments=1         [feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?&feed=$matches[1]         [(feed|rdf|rss|rss2|atom)/?$] => index.php?&feed=$matches[1]         [page/?([0-9]{1,})/?$] => index.php?&paged=$matches[1]         [comments/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?&feed=$matches[1]&withcomments=1         [comments/(feed|rdf|rss|rss2|atom)/?$] => index.php?&feed=$matches[1]&withcomments=1         [comments/page/?([0-9]{1,})/?$] => index.php?&paged=$matches[1]         [search/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?s=$matches[1]&feed=$matches[2]         [search/(.+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?s=$matches[1]&feed=$matches[2]         [search/(.+)/page/?([0-9]{1,})/?$] => index.php?s=$matches[1]&paged=$matches[2]         [search/(.+)/?$] => index.php?s=$matches[1]         [author/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?author_name=$matches[1]&feed=$matches[2]         [author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?author_name=$matches[1]&feed=$matches[2]         [author/([^/]+)/page/?([0-9]{1,})/?$] => index.php?author_name=$matches[1]&paged=$matches[2]         [author/([^/]+)/?$] => index.php?author_name=$matches[1]         [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]         [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]         [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/page/?([0-9]{1,})/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&paged=$matches[4]         [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]         [([0-9]{4})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]         [([0-9]{4})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]         [([0-9]{4})/([0-9]{1,2})/page/?([0-9]{1,})/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&paged=$matches[3]         [([0-9]{4})/([0-9]{1,2})/?$] => index.php?year=$matches[1]&monthnum=$matches[2]         [([0-9]{4})/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?year=$matches[1]&feed=$matches[2]         [([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$] => index.php?year=$matches[1]&feed=$matches[2]         [([0-9]{4})/page/?([0-9]{1,})/?$] => index.php?year=$matches[1]&paged=$matches[2]         [([0-9]{4})/?$] => index.php?year=$matches[1]         [[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/?$] => index.php?attachment=$matches[1]         [[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1         [[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]         [[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]         [[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]         [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/trackback/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&tb=1         [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&feed=$matches[5]         [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&feed=$matches[5]         [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/page/?([0-9]{1,})/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&paged=$matches[5]         [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&cpage=$matches[5]         [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/entry(/(.*))?/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&entry=$matches[6]         [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)(/[0-9]+)?/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&page=$matches[5]         [[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/?$] => index.php?attachment=$matches[1]         [[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1         [[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]         [[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]         [[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]         [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/comment-page-([0-9]{1,})/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&cpage=$matches[4]         [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/entry(/(.*))?/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&entry=$matches[5]         [([0-9]{4})/([0-9]{1,2})/comment-page-([0-9]{1,})/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&cpage=$matches[3]         [([0-9]{4})/([0-9]{1,2})/entry(/(.*))?/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&entry=$matches[4]         [([0-9]{4})/comment-page-([0-9]{1,})/?$] => index.php?year=$matches[1]&cpage=$matches[2]         [([0-9]{4})/entry(/(.*))?/?$] => index.php?year=$matches[1]&entry=$matches[3]         [.+?/attachment/([^/]+)/?$] => index.php?attachment=$matches[1]         [.+?/attachment/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1         [.+?/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]         [.+?/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]         [.+?/attachment/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]         [(.+?)/trackback/?$] => index.php?pagename=$matches[1]&tb=1         [(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?pagename=$matches[1]&feed=$matches[2]         [(.+?)/(feed|rdf|rss|rss2|atom)/?$] => index.php?pagename=$matches[1]&feed=$matches[2]         [(.+?)/page/?([0-9]{1,})/?$] => index.php?pagename=$matches[1]&paged=$matches[2]         [(.+?)/comment-page-([0-9]{1,})/?$] => index.php?pagename=$matches[1]&cpage=$matches[2]         [(.+?)(/[0-9]+)?/?$] => index.php?pagename=$matches[1]&page=$matches[2]     )      So I see Platform and Testtax in there, they don't have as many lines as the rewrites for my custom post types, however from what I can tell it looks like they do have rules that should make this work.


title: Problem with removing post tags programmatically

text: I use the following function in order to retrieve tags of a post, remove an element from the array and then set the result to the post:               $post_tags = wp_get_post_terms( $post_id );     foreach ( $post_tags as $key => $tag) {         $tag_string = http_build_query( $tag );         if( 0 != strpos( $tag_string , 'tag-to-be-deleted' ) ) {                 unset( $post_tags[$key] );         }     }     wp_set_post_terms ($post_id, $post_tags, 'post_tag');      Then I get a bug inside the wp_set_post_terms function, that says the $post_tags parameter should be a string and not an array...what am I doing wrong here? Any help would be appreciated.


title: using enqueue_script in a shortcode isn't working

text: I'm new to wordpress and I'm trying to get this to work by following the wordpress codex but I feel like I must be missing something obvious. I have a child theme based off of a parent one, and I created a file called "functions.php" in the root directory of the child theme with FTP. I added this code to it:               <?php     function my_canvas_include(){       wp_enqueue_style( 'style-name', get_stylesheet_directory_uri() . '/css/stylesheet.css');       wp_enqueue_script( 'script-name', get_stylesheet_directory_uri() . '/js/site.js', array('jquery'), '1.0.0', true );            $output = '';       $output .= '<canvas id="myCanvas" width="200" height="100" style="border:1px solid #d3d3d3;">Your browser does not support the HTML5 canvas tag.</canvas ';       return $output;     }          add_shortcode('my_canvas', 'my_canvas_include');     ?>      The example here has some contrived names for the function and shortcode. The idea, though, is that I want to include the js and stylesheet _only_ on those pages I need it (by using the shortcode `[my_canvas]` when editing a page in wordpress admin) which will also output that canvas element (the styles and js will manipulate the canvas element). Using the shortcode...mostly works. It adds the canvas element, but I don't see the stylesheet or js file anywhere in the source, and even when i put `alert('hi')` in the js file it doesn't do anything when I use the shortcode on the page. What am I doing wrong here? Is there another way I'm supposed to conditionally include stylesheets or scripts on only pages that need them?


title: set post_type based on custom taxonomy permalink

text: I have a custom post type registered as `publication` and a custom taxonomy registered as `publication_category`. The post type's slug is `publication` and the taxonomy slug is `publication/category`. The reason I have it set up like that is to get these urls               example.com/publication/ - Archive     example.com/publication/post-name - Single     example.com/publication/category/category-name - Category Archive      The problem is that when I go to this url `example.com/publication/category/category-name` the post_type is not set so it uses the default archive template. Is there a way without passing in `?post_type=publication` that I can set the post_type to publication so it uses the publication archive template?


title: Am I overusing custom fields (for adding nearly 5 images and their titles)?

text: I never used custom fields so I got a bit exited. I'm not sure if I'm overusing them: ![enter image description here](http://i.stack.imgur.com/IDImY.png) ![enter image description here](http://i.stack.imgur.com/3bf6p.png) (I'm using them to display the title of images and images themselves. (big and small ones). I used to do it with custom post types but it didn't make sense since those images belong only to that single posts. Any suggestions?


title: Different 'WP_CONTENT_URL' for different subsites in Multisite setup?

text: I host quite a few blogs on my network (WordPress Multisite) and have their static content served via a common CDN, by simply setting the wp-content directory URL in wp-config.php like so:               # http://codex.wordpress.org/Editing_wp-config.php#Moving_wp-content_folder     define( 'WP_CONTENT_URL', 'http://abcdefghijk.cloudfront.net/wp-content' );      Now all static content (images, css, js, etc.) in wp-content directory, **for all sites** , is served via the common CDN. The problem is, I need to use a different CDN/URL for wp-content directory for some sub-sites in the network. So, the question is:   1. Is it possible to set different `WP_CONTENT_URL` values for different sub-sites in wp-config.php?   2. If (1) isn't possible, is it possible to define `WP_CONTENT_URL` in functions.php instead? If yes, then is it possible to set different `WP_CONTENT_URL` values for different sub-sites in functions.php?


title: How would an if statement surrounding a custom field with two variables (holding values) look like?

text:
This is from the codex:               <?php if ( get_post_meta($post->ID, 'thumb', true) ) : ?>         <a href="<?php the_permalink() ?>" rel="bookmark">             <img class="thumb" src="<?php echo get_post_meta($post->ID, 'thumb', true) ?>" alt="<?php the_title(); ?>" />              <?php endif; ?>      I want to include an if statement like the example above. But I can't figure out the proper way of doing that to the following:               <?php // Set and display custom field             $mainbar_left_title = get_post_meta($post->ID, 'Mainbar Left Title', true);             $mainbar_left_image = get_post_meta($post->ID, 'Mainbar Left Image', true); ?>

<?php echo $mainbar_left_title; ?>
                 <img src="<?php echo $mainbar_left_image ?>" alt="" />
 <?php         ?>


title: How to setup sidebar modules to use jQuery Accordian

text:
To use jQuery UI accordion, I need markup like
Module 1

Module 2

          ...      How can I setup my side bar like that? Or perhaps I somehow change the way jQuery creates accordian, maybe there are some options?


title: Custom Post Type Set Comments ON by default without show METABOX

text: I've created a new custom post type for a specific posts. The posts from my new custom post type, have - by default - set the comments to "off". I need to the comments to be "on" by default. In my `functions.php` file I have this:               'supports' => array('editor','comments')      and               function default_comments_on( $data ) {         if( $data['post_type'] == 'registro' && $data['post_status'] == 'auto-draft' ) {             $data['comment_status'] = 1;         }               return $data;     }     add_filter( 'wp_insert_post_data', 'default_comments_on' );      But it didn't mark the box to comment by default. Any tips? My default posts, don't show the metabox for comments, and the comments are allowed by default. I want to do exactly this with my new custom post type. I mean: Don't show the metabox and turn Comments on by default. The register:               function create_post_type_registro() {          /**      * Labels customizados para o tipo de post      *       */     $labels = array(         'name' => _x('Registros', 'post type general name'),         'singular_name' => _x('Registro', 'post type singular name'),         'add_new' => _x('Adicionar novo', 'film'),         'add_new_item' => __('Adicionar novo registro'),         'edit_item' => __('Editar registro'),         'new_item' => __('Novo registro'),         'all_items' => __('Todos os registros'),         'view_item' => __('Ver registro'),         'search_items' => __('Procurar registros'),         'not_found' =>  __('Nenhum registro encontrado'),         'not_found_in_trash' => __('Nenhum registro encontrado na lixeira'),         'parent_item_colon' => '',         'menu_name' => 'Registros'     );          /**      * Registamos o tipo de post registro através desta função      * passando-lhe os labels e parâmetros de controle.      */     register_post_type( 'registro', array(         'labels' => $labels,         'public' => true,         'publicly_queryable' => true,         'exclude_from_search' => false,            'show_ui' => true,         'show_in_menu' => true,         'has_archive' => 'registros',         'rewrite' => array(          'slug' => 'registros',          'with_front' => false,         ),         'capability_type' => 'post',         'has_archive' => true,         'hierarchical' => false,         'menu_position' => null,         'supports' => array('editor','comments')         )     );


title: Rewrite database urls

text: Is there a query I can run on my wordpress database so that I can change all instances of               www.mydomain.com      to               localhost/mylocalsite.com?


title: User level categories

text: I am using ClassiPress to create a different type of listing classifieds. I will select manually who can subscribe or not (only a type of leaders for a religious institution). I have four categories. Two of them need to be available to every one at all times (to browse). The four will be available to the leaders. The leaders will be able to post in all four categories, and they will be able to view / post all four categories. **But** the main public will only see two. How could I go about this? I could make the two categories that need login, subjected to a php conditional line. I saw a solution similar solution here How to block a category from one user and enable the category for the rest of the users, but I do not have the same problem. Basically, every one without login is able to see two of the four categories, two always hidden for everyone, except teacher, who once logged in are able to see everything. Any one?


title: Using _s theme, menu changes do not affect header menu

text: I'm using the _s theme and seeing the header menu point to 'Home' and 'Sample page'. in `functions.php`, we have               register_nav_menus( array(       'primary' => __( 'Primary Menu', 'mytheme' ),       'secondary' => __( 'Secondary Menu', 'mytheme' ),     ) );      Then in `header.php`, we use               <?php wp_nav_menu( array( 'theme_location' => 'Primary Menu' ) ); ?>     <?php wp_nav_menu( array( 'theme_location' => 'Secondary Menu' ) ); ?>      etc. Finally, we have created both menus in the Wordpress custom menu section and added some custom items, but they are not reflected in the site. How do we match them up?


title: W3 Total Cache and IIS7 not doing much

text: I have my WordPress blog up and running on an IIS7 server and I installed W3 Total Cache. At some point prior to WordPress 3.2 upgrade, everything seemed to be working, but since then (and quite possibly, some plugin installations) all it does is add a single `<meta>` tag after the `<head>` tag and its footer saying "Performance Optimization by...". It doesn't cache anything, it doesn't change browser cache settings in the response header. It doesn't work. I can't work out what is going on, so I'm hoping someone here recognises this issue and can help. I have WordPress 3.2.1 and W3 Total Cache 0.9.2.3. The other active plug-ins I have are:   * Akismet 2.5.3   * FeedBurner FeedSmith Extend 1.0.0   * Google Analytics for WordPress 1.1.3   * Recommended Reading: Google Reader Shared 4.0.4   * Share and Follow 1.54.1   * SyntaxHighlighter Evolved 3.1.3   * TinyMCE Valid Elements 0.3   * Tweet Blender 3.3.14   * Twitter Facebook Social Share 2.0.0 I have turned on the debugging feature but nothing gets appended to the page. I will continue to investigate but if anyone can see where my issue lies, please answer accordingly. Why won't W3 Total Cache, cache?


title: Adding Widgets to Reactor Theme (based on Foundation 4)

text:
How do I change the footer area to have three widget areas? The Reactor Theme has one footer widget area. It separates into three columns if more than one widget is added but I find that difficult to balance up with more than three widgets being used. So, I tried to change it to three widget areas in the footer. I have done this before but not in a theme that spreads itself out in the way that Reactor does with all those functions, hooks, actions and stuff. Anyway, I had a go at changing the code in two files and I have put that here: http://pastebin.com/MA4nrPBq I want to get three footer widgets in my admin area but not on my page. I think I have the right code to edit but how do I edit the code to move this on? Thanks Martin Here's the code I am trying:               //In sidebars.php                  if ( in_array( 'footer', $sidebars[0] ) ) {                     $footer  = '
';                     register_sidebar( array(                             'name'          => __('Footer 01', 'reactor'), //Added 01                             'id'            => 'sidebar-footer-01', //Added -01                             'description'   => 'Footer widget area',                             'class'         => '',                             'before_widget' => $footer,                             'after_widget'  => '
',                             'before_title'  => '
',                             'after_title'   => '
',                     ) );             }             if ( in_array( 'footer', $sidebars[0] ) ) {                     $footer  = '
';                     register_sidebar( array(                             'name'          => __('Footer 02', 'reactor'), //Added 02                             'id'            => 'sidebar-footer-02', //Added -02                             'description'   => 'Footer widget area',                             'class'         => '',                             'before_widget' => $footer,                             'after_widget'  => '
',                             'before_title'  => '
',                             'after_title'   => '
',                     ) );             }     //The above code is just a copy of Reactor code.  I just added the 01, 02 and did it 4 times.          //In sidebar-footer.php                          <?php if ( is_active_sidebar('sidebar-footer') ) : ?>
                     <div class="<?php reactor_columns( 12 ); ?>">
                           <?php dynamic_sidebar('sidebar-footer-01'); ?> //Added -01                           <?php dynamic_sidebar('sidebar-footer-02'); ?> //Added line                           <?php dynamic_sidebar('sidebar-footer-03'); ?> //Added line

                     <?php endif; ?>


title: How to save media files under custom folder without changing wp-config.php or changing media settings

text: I want to upload images in a unique folder. Then retrieve the path of this image saved on server like               http://example.com/wp-content/uploads/myimages/image1.jpg      Now I want to save this URL in a post having custom field as url. I'll be overwriting the posts on regular basis as well as replacing corresponding images, so I don't want to keep the images related to previous posts (deleted posts) on my server (otherwise it would increase the memory on server). I want to delete all the images from `myimages` folder. I don't want to change the default path for uploads. Here's my code for creating the post:               $new_post = array(     'post_title' => $phototitle,     'post_status' => 'publish',     'post_author' => 1,     'post_type' => 'post',     'post_category' => array(328)     );          $postid=wp_insert_post($new_post);     update_field('field_521c73f75a652',$photoid,$postid);     update_field('field_521c74a65a653',$phototitle,$postid);     update_field('field_521c74b25a654',$photourl,$postid);     update_field('field_521c74be5a655',$details,$postid);     update_field('field_521c77e72f9a6',$countinarr,$postid);          require_once(ABSPATH . 'wp-admin/includes/media.php');     require_once(ABSPATH . 'wp-admin/includes/file.php');     require_once(ABSPATH . 'wp-admin/includes/image.php');     $image = media_sideload_image($photourl, $postid, $phototitle);          $path = (string)$image;     $arr = (explode("'",$path));     $url = $arr[1];          update_field('field_521c758095f55',$url,$postid);      Please tell me how to change this upload path without making any change in `wp-config.php` or media settings.


title: For homepage images (for small business website), is it better to use custom fields or post_thumbnail?

text: Already searched on here and couldn't find question so forgive me if it's been asked. _I'm trying to use dynamic images on a homepage so my client can maintain the images._ I've seen tutorials where one person uses post_thumbnails while another uses custom fields. Do I need to create a post for each image and display post_thumbnail on homepage? Or is it better to use custom fields for one post to display multiple images? Reference: `the_post_thumbnail()` http://ontwik.com/wordpress/creating-a-wordpress-theme- part-1/ `get_post_custom()` http://ontwik.com/web-design/how-to-design-a-portfolio- site-part-2/ similar question


title: No responsive design is displayed

text: I have a strange problem. I'm using the Twenty Thirteen theme. When I decrease the navigator width it should make the h1 title decrease too, but it does not. I have the next default css rule:               .entry-title, .format-chat .entry-title, .format-image .entry-title, .format-gallery .entry-title, .format-video .entry-title {     font-size: 22px;     font-weight: bold;     }       inside               @media (max-width: 643px){ ... }      It works fine with other web page that I've done with the same theme, but not with it. I've tried with different rules, but no luck. When I look at the css code with Firebug, I see the rule, but it is not taken into account in h1 with the .entry-title class. Any idea of what can I be doing wrong?


title: Anonymous function is executed twice in wp_head while added from the_posts filter?

text: I know this sounds complicated, so bear with me. I'm trying to add certain custom css styles based on the shortcodes(if any) in the current post/page.               function load_shortcode_styles($posts){                //function to check short codes here                //regex to get id from shortcode(e.g [item id=""] )                //get custom post meta from the id that has my custom css                add_action('wp_head', create_function('', 'echo "\n<!-- my style -->\n<style>' . $custom_css . '</style>\n";') );          }          add_filter('the_posts', 'load_shortcode_styles' );      After I open my post pages, the source shows my style being printed twice like:               <!-- my style -->     <style>     </style>     <!-- my style -->     <style>     </style>      For testing purposes I used a hardcoded function to echo a certain string, and it works fine. e.g. :               function test_print(){         echo "\n<!-- my style -->\n<style>foo bar</style>\n";     }      and replace above action hook with this               add_action('wp_head', 'test_print' );      Somehow, this will print, which is the correct one!               <!-- my style -->     <style>     foo bar     </style>      Does anyone know about this issue? How can I solve this?


title: Advanced Custom Fields repeter field expiration

text:
I'm developing a small online-courses website for a friend and got stuck with ACF repeater field! Here's my code to display the course dates table:               <?php      $rows = get_field('dates');     $i = 1;          if($rows) { ?>

                     Course Dates

                 <?php                                                foreach($rows as $row) {                      echo '
';                     echo '' . $i . '	';                     echo '' . $row['start_date'] ;                          // Check, if "end_date" field is not empty                     if( $row['end_date']) {                         echo ' - ' . $row['end_date'] . '	';                     } else {                         echo '	';                     }                          echo '10am – 5pm	';                     echo '£' . $row['course_price'] .'	';                     echo 'Book Now	';                     echo '
';                     $i++;                 }; ?>

           <?php }      This code outputs a nice table: ![OUTPUT](http://i.stack.imgur.com/n8psj.jpg) The only thing I can't figure out is how to check **['start_date']** sub_field against current date and display courses in the loop with valid dates only. So, basically, I need to auto delete or just exclude from the loop a whole table row if the [start_date] sub_field is not valid any more! Is there any workaround for this?


title: WordPress built-in Custom Background

text: Is it possible to enable the "Custom Background" function of WordPress (add_custom_background() ) in my own theme-options page? Thx for helping!


title: Aviary + Wordpress Media

text: has anyone tried to implement Aviary API and wordpress successfully? I am looking for a tutorial or guide of some sort.


title: Any issues changing username from wpdb in admin

text: I'm building a plugin that will have a custom sign up process built in. I would like the users to be able to change their username if needed, since I am using their email address as the username. I have set up a custom role that is assigned to them on sign up. I won't be using posts at all for these roles, it's a donation plugin so it will be storing transactions and other info all in the user meta table. I just want to know if there are any drawbacks, issues, with changing the username? Here is the function I will be using to change the username:               function change_username( $user_id, $username ) {              global $wpdb;              $wpdb->update(              $wpdb->users,              array(                  'user_login'    => $username,                 'user_email'    => $username,                 'user_nicename' => preg_replace( "![^a-z0-9]+!i", "-", $username )             ),             array(                  'ID' => $user_id             )         );          }      Any input is greatly appreciated, thanks!


title: Function to update post_meta based on existing post_meta

text: I have a custom post type for addresses on a Google Map. One meta field is for the address, but I want to convert that address to longitude/latitude. So I have a meta field for longitude & one for latitude. I created a function in my loop to update the longitude & latitude postmeta based on the address postmeta. Here is the function:               function geocode_spot_address ($post_ID) {         $address = get_post_meta($post_ID,'spots_address',true);              $address = str_replace(' ', '+', $address);         $address = 'http://maps.google.com/maps/geo?q=1020+' . $address . '&output=xml';         $result = file_get_contents($address);         $xml = new SimpleXMLElement($result);              list($longitude, $latitude, $altitude) = explode(",",$xml->Response->Placemark->Point->coordinates);              update_post_meta($post_ID, 'spots_longitude', $longitude);         update_post_meta($post_ID, 'spots_latitude', $latitude);              return $post_ID;          }      This works great when I refresh the page that I call the function on in the loop and pass the post ID:               geocode_spot_address($post->ID);      For the life of me though, I can't get this to work when trying to get it to update longitude/latitude on post save/publish/update by hooking the function to:               add_action('save_post', 'geocode_spot_address', 1, 2);      I obviously just want to enter the street address, then on save/publish/update have it run this function and add longitude/latitude to the appropriate meta fields. Any help would be appreciated. FWIW I am using Rilwis's Meta Box framework for creating my custom post types and meta boxes.


title: Saving settings of the custom permalinks (using the API Settings)

text: I'm developing a Wordpress theme and I've created some options because I want to be able to change the permalink structure: to remove the /category base, to add the trailing slash "/" at the end, etc. When I save the changes, these are not applied. So, if I press F5 and I click a link to load an URL, it shows "Page not found". To see the changes applied I need to go to the Permalinks Settings page of Wordpress and click "Save settings". Doing that, Wordpress recognizes the changes of my own Theme Options. How can I save these settings directly from my Theme Options page?


title: WPAlchemy repeating field creates duplicates

text:
I'm using WPAlchemy to create a repeating image field. I am getting some very strange behavior from it. When I add the first image, it behaves as expected - the image URL is put in the image field. When I add the second field, it also behaves as expected - I click the "add" button, another field appears, I click "add media" and it inserts the image URL into the field. However, things go haywire when I add the third field. I click "add", and it creates a new field, but this third field is pre-populated with data from the second field. After that, any field I add duplicates the previous field. Even weirder - when I save the post, it saves two copies of the last field. Here is the code that generates the repeating field:                                <fieldset class="images">             <legend>360 Images</legend>
Your changes have not been saved!  Remember to click Save (at the bottom of this box) or Update (at the top of the page) to save your changes!
                  Upload your own images here.  If you upload any images here, none of the MLS images will appear.  If you want to include some or all of the MLS images, download them and reupload them here.             You can drag and drop the images to change their order.  The first image will be used as the featured image.
Remove All
                  <?php while($mb->have_fields_and_multi('360mls')): ?>             <?php $mb->the_group_open(); ?>                      Remove                      <?php $mb->the_field('imgurl'); ?>                 <?php $wpalchemy_media_access->setGroupName('img-m'. $mb->get_the_index())->setInsertButtonLabel('Insert'); ?>

                         <?php $img = $mb->get_the_value();                              $img_size = preg_replace('/\.jpg$/', '-670x442.jpg', $img); ?>                         <img src="<?php echo $img_size; ?>">
                          <?php echo $wpalchemy_media_access->getField(array('name' => $mb->get_the_name(), 'value' => $mb->get_the_value())); ?>                     <?php echo $wpalchemy_media_access->getButton(); ?>
                  <?php $mb->the_group_close(); ?>             <?php endwhile; ?>
Add
                  <input type="submit" class="button" name="save" value="Save">                             </fieldset>      Do you see what I am doing wrong? Has anyone else had this problem? Do you have any suggestsions for fixing it?


title: If the only thing I use MySQL for is Wordpress, do I need MySQL's timezone tables?

text: The only thing I have MySQL around for is Wordpress. Some MySQL features, I gather, require you to import the system timezone database into special tables in the `mysql` database. (Which seems like a silly way to do things, but never mind.) Does Wordpress make use of any of those features? The MySQL global time zone is set to 'SYSTEM', and the server runs in UTC.


title: wordpress pagination, links appear but go nowhere when clicked

text:
First let me say that, ive been digging for the past 2 hrs and the problem is that, although the links do appear on the bottom of the page where i place the function that calls the pagination. when clicked, the page does nothing. Ive found countless similar questions on the web (many here on WA ) but when i try to implement those posts resolutions, the same thing happens. ALL the different pagination methods,loops,functions....and EVEN plugins that i try WORK in that they **appear** on the page but when clicked, the url changes accordingly but the page content doesn't change. So as an example, im using this loop that i found in an "accepted answer" from someone elses question here on SO               function pagination($pages = '', $range = 3){          $showitems = ($range * 2)+1;         global $paged; if(empty($paged)) $paged = 1;         if($pages == '') {             global $wp_query; $pages = $wp_query->max_num_pages; if(!$pages)         { $pages = 1; }      }           if(1 != $pages) { echo "
Page ".$paged." of ".$pages."";          if($paged > 2 && $paged > $range+1 && $showitems < $pages) {              echo "« First";          }          if($paged > 1 && $showitems < $pages) {              echo "‹ Previous";          }               for ($i=1; $i <= $pages; $i++){               if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems )){                    echo ($paged == $i)? "".$i."":"".$i."";             }                }                if ($paged < $pages && $showitems < $pages) echo "Next ›";          if ($paged < $pages-1 &&  $paged+$range-1 < $pages && $showitems < $pages) echo "Last »";          echo "
n"; }      }      and applied the function call to the bottom of my post loop under the endwhile//if so that it doesnt repeat through each post shown on the page, and again, it shows (just like all the others) but the page itself doesnt do anything. My question is, with this type of a problem where the links are showing up and all types of different versions ive tried, **do** appear on the page but when clicked, go nowhere, what is it i could be missing??? do i need to enable pagination somewhere like the way one enables widgets or..or do my pages have to have any type of hook or ..... like when one inserts " ****" etc... im at a loss. thanks in advanced EDIT***to illustrate what i mean, if you visit this site which is a site im currently working on, http://www.somdowprod.net/4testing/campanita/?page_id=18 i put the per page post count to 3 so that the links show up at the bottom, when clicked, the other posts dont show.


title: Options Theme - Wordpress

text: Searching about options page, I found a lot of themes that uses a options theme page like this one: ![enter image description here](http://i.stack.imgur.com/zoImJ.jpg) There is an pre-built option? What framework do you advise? Thanks


title: set theme's default slider to show woocommrce's product

text: we know that theme's slider just can be set to show image of site' category and we can not change it to show image's of woocommerce's categories. there are ways to make a slider to show it. but I'm looking for a way to force theme's default slider to do that. I've idea.if there is a way that woocommerce's product to use site' parent category but i don't know how to do it. if you know a way to do it or you have an idea please tell me to help thank you it's a part pf theme's code that gives category to show on slider:               $categories_tmp = array_unshift($zm_categories, "Chooze Category:")           $options = array (          array(  "name" => "slider setting",                 "type" => "title",                 "desc" => "This section customizes featured slider on the homepage.",                 ),              array(    "type" => "open"),                  array(  "name" => "Slider Category",                 "desc" => "choose category to show on home page slider",                 "id" => $shortname."_slide_cat",                 "std" => "Select a category:",                 "type" => "select",                 "options" => $zm_categories),                 array(  "name" => "count of images to show",                 "desc" => "please set count of images to show on home page slider",                 "id" => $shortname."_slide_count",                 "std" => "",                 "type" => "text"),                            array(    "type" => "close"),


title: Is there a way to target only images within the loop?

text: I'm new to WordPress and I'm trying to target specific parts of the content. I understand how to grab the title with `get_title()` — **is there something similar for images**?


title: Show list of Child Post in Parent Post

text: I have created custom post type. I have posted a parent post and it has a few child posts as well. On the Parent post, I want to show its children posts. How can I achieve it?


title: Check whether attachment ID is associated with more than one post?

text: Is there a function to check whether an attachment ID (`=get_post_thumbnail_id(..)`) is associated with more than one post? With "associated" I mean that a posts's meta value for the meta_key `_thumbnail_id` equals the attachment ID. I know that `get_post_meta()` returns an empty array if it does not find anything, but I would have to somehow loop over all posts.


title: Export Custom Post Type posts with all Custom Fields and Custom Texonomy associated with it

text: i have question: I've created a custom post type name "product" and i have many custom fields and Custom Texonomy associated this "product" with it like: images, extra description, type, size and many more.. I have 3 website with all most same content. My requirement is : if i add one product details on one website then i want to export this SINGLE PRODUCT and import on other 2 websites. Could anyone please suggest any option to export SINGLE CUSTOM POST TYPE post with all custom fields and Custom Texonomy associated with it having check boxes with each posts to select which one i want to export.?? I have searched and couldn't fine related plugin. Any help?


title: I need to bulk update all wordpress posts on a scheduled time

text: I need to update all posts on my wordpress site on a scheduled time (every day). So I wanted to create a new page template which I can call everyday through a cronjob to update all the posts at once. I have already created the page and the cronjob, but the code I add inside doesn't seem to be working. Can you please let me know what is wrong with my code?                   <?php     /**      * Template Name: POSTUP      *      */          $my_posts = get_posts( array('post_type' => 'post', 'numberposts' => -1,))     $post_id = get_the_ID();          foreach ( $my_posts as $my_post ) {         $updated_post_info = array(           'ID'           => $post_id,           'pinged'       => '',         );              wp_update_post( $updated_post_info );     }     ?>


title: Subdomains to pages

text: Hi I have a website on wordpress which have 2 pages which I meant to convert it to subdomain. Eg: Let my website at be http://www.domain.com there are two pages http://www.domain.com/page1 and http://www.domain.com/page2 I want them to be accessible at http://page1.domain.com & http://page2.domain.com respectively. Also I have may subpages to page1 which i wanna access using subdomain of main page. I mean if http://www.domain.com/page1/subpage1 is subpage of http://www.domain.com/page1 then I want to access it as http://page1.domain.com/subpage1 I have already created subdomains in cpanel pointing them to root folder of my website and tried following htaccess.               RewriteEngine on     RewriteBase /          RewriteCond %{HTTP_HOST} ^subsite\.domain\.com$ [NC]     RewriteCond %{REQUEST_URI} !^/subsite [NC]     RewriteRule ^(.*)$ /subsite/$1 [L]      I have tried different other variants of htaccess code I got from different forums and also www.stackoverflow.com Also tried WP Subdomains (Revisited) plugin and found of no use. Please help me to fix it.


title: How to remove p tags around img and iframe tags in the acf wysiwyg field

text: I am querying an advanced custom fields wysiwyg field. Problem is in the output wordpress wraps occasional imgs and iframes with p tags no matter what i try. Deactivate the wpautop works `remove_filter ('acf_the_content', 'wpautop');`but if i try to exclude only imgs and iframes with the following snippet it fails:               function filter_ptags_on_images($content)     {         $content = preg_replace('/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU', '\1\2\3', $content);         return preg_replace('/<p>\s*(<iframe .*>*.<\/iframe>)\s*<\/p>/iU', '\1', $content);     }     add_filter('the_content', 'filter_ptags_on_images');      Does anyone have a suggestion how to accomplish that goal? Best regards Ralf


title: Exclude post by custom meta with pre_get_posts

text: I'm creating a Custom Post for an event calendar. My Custom Post has 2 custom meta fields called "event_star_date" & "event_end_date". I want to use `pre_get_posts` to exclude Events which their "event_end_date" is lower than todays date OR "event_end_date" is empty and "event_start_date" is lower than todays date. I have see some codes but the don't finaly work for me. Thanks to @cybnet I have nearle get the code I need, but steel not working. What I would nedd could be something like this:               function bbwp_calendar_visible_events( $query ) {     if ( !is_admin() && $query->is_main_query() ){         if ( is_post_type_archive( $postType ) ) {                 $meta_query = array(                 'relation' => 'OR',                 array(                     'relation' => 'AND',                     array(                         'key'   => 'event_start_date',                         'value' => current_time( 'timestamp' ),                         'type' => 'CHAR',                         'compare' => '>=',                     ),                     array(                         'key'   => 'event_end_date',                         'value' => '',                         'type' => 'CHAR',                         'compare' => '=',                     ),                 ),                 array(                     'key'   => 'event_end_date',                     'value' => current_time( 'timestamp' ),                     'type' => 'CHAR',                     'compare' => '>=',                 ),             );                  $query->set( 'meta_query', $meta_query );         }     }     }          add_action( 'pre_get_posts', 'bbwp_calendar_visible_events' );      Thanks to every body


title: Get object for a few selected taxonomies

text: I have some custom taxonomies that I would like to use as an object in a foreach loop. I know these functions which returns the object for either all taxonomies:               global $wp_taxonomies;      or the post taxonomies object:               $taxonomy_objects = get_object_taxonomies( 'post', 'objects' );      but if I would like to only include a few taxonomies in the object like `video`, `audio`, `tv` and `radio` (all taxonomy names), how would I go about it?


title: Attaching images on frontend with AJAX to show thumbnails before submitting form

text: I currently have a frontend post upload form working so that users can add thumbnail attachments to a post, however it isn't possible to see which thumbnails you have attached before you submit the form, is there a way around this with AJAX? Frontend code:               $thumbnail_field = 'image-one';          if ( ! empty( $_FILES ) ) {         foreach ( $_FILES as $file => $array )         $newupload = insert_attachment( $file, $post_id, $thumbnail_field );     }      functions.php               function insert_attachment( $file_handler, $post_id, $set_thumb = false ) {     if ( UPLOAD_ERR_OK !== $_FILES[ $file_handler ]['error'] )         return false;           require_once ABSPATH . 'wp-admin/includes/image.php';     require_once ABSPATH . 'wp-admin/includes/file.php';     require_once ABSPATH . 'wp-admin/includes/media.php';          $attach_id = media_handle_upload( $file_handler, $post_id );          //set post thumbnail (featured)     if ( $attach_id && $set_thumb == $file_handler )         update_post_meta( $post_id, '_thumbnail_id', $attach_id );          return $attach_id;     }


title: Show posts in "image" format when viewed in category page, but with comments in blog

text: I am working on an artist's website. She wants each image to show up in the blog, and to category pages like "paintings", "calligraphy", etc. When viewing the category pages, the images should be displayed without comments. But when the images are viewed in the blog, they should have a comment section. Ideally the category page posts could link back to the blog view, but this is optional. As far as I can tell, you can only choose the format of a post on a per-post basis. Is there any way to make a category page apply a format to all of its posts?


title: Accessing theme customizer farbtastic object instances

text: I have multiple individual color pickers set up in the theme customizer, which results in several instances of the farbtastic color picker. I am trying to find the jQuery/JavaScript instance variable for each of these, just can't seem to find a reference to them anywhere. I want to be able to set each farbtastic color manually, i.e. I need to access the color pickers setColor() method. As a test, I can set a global JS var in customize-controls.js, in the color picker section, and can access this via Chrome console easy enough. But I need to do the same thing by accessing the default farbtastic instances. I just can't find them!


title: BuddyPress - Change Topic Order

text: I have a Buddypress website. When I make posts to a topic on my website, that topic gets moved to the top of the list on my forums page. I do not want that to happen - what file do I edit to prevent this from happening, and any helpful code examples would be very helpful. Thanks.


title: Transient pagination not working properly

text: So I wrote the following to create a transient:               $wp_object_i_created = new WP_Query('cat=1');     set_transient('category_one_posts', $wp_object_i_created, 60*60*1);      Ok so then I decided "Ya know lets walk through this and spit out the posts." So I did the following:               if(false !== get_transient('category_one_posts')){         $posts_inside = get_transient('category_one_posts');         if($posts_inside->have_posts()){             while($posts_inside->have_posts()){                 $posts_inside->the_post();                 // Display your posts in some maner.             }             echo get_next_posts_link('« Older Entries', $max_pages);             echo get_previous_posts_link('Newer Entries »', $max_pages);         }      }      Now the pagination works - **here's the catch** \- It works in a really failed way. So I have it set to display 5 posts per page. So if I go to my link: `http://localhost/wordpress/?page_id=1667` I see my 5 posts and at the bottom my two links - one for older, one for newer. Woot. But if I click on the button "Older Entries" to go back, so my link now looks like: `http://localhost/wordpress/?page_id=1667&paged=2` I see that were on page two, I can go one page forward and so on - BUT the posts are the same, they never updated. Now regular queries done to get specific posts based on specific parameters, or even just the regular WordPress loop - their pagination all work as expected, you go to page two, you get a different set of posts then that on page one - woot! - we work. But transient based pagination does not work. Why?


title: How to debug removal of rewrite rule flushing?

text: I use Custom Post Types. I try this: _functions.php_               add_action( 'admin_init', 'flush_rewrite_rules' );      Now I’d like to remove this again. I try this:               remove_action( 'admin_init', 'flush_rewrite_rules' );      I’m not sure if it works right. How can I test if the rewrite rules really not flushed anymore?


title: 2nd page displaying the exact same posts as my first page (minus the very first post)

text:
Site Links: http://manofmany.com & http://manofmany.com/page/2/ I'm seeing my 2nd page displaying the exact same posts as my first page (minus the very first/latest post). All other pages 3,4,5 etc are performing as normal/expected. I was changing around the coding to exclude a category, so I tried copying in the original coding to fix it but with no luck. Here is the start of the loop:               <?php if( is_front_page() && !is_paged() ) : ?>
     <?php dynamic_content_gallery(); ?>
<?php endif;?>          <?php global $query_string; query_posts( $query_string . '&cat=-1470'); ?>     <?php if (have_posts()) : $i = 1; while ( have_posts() && $i <= $loop ) : the_post(); ?>      I've also looked at this but can't quite get it to work: Wordpress second page displays the same content as my first Most other errors and solutions I find are in relation to all pages (3,4,5) displaying the same posts as the first. I'm only experiencing the problem with my second page. Detail instructions are appreciated as I'm by no means an expert at dealing with php.


title: WPML conflicting with content creation via XML RPC

text: I am creating new posts in WP via an app written in Obc-C. The app pulls my iOS app reviews via JSON and creates posts and categories programmaticaly. Creation of posts and categories works great, as long as WPML is disabled. As soon as I enable it, the posts and categories aren't visible via WP's admin interface. Is there something extra I need to do when creating post automatically to make WMPL work? I need WMPL as my app and site are localized for several countries. In addition, I scripted a page to output the reviews on one of my WP pages using WP_Query object making sure to use a unique new WP_Query object. Again, works fine without WP, with it enabled, it produces no output, which makes sense since WMPL seems to be hiding my posts. I examined the SQL produced and WPML is injecting itself into the query somehow. Here's my WP code for the query:               <?php          $args = array (             'post_status'           => 'draft',             'pagination'            => true,             'category_name'         => 'us,gb,ca,au,ie',             'cache_results'          => false,             'update_post_meta_cache' => false,             'update_post_term_cache' => false,         );         $review_posts = new WP_Query( $args );     ?>      This is the SQL returned by var_dump on the query object. As you can see, somehow WPML related tables are being injected in the statement - ie. - 'JOIN wp_icl_translations t ON wp_posts.ID' SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) JOIN wp_icl_translations t ON wp_posts.ID = t.element_id AND t.element_type IN ('post_post','post_page','post_gallery') JOIN wp_icl_languages l ON t.language_code=l.code AND l.active=1 WHERE 1=1 AND ( wp_term_relationships.term_taxonomy_id IN (106,107,92,98,91) ) AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'draft') AND t.language_code='en' GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 1000 Thank you for any pointers.


title: For best DB performance should I serialize all theme options together or by type?

text: If my theme has a lot of options is it better to store all options in one database entry, or to use a databse entry for each group of options? IE would I name all options like this `themeSlug[optionType_specificOption]` or like this: `themeSlug_optionType[specificOption]`?In the latter example if I need the settings for my post slider I would do `$sliderOptions = get_option('themeSlug_slider');`. I guess my question is do I see any performance benefit to making several smaller queries vs one large query for my options? Are their any other advantages/disadvantages to grouping my options into different entries?


title: Show hierarchical relationship between to custom post types on admin list

text: I have two custom post types: "request" and "quote". Both have the "hierarchical" flag set to true. A 'request' cpt can be the parent of one or more 'quotes' cpt. Since these are two different post types, WordPress admin has seperate overview lists (e.g. edit.php?post_type=request) for both. What I am looking for is a way to format the request overview the same way a hierarchical page list is formatted, for example:   * Request 1      * Quote 1     * Quote 2   * Request 2      * Quote 3     * Quote 4 I only need to do this on the admin side (as I'm not using the front-end).


title: Query by radio button ACF

text: I am making a page template that should display custom post-types that have meta value that matches the page title. Meta value is added trough Advanced Custom Field radio buttons, but the query is not taking the meta into consideration, it's displaying all the posts. I've checked `$name` stores the correct string, posts have the correct value for `program` key. Here is the query code:               $name = get_the_title(get_the_ID());     $args = array(         'post_type' => 'project',         'posts_per_page' => -1,         'meta_query' => array(                 'key' => 'program',                 'value' => $name,                 'compare' => 'LIKE'             )          );     $projects_q = new WP_Query($args);      I've even tried to wrap the 'value' value in `""` and change the `$name` to lower case but the result is the same.               $name = strtolower(get_the_title(get_the_ID()));     $args = array(         'post_type' => 'project',         'posts_per_page' => -1,         'meta_query' => array(                 'key' => 'program',                 'value' => '"' . $name . '"',                 'compare' => 'LIKE'             )          );     $projects_q = new WP_Query($args);      Is there some special way to query posts with radio buttons?


title: How to duplicate "Pages" section in the control panel?

text: I want to create my own custom page (gallery) tab like PAGES in the control panel. Its help me to organize the gallery pages under "Gallery" name. How can I do this? I can do this with custom posts but this time templates won't shown up. :/ Actually I want to exactly copy of the "Pages" and name it "Gallery". Then I create my custom pages under it. Hope you'll understand my problem.


title: Dynamically generate custom post type title from category

text: I have a custom post type named "event", for which i disabled the title field. This results in the post to be automatically named "Auto Draft" and the slug "auto-draft-x" How can i automatically generate the title and the slug according to the post type name and the category set to the post when saving it? Example: event-live-1 (where "live" is the category) There is the Auto Post Title plugin that does the trick for the title, but doesn't seem to affect the slug name. Any help appreciated, thank you!


title: shortcodes between square and curly brackets

text: I'm having difficulty searching for the answer to this question since {} and [] don't seem to affect search queries. My question is simple: how are these syntaxes different in meaning?               {short_code}{/short_code}     [short_code][/short_code]


title: Conditional Image Sizes for Use via Theme Customizer Upload Only

text: I'm looking for a way to add image sizes that are only generated by uploads happening in the Theme Customizer, any suggestions or direction on how this could be done? I've already worked with the `intermediate_image_sizes_advanced` filter, which gives me the images I want, the problem is that they don't appear in the media library so they can't be deleted by the user. This is for a Multisite network so I don't want to create an infinite accumulation of images that the users can't access for cleanup, and create a situation where the sysadmin has no way of knowing which images should be deleted and are not in use. Here is the current code, which does not work simply because the `intermediate_image_sizes_advanced` filter does not hook these new sizes the same way that `add_image_size()` does, and so they become "orphaned" as I mentioned above.               add_filter('intermediate_image_sizes_advanced','responsive_customizer_bg_images');     function responsive_customizer_bg_images( $image_sizes ){              // quit if the theme is not pure - only PURE gets responsive images, add new themes with responsive images  here         if ( ! isset( $_POST['post_data'] ) ) {             return false;         } else {             if ( $_POST['post_data']['theme'] != 'pure' )                 return false;         }              $sizes = array(                 '1024' => array(                         'width' => 1024,                         'height' => 768,                         'crop' => true,                     ),                 '1680' => array(                         'width' => 1680,                         'height' => 1050,                         'crop' => true,                     ),                 '2560' => array(                         'width' => 2560,                         'height' => 1440,                         'crop' => true,                     ),             );              $image_sizes = [];         $custom_sizes = [];         foreach ($sizes as $key => $value) {             $image_sizes[ 'artsite-bg-' . $value['width'] . 'x' .$value['height'] ] = array(                     'width' => $value['width'],                     'height' => $value['height'],                     'crop' => $value['crop']                 );             $custom_sizes[] = array(                     'artsite-bg-' . $value['width'] . 'x' .$value['height'] => __('Background ' . $value['width'] . 'x' .$value['height'] )                 );         }              return $image_sizes;     }      **EDIT** \- for what it's worth, this question solves a similar problem, however the OP is not trying to spy on `$_POST` like I am to determine whether the incoming upload is from the Customizer or not: Add custom image sizes to media uploader **EDIT 2** \- Here's a fun version that creates an infinite loop where each responsive image gets inserted as an attachment at the end, in turn causing the function to trigger itself and create an infinite loop. Is there a different hook I could grab that would avoid the self-invoking loop?               add_filter('add_attachment','generate_responsive_sizes');          function generate_responsive_sizes( $attachment_id ) {              $image_post_data = get_post( $attachment_id );              error_log(print_r($image_post_data,true));              // quit if the post_type is not attachment and mime_type is not jpeg/jpg/gif         if ( $image_post_data->post_type != 'attachment' || $image_post_data->post_mime_type != ( 'image/jpeg' || 'image/png' || 'image/gif' ) )             return false;              // quit if the theme is not pure - only PURE gets responsive images, add new themes with responsive images  here         if ( ! isset( $_POST['post_data'] ) ) {             return false;         } else {             if ( $_POST['post_data']['theme'] != 'pure' )                 return false;         }              $upload_dir = wp_upload_dir();         $file = substr( strrchr( $image_post_data->guid, '/' ), 1 );         $filepath = $upload_dir['path'] . '/' . $file;         $file_arr = preg_split( '/\./', $file );         $filename = $file_arr[0];         $file_ext = $file_arr[1];         error_log(print_r($upload_dir,true));              $sizes = array(                 '1024' => array(                         'width' => 1024,                         'height' => 768,                         'crop' => true,                     ),                 '1680' => array(                         'width' => 1680,                         'height' => 1050,                         'crop' => true,                     ),                 '2560' => array(                         'width' => 2560,                         'height' => 1440,                         'crop' => true,                     ),             );              $new_sizes_generated = [];              // first create the images         if ( ! is_wp_error( $image_post_data ) ) {             foreach ($sizes as $key => $value) {                 $image = wp_get_image_editor( $filepath );                 $new_img_filepath = $upload_dir['path'] . '/' . $filename . '-' . $value['width'] . 'x' . $value['height'] . '.' . $file_ext;                      error_log(print_r($value,true));                 error_log(print_r($image,true));                 error_log(print_r($new_img_filepath,true));                 $dimensions = $image->get_size();                 // if the image new size is not bigger than the original, we will                 // continue and not save a new version of this image                 if ( $dimensions['width'] < $value['width'] && $dimensions['height'] < $value['height'] ) {                     continue;                 }                 $image->resize( $value['width'], $value['height'], $value['crop'] );                 $image->save( $new_img_filepath );             }         }              // now attach them, we do this separately to avoid an infinite loop of files added,         // which in turn triggers this entire function from start, since it's hooked to         // `add_attachment`.         if ( ! is_wp_error( $image_post_data ) ) {             foreach ($sizes as $key => $value) {                      $new_img_filepath = $upload_dir['path'] . '/' . $filename . '-' . $value['width'] . 'x' . $value['height'] . '.' . $file_ext;                      // Check for existence of an attachment with the same GUID to avoid                 // infinite loop as noted at the opening of the above foreach loop                 global $wpdb;                 $prefix = $wpdb->prefix;                 $attachment = $wpdb->get_col($wpdb->prepare("SELECT ID FROM " . $prefix . "posts" . " WHERE guid='%s';", $new_img_filepath ));                      if ( ! empty( $attachment ) ) {                     error_log(print_r('there already is an attachment for ' . $new_img_filepath, true ));                     return false;                 } else {                     error_log(print_r('there is NO attachment for ' . $new_img_filepath, true ));                          $wp_filetype = wp_check_filetype(basename($new_img_filepath), null );                     error_log(print_r($wp_filetype,true));                     $attachment = array(                         'guid' => $new_img_filepath,                         'post_mime_type' => $wp_filetype['type'],                         'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_img_filepath)),                         'post_content' => '',                         'post_status' => 'inherit'                     );                     error_log(print_r($attachment,true));                          wp_insert_attachment( $attachment, $new_img_filepath, 37 );                      }                  }         }     }


title: Full size image option removing problem

text:
I have removed the Full size image option from the media upload window see Code:               function theme_t_wp_set_image_size_options( $sizes ){            $sizes = array(         'thumbnail' => 'Thumbnail',         'medium'    => 'Medium',         'large'     => 'Large'       );            return $sizes;          }     add_filter( 'image_size_names_choose', 'theme_t_wp_set_image_size_options' );      This code removes the full size image option. But there is a problem I am using AdRotate plugin and now I can't select Full size for my ads because I have removed the option. I would like to have full size option available only if someone is putting an ad on the site. Or a working custom image size option. The ad is 900 x auto height               add_image_size( 'footer-ad', 899, 99999, true );      This code works but I think it's a little hacky. Wordpress thinks it's not a full size image and allows me to select this option but if I would to make it `(900, 99999, true)` it wouldn't let me select it anymore. Is there a way to fix this? **Or** is there another way to achieve this with completely different code or way? **UPDATE 29.07.2013** I have removed the option to use Full size images for clients that they don't put too large images on the web site posts. But because I have removed the option Wordpress doesn't allow me to add advertising images that are full size (it tries to crop them) I am using AdRotate (I manually need to upload the ads with wordpress media uploader and put them in place with the plugin). And if I try to override it by creating a new image size with `add_image_size` for the ads it doesn't work because Wordpress thinks that the new image sizes are "full size" and I have removed the option. It works if I create a new image size that is 1% smaller than the image I try to upload. What i would like to happen is that Wordpress blocks the usage of full size images in default Article posts but allows them in the plugin (AddRotate) taht I and the client could add ads to the site that are 100%. The ad sizes are 900px x auto and 275px x 200px AdRotate code is in sidebar.php
<?php echo adrotate_ad(1); ?>


title: Adding parent custom post type menu option

text: random problem for me here. I have several custom post types registered to Wordpress and I want to add the archive pages to the menu, but I do not want them to be static links. Is there any way to add the custom post types to the Wordpress menu via plugin etc and have the hiearchical menu classes stuff work nicely? E.G I have a jobs CPT which I want to just add a jobs menu item for which will just link to the archive for that CPT.


title: Get all Youtube video's from posts and embed them on a different page

text: Is this possible? I want to let it check all my posts to see if there is a embedded Youtube video. If so, I want to show that on a different page, embedded and linking to that particular post... I tried the following snippet, but that did not work for me. It doesn't embed a video...               function aihato_latest_video() {       $query_args = array(         's' => 'youtube.com/watch?v=',         'posts_per_page' => 1       );            $posts = get_posts( $query_args );       $post1 = $posts[0];            $matches = array();            preg_match('|http://www.youtube.com/watch\?v=([a-zA-Z0-9]+)|', $post1->post_content, $matches);       $v = $matches[1];     ?>     <object width="415" height="250">       <param name="movie" value="http://www.youtube.com/v/<?php echo $v ?>&hl=en_US&fs=1&"></param>       <param name="allowFullScreen" value="true"></param>       <param name="allowscriptaccess" value="always"></param>       <embed src="http://www.youtube.com/v/<?php echo $v ?>&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="415" height="250"></embed>     </object>     <?php     }      Edit: This is working neither:               function aihato_latest_video() {       $query_args = array(         's' => 'youtube.com/watch?v=',         'posts_per_page' => 1       );          $posts = get_posts( $query_args );     foreach ($posts as $p) {       $matches = array();       preg_match('|http://www.youtube.com/watch\?v=([a-zA-Z0-9]+)|', $p->post_content, $matches);     ?>           <?php if (!empty($matches[1])) { ?>         <object width="415" height="250">           <param name="movie" value="http://www.youtube.com/v/<?php echo $matches[1] ?>&hl=en_US&fs=1&"></param>           <param name="allowFullScreen" value="true"></param>           <param name="allowscriptaccess" value="always"></param>           <embed src="http://www.youtube.com/v/<?php echo $matches[1] ?>&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="415" height="250"></embed>         </object><?php       }     }          ?>


title: Displaying custom taxonomy menu in custom post type archive

text: I have two post types "restaurant" & "pub", they both share same custom taxonomy "country". And I display each post type in archive page. What I want to do is, when I visit "restaurant" archive page, there is the taxonomy "country" terms listed as the menu in that page. The terms has to be from the posts that created in "restaurant" post type, so when user click on the terms (let say "US"), it will display the posts from "restaurant" that in "US". Here is the illustration: ![enter image description here](http://i.stack.imgur.com/DcOu8.jpg) Thanks


title: Query Custom Post by taxonomy multiple categories

text: I need to query posts using certain taxonomy category, but more than one category of the taxonomy, as I can with posts categories.. For example, I have the **Portfolio** custom posts, and the **Project Type** to organize it (same as categories); So, we have **Animation, draw, icons and painting** types of project. I need to create an loop that will query **animations and painting** types only (query more than one king of portfolio type). I thinked that tax_query would do it, but this tax_query selects only posts that are in the **animations and paintings at the same time** My last code was:               $args['tax_query'] = array(      array(     'taxonomy'  => 'project-type',     'field'  => 'id',     'terms'  => array(1,2) // don't work as I need, it's a exclusion)     )      Thank you in advance!


title: remove menu items if user can't read

text: I want to create one menu for all users and then hide / remove items from the menu if they don't have access to the page the link leads to. This to me seem like an SOP. I really don't understand how this is not a core functionality. I can't possibly be the first one to want or think of such an idea. anyway here is what i have so far I'm just not sure how or where to get the post id from               add_filter( 'wp_nav_menu_items', 'rm_menu_items', 10, 2 );          function rm_menu_items( $items, $args ) {         foreach($items as $key=>$item){                  if (!current_user_can('read', $post_id)){                 unset($items[$key]);             }         }             return $items;     }


title: Problem getting .js file to load via a plugin

text: This http://jsfiddle.net/ambiguous/7L4WZ/ works...it removes empty `<p></p>` tags and then some but I can not git it to work from my plugin.                   $('p').each(function() {             var $this = $(this);             if($this.html().replace(/\s| /g, '').length == 0)                 $this.remove();         });      WP loads jquery automatically so, can I just load the .js file say from the main plugin file like this:               <script type="text/javascript" src="<?php plugin_dir_url( __FILE__ ); ?>js/jquery.js"></script>      Or do I need to use wp_enqueue_script()? When I run it as a `<script>` it loads as the very first line, even before `<!DOCTYPE>` but gives off this error when the script is loaded:               jquery.js:1SyntexError: Unexpected token '<'     jquery.js:-1Resource interpreted as Script but transferd wiht MINE type text/html      Inside the jquery.js file I get this error:               jquery.js:6SuntaxError: Invalid character '/u8203'      When I load in under wp_enqueue_script() I do not get the twp page errors as above but I still get the same error then in the .js file:               jquery.js:6SuntaxError: Invalid character '/u8203'      for Chip... myCoolPlugin.php is loaded when the plugin is activated and here is the part that deals with the .js file. above I just define some variables...then                   add_action('wp_enqueue_scripts', 'add_stylesscripts');              function add_stylesscripts() {                  // css:                      // here I load a some stylesheets...removed for sapce                // javascript                 wp_register_script( 'wlmm-js_custom', plugin_dir_url( __FILE__ ) . 'js/jquery.js', false );                 wp_enqueue_script ('wlmm-js_custom');         }      and then I include some other files...end The .js file is loading like it should when enqueued but there is a script error in the .js code but the .js code works fine in jsfiddle. So my question is: 1) am I enqueueing the .js properly 2) do I even need to enqueue the .js file and should I run it as a 3) why does the .js code work in jsfiddle but not when I load via my plugin?


title: How to scale image with equal width and height without distortion?

text: I have a section on my frontpage that querys through recent posts and grabs the title and thumbnail of each. In my functions.php, I've specified a `width` and `height` for the thumbnail using:               add_image_size( 'thumbnail-small', 179, 147 );      I have all different size images in my posts set as featured images and when they get pulled into the image thumbnail element on the page, they crop proportionately, but don't scale to the correct size: ![enter image description here](http://i.stack.imgur.com/kJqtv.png) I put borders around the images so you can see the scaling, but it seems as Wordpress is just scaling them to whatever fits right. How can I get them to all look the same, and then just crop out the excess with overflow:hidden in CSS? I've tried some CSS such as:               // .image-mask is the wrapping div     #middle .image-mask { width:179px; height:147px; overflow: hidden; position:relative; }     #middle img { position:absolute; display: block; top:0; left:0; }      and...               #middle img{ width: auto; max-width: 150px; height: auto; max-height: 100px; }


title: WP doesn't remove uploads from folder when removed from "Media Library"?

text: I'm wondering why WordPress doesn't remove uploads from folder when removed from "Media Library"? I set limit to 5mb on WPMU but even if user removes everything from "Media Library" he can't upload anything new because 5mb limit is still present. How can I make WPMU remove user uploads when removed from Media Library?


title: Order by DESC, ASC in custom WP_Query

text: I need to do multi-level ordering in a query. The issue is with ordering one value DESC and the other ASC as in SQL. The following SQL seems to give me what I want when I run it in terminal:               SELECT DISTINCT * FROM wp_posts      INNER JOIN wp_postmeta      ON wp_posts.ID = wp_postmeta.post_id      WHERE wp_posts.post_type = 'post'      AND wp_postmeta.meta_key = 'pb_issue_featured'     AND wp_posts.post_status = 'publish'      ORDER BY wp_postmeta.meta_value DESC, wp_posts.menu_order ASC;      The `pb_issue_featured` is a boolean value. The end result I need is the query to display posts that have a meta value of 1 for this field at the top, then all the others bellow. Then the second tier ordering is the designated `menu_order` (I'm using the post types order plugin). The issue is that my boolean value needs to be ordered high to low (1 to 0) but the menu_order is the opposite. What is ordered first with the plugin has a menu order of 1. So using the built in 'orderby' in WP_Query doesn't work. Anyone have suggestions? I looked into the 'posts_orderby' filter but couldn't get it to take. Wasn't really sure where it should be applied or how I could troubleshoot it. It just didn't re order the way I had it. Thanks for the help! I will post the actual WP_Query if it's relevant but I wanted to keep this as short as possible. The query args:               $args = array(             'post_type' => 'post',             'meta_key' => 'pb_issue_featured',             'orderby'   => 'meta_value',             'order' => 'DESC',             'post_status' => 'publish',             'posts_per_page' => $posts,             'paged' => $paged,             'meta_query' => array(                 array(                     'key' => 'headline',                     'value' => 1,                     'compare' => '!='                      )                 )             );     $q = new WP_Query($args);


title: Page returns 404 with POST variables, but not without

text: I have a problem with my page. I'm trying to make a "Contact Us" page. It's working perfectly fine design-wise. But when I try to send the form to the same page as origin. It returns 404 error. It only happens when I'm sending the form. I've tried both with GET and POST requests. Nothing seems to work. I've even commented out the PHPMailer part. It's caused entirely by the extra variables. If it helps anything, they're "name", "email" and "message".


title: $_POST['message'] gives a 404

text: I am using Wordpress 3.3.1 and building a small API to be able to send an SMS to insert data.               <?php      /**      * Template Name: API: Response      *      */          print_r('hello');          ?>      The following `$_POST` variables are being sent from the SMS provider               $_POST['message']     $_POST['from']      When using `$_POST['message']`, `$_GET['message']` or `$_REQUEST['message']` Wordpress gives me a 404. Works like a charm when using `$_POST['_message']`. Any ideas? Can't find it in the reserved taxanomies.