Full permalinks with custom post type and multiple taxonomy depth

I'm really hoping someone can help shed some light on this for me, it's getting very confusing and seems no-one has answered a question like this yet. I have a custom post type (news) and a hierarchal custom taxonomy (news_category) - the two are linked. What I am trying to do is to get a clean permalink structure, that works in a similar way to how the default posts / categories works, namely: Category URL: httpslashexampleurldotcom/news/category-1/ Second level category: httpslashexampleurldotcom/news/category-1/category-2/ Individual post: httpslashexampleurldotcom/news/category-1/category-2/post- title/ I can see that this must be possible somehow, as the default posts taxonomy does this, however duplicating the default taxonomy doesn't provide the same results. I believe that the default 'category' taxonomy is actually hardcoded to be treated differently, on line 206 of /wp-includes/canonical.php:               } elseif ( is_single() && strpos($wp_rewrite->permalink_structure, '%category%') !== false && $cat = get_query_var( 'category_name' ) ) {             $category = get_category_by_path( $cat );             $post_terms = wp_get_object_terms($wp_query->get_queried_object_id(), 'category', array('fields' => 'tt_ids'));             if ( (!$category || is_wp_error($category)) || ( !is_wp_error($post_terms) && !empty($post_terms) && !in_array($category->term_taxonomy_id, $post_terms) ) )                 $redirect_url = get_permalink($wp_query->get_queried_object_id());         }      Here's what I have tried so far:   1. As mentioned, I have duplicated the code to generate the categories taxonomy, without success.   2. I have added the rewrite rules to the taxonomy and custom post type. This allows one of the two to work, depending on which one is first - so if taxonomy is first in the functions.php then taxonomy works and the individual posts return a 404. If I switch them the individual posts starts working and the taxonomy returns a 404. This indicates to me that the slug can only be used once, either for taxonomy or for CPT but not at the same time.   3. I have tried adding a rewrite JUST to the taxonomy, and writing a function that hooks the post_type_link filter and overrides with a full category permalink. This continued to return a 404.   4. I have looked into the rewrite rules in place at the moment, I can see that some custom redirect is happening, specific to the category taxonomy, perhaps associated with the above chunk of code. So, I am in the current situation. Taxonomy works as requested, with top level category, followed by second level, but I cannot get the associated custom post type to fit into the URL structure, continually returning a 404. Here's the code I'm currently using to create my taxonomy / CPT:               global $wp_rewrite;          $news_labels = array(         'name'                       => 'News Categories',         'singular_name'              => 'News Category',         'menu_name'                  => 'News Categories',         'all_items'                  => 'All News Articles',         'parent_item'                => 'Parent News Category',         'parent_item_colon'          => 'Parent News Category:',         'new_item_name'              => 'New News Category',         'add_new_item'               => 'Add New News Category',         'edit_item'                  => 'Edit News Category',         'update_item'                => 'Update News Category',         'separate_items_with_commas' => 'Separate news categories with commas',         'search_items'               => 'Search news categories',         'add_or_remove_items'        => 'Add or remove news categories',         'choose_from_most_used'      => 'Choose from the most used news categories',     );          $news_args = array(         'labels' => $news_labels,         'hierarchical' => true,         'query_var' => 'category_name',         'rewrite' => array(             'hierarchical' => true,             'slug' => 'news',             'with_front' => $wp_rewrite->using_index_permalinks(),             'ep_mask' => EP_CATEGORIES,         ),         'public' => true,         'show_ui' => true,         'show_admin_column' => true,     );          register_taxonomy('news_category', 'news', $news_args );      and the CPT:               $news_labels = array(         'name' => _x( 'News Articles', 'news' ),         'singular_name' => _x( 'News Article', 'news' ),         'add_new' => _x( 'Add New Article', 'news' ),         'add_new_item' => _x( 'Add New News Article', 'news' ),         'edit_item' => _x( 'Edit News Article', 'news' ),         'new_item' => _x( 'New News Article', 'news' ),         'view_item' => _x( 'View News Article', 'news' ),         'search_items' => _x( 'Search News', 'news' ),         'not_found' => _x( 'No news found', 'news' ),         'not_found_in_trash' => _x( 'No news found in Trash', 'news' ),         'parent_item_colon' => _x( 'Parent News Article:', 'news' ),         'menu_name' => _x( 'News Articles', 'news' ),     );          $news_args = array(         'labels' => $news_labels,         'description' => 'News articles',         'supports' => array( 'title', 'editor', 'author', 'revisions' ),         'taxonomies' => array( 'news' ),         'public' => true,         'show_ui' => true,         'show_in_menu' => true,         'menu_position' => 5,         'menu_icon' => '/wp-content/themes/themename/images/icons/custom-post-types/news.png',         'show_in_nav_menus' => true,         'publicly_queryable' => true,         'exclude_from_search' => false,         'has_archive' => true,         'can_export' => true,         'capability_type' => 'post',         'hierarchical' => false,         'rewrite' => false,         'query_var' => false,     );          register_post_type('news', $news_args);      Can anyone help? Many thanks, Ryan


Add a link to the Admin menu

I would like to add 2 lines to the POSTS menu in the wordpress admin: Published and Scheduled. I would also like to add a section to the media menu for Unattached media. How would I go about doing this? Cheers![enter image description here](http://i.stack.imgur.com/LkpPf.png)


Add a menu metabox to post edit page

I have a basic understanding of how to create meta boxes, and I have an understanding of how and where to put wordpress menus on the front end. I am a wordpress theme developer but NOT a wordpress back end developer (but I am trying to learn). I have a page template that is set up where there are a list of links that, when clicked, display different tabbed content that is on the same page. see here The blue box w/ tabs and the white interior content is built like this: Interior white content is written in the main wp_content box on the page edit page. I have it so that the client adds all of the content for each box in that one area and then wraps them in short codes to separate the divs The blue tabs on the left are wordpress 3.0 menus. I have it set as a widget area. The client first creates the page, then creates the menu for that page and gives a custom link of href="#tab2" to initiate the javascript. THEN they go to widgets and drag the custom menu into the widget area called "tabs" and use the conditional widget display to display that menu only on that page. I would LOVE to be able to cut out a step or two ... I think it would be a LOT easier if the widget area step was moved into the wordpress page. Then the client could make the new menu in the WP menu creator, go and create the page and choose the menu from a meta box drop down. This should basically create the conditional display because it is now associated with that page and stick the menu in the spot that has already been previously defined. Thoughts on this??? The other way to do it would be to create the menu in the page edit page and automatically place the actual menu in the predefined spot with the condition that this menu is only for this page.


Get caption from image gallery

I'm using the retailer template with wordpress and woocommerce. There is an option to add images to a product. It makes a image gallery. And you can add a specific caption on each image. The code I want to edit is the following:
                <?php if ( has_post_thumbnail() ) : ?>                     <?php                //Get the Thumbnail URL                $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), false, '' );                     $attachment_count   = count( get_children( array( 'post_parent' => $post->ID, 'post_mime_type' => 'image', 'post_type' => 'attachment' ) ) );                     ?>
                <?php echo get_the_post_thumbnail( $post->ID, apply_filters( 'single_product_large_thumbnail_size', 'shop_single' ) ) ?>                <a href="<?php echo $src[0] ?>" class="zoom" rel="prettyPhoto[product-gallery]">
                     <?php endif; ?>                       <?php                     if ( $attachment_ids ) {                          $loop = 0;                     $columns = apply_filters( 'woocommerce_product_thumbnails_columns', 3 );                                                  foreach ( $attachment_ids as $attachment_id ) {                               $classes = array( 'zoom' );                               if ( $loop == 0 || $loop % $columns == 0 )                               $classes[] = 'first';                               if ( ( $loop + 1 ) % $columns == 0 )                               $classes[] = 'last';                                    $image_link = wp_get_attachment_url( $attachment_id );                               if ( ! $image_link )                               continue;                                    $image       = wp_get_attachment_image( $attachment_id, apply_filters( 'single_product_small_thumbnail_size', 'shop_thumbnail' ) );                               $image_class = esc_attr( implode( ' ', $classes ) );                               $image_title = esc_attr( get_the_title( $attachment_id ) );                                    printf( '
%s
', wp_get_attachment_image( $attachment_id, apply_filters( 'single_product_large_thumbnail_size', 'shop_single' ) ), wp_get_attachment_url( $attachment_id ) );                                    $loop++;                      }                      }           ?>
      is where the caption needs to be placed.


how to create cron that post events daily in wordpress?

I want a cron that post events daily. I want to set cron programmatically               function cp_remove_sold_ads(){              global $wpdb;         // Get all sold ads         $sold_ads = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "postmeta WHERE `meta_key` = 'cp_ad_sold_date' AND `meta_value` <> ''");              foreach ($sold_ads as $ad) {             $today = time();                  // Get day, month, year             $date = explode('-',get_post_meta($ad->post_id, 'cp_ad_sold_date', true));                  $sold_date = mktime(null, null, null, $date[1], $date[2], $date[0]);             $date_diff = $today - $sold_date;                  // Get the days difference             $sold_day_diff = floor($date_diff / (60*60*24));                  if ($sold_day_diff >= 5) {                 wp_update_post(array('ID' => $ad->post_id, 'post_status' => 'draft'));             }         }     }


With plugin-list-category-post is there a way of sorting titles by a date?

I have a series of posts that fall within a category of "calendar". I want to produce a list of them in date order. The post titles can begin with the date but I can't see a way of sorting by it. Being British, I'd prefer something in the format dd/mm/yy and I guess North American users would prefer mm/dd/yy. At the moment, the only way I can achieve this is using the format yy/mm/dd which few people can understand. Any thoughts on how to achieve this? Many thanks, Graham.


wp_Query with 4 post meta feald arguments gives 500 internal server error

I am creating a custom plugin to search for custom post type provided with 4 meta field arguments. I am using wp_Query() to fetch the search results. My Query string is.                           $args = array(                 'update_post_meta_cache' => false,                 'cache_results' => false,                 'post_type' => 'caravans',                 'meta_query' => array(                     'relation' => 'OR',                     array(                         'key' => 'caravan_used_new',                         'value' => $used,                         'compare'=>'like',                     ),                     array(                         'key' => 'caravan_or_motorhome',                         'value' => $type,                         'compare'=>'like',                     ),                     array(                         'key' => 'caravan_berth',                         'value' => $bearth,                         'compare'=>'like',                     ),                     array(                         'key' => 'caravan_make',                         'value' => $make,                         'compare'=>'like',                     ),                 )             );             if(!empty($key)){                 $wp_query = new WP_Query("s=$key", $args);             }else{                 $wp_query = new WP_Query($args);             }      Now it is working good if I put only three meta_Query arguments when I make it to 4 its start crashing and all I see in 500 internal server error. Am I doing something wrong or meta_query has its own limits?


Why Isn't My WP_Nav_Menu returning false?

I'm using `wp_nav_menu` for a submenu that I only want to display (including the surrounding html) when there are sub-menu items to display. The problem is, the function is always returning with either the menu items (when it's supposed to), or with an empty list when there's nothing to display. I need it to (and thought it would) return false. Here's my code.               // Capture submenu as a variable     $args = array(                  'theme_location' => $in_menu,                 'echo'           => '0',                 'sub_menu'       => true,                 'fallback_cb'    => 'coepio_return_false'         ); // Note I've also tried 'fallback_cb' => false with the same result     $submenu = wp_nav_menu( $args );          // If the menu exists     if( $submenu ) {         ?>

In This Section

                     <?php                      echo $submenu;                     ?>

         <?php     }      If you noticed that `'sub_menu' => true` argument you have a good eye. Here's the code for that.               // Submenus - required for the submenu (above) to work     // filter_hook function to react on sub_menu flag     function coepio_submenu( $sorted_menu_items, $args ) {       if ( isset( $args->sub_menu ) ) {         $root_id = 0;              // find the current menu item         foreach ( $sorted_menu_items as $menu_item ) {           if ( $menu_item->current ) {             // set the root id based on whether the current menu item has a parent or not             $root_id = ( $menu_item->menu_item_parent ) ? $menu_item->menu_item_parent : $menu_item->ID;             break;           }         }              $menu_item_parents = array();         foreach ( $sorted_menu_items as $key => $item ) {           // init menu_item_parents           if ( $item->ID == $root_id ) $menu_item_parents[] = $item->ID;                if ( in_array( $item->menu_item_parent, $menu_item_parents ) ) {             // part of sub-tree: keep!             $menu_item_parents[] = $item->ID;           } else {             // not part of sub-tree: away with it!             unset( $sorted_menu_items[$key] );           }         }              return $sorted_menu_items;       } else {         return $sorted_menu_items;       }     }     add_filter( 'wp_nav_menu_objects', 'coepio_submenu', 10, 2 );


How to add the scheduled posts in existing content link in hyperlink

I am blogging with scheduled publication. Say, I have content "1" (complete and saved already) scheduled to be published tomorrow Now I have another content "2" (complete and saved already) scheduled to be published 2 days from now. Inside content "2" is linking to content "1", the easiest way to link an article using wordpress editor is Adding the link to "existing content" then select it. The problem is, editor is just showing the **already published content** only, is there a way to add other posts, such as draft, scheduled articles, etc. Well, you might think I am linking a "non existing content" in my website, but, it would make sense if the content that "would link to those non existing content" would be published later after the linked content. Hope there's function or plugin for this. (I am really hoping for a function that I only need to add to my theme's function) Thanks in advance and more power.


Simple form to add custom links to menu?

I currently have a menu set up called "sidebar links" with 5 custom URLs. In my widgets section I have a Custom Menu which shows my "sidebar links" menu. This basically gives my sidebar 5 links. * * * What I am looking to do is to make a simple html/php form which....   * You enter an URL and title then hit enter   * The form then adds this URL to the menu as a custom URL   * The form then removes the oldest link Is this possible? I don't want to give people access to the menus part of the dashboard.


Rewrites with options on custom post type

I have a custom post type called 'episodes'. All of my episodes have an audio file associated with them. This file is embedded automatically in the template. Some of my episodes also have a video associated with them though. By default, if you go to the episode-single page, (ex: /episodes/breaking- bad), I only want to display the embedded audio. However, if the parameter ?video=true is set, (ex: /episodes/breaking-bad?video=true), my template will instead show the embedded video. I'd like to clean up the url to look like: /episodes/breaking-bad/video. I've added this code to my custom functions:               add_action( 'init', 'add_custom_rewrite_rules' );          function add_custom_rewrite_rules() {          add_rewrite_rule(             "episodes/([^/]+)/video/?$",             "index.php?episodes=".$matches[1]."&video=true",             "true");     }      ... and flushed the permalinks, but instead of displaying the page "/index.php?episodes=breaking-bad&video=true", it displays my post archive page (presumably because i have several posts with the term "video" in the title and it's looking for that. What's up? I've gone over the code several times and don't understand why this approach doesn't work.


Send email on new comment when no admin approval needed?

I see that if I turn off "An administrator must always approve the comment" and "Comment author must have a previously approved comment" I get no notifications of new comments on my site. Can I somehow make it send the notification even though approvals are unchecked in dashboard under "discussion settings"? And what would be a good way to send this notification to all users registered on this website, and not only to admin? I tried WP Comment Notifier For All (Wordpress Plugin). but it didn't work... thank you


Exclude taxonomy term from all loops, but having it on widget

I have excluded a custom post type taxonomy term from all posts like this:               add_action( 'pre_get_posts', 'exclude_category_posts' );     function exclude_category_posts( $the_query ) {         $taxquery = array(             array(                 'taxonomy'  => 'product_cat',                 'field'     => 'tag_ID',                 'terms'     => array( 157 ),                 'operator'  => 'NOT IN'             )         );         $the_query->set( 'tax_query', $taxquery );         return $the_query;       }      But I need that taxonomy term to be included back in a specific widget loop and only for that specific widget. Is there any chance for that? The reason I followed the above way, because I have created a product category, which I'd like to be shown only on a widget I created and nowhere else except search queries and the taxonomy term page. On all other loops I'd like it excluded.


Front page welcome message area

How i can create a welcome message area for my frontpage with backend control {admin panel} ##  Welcome message


Blog not indexed

my blog is 6 months old, with frequently updated content. Yet, not a single page is indexed by Google. Why is that so? isn't wordpress set up for SEO by default?


tag.php doesn't work with tags on a custom post type post?

here's another stumper. I have a tag.php page. It works fine, unless you click a tag that is in a post associated with a custom post type. Then it doesn't work. Its like that tag, doesn't exist. But its just a tag that's used cross site. I'm not too sure why? And the codex isn't helping much after a lot of searching. anyone ever run into this issue? I'm stumped. thanks. Nadine


Allow access on a page to just only a specific member

I am trying to create a membership site on WP where each members will have access to only specific pages created for them. I mean just a member is allowed to view content on a page while that page is restricted to others. I just to grant on a member access to a page. I don't know if this is possible with the help any plugin


get contents and permalink from a specified page

below is a query where it supposed to get a contents from a page by a specified page title               <?php         $page = get_page_by_title( 'About Us' );         $content = apply_filters('the_content', $page->post_content);               the_content_rss('', TRUE, '', 100);     ?>              <a href="<?php the_permalink() ?>" title="Read the whole post" class="rm">Read More      and yes its successfully display a content and trim the content by 100, but the problem is the content and permalink is not the content and the permalink of the specified page that I pulled from the query, i mean, the content and permalink is different from the page Im pulling up. Any ideas whats going on? Im trying to play around with the code but seems nothing works at all and also im currently looking on the web for the possible solution but unfortunately, I find nothing. PS: I just want to display the content and get the permalink of the specified page that im pulling up through the query above.


Including link to custom post type in 'wp_list_pages' function

I am generating a navigation menu on my website using the wp_list_pages() function and I also am using a couple of custom post types with a post type archive function. How would I go about adding a link to the wp_list_pages function to also include a link to my post type. The menu is as follows: Home   Tour & Arrival Information   Getting Around   About Us   Contact Us These are all pages and as such, are automatically found and placed into the list_pages function. I have a custom post type called sponsors which is a page that lists sponsors of the site. How do I add a link to /sponsors? Can you make Wordpress treat a custom post type as a page and link to it? I did try and use the Wordpress menus functionality, but it couldn't see my post type. I understand that the wp_list_pages uses internal functions to get pages with the post type of 'page' and that I need to use another function to accomplish what I am trying to do, however, I am stuck. I don't want to display posts using the post type 'sponsors' I just want to display a link to /sponsors that says sponsors, but allow the client to rearrange the order of the navigation which leads me to believe that I need to use a menu. Sorry if I didn't provide enough information, just ask if I didn't. I'm very busy at present and probably didn't describe myself properly.


Running Wordpress from MySQL Cluster with HAPRoxy

I'm trying to install a wordpress installation where the DB will sit on a MySQL cluster (Galera/Percona XtraDB Cluster) and connected through HAProxy. Everything outside of the Wordpress install seems to work fine. Using the mysql client to connect to the database with a username and password works just fine. The Wordpress install is on the same server as the HAProxy. That works fine from command line when I do this:               mysql -u wordpress -p<password> -h <haproxy ip> -D wordpress      However, from the install GUI page, it constantly takes me to the "DB connection failed" page. Can anyone shed some light on where the issue might be? Here is what I'm attempting to use in the install from:               database name: wordpress     username: wordpress     password: <password>     database host: <ip of haproxy server>     table prefix: wp_      Thanks for any suggestions!


Custom post type permalinks giving 404s

I'm having trouble setting up permalinks for a custom post type. Below is the code from my init function:               register_post_type('topic',       array(        ...        'hierarchical' => true,        'query_var' => true,        'rewrite' => false,        ...       ));          if(get_option('permalink_structure')!= ''):       global $wp_rewrite;            $wp_rewrite->add_rewrite_tag('%topic%', '(.+?)', 'topic=');       $wp_rewrite->add_permastruct('topic', '%forum%/%topic%/', false, EP_PERMALINK);     endif;      Basically I'm trying to set up permalinks my own way because I want to append a custom taxonomy term before the post title. Instead of: `topic/whatever` use: `general-forum/sub-forum/whatever` This is the function that changes the link, which seems to work ok:               add_filter('post_type_link', 'topic_link', 10, 4);     function topic_link($link, $post){       if($post->post_type != 'topic') return $link;       global $wp_post_types;       $terms = get_the_terms($post->ID, 'forum');       if(!is_wp_error($terms) && !empty($terms)):         usort($terms, '_usort_terms_by_id');         $forums = $terms[0]->slug;         if(!empty($terms[0]->parent)):           $parent_item = $terms[0]->parent;           while(!empty($parent_item)):             $parent = get_term($parent_item, 'forum');             if(!is_wp_error($parent) && !empty($parent))             $forums = $parent->slug.'/'.$forums;             $parent_item = empty($parent->parent) ? false : $parent->parent;           endwhile;         endif;       endif;       return str_replace('%forum%', $forums, $link);     }      So the modified URL is displayed fine, the only problem is that I get a 404 error :) What am I doing wrong in my init code? **LE:** the 'forum' taxonomy:               register_taxonomy(       'forum',         array('topic', 'reply'),         array(           'public' => true,           'name' => _a('Forums'),           'singular_name' => _a('Forum'),           'show_ui' => true,           //'show_tagcloud' => true,           'show_in_nav_menus' => true,           'hierarchical' => true,                'labels' => array(             'name' => _a('Forums'),             'singular_name' => _a('Forum'),             'search_items' => _a('Search Forums'),             'popular_items' => _a('Popular Forums'),             'all_items' => _a('All Forums'),             'parent_item' => _a('Parent Forum'),             'parent_item_colon' => _a('Parent Forum:'),             'edit_item' => _a('Edit Forum'),             'update_item' => _a('Update Forum'),             'add_new_item' => _a('Add New Forum'),             'new_item_name' => _a('New Forum Name'),           ),           'query_var' => true,           'rewrite' => array('slug' => 'forums', 'with_front' => false, 'hierarchical' => true),           //'update_count_callback' => 'my_custom_count_callback',       )     );


CSS Customizations for certain page

I've been using Wordpress for a while, and came to a point where I need to make css customizations, but only for a certain page. I know that one way to do this is to use conditional tags: `if ( is_page( 'mypage' )` And that's where I get stuck! Are there any other ways of making css customizations, only for a certain page?


Change headers in admin posts list

Is there anyway to show different information shown about custom post types in their list in the admin, wp-admin/edit.php?post_type=myposttype ? Obviously I could rip it apart by adding php or js to the admin_head action, but is there a core wp way.


Trying to integrate wordpress query on other website - getting redirection to wp-install

i'm trying to replace news system on my website with posts from wordpress site. I have main site in (example) /var/www/site and working Wordpress blog on /var/www/site/blog Tried to do that: http://codex.wordpress.org/Integrating_WordPress_with_Your_Website and neither wp-load nor wp-blog-header are working. I'm getting redirection to wp-install. Strange thing is that php file put into main site main dir is working properly, but any try to require wp files inside main site structure (on init stage or on displaying page header) are failing. What i am doing wrong? It's all happening on 3.4.1 WP version. Cheers


Apply class to the a tag link generated in post tag links

I'm using the following code to generate tags               <?php if( has_tag() ): ?>     <?php echo '
'?>
Tags
<?php the_tags('

','

','

'); ?><?php echo '
' ?>     <?php endif; ?>      It's output is an unordered list with simple `<a>` links. I need to apply a class to these links `class="tag-body olive` What file is generating these tags I looked in my themes functions.php Thanks


Can't display custom menu using name?

I want two menus using the new WordPress 3.0 feature. In `functions.php` I have:               function register_my_menus() {      register_nav_menus(         array(          'header-menu' => __( 'Header Menu' ),          'top-menu' => __('Top Menu')        )      );      }          add_action( 'init', 'register_my_menus' );      And in `header.php` I have:               <?php wp_nav_menu( array( 'name' => 'Header Menu' ) ); ?>     ....     <?php wp_nav_menu( array( 'name' => 'Top Menu' ) ); ?>      Now they seem to fallback or something, always showing the same menu. The menus have been defined and setup in wp-admin "theme-locations". Why won't they load appropriately?


How do i structure my theme folder to avoid one huge list of files

When working with a worpress site with lots of custom post types and lots of page templates, my theme folder is looking messy. What are the accepted best practices to organise code files in WordPress? a couple of the limitations i'm coming up against are that templates are chosen by name, so i can't group files by prefixing them. Also custom post template files can not be in sub directories. Also header and footer can not be in subdirectories. How can i organise my code better?


Custom Taxonomy Doesn't Show Up

Have a snippet here that doesn't seem to show up the taxonomy in the CPT edit screen. Not sure what's wrong, both the taxonomy and CPT are registered to each other.               <?php     add_action('init', 'create_taxonomy');          function create_taxonomy() {         register_taxonomy( 'farm', array('farmer', 'food', 'recipe'), array(             'label'                                 => 'farms',             'public'                                => true,             'show_ui'                               => true,             'show_in_nav_menus'                     => true,             'show_tagcloud'                     => true,             'hierarchical'                          => true,             'show_admin_column'                     => true,             'query_var'                         => 'farm',             'update_count_callback' => '',             'sort'                                  => true,             'labels'                                => array(                 'name'                                              => __('Farms'),                 'singular_name'             => __('Farm'),                 'menu_name'                                     => __('Farm'),                 'all_items'                                     => __('All Farms'),                 'edit_item'                                     => __('Edit Farm'),                 'view_item'                                     => __('View Farm'),                 'update_item'                                   => __('Update Farm'),                 'add_new_item'                              => __('Add New Farm'),                 'new_item_name'                             => __('New Farm'),                 'search_items'                              => __('Search Farms'),                 'popular_items'                             => __('Popular Farms'),                 'separate_items_with_commas'    => __('Separate farms by commas'),                 'add_or_remove_items'                   => __('Add or remove farms'),                 'choose_from_most_used'             => __('Choose from the most popular farms'),                 'not_found'                                     => __('No farms found')             ),             'rewrite'                               => array(                 'slug'                  => 'farm',                 'with_front'        => false,                 'hierarchical'  => false,             )         ) );              register_post_type( 'farmer', array(             'public'                    => true,             'taxonomies'            => array( 'farm' ),             'menu_position'     => 6,             'capability_type'   => 'page',             'rewrite'                   => array( 'slug' => 'farmer' ),             'supports'              => array( 'title', 'editor', 'thumbnail', 'custom-fields' ),             'labels'                    => array(             'name'                              => __('Farmers'),             'menu_name'                     => __('Farmers'),             'singular_name'             => __('Farmer'),             'add_new'                           => __('Add New'),             'add_new_item'              => __('Add New Farmer'),             'edit_item'                     => __('Edit Farmer'),             'new_item'                      => __('New Farmer'),             'all_items'                     => __('All Farmers'),             'view_item'                     => __('View Farmer'),             'search_items'              => __('Search Farmers'),             'not_found'                     => __('No farmers found'),             'not_found_in_trash'    => __('No farmers found in Trash')             )         ) );}     ?>


get tags from custom post type

I have a custom post type called "portfolio" with 2 registered taxonomies : **portfolio_category** and **portfolio_tag**. I'm using a custom theme that use a lot of javascript/jquery. So this is how the categories taxonomy is defined in template-portfolio.php (it's just some relevant code used to define categories taxonomy) :               if($pf_categorynotin){         $args['tax_query'] = array(             array(                 'taxonomy' => 'portfolio_category',                 'field' => 'slug',                 'terms' => $pf_categorynotin,                 'operator' => 'NOT IN'             )         ); //category__in     }          if( have_posts() ) :          while ($wp_query->have_posts()) : $wp_query->the_post();             $post_cat = array();             $post_cat = wp_get_object_terms($post->ID, "portfolio_category");             $post_cats = array();             $post_rel = ' all ';             for($h=0;$h<count($post_cat);$h++){                 $post_rel .= $post_cat[$h]->slug.' ';                 $post_cats[] = $post_cat[$h]->name;             }                  $attachments = get_post_meta($post->ID, '300-160-image', true);                       if ($attachments) {                          $post_cat = array();                 $post_cat = wp_get_object_terms($post->ID, "portfolio_category");                 $post_cats = array();                 for($h=0;$h<count($post_cat);$h++){                     $post_cats[] = $post_cat[$h]->name;                 }                 $cats_pf_this = implode(", ", $post_cats);      So, this is how the categories taxonomy are defined. For define the tags taxonomy I just have to duplicate this code ? Thanks!


get variable from url?

say i've got a url http://bfami.modernactivity.co.uk/category/museum/orderby/date/order/desc/ that works with;               add_rewrite_rule( 'category/(.+?)/orderby/([^/]+)/order/([^/]+)(/page/?([0-9]{1,}))?/?$', 'index.php?category_name=$matches[1]&paged=$matches[5]&orderby=$matches[2]&order=$matches[3]', 'top' );      how do i get the value of orderby or order on a page? Think wordpress removes the GET values which is what i'd normally use... Just want to highlight the active order filter on the page!


Wordpress 3.1's admin bar disappears only leaving its 28 px padding (in ubuntu)!

At the begining, I thought there was an issue with my HTML or CSS files. But then I realized that other people using Wordpress 3.1 had the same problem (check out this link). The admin bar disappears when I click another 'Pages' or 'Posts,' but it leaves its 28px padding at the top of the page. I'm not sure if this has something to do with folder's permission issues in ubuntu (I'm using ubuntu 11.04). I did `chmod -R 777` to my `www` folder (the default folder for my `locahhost`), but I'm still having the same issue. Any suggestions to fix this?


Dynamically Adding Category Specific Content To Specific Category & Subcategory Pages

I'm working on an internal project/idea (a directory of sorts for a vertical market) where I will have 40 Categories with each Category having (potentially) 30 Sub-Categories. For each Category and Sub-Category page we need to present (unique for each Cat and Sub-Cat) a block of rich text (and possibly an image) in the top of the first page, and some additional text in the bottom of the first page. Subsequent pages in the page-navi would just have standard Category (or Sub- Category) title. The text in the bottom of the page would be updated from time to time - so (relatively) easy content management would be ideal. I know I can create a conditional statement above the loop in a category.php page template to place the various text elements -- but that's one monster conditional statement. And I obviously don't want to create a unique category template for each. I'd rank myself an intermediate WP coder so I'm wondering if any of you Pro's have some insight. I'm not looking for code, just a general sense of best practice/strategy for how I might approach this so it's easy to manage through the WP Admin (ideally) going forward. Looking for a point in the right direction. I just can't seem to get my head around it.


Count parent comments & replies separately?

I am trying to find a function, plugin, query - something that will separate the parent comment count from the reply count. Does anyone know how to achieve this? 10 comments total are broken into 3 parent comments and 7 replies. How can I display this at the top of the comment form? Please & thank you!


WP_Query not working as expected for attachments and custom meta_query

If I use `get_posts()` like so I get a number of results with the value 1 for the `my_key` meta_key:               $posts = get_posts(          array(              'post_type'  => 'attachment',              'meta_key'   => 'my_key',              'meta_value' => '1'          )      );          //this has a bunch of results as expected     print_r($posts);      However if I create a similar query with WP_Query I get an empty result array               $args = array(        'post_type' => 'attachment',        'meta_query' => array(            array(            'key'     => 'my_key',            'value'   => '1',            'compare' => '=',            'type'    => 'BINARY'                )        )     );          $query = new WP_Query();     $results = $query->query($args);     //this is empty     print_r($results);      I have tried a few varieties of the meta_query array all with no luck. I am thinking that this might be a bug, but wanted to make sure I was not missing something first.


How to remove custom post type and add category and post name

I have a custom post type called **_listing_** and taxonomy for this listing is called **_listing_cat_**. At the moment my wordpress permalinks appear in this format               localhost/wordpress/listing/listing_cat/post_name      I want to **remove listing** from permalink so it would appear in this format.               localhost/wordpress/listing_cat/post_name      Problem is when I remove listing from permalink with the help of **"post_type_link"** filter it direct me to 404 Page. Here is the code that I am using that I have taken from another question.               add_filter('post_type_link', 'projectcategory_permalink_structure', 10, 4);     function projectcategory_permalink_structure($post_link, $post, $leavename, $sample) {         if (false !== strpos($post_link, 'listing')) {             $projectscategory_type_term = get_the_terms($post->ID, 'listings_categories');                  if (!empty($projectscategory_type_term)){                     // var_dump($projectscategory_type_term);                 $post_link = str_replace('listing', array_pop($projectscategory_type_term)->                     slug, $post_link);             } else{                      $post_link = str_replace('listing', 'uncategorized', $post_link);             }         }              return $post_link;     }      What is workaround of this problem. Thanks


Two text domains in one plugin

_From start: **A** = main plugin(the library), **B** = child plugin_ I develop a plugin **B** that will depend on another plugin **A** in order to work properly. I do this because I'm one of the persons who don't like code duplication. So I have a plugin with the library required for other plugins **A** and another plugin that will do only what it should but only if plugin **A** is activated. Everything is working well, but... I also need to make the plugin **B** independent and to archieve this I must include the main library. Is simple and all I need to do is to change a few lines of code. Here is the potential problem. In plugin **A** I have the translation text domain `example_text_a` and in the child plugin( **B** ) it is `example_text_b`. Both are using something like this to load the languages:               add_action( 'plugins_loaded', 'example_load_translations' );     function example_load_translations() {         load_plugin_textdomain(              'example_text_X',              false,              dirname( plugin_basename( __FILE__ ) ) . '/languages/'          );      }      Now the question. Is it possible to load two different lang text domains in a single plugin? And if YES, will cause this any conflicts? I would apreciate more help regarding localization if possible. Thank you.


Get Stylesheet To Showup in WP Admin Panel Editor

So I have a css file that is called `blue.css` and a universal one called `style.css` I have a few css colors inside a `/css` folder. How do I get all those css files to show up in my Admin panel editor?


Fetch CSS of posts

I am using JSON API plugin for fetching recent posts.Now I want to show them in my web as they are being displayed in wordpress.How can i get css of wordpress theme?


Which theme template is used renders next page

I am building a theme from scratch to be used here. http://www.bel- viso.co.uk/gemma-permanent-makeup-blog/ . This page lists all the recent posts and breaks them off after every 5. If you click on the next page however, it doesn't render correctly see: http://www.bel-viso.co.uk/gemma-permanent- makeup-blog/page/2 Please can you tell me which template file I need to provide to get this sorted? Thanks


Add custom option to Standard Page Attributes Meta Box

I'd like to add a simple checkbox option to the exsisting standard Page Attributes Meta Box. Is there an obvious/intended way to do that using the WordPress API, rather than registering a new metabox for my one new option?


Is it possible to upload files for wordpress importer over FTP?

I run WordPress on Heroku – an environment where you can't upload files manually, but rather push them via Git. I host my files on `Amazon AWS Filebucket`. This generally works great, however, I get an error when I try to import a WordPress XML from another WordPress site. WordPress tries to upload the file and then read it, but this doesn't work as the directory is read only. I wonder weather I can put the file somewhere on the server so that it's there when WordPress tries to find it.


How a deprecated function can crash WordPress site while upgrading

It is said that deprecated functions used in plugins & themes can crash a wordress website while upgrading to newer version, I want to see an example of deprecated function that can cause a crash. Can someone show me an example? Many Thanks!


Ordering Custom WP_Query loop by meta key value with pagination

I am trying to Order custom post type results by a `meta_key` value with pagination. The pagination is working fine and I suspect I can't use the same `$args` that I am using with my `new WP_Query` in my `wp_query->query()`. Here is the code :                       $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;             $temp = $wp_query;              $wp_query = null;              $args = array(               'showposts'=> 5,               'orderby'  => 'meta_value',               'meta_key' => 'report_date',               'order' => 'DESC',                           'post_type'=> 'match_report',               'paged'    => $paged             );             $wp_query = new WP_Query($args);                   $wp_query->query($args);                         if ( $wp_query->have_posts() ) :                  ?>
             <?php while ( $wp_query->have_posts() ) : $wp_query->the_post();              $matchdate = get_post_meta($post->ID, 'report_date', true);             $matchDay = date("d", strtotime($matchdate));             $matchMonth = date("M", strtotime($matchdate));             $hometeam = get_post_meta($post->ID, 'report_home-select', true);             $homename = get_the_title($hometeam);                            $awayteam = get_post_meta($post->ID, 'report_away-select', true);             $awayname = get_the_title($awayteam);             $permalink = get_permalink($post->ID);              ?>

<?php echo $matchDay .' ' .'' . $matchMonth . '' ?>

<?php echo $homename . " vs. " . $awayname;?>

<a href="<?php echo $permalink ?>"><button>Get Report</button>

                 <?php endwhile; ?>                                <?php paginate(); ?>                               <?php               $wp_query = null;               $wp_query = $temp;  // Reset             ?>


Single Widget Multi Sidebar

I wrote a widget that has multiple output format based on type dropdown list. I intend to use this widget on both left and right sidebars. The problem however is it only shows up on one sidebar either left or right. I want the widget to appear on both sidebars please find the widget code below:                class Posts_Widgets extends WP_Widget{            function __construct(){         $id = "posts_widgets";         $name = "Anzima Posts Widgets";         $widgets_ops = array('description'=>__('Widget for displaying various posts formats'));         $control_ops = array('width' => 400, 'height' => 350);         parent::__construct($id,$name,$widgets_ops);       }            function form($instance){         $title = esc_attr($instance['title']);         $cats  = esc_attr($instance['cats']);         $type  = esc_attr($instance['type']);         ?>              <p>                 <label for="<?php echo $this->get_field_id('title'); ?>" ><?php _e('Title'); ?>:                 <input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>"                    name="<?php echo $this->get_field_name('title');?>" value="<?php echo esc_attr($title);?>" />                 </label>              </p>                   <p>                 <label for="<?php echo $this->get_field_id('cats'); ?>" ><?php _e('Post Categories'); ?>:                 <select class="widefat" id="<?php echo $this->get_field_id('cats'); ?>" name="<?php echo $this->get_field_name('cats')?>" >                 <?php $cats_a = $this->get_category(); ?>                 <option value="" ><?php _e('Please select an option'); ?></option>                 <option value="x" <?php if($cats == 'x'){?>selected="selected"<?php }?> ><?php _e('Most Read'); ?></option>                 <?php foreach($cats_a as $o){ ?>                     <option <?php if($cats == $o->id){?>selected="selected"<?php }?> value="<?php echo $o->id; ?>"><?php echo $o->name; ?></option>                 <?php } ?>                 </select>                 </label>              </p>                   <p>                 <label for="<?php echo $this->get_field_id('type'); ?>" ><?php _e('Display Type'); ?>:                 <select class="widefat" id="<?php echo $this->get_field_id('type'); ?>" name="<?php echo $this->get_field_name('type')?>" >                    <option value="" ><?php _e('Please select an option'); ?></option>                    <option <?php if($type == 1){?>selected="selected"<?php }?> value="1" ><?php echo _e('Main Plus Thumbs List'); ?></option>                    <option <?php if($type == 2){?>selected="selected"<?php }?> value="2" ><?php echo _e('Item List'); ?></option>                    <option <?php if($type == 3){?>selected="selected"<?php }?> value="3" ><?php echo _e('Main Plus List'); ?></option>                    <option <?php if($type == 4){?>selected="selected"<?php }?> value="4" ><?php echo _e('Grid'); ?></option>                    <option <?php if($type == 5){?>selected="selected"<?php }?> value="4" ><?php echo _e('Single Post'); ?></option>                 </select>                 </label>              </p>         <?php        }            function update($new_instance,$old_instance){         $instance = $old_instance;         $instance['title'] = strip_tags($new_instance['title']);         $instance['cats'] = strip_tags($new_instance['cats']);         $instance['type'] = strip_tags($new_instance['type']);        return $instance;       }            function widget($args, $instance) {           extract($args, EXTR_SKIP);           $data = array();           if($instance['cats'] != 'x'){             $data['title'] = get_cat_name($instance['cats']);             $data['image'] = ((is_file(TEMPLATEPATH . '/images/'.$instance['cats'].'.png'))?get_bloginfo('stylesheet_directory') . '/images/'.$instance['cats'].'.png':'');           }else{             $data['title'] = 'most read';             $data['image'] = get_bloginfo('stylesheet_directory') . '/images/most-read.png';           }           $data['id'] = $instance['cats'];           $data['list'] = $this->get_list($instance['cats'],$instance['type']);           include_once TEMPLATEPATH . '/widgets/templates/'.$instance['type'].'.php';       }       }     ?>      Thank you in advance for your utterly appreciated help * * * FlashingCursor; I am registering the widget just forgot to paste it               function reg_post_widget(){     register_widget( 'Posts_Widgets' );     }     add_action( 'widgets_init','reg_post_widget');      The problem is it appears only on onside bar but not both although in the backend I can drop the widget on both sidebars * * * Thank you for your response, I am registering my widget but forgot to paste it The problem however, is that the widget only appears on one sidebar either left or right but not both at a time. I don't know if I am missing some configuration option to make my widget multi-widget. Definitely I am missing something out!!! by the way how can I reply to answers instead of editing them??


Hybrid meta box, how to show?

As a designer I'm not that well in PHP. I've created a (hybrid) meta box. Now I want to show the meta stuff on my template. For some reason I can't get it hooked in my template. The meta box is saving stuff propperly.               function hybrid_service_meta_boxes() {          /* Array of the meta box options. */     $meta_boxes = array(         'doc' => array( 'name' => 'doc', 'title' => __('doc', 'hybrid'), 'type' => 'text' ),         'description' => array( 'name' => 'Description', 'title' => __('Description', 'hybrid'), 'type' => 'textarea' ),                 );          return apply_filters( 'hybrid_service_meta_boxes', $meta_boxes );}      The problem now is, how do I hook this up to the front?               <?php if ( get_post_meta($post->ID, 'Service', true) ) : ?>          Test succes          <?php endif; ?>      As you can see I'm testing if the stuff is working, but I won't get the 'test succes'. Does anyone know what I'm doing wrong? I think 'Service' is incorrect..


get_query_var() not working in pre_get_posts

I'm using the `pre_get_posts` hook to order the main query on all my custom post type / taxonomy pages using a custom meta value. As part of the logic, I am trying to determine which taxonomy is currently being displayed by using `get_query_var('taxonomy')`, however no matter what I try, it keeps returning a blank string:               function sort_query($query)         ...         if (is_tax()){             ...             echo get_query_var('taxonomy'); // Empty             echo get_query_var($query->query_vars['taxonomy']); // Empty             ...         }     }     add_action('pre_get_posts', 'sort_query');      Any help would be greatly appreciated; thanks!


Hide comments awaiting moderation from user who submitted the comments

This is a strange one. I host a website that is primarily for children. All posts are moderated. Users are required to enter a user name and location (State), but are not required to be registered and logged in to make a comment. Some users have started using a common user name, allowing them to see one another's posts while the posts are awaiting moderation. This allows them to use the posts awaiting moderation like an unmoderated chat room, until the moderator gets to the comments. I would like to filter the comments on the posts so that only approved comments are shown, regardless of whether the user just entered a comment that is awaiting moderation. I have looked in the wp-includes/comments.php, and in the wp-includes/post.php but haven't been able to find where to limit the comments that are seen on the posts. Can anyone direct me further?


What is an efficient way to query based on post_meta?

The problem I am having is when I allow users to filter posts it overpowers the database and things run extremely slow. I am unsure what the best way to query posts using meta values is. My site has a form that users can submit to filter posts based on checkboxes containing meta values. I currently have the site making an array out of the checkboxes selected for individual post_meta keys like so:               for ($i=0; $i< count($amenities); $i++)//where $amenities is an array of selected checkbox values              {        //$arrays is the array that stores the arrays of checkboxes for different meta keys             $count = count($arrays);             $arrays[$count] = array(                         'key' => 'amenities',                         'value' => $amenities[$i],                         'compare' => 'LIKE'                         );         }      Then I query the database using an array of arrays which contain the values selected for each meta_key. Like this:               $the_query = new WP_Query(array(             'post_type' => 'listing',             'post_status' => 'publish',              'category_name' => 'private_rental',             'orderby' => 'rand',             'meta_query' => $arrays         ));      When I do this I get the results I want but it can take over a minute for the results to appear on the screen. Is there a more efficient way of doing this? Any help would be appreciated!


wp_handle_upload - The uploaded file could not be moved to wp-content/uploads/2012/09

This is the code I am using to upload the file to WordPress               define(‘WP_DEBUG’, true);          $filename = "test.png";     $tmpFile = download_url("http://url.com/testing/crop/".$filename);          chmod($tmpFile, 0755);          $mimeType = wp_check_filetype($_SERVER['DOCUMENT_ROOT'] . '/testing/crop/'.$filename);     $file_array = array(         'file'      => $_SERVER['DOCUMENT_ROOT'] . '/testing/crop/'.$filename,         'url'       => $_SERVER['DOCUMENT_ROOT'] . '/testing/crop/'.$filename,         'type'      => $mimeType['type'],         'size'      => filesize($_SERVER['DOCUMENT_ROOT'] . '/testing/crop/'.$filename),         'name'      => $filename,         'tmp_name'  => $tmpFile     );          $image = wp_handle_upload($file_array, array('test_form' => FALSE, 'test_upload' => FALSE, 'test_type' => FALSE));          print_r($file_array);     print_r($image);          unlink($tmpFile);     ?>      This is the error I am getting "The uploaded file could not be moved to /home/xxxx/public_html/wp-content/uploads/2012/09." What I am trying to do is have a small PHP script outside of WordPress upload images to its Media Library and then post it however at this point I am getting stuck at the uploading stage. All the permissions are correct as I am able to upload fine through the WordPress admin area. Any help is much appreciated.


How to modify product title when adding to cart in Woocommerce?

I need to add some additional information when buyers adding product to cart, so it could contain this information in cart, checkout page and orders. Could anyone give me some snippet about achieving that?


Need to include and redirect template from plugin

I am trying to write a code for my custom plugin where need to include a template page. I have tried in few ways but it redirects me to 404. After this i also added code for template redirect but no results. Somebody please notice me where I am doing wrong ? Few example of my code snippet:               add_filter( 'template_include', 'portfolio_newpage_template', 99 );     function portfolio_newpage_template( $template ) {       $new_template = locate_template( array( dirname( __FILE__ ). '/portfolio-page-template.php' ) );         if ( '' != $new_template ) {             return $new_template ;         }          return $template;     }      For redirect i am using:               function templateRedirect() {          //global $wp;     // if ($wp->request == 'http://localhost/plugin-testing/portfolio') {     //  loadWordPressTemplate(dirname( __FILE__ ). '/portfolio-page-template.php');          if ( is_page_template('portfolio-page-template.php') ){      loadWordPressTemplate(plugin_dir_url( __FILE__ ) . 'portfolio-page-template.php');       }           }      add_action('template_redirect', 'templateRedirect');      I already google many codes but i didn't get the right way to solve my issue. Currently i am testing in my localhost so I need to load my template when the url is something like: > esc_url(home_url( )).'/portfolio' And one more thing i don't want to use **wp_insert_post function** that requires **update_post_meta function** which make visible the post/page in admin area. But if there have any way to hide the inserted post/page from admin area, really it will be appreciated from me. Thanks in advance


Unify the roles and caps?

I installed several plugins(buddypress-docs,achievement,bbpress), each one create capabilities for their own post_type. I would prefer to make all roles and capabilities unified into one system, Is there a solution to overwrite all existing caps and control all post_types? Eventually I would like to organize users by group, and assign each user group different caps across all types.


Users disappeared from wp-admin

I have a WordPress multisite network and the question is related to one of my sites on that network. The site has a login page before you can use that site. So I created a user from wp-admin with the Subscriber role. The idea was to let that user log in to the site but not have access to wp- admin, but it didn't work. So I went in again as a Superadmin and changed the role to " - No role for this website - ". It worked and that user can't access wp-admin but can still log in to the site. Now I want to edit that user's information, but the user disappeared from the list shown in wp-admin. My question is: **Where do I find that user?** Some follow-up questions: is it removed but still active? How come? Is there a specific location where I could find that user?


Include jQuery UI as a whole

Is it possible to include jQuery UI as a whole instead of:               wp_enqueue_script('jquery-ui-core');     wp_enqueue_script('jquery-effects-core');     // a lot of other jquery ui imports....      I've searched in the codex and was able to find the full list of included scripts, but could not find a way to include the full jQuery UI version as one import like:               wp_enqueue_script('jquery-ui');      Sources: http://codex.wordpress.org/Function_Reference/wp_enqueue_script


How can I add multiple content-editable blocks without a plug-in?

I'm using WP as a CMS, not a blog. I have _a lot_ of pages (not posts) that need to have different content per page in the sidebar. The content (html, images, php) in the sidebar will be different depending on what page you are viewing. Since I have a lot of pages, I don't think checking for what page is currently displayed and then show a different template part/widget in sidebar based on that check is feasible. Otherwise, I would have tons of is_page() calls. Right? What other options do I have? I looked around for ways to add multiple WYSIWYG editors to a Page's editor mode, but it looks like is not possible without a plug-in which I don't want to add. What about multiple Text widgets? I guess I can create as many different widgets as I need for the sidebar, but how do I specify the widgets I want to use on a specific page.? It would great if you could, in Page editor mode, select the widget(s) you want to use just like you can select the page template to use. I'm not great at PHP, so what's the best, quickest, code-less way to do what I need without a plug-in.? The reason I don't want to use a plug-in is to keep down the code weight, and the widgets I did look at to solve my problem seemed "wonky". I'm using the latest version of WP.


Embedded Feed Update

I am trying to embed a feed on my site. The plugin I am using is called Hungry Feed. I have the feed properly embedded and everything seems to be working except one thing. The feed updates... How often is the embedded feed supposed to update? It seems that the feed is stuck at the articles that were available to the feed when I put the short code in my template. The page the feed is embedded on is http://www.ragequitbaddie.com/news The feed url that I used is: http://www.joystiq.com/editor/jessica-conditt/rss.xml If you know of another plugin way to embed a feed that will allow me to get real time updates for a feed much like subscribing on google reader that would help too.


Hook into $wpdb

Is there a way to hook into the WPDB instance ($wpdb)? What i basically want, is to execute a own function BEFORE the desired query get's executed. Is this possible? # Additional question for comment to first answer:                   $query = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "test WHERE type = %s and ip = %s", $type, $ip_full_log);         $fetch = $wpdb->get_results($query, ARRAY_A);      Would this parse the final query to my callback function?


Blending Foundation's Tabs with Wordpress Nav Menu & Display Active Tab

I am currently working with ZURB's Foundation Framework. It's a terrific framework and my project is coming along a lot nicer and quicker than it would have beforehand. Foundation comes with CSS/Javascript that can be called upon within your design. One of these key features is their Tabs system. Now, what I currently have below works brilliantly on the site so far!
              <?php         // List all pages needed in Navigation with their slug and title         $pages = array(             "" => "Home",             "about" => "About",             "contact" => "Contact",         );              // Find which page you're on currently...         global $post;         $post_slug = $post->post_name;              // Looping through the pages to create each tab...         foreach ( $pages as $slug => $title )         {             // Find out if we're on this page and setup the 'active' class.             $active = ( $slug == $post_slug || ( $slug == '' && is_front_page() ) ) ? "class='active'" : "";                  // Echo each dd item with a link to page...             echo "
                 ".$title."
";         }         ?>
      It shows the active tag and allows me to add new links via hardcode. What I need is flexibility however and I want to blend in the support for Wordpress's new Menu system on the backend and incorporate wp_nav_menu somehow. However, I'm unsure where to begin... I'm testing different things while I post this so, maybe I'll stumble across a resolution but I wanted to check here first. Thanks!


Sql syntax error

Sometimes in my error log i have this error: > >     You have an error in your SQL syntax; >     check the manual that corresponds to your MySQL server version for the > right syntax to >     use near '' at line 1   >         SELECT * >         FROM c_posts >         WHERE id = , >         do_action('wp_ajax_inline-save'), >         call_user_func_array, >         wp_ajax_inline_save, >         edit_post, >         wp_update_post, >         wp_insert_post, >         wp_transition_post_status, >         do_action('transition_post_status'), >         call_user_func_array, >         apt_check_required_transition, >         apt_publish_post, >         W3_Db->query >   How to fix this ? I think error in this plugin. It is piece of code :               /**       * Function to check whether scheduled post is being published. If so, apt_publish_post should be called.       *       * @param $new_status       * @param $old_status       * @param $post       * @return void       */      function apt_check_required_transition($new_status='', $old_status='', $post='') {     global $post_ID; // Using the post id from global reference since it is not available       in $post object. Strange!          if ('publish' == $new_status) {         apt_publish_post($post_ID);     }      }           /**      * Function to save first image in post as post thumbmail.      */      function apt_publish_post($post_id)       {     global $wpdb;          // First check whether Post Thumbnail is already set for this post.     if (get_post_meta($post_id, '_thumbnail_id', true) || get_post_meta($post_id, 'skip_post_thumb', true)) {         return;     }          $post = $wpdb->get_results("SELECT * FROM {$wpdb->posts} WHERE id = $post_id");          // Initialize variable used to store list of matched images as per provided regular expression     $matches = array();          // Get all images from post's body     preg_match_all('/<\s*img [^\>]*src\s*=\s*[\""\']?([^\""\'>]*)/i', $post[0]->post_content, $matches);          if (count($matches)) {         foreach ($matches[0] as $key => $image) {             /**              * If the image is from wordpress's own media gallery, then it appends the thumbmail id to a css class.              * Look for this id in the IMG tag.              */             preg_match('/wp-image-([\d]*)/i', $image, $thumb_id);             $thumb_id = $thumb_id[1];                  // If thumb id is not found, try to look for the image in DB. Thanks to "Erwin Vrolijk" for providing this code.             if (!$thumb_id) {                 $image = substr($image, strpos($image, '"')+1);                 $result = $wpdb->get_results("SELECT ID FROM {$wpdb->posts} WHERE guid = '".$image."'");                 $thumb_id = $result[0]->ID;             }                  // Ok. Still no id found. Some other way used to insert the image in post. Now we must fetch the image from URL and do the needful.             if (!$thumb_id) {                 $thumb_id = apt_generate_post_thumb($matches, $key, $post[0]->post_content, $post_id);             }                  // If we succeed in generating thumg, let's update post meta             if ($thumb_id) {                 update_post_meta( $post_id, '_thumbnail_id', $thumb_id );                 break;             }         }     }      }// end apt_publish_post()


Replace shortcode with output in database?

For example, say I created a shortcode called `[sourcecode]` using the Shortcode API function, which is used to share code in posts like so:               [sourcecode]     #button {         font-weight: bold;         border: 2px solid #fff;     }     [/sourcecode]      (And it wraps the code in `<pre><code>` tags, takes care of escaping special characters, etc.) Then say, after a while I decide to use Markdown (and no longer want to use the `[sourcecode]` shortcode or have its function in my functions.php) or switch to a new blogging platform. Given the case, I'd like to have all instances of `[sourcecode] .... [/sourcecode]` in all posts replaced with their respective output. For example, if one of the posts has this:               [sourcecode]     #button {         font-weight: bold;         border: 2px solid #fff;     }     [/sourcecode]      It'd be replaced with and saved to database as:
#button {         font-weight: bold;         border: 2px solid #fff;     }
      Similarly, this should happen in all posts that have the `[sourcecode]` shortcode. Does wordpress have any such regenerate function built-in, or is there a plugin that does what I am after?


Using AJAX in WordPress Widget

The past few days I've been Googling and searching for answers to no avail. I'm building out a "Featured Content" widget where the user can easily (via ajax/jquery) search for posts. Is it possible to use AJAX/jQuery strictly in the Widget area, or would this type of application have to be plugin-based?


How to add an extra field in a post and show it on the template

I'm extremely new to WP. I want to add an extra field to the Post interface and show the content on a template. I don't want to show the content of the Post, but just the content in the extra field. Basically what I'm trying to achieve is design a Customer Testimonial page on my website where I show the full testimonial using the extra field, and show the post content as the mini testimonial if you get what Im saying. Please let me know if I need to clarify more. Thanks heaps. I tried custom fields in WP, but not sure how to grab the extra content only. is there a plug out there for this?


Two Navigation Menus - secondary nav is including main nav

Two Navigation Menus in Themes Produce the same menus? reference the subject on page link above. i created two navs, yet the secondary nav includes all pages. the main nav is fine, but the secondary nav is including the main nav pages as well. the two menus contain only the pages i want per nav (appearance > menus). any suggestions? it is my own theme built from 2010. it is located here > http://journeymaninc.ca/ at a loss at this point. thanks kindly Neil


Create page template with some static contents

I am new to wordpress. I searched > page vs post and found that pages are mostly static contents (in the sense that they dont need to be changed and stays in its place for ever). My question is my site consists of lets say 20 pages. They are sorted into 4 categories so each category has 5 pages. I want to create one template for each category, the only difference would be the right side bar would contain some static links to the pages in the same category. Is there any easy way of doing it?


The same slug in multiple taxonomies

We have a project that uses several custom taxonomies, and we're finding that the client wants to add the same term in several of them. While the first slug for Foo may be `foo`, subsequent copies of Foo in different taxonomies become `foo-2`. It would be nicer if the two terms could both use the same slug. It would be less confusing, and allow for nicer URLs like `search?tax=foo` rather than `search?tax=foo-2`. I notice that the `wp_terms` and `wp_term_taxonomy` table are separate, leading me to believe that it's technically possible for the same term (Foo with the slug `foo`) to appear in more than one taxonomy. But this option isn't exposed in the user interface. Is there a good reason for this? Would I be risking future brokenness by fiddling with the database like that?


get_the_term_list() wanting to loop through the returned values

I have a custom post type, I am echoing out my custom taxonomies in my template by doing the following, `get_the_term_list( get_the_ID(), 'work', '<li>', "", '</li>')` , this currently returns "Design", what I am wanting to do, is the following, for the first value that it is found I want to do the following, `<li><a href="the taxonomies link"> Find out more about Taxonomy Name</a></li>` for the second value (if there is a 2nd) I would like the do the following `<li><a href="the taxonomies link">How Taxonomy Name can benefit you</a></li>` Basically how ever many taxonomies there I only want to show 2 and I want to be able to use them as above? Is this even possible?


How do I store get_sidebar in a varaible?

> **Possible Duplicate:**   >  how do I get_sidebar into a varaible? I found how do I get_sidebar into a varaible? but the goal was different than mine, so the answers don't apply. I want to get a sidebar and save it into a variable so that I can create an if/elseif statement that will print the correct sidebar depending on my conditional criteria. For example, I currently have something like this...               if ( is_page(1) ) {         $sidebar = get_sidebar('wine');     } elseif ( is_page(2) ) {         $sidebar = get_sidebar('cheese');     } elseif ( is_page(3) ) {         $sidebar = get_sidebar('whatever');     } else {         $sidebar = get_sidebar('primary');     }      I'm not actually using **is_page** in my conditional statements and I am setting more than just the **$sidebar** variable, but you get the idea. Further down in the code I want to do this...               echo $sidebar;      The sidebars I am working with are not all dynamic, but some are. So, is there a function besides **get_sidebar()** that I can use? * * * UPDATE = ANSWER Oh, why did I hit enter? The answer left by goldenapples on the question I linked to (above) did do exactly what I wanted. When I first read it I misunderstood what output buffering did, so I didn't think it applied. My bad.


How long to keep old domain for 301 redirects after moving WordPress?

I'm looking into moving my WordPress blog from an old domain to another domain that I own. The old domain is getting expensive at $25/year and I have to renew in a month. I had the old domain for 15 years but it no longer serves it's purpose as a standalone blog. I have several options for handling this:   1. Leave it as is and keep paying the renewal registration.   2. I can do the move right now and let the registration expire next month.   3. Make the move and renew for another year before letting the registration expire. How long do I need to keep the old domain up for the 301 redirects to be effective before I let the registration expire?


Load template for specific subdomain

I'd like to be able to set a wordpress theme for certain subdomains, but still load the same content for all installations. For example, I have www.domain.com that loads the default template with default content. I'd also like to have mobile.domain.com, that too loads the same content but a separate template. What would be the best way to go about this?


Strip the + symbol from the_search_query

When using the_search_query to display search result on my site, the spaces between words are displayed with a **+** symbol. So if a visitor searches for "wordpress plugins" the_search_query output in search.php returns                   wordpress+plugins      How can I remove the + symbol, and/or replace it with non-break space entity, like so .....                   wordpress plugins         or         wordpress plugins      I tried this approach but it is not working .....                   <?php              $string = the_search_query();             $res = preg_replace("/[^a-zA-Z]/", "", $string);             echo $res;         ?>


add_action 'manage_posts_custom_column' in a class

I think this may be more of a general php question but I am posting it here as it relates to a WP function. I am having some issues with an `add_action` on `manage_posts_custom_column` inside a class. Here is the code (stripped a little):               class The_class{              function __construct() {             $this->add_actions();         }              function add_actions() {             add_action('admin_notices', array($this, 'admin_notices'));             add_action('manage_posts_custom_column', array($this, 'manage_post_columns', 10, 2));         }              function admin_notices() {         // Works fine         }              function manage_post_columns($column_name, $post_id)             switch ($column_name) {                 case 'xxxyyzz':                     // The code                                                  break;                       default:                     // Error                 break;             }            }     }      The error I am getting is `Warning: call_user_func_array() expects parameter 1 to be a valid callback, array must have exactly two members in xxx/wp- includes/plugin.php on line 405`. Looking deeper I found that the action `manage_posts_custom_column` is referenced in the `WP_Posts_List_Table` class that extends `WP_List_Table` and I wonder if this is the cause of the error? How do I get around this? **Edit:** Well for starters I could write the action properly!!! Instead of `add_action('manage_posts_custom_column', array($this, 'manage_post_columns', 10, 2));` it should be `add_action('manage_posts_custom_column', array($this, 'manage_post_columns'), 10, 2);`. Note the position of the `)`. :-)


how to show posts that are missing a meta_value

How can I build a query to find posts that DO NOT contain a certain meta key or meta value? for example:               query_posts( array(          'meta_query' => array(             array( 'key' => 'feature', 'value' => '_wp_zero_value', 'compare' => '!=' )         )     ) );


How to query posts from single post format on Genesis framework? I want to just show posts from **gallery post** format only. I tried this query:               <?php      $recent = new WP_Query(         "taxonomy=post-format&field=slug&terms=post_format-link&posts_per_page=5"     );      while($recent->have_posts()) :      $recent->the_post();     ?>      But I didn’t get what I wanted.


Nginx + Redirection Plugin breaks Permalinks

I'm migrating from Apache to Nginx. Everything works great, except if I have the Redirection plugin enabled. In this case, I can't access any of the pages on my site with the exception of the home page. They all return a 404 error. If I disable the plugin again, I'm able to navigate my site normally. My Nginx config is as follows:               upstream php      {         server 127.0.0.1:9000;     }              server         {             listen  80;              root    /home/clearpointccs/public;             server_name www.clearpointcreditcounselingsolutions.org clearpointcreditcounselingsolutions.org;             index    index.php;                  location /              {                    index       index.php;                  try_files $uri $uri/ /index.php;             }                          location ~\.php$             {                    include             /etc/nginx/fastcgi_params;                 fastcgi_param       SCRIPT_FILENAME     $document_root$fastcgi_script_name;                 fastcgi_pass        php;                  fastcgi_index       index.php;             }            }      I've tried to look into this, but everything else I read says the plugin is compatible with Nginx, which makes me believe it's something in my config. Any ideas? EDIT: A peek at the error logs shows the following:                14 2012/06/29 21:36:48 [error] 17279#0: *703 FastCGI sent in stderr: "ould not be called statically, assuming $this from incompatible context in /home/clearpointccs/public/wp-content/plugins/re    direction/models/match.php on line 68      15 PHP Strict Standards:  Non-static method Red_Action::create() should not be called statically, assuming $this from incompatible context in /home/clearpointccs/public/wp-content/plugins/redir    ection/models/redirect.php on line 46      16 PHP Strict Standards:  Non-static method Red_Action::available() should not be called statically, assuming $this from incompatible context in /home/clearpointccs/public/wp-content/plugins/re    direction/models/action.php on line 20" while reading response header from upstream, client: 96.228.60.10, server: www.clearpointcreditcounselingsolutions.org, request: "GET /about-us/ HTTP/    1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.clearpointcreditcounselingsolutions.org", referrer: "http://www.clearpointcreditcounselingsolutions.org/"


Locking one blog of many in a multi user/blog Wordpress installation

I have a multi user /wordpress installation that is working fine. One of the blogs running on that multi user /wordpress installation will never be updated again but I want it there for historic reasons. Is it possible to make one blog read-only even though it is on a multi user /wordpress installation and sharing a database with the other blogs? **Edit**   To make it clear; I want to freeze the entire blog including contents and users. I have implemented the suggestions given for the blog I am currently asking about since it only has 1 user, but I wish not having to delete users at a later time on other blogs i administer since then their names and timestamps would disappear from the site which is not what I want. Cheers.


Building advanced search form with option post or category

I want to give my browsers a bit more options on my search form. In my search from, there is radio buttons optioning with "Game" or "The rest of the site". If he/she chooses "Game", it search posts in the "Game" category. Or if he/she chooses "The rest of the site", it search posts/pages in the site except posts in the "Game" category. How do I do it? Cheers.


Display an archives name

I want to display the current archives name, so for the url below I could do something like this
<?php echo "answer" ?>
      which would output something like this
News
      or better yet
News: supplierName
      http://www.site.com/suppliers/news/?supplierstax=supplierName


Get closest page ID from URL

Lets say on my WordPress website I navigate to: > www.example.com/media-centre/news/17/an-example-news-post In this case I am looking at a post in a CPT called `News`. What I want to do is get the page ID thats closest to that URL. I know the closest page ID can be found at: > www.example.com/media-centre/news/ So how do I loop back over my URL to find the closest page and then how do I get the ID of that page?


Get how many days since last post of the current user

How do I get how long since current user's last published post? For example:               It has been <?php echo $days_since_last_post; ?> days since your last post      I need to use that number in a variable for a plugin I am developing. I’m looking for a solution with performance in mind.


setting website with ww

I have a project and i want to make a replica of my website, and copy over to ww.abc.com , its a wordpress site, does ww is a domain or what? should i use any plugin? Can i make a master/slave database? if i want? One database will be used by all four, www.abc.org, ww.abc.org, www.abc.info and ww.abc.info for Comments and Comment Related Data only. Setup the database for www.abc.org as the master database and comments and comment related data should update on the others from there. Comments will be places on www.abc.org and those need to be pushed out to the other sites.


Wordpress Dashboard Characters Messed Up

I recently added a new post, and afterwards, many of the text lines on the wordpress dashboard appear messed up, almost as if they are protecting from a security breach or something. ![enter image description here](http://i.stack.imgur.com/B6T4v.png) I have tried disabling all plugins, emptying the cache, using a different browser, but none of these seem to work. I am developing locally too, not sure if that has any bearing. Many thanks for any help in advance


Nginx Multisite redirects (incorrectly) on Chrome IE and Mobile, but works (correctly) on Firefox

I'm having an issue that I can't find anybody else talking about anywhere. I have a wordpress multisite setup utilizing sub-directories. It's running on Debian Squeeze, and it's powered by nginx, php 5.4, and php5-fpm. Currently I am using the batcache plugin and the advanced apc caching plugin from mark jaquith. **The Bad:** So, the problem I'm having is that when I access the site with either IE, Chrome or by mobile, it always redirects back to the root site. The only time it doesn't is when accessing wp-admin. **The Good:** The whole setup works perfect on firefox. I have ran some `curl -I` passes on the site to get the header info. Here are the results: http://pastebin.com/VryGXAAY **What I've Tried:** I have cleared the browser cache. Tried it on a different machine. And yelled at it a lot. **Here is a copy of the config files:** sites-enabled/example.com: http://pastebin.com/69xsMuwb globals/mu-dir.conf: http://pastebin.com/CSup1q1h globals/mu-files.conf:               # Rules for any Multisite install     # For uploads     if ( $uri ~ "files" ) {         rewrite ^/(?:.*/)?files/(.+) /wp-includes/ms-files.php?file=$1;     }      globals/restrictions.conf: http://pastebin.com/rhrr5Qkf globals/common-locations.conf: http://pastebin.com/GiYBRP1y Let me know what other info you might need. Any help would be appreciated! :)


Panoramica Theme Portfolio

I am using panoramica theme for my WordPress website. I want to show the portfolio with category "Meet the team" along with other post category in one page. How can it be possible. Now I am able to show the post of a specific category in one page.I need to add Posrtfolio page to this. below is the code I used to show the post of a specific category in one page.               <?php     /*      Template Name: Custom Template     */     ?>     <?php get_header();              $recent = new WP_Query("cat=4&posts_per_page=5");          while($recent->have_posts()):$recent->the_post();               the_content();               endwhile;                get_footer();     ?>


Show content based on width?

Is it possible to show content based on width of page/screen? I would like to show part of the header and footer only when the paged is shown in full width and then have it go away when used on smaller screen/mobile/pad. The best thing would be able to use a responsive theme and have areas above and below that only shows when using "full screen" = 1000px. * * * [FIXED AREA SHOWN ONLY WHEN WIDTH IS 1000+ PX] Responsive theme [FIXED AREA SHOWN ONLY WHEN WIDTH IS 1000+ PX] * * * Best regards, Mikael


Show all parts in multipage post

You can do a multipage post by using the `<!--nextpage-->` inside the post. The question is: How can I display the whole post (not paged) for this post.


Can anyone see a syntax error in this?

My hosting at wp-engine wont allow me to upload this file by git because of a syntax error. Can anybody see what the error is?               <?php     $aryWPMUConfig = get_site_option('wpmu-piwik_global-settings',false);     if (is_plugin_active_for_network('wp-piwik/wp-piwik.php') && $aryWPMUConfig) {     foreach ($aryWPMUConfig as $key => $value) {         self::$settings->setGlobalOption($key, $value);     }     delete_site_option('wpmu-piwik_global-settings');     self::$settings->setGlobalOption('auto_site_config', true);     } else {     self::$settings->setGlobalOption('auto_site_config', false);     }     self::$settings->setGlobalOption('dashboard_seo' = false);     self::$settings->setGlobalOption('stats_seo', false);     self::$settings->setGlobalOption('track_404', self::$settings->getOption('track_404'));     self::$settings->setGlobalOption('track_compress', false);     self::$settings->setGlobalOption('track_post', false);      This is update/90001.php from wp-piwik


How to rename wp-includes folder?

Is there a way that we could rename wp-includes folder I have found out there are ways to do for other folders. But how do we do it for wp-includes folder? http://pythoughts.com/how-to-hide-that-you-use- wordpress/


Javascript/jquery loads super slow (around 6 seconds) which affects only homepage

I got a custom wordpress theme from a developer but he isn't responding to me anymore. Basically my homepage takes ages to load which causes all the elements on the homepage not function until the javascript loads. I believe the problem lies within this script which is found in the `functions.php` file, I'm running wordpress 3.5. Can anyone spot some glaring issues, please help a lost soul.               function theme_init_theme() {         # Enqueue jQuery         wp_enqueue_script('jquery');              if (is_admin()) { /* Front end scripts and styles won't be included in admin area */             wp_enqueue_style('theme-custom-admin', get_bloginfo('stylesheet_directory') . '/css/admin.css', array(), '1.0');             return;         }         # Enqueue Custom Scripts         # @wp_enqueue_script attributes -- id, location, dependancies, version         //wp_enqueue_script('custom-script', get_bloginfo('stylesheet_directory') . '/js/custom-script.js', array('jquery'), '1.0');         wp_enqueue_script('jquery-flexslider', get_bloginfo('stylesheet_directory') . '/js/jquery.flexslider-min.js', array('jquery'));         wp_enqueue_script('jquery-cookie', get_bloginfo('stylesheet_directory') . '/js/jquery.cookie.js', array('jquery'));         wp_enqueue_script('jquery-colorbox', get_bloginfo('stylesheet_directory') . '/js/jquery.colorbox-min.js', array('jquery'), '1.0');         wp_enqueue_script('jquery-functions', get_bloginfo('stylesheet_directory') . '/js/functions.js', array('jquery', 'jquery-flexslider', 'jquery-cookie'));         wp_enqueue_style('googlefont-open-sans', 'http://fonts.googleapis.com/css?family=Open+Sans:400,800italic,800,700italic,700,600italic,600,400italic,300italic,300');         wp_enqueue_style('googlefont-merriweather', 'http://fonts.googleapis.com/css?family=Merriweather:400,900,700,300');         wp_enqueue_style('colorbox', get_bloginfo('stylesheet_directory') . '/css/colorbox.css', array(), '1.0', 'all');     }     add_action('init', 'theme_init_theme');     add_action('after_setup_theme', 'theme_setup_theme');


very last action before during user registration before he is redirected to homepage

I'm using wordpress social login plugin. So some of my users register via facebook. I'm trying to hook myself to user_register and display only once upon registration and upon using facebook as source some special message. Wordpress social login plugin creates meta_key Facebook if user registered via facebook. So I created this little script:               //save referral information passed from cookie: referral_user     add_action('user_register', 'register_referral');          function register_referral($user_id) {        $userdata = array();        $userdata['ID'] = $user_id;        wp_update_user ($userdata);                   //IF user there is appropriate user_meta field.         $user_origin = get_user_meta($user_id,'Facebook',true);              if ($user_origin) {           {echo 'registered via faceboook, hurey!';}         } //master if     }      Problem is `$user_origin` is never evaluated true, because when this IF statement is run `meta_value Facebook` is not Yet created! I tested it by putting break; before and checking DB for this field. So, my question is this, is there a way to move my action to be the last action upon registration of user. So that first Facebook is created by social login plugin, and than I can evaluate and run my scripts. Thanks@! Edit: Plugin doesn't use user_register hook. Greped "add_action" and got:               Sandros-MacBook-Air:plugins sandro$ grep -ir "add_action" wordpress-social-login/*     wordpress-social-login/includes/plugin.auth.php:add_action( 'init', 'wsl_process_login' );     wordpress-social-login/includes/plugin.init.php:    add_action( 'admin_init', 'wsl_register_setting' );     wordpress-social-login/includes/plugin.init.php:add_action('admin_menu', 'wsl_admin_menu' );      wordpress-social-login/includes/plugin.init.php:add_action('admin_menu', 'wsl_admin_menu_sidebar');     wordpress-social-login/includes/plugin.ui.php:add_action( 'login_form', 'wsl_render_login_form_login' );     wordpress-social-login/includes/plugin.ui.php:add_action( 'register_form', 'wsl_render_login_form_login' );     wordpress-social-login/includes/plugin.ui.php:add_action( 'after_signup_form', 'wsl_render_login_form_login' );     wordpress-social-login/includes/plugin.ui.php:add_action( 'wordpress_social_login', 'wsl_render_login_form_login' );     wordpress-social-login/includes/plugin.ui.php:add_action( 'comment_form_top', 'wsl_render_comment_form' );     wordpress-social-login/includes/plugin.ui.php:add_action( 'login_head', 'wsl_add_javascripts' );     wordpress-social-login/includes/plugin.ui.php:add_action( 'wp_head', 'wsl_add_javascripts' );     wordpress-social-login/includes/plugin.ui.php:add_action( 'login_head', 'wsl_add_stylesheets' );     wordpress-social-login/includes/plugin.ui.php:add_action( 'wp_head', 'wsl_add_stylesheets' );


woocommerce product in multiple categories navigation

I wonder if someone has an answer to this or could point me in the right direction I have a woocommerce product which resides in multiple categories like so                           /**the product categories structure is something like this**/                  (id 1)  cat-a                  (id 2)     -subcat-a-1                  (id 3)         -subcat-a-1-1                  (id 4)         -subcat-a-1-2 (product in this category)                  (id 5)         -subcat-a-1-3                  (id 6)     -subcat-a-2                  (id 7)         -subcat-a-2-1                  (id 8)         -subcat-a-2-2                  (id 9)         -subcat-a-2-3                  (id 10)        -subcat-a-3                  (id 11) cat-b                  (id 12)    -subcat-b-1                  (id 13)    -subcat-b-2                  (id 14)    -subcat-b-3                  (id 15)        -subcat-b-3-1 (same product in this category too)                  (id 16)        -subcat-b-3-2                  (id 17)        -subcat-b-3-3                          (id 18) cat-c                 .......and so forth......      i also have the woocommerce navigation menu on the product category as well as single product page. when i go to a category like                           http://www.domain.com/categories/cat-a/subcat-a-1/subcat-a-1-2       the right products gets shown and the navigation selects/shows the right subcategory. so far so good. however, when then going to a product the naviagtion on the single product page always selects the same category , regardless of where we came from so to speak. I realise that the links to products on category pages do not include the category we were coming from, so I i added the following to "archive- product.php"                           /**get currently selected category, so we can                      add cat id to product link to select appropriate                      side nav cat when selected                 **/                 global $wp_query,$msci_cat_obj;                 $msci_cat_obj = $wp_query->get_queried_object();      and this to "content-product.php"                           global $msci_cat_obj;                 /**                     some more stuff                 */                      /*changing link to add category id to url**/                 <a href="<?php the_permalink(); ?><?php echo $msci_cat_obj->term_id; ?>" title="<?php the_title() ?>">                 /**                     even more stuff                 **/      which now gives me a url to the product like so                           http://www.domain.com/product/example-product/4/                 and                 http://www.domain.com/product/example-product/15/      respectively depending on which (sub)category I am in. obviously , when now going to the respective product page by using aforementioned links i can explode (or whatever) the url to just get the category id I came from. What I do _not_ know (and have tried from days to figure out ) is how to use this id to persuade the navigation to set this category to be selected in the navigation on the single product page and not always the same one. Any hints/suggestions/links much appreciated.


Can I connect a page to a taxonomy?

I'm creating a website for a soccer club. It has news, reports and media custom post types. There you can connect the post to the Team taxonomy. But I also need to have a page for that team where I can add info, team photo etc. Can I connect a page to a certain taxonomy? For example I got a page called "Team 1" and connect that to the taxonomy term "Team 1"? If not what is the best option?