title: Wordpress for questions and responses website

text: I am using Wordpress to create a Q&A website. The question is returned by `the_content.` If I store the answers as post meta field array:               {           [1] => 'first answer',           [2] => 'second answer',           [3] => 'third answer',           .....           }      How can I create separte comments for each item (comments for question, then comments for first answer, then comments for second answer....)? Noramlly, I use `<?php comments_template( '', true ); ?>` which creates comments relative to `the_content`. If I reuse it, it will display a new comment for all the items. `comments_template` doesnt have a pramater to identify a list of comments against other lists.


title: Echo number of all users (subscribers, contributors, authors, etc.) whom have posted at least once

text: Hopefully quite an easy question for you code-savvy ladies and gents today: how would one go about echoing the precise number of registered users on a WordPress blog whom have successfully published at least one post (discounting pending, drafts, etc.)? Subscribers are able to publish posts on my blog, and there's a terrific number of new members joining and new posts being generated daily, so manually updating the number would be a bit tricky (hehe). I'd love to be able to just plonk a somewhere in the sidebar, but, given my limited knowledge of PHP, I'm at my wit's end as to how to accomplish this. Thanks for any and all help, guys. Cheers!


title: get all sub categories without specify any category

text: I have 2 levels of categories ( one sub-category only. No `sub-sub` category ). I need to get all sub categories without parent category. (I don't want to specify any parent category.) Example:               p_cat1        s_cat1        s_cat2     p_cat4     p_cat3        s_cat4        s_cat5        s_cat7      from here, I need               s_cat1     s_cat2     s_cat4     s_cat5     s_cat7      And, I need there to be a URL for each of those sub-categories. I want to give `<a>` for each subcategory. How do I do that?


title: Multiple post types on a grid (every nth post must be a specific post type)

text:
I have a grid where I display multiple posts types. I need to lay out the grid making sure that I have 2 posts from one post type, followed by 4 posts from another, flowing continously thereafter. In addition, every post type needs to use a different class (for box size) on the grid. Such as:
         1st post (must belong to post type 'movies')

         2nd post (must belong to post type 'movies')

         3rd post (must belong to post type 'artists')

         4th post (must belong to post type 'artists')

         5th post (must belong to post type 'artists')

         6th post (must belong to post type 'artists')
           This is what I have so far; I have managed to lay them out the way I want (visually), but I can't find a way to make sure I have the right post type in the right position:               // http://wordpress.stackexchange.com/questions/53194/wordpress-paginate-wpdb-get-results     $grid_items = "       (SELECT *          FROM wp_sorter_items          WHERE area_id = 1          AND active = '1'          ORDER BY item_order ASC     )";          if ( $grid_items ) {          $total = $wpdb->get_var( "SELECT COUNT(1) FROM (${grid_items}) AS combined_table" );     $items_per_page = 12;     $page = isset( $_GET['page'] ) ? abs( (int) $_GET['page'] ) : 1;     $offset = ( $page * $items_per_page ) - $items_per_page;     $latestposts = $wpdb->get_results( $grid_items . " ORDER BY item_order ASC LIMIT ${offset}, ${items_per_page}" );          $counter  = 0;          foreach( $latestposts AS $grid ) {          $post = get_post( $grid->item_post_id );     setup_postdata( $post );              if ($counter % 6 == 0 || $counter % 6 == 1){             $grid_type = "big";         } else {            $grid_type = "small";         }              // including the template so I can have pagination         include(locate_template('templates/loop-home.php'));              $counter ++;      }         How can I make sure the big ones are `post_type=movie` and the small ones are `post_type=artist`? Any help would be much appreciated. Thanks in advance.


title: custom url - add attachment's id or name after post

text: I want to link to attachments but through its parent page. /directors/piranha-bar/ shows all of that post's attachments on single.php and i want /directors/piranha-bar/video/name-or-ID/ to still use single.php but have the variable $video captured. How can i firstly make the links on the attachments into this format? Then get wordpress to recognise this url, get the variable and go to single.php? hope that's clear! best, Dc


title: How can I create post templates that users can choose from?

text: I have created a user driven site for the Talmud. I have made a couple posts and would like other users posts to look the same. I'm not talking about the actually page, just the post content. I would like to create templates that the users can choose from that look exactly my post and they can then just insert their own text their. Is this possible? And if its is how would I do it.


title: Plugin redirects URL structure using 301 redirect. Time to disable the plugin?

text: I have been using a plugin that goes by the name "Permalink Redirect." This WordPress plugin redirects older permalinks to the newer one set by me. Old URL structure: /%year%/%category%/%postname%.html New URL structure: /%category%/%postname%/%post_id%/ All the posts with the older URL structure are redirected to newer ones using 301 redirects. Now it has been months since I implemented this, and Google doesn't index the older URL structure anymore -- newer ones are visible in Google index. I was wondering if it's the right time to disable the plugin? I am doing this because I have seen constant dip in the traffic -- Google doesn't like 301 with another 301 redirect, or so I read. (I also use another plugin for custom redirecting of broken URLs.) I implemented this plugin back in May, 2011. Is it okay to deactivate the Permalink Redirect plugin? I'm worried if this is the right move. My site: http://blogote.com -- I have deactivated the plugin just now. Edit: Plugin activated; over 1200 inbound URLs are removed and replaced with newer URLs.


title: How to accomplish a child page navigation?

text: I'm not finding any info on this, so I'm probably wording it incorrectly in my search. So I'm hoping someone can point me in the right direction. I have 50 pieces of content that'll be going on my wordpress site. Each piece of content will be broken down into 5-6 pages (each). So I made a custom page template for this. My goal is to have a navigation that shows the child pages, so users can click through them easily to reference different sections of the content. But I don't want to do this manually per page. I've tried searching for child-page navigations and the best I've come up with is a plugin that just lists the child-pages. This wont work because even on the child pages I want the navigation to show. Any direction would be extremely helpful.


title: append PHP function to the_content

text:
I'm using the Jetpack plugin for related items and social sharing. Both of these options filter the_content and append themselves to the end of it. The problem is that I'm using custom navigation in my posts which I output by using this code above and after `the_content` in my `single.php`.
           <?php multipagebar(); ?>
             <?php TA_content_jump(1); ?>

        I know that to append something to the_content I can use a filter:               add_filter('the_content', function($content)     {         return 'text-to-append' . $content;     });      My question and problem is: how to append the navigation PHP functions so that they display before the related and social sharing items of Jetpack?


title: get_post_meta in WP_Query

text:
I'm doing a plugin to add likes to posts I want to create a table on a page in the plugin to show each post and the number of likes               function my_plugin_options() {              echo '
Table of Likes
';         echo '
';              echo '
';       echo '
';       echo 'Post	';       echo 'Number of likes	';       echo '
';              // -- WP_Query --               $like_args = array(             'post_type' => 'post',             'order' => 'DES',             'post_status' => 'publish'         );              $like_loop = new WP_Query($like_args);              if($like_loop->have_posts()):             while($like_loop->have_posts()):                 $like_loop->the_post();              // -- WP_Query --                    $likes = get_post_meta( $like_loop->post_ID, "_like_amount", true);                   echo '
';         echo '';         the_title();         echo '	';         echo '';         $likes;         echo '	';         echo '
';              endwhile;         endif;              wp_reset_postdata();              echo '
';     }      I have a meta field in each post '_like_amount' that is the number of likes. How do I use get_post_meta to retrieve the meta field in my `WP_Query` loop? I've tried               $likes = get_post_meta( $like_loop->post_ID, "_like_amount", true);      But it fails


title: Using css class selectors on a specifc page

text: I'm trying to position images next to several bullet lists in such a way the global default doesn't achieve so in my style.css file for the child theme I have my selector as .activities img{ code here; } then on the page I'm applying it to I find an img tag make it look like               <img class="activities" src"linktoimage.png"/>      When I refresh nothing happens to the image. I've tried using ID instead of class and putting the image within a DIV that uses the selector none of which has any effect. I'm possibly doing it wrong so any help would be appreciated thanks


title: can i create 2 blog 'feeds' within one blog

text: Right now by blog has the 'home' section where all my new posts go, and 'pages' sections which are static pages that i can edit. my question is, can i have another section that will behave like the 'home' link? for example, can i have a page called 'cars' and a section called 'cats', where i can add new posts to either section? if this is not possible, what are some workarounds? **edit:** i dont want the blog homepage to contains ALL stories, i want it to contain all stories under the cat category, and the 'car' page contain all the posts under 'car' category. in essence, it will be like i have 2 different blogs under a single blog


title: How can I find the 'public absolute' path of a file?

text: **Short Version** I need to give in the absolute path of a Javascript file that is to be hooked into something. It works if I hardcode it into 'http://mywebsite.com/folder/script.js' However I prefer not to hardcode it in. I can do `dirname(___FILE___)`, which gives me this: '/home/public_html/folder/script.js' But that fails, the script isn't loaded. What's the best practice to find the absolute path (starting with 'http://')? - **Long Version** On this page in the Wordpress documentation relating to the tinyMCE plugin creation, I found this:               // Load the TinyMCE plugin : editor_plugin.js (wp2.5)     function add_myplugin_tinymce_plugin($plugin_array) {        $plugin_array['myplugin'] = URLPATH.'tinymce/editor_plugin.js';        return $plugin_array;     }      There's a note at the bottom saying: > Note: when using the mce_external_plugins filter, the url should point to > the actual plugin file, as in the example above. A bit higher in the documentation they say > mce_external_plugins: passes in/out an associative php array 'plugin_name' > => 'plugin_url'. The url should be absolute and on the same domain as your > WordPress installation. I am completely puzzled because I can't find any information about **'URLPATH'** which is used in their example. I don't think it exists in PHP, WP or TinyMCE, but I could be wrong. Incidentally, were this to be an error in the WP documentation, what would I replace URLPATH with to make it work?


title: Grab Wordpress Salt Data From URL

text: I'm looking to grab only the values of the Wordpress salt information from this URL with PHP: https://api.wordpress.org/secret-key/1.1/salt I want to target the second set of values within single quotation marks. Is this do-able with regex? I'm having issues               $url = 'https://api.wordpress.org/secret-key/1.1/salt';          $ch = curl_init();          curl_setopt($ch, CURLOPT_POST,1);     curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_data));     curl_setopt($ch, CURLOPT_URL,$url);     curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);          $output= curl_exec($ch);     preg_match_all("/'(.*?)'/", $output, $matches, PREG_PATTERN_ORDER);     var_export($matches);      I'm working on a tool that will automatically grab the content from the url, strip out everything except for the values of the defined keys and return it in an array. It seems to mess up alot and doesn't bring back the proper values, is there any other way to target the defined values only from the second set of quotation marks? Thanks


title: What level of permissions should the plugins folder be set to?

text: I am on a (non-hosted) server...what level of permissions should my plugins folder (and everything inside of it) be set to? I seem to be having issues deleting or moving files inside of this folder...


title: Remove [ and ] from excerpt

text: I am displaying the wordpress posts on the index page with:               <?php the_excerpt(); ?>      In my functions.php file I have following code:               add_filter('excerpt_length', 'my_excerpt_length');     function my_excerpt_length($length) {     return 30; }      This works fine but it shows `[...]` at the end of excerpt. I want to remove these `[` and `]` and instead I want to show only three dots `...` . How can i do that? Thanks.


title: Enclosures being deleted "automatically"

text: I am using PowerPress for my podcast support. I am working on some things on the web site and I swear, I set the enclosure, verify via phpMyAdmin that it is there. I don't touch anything on the site and check minutes later and the enclosure is missing. Huh?!? Does anyone have any ideas where to start looking? I am running my own server on Ubuntu 11.x. I am using Apache for my web server.


title: How to use is_active_widget?

text:
This is the manual page and this is the code. But I'm still struggling to understand how to use this function. Perhaps I am using it right, but something I can't think of is wrong. But more surely, I need to know what this means:   1. `callback` - I assumed this was the name of the Widget class. Am I right?   2. `widget id`, what is this?   3. `id base`, what is it?   4. _Whether to check in`wp_inactive_widgets`._ What is `wp_inactive_widgets`? I really feel like the manual isn't explaining these things. Here's something that I put together which does not work:               function cbs_register_widgets() {         register_widget( 'cbs_map_widget' );     }          add_action( 'widgets_init', 'cbs_register_widgets' );          function cbs_enqueue_resources() {              if ( is_active_widget( 'cbs_map_widget' ) ) {             wp_enqueue_script( 'fancybox-js', plugins_url( '/fancybox/jquery.fancybox-1.3.4.pack.js', __FILE__), array( 'jquery' ), '1.3.4' );             wp_enqueue_style( 'fancybox-css', plugins_url( '/fancybox/jquery.fancybox-1.3.4.js', __FILE__ ), '', '1.3.4' );         }              wp_enqueue_script( 'cbs-widgets-js', plugins_url( '/js/cbs-widgets.js', __FILE__ ), array( 'jquery' ) );         wp_enqueue_style( 'cbs-widgets-css', plugins_url( '/css/style.css', __FILE__ ) );          }          add_action( 'template_redirect', 'cbs_enqueue_resources' );      The enqueueing in itself works, it is the `is_active_widget` that doesn't work. The widget itself works too, and displays correctly. Just the fancybox js that's missing. Here's my implementation of one of the answers I got below, it does not work either:               class cbs_map_widget extends WP_Widget     {         function cbs_map_widget()         {             $ops = array('classname' => 'cbs-map-widget', 'description' => 'Visar en karta över Chalmers område där lokaler som används av Sällskapet har markerats.');                  $this->WP_Widget('cbs-map-widget', 'CBS kartwidget', $ops);         }              function widget($args, $instance)         {             extract($args);                  echo $before_widget;                  echo '
text
';             echo '';                  echo $after_widget;                  add_action('wp_enqueue_scripts', array(&$this, 'js'));         }              function js()         {             if ( is_active_widget(false, false, $this->id_base, true) ) {                 wp_enqueue_script( 'fancybox-js', plugins_url( '/fancybox/jquery.fancybox-1.3.4.pack.js', __FILE__), array( 'jquery' ), '1.3.4' );                 wp_enqueue_style( 'fancybox-css', plugins_url( '/fancybox/jquery.fancybox-1.3.4.js', __FILE__ ), '', '1.3.4' );             }         }          }


title: Dash or underscore in theme folder name?

text: I'm confused and I didn't find any answer by Googling. My theme files such as `single.php` or `header.php` reside in a folder. Should I use dashes or underscores in the folder name? My web server run on Linux / Apache and I'm not sure what the consequences are regarding folder names. So should I prefer something like `my_wordpress_theme_folder` over `my-wordpress-theme-folder` or are both equally valid?


title: How to change title "Search Results for:...." in search results page of genesis?

text: I want change title "Search Results for:...." in search results page because i want translate to Vietnamese. I use Genesis. Please help me!!


title: How to show dynamic side bar on menu item

text:
I want to show dynamic sidebar content on menu item (within `<li></li>` tag) but unfortunately sidebar content show top of `<nav></nav>` tag, i mean top of the menu and where i call dynamic side bar here show result 1. I don't find any suggestion related this problem. So please, any one can help me. Thank you. here is my menu code               1. Menu code:                                                               <?php                              if(has_nav_menu('primary-menu')){                               wp_nav_menu( array('menu' => 'primary-menu' ));                             } else {                                 $pages = wp_list_pages('sort_column=menu_order&title_li=&echo=0');                                 $pages = str_replace(array('
', '
'), '', $pages);                                 echo "
".$pages."

";                             } ?>                                       2. dynamic side bar adding code:              add_filter('wp_nav_menu_items', 'your_custom_menu_item', 10, 2);              function your_custom_menu_item($items, $args) {             if ($args->menu == 'primary-menu') {                 return $items .= '
What is blank         '.dynamic_sidebar('Mega Menu').'

                     <form role="search" method="get" class="search-form" action="'.home_url( '/' ).'">                         <input type="search" class="search-field" placeholder="Search …" value="" name="s"/>                         <input type="submit" class="search-submit postfix" value="Search" />                     </form>

';             }             return $items;         }          3. Result code:
What is blank1


title: How to show tags in posts with a theme that does not do it

text: For my wordpress site I bought a theme, but I discovered later that this particular theme does not show posts' tags (in posts' pages). Is it possible to force the theme to show tags in posts ?


title: pre_get_posts redirecting

text: Is there any possibility to redirect visitors to home page, for example, if they aren't allowed to view page's/post's content, using pre_get_posts action? I'm trying to develop a simplified membership plugin and I want to test if current_user/ current_visitor is allowed to view the content of page/post. For that, I want to retrieve the queried post id from wp_query and test if user/visitor can view the content he asked for. If he can't, I want to redirect him to an error page. I'm also using classes to encapsulate a little bit data. Here's a piece of code:               class Public {         public function __construct() {             add_action('pre_get_posts', array($this, 'try_redirect'));         }              private function try_redirect() {             wp_redirect( home_url() ); // doesn't work         }     }      If this isn't possible can you bring me another idea? Thanks!


title: How Does Wordpress Remember Metabox Positions?

text: I was wondering how Wordpress remembers the position of metaboxes: session basis, user basis, computer basis? Does it set a cookie? Is it saved in the database?


title: Filter the_content to add something before each <h1> element?

text:
I'm looking for a clean way of filtering the_content to add a piece of code before each H1 tag present in it. In fact, I have a long privacy policy text and I want to add a back to the top link before each paragraph. Of course, I could easily add these in the content editor but I don't want my customer to be able to remove it accidentally. So I have something like :
BLA BLA BLA

A very interesting piece of text here...

BLA BLA BLA

A very interesting piece of text here...

BLA BLA BLA

A very interesting piece of text here...
      and I want to filter it to get :               Back to the top
BLA BLA BLA

A very interesting piece of text here...
     Back to the top
BLA BLA BLA

A very interesting piece of text here...
     Back to the top
BLA BLA BLA

A very interesting piece of text here...
      Thanks in advance for your time. Cheers, J.


title: Add default WordPress tag meta box to User Profile

text: I've set up my user profiles to allow custom taxonomies following this tutorial. Ideally, I'd like to use the default Tag meta box from the Post screen, so users can easily add new terms and find commonly used ones. I'm currently using a checkbox list, but this could get very long as we'll have a number of taxonomies. Could I somehow use the `post_tags_meta_box()`? I've looked into `add_meta_box()` but that doesn't work on `'user'`.


title: the loop - how to control whether wp or plug-in runs it

text: I have a problem with the loop running on two instances with thecartpress plugin. Im not great with php by any standards but can usually get things done, however with wordpress im fairly new. Is there a way to have my plugin control the loop for just my catalog page and have wordpress ignore it? i hope im not being to vague. THIS IS ALL CODE FROM PAGE.PHP IN MY THEME                       <?php                  global $projectTheme;                      get_header();                  ?>                       <?php get_template_part('theloop'); ?>                  <?php comments_template(); ?>                  <?php get_template_part('navigation'); ?>                              <?php get_footer(); ?>      THIS IS THE ONLY HTML ON THE CATALOG PAGE CREATING THE DUPLICATION                                 [tcp_list id="all_products"]      That is shortcode from the tcp (thecartpress plugin) Now this plugin is great, it gives you options for theme compatibility, asking how to display things in your catalog, and whether to let your theme control the loop, or use their configurable loop, however i have exhausted every bit on settings within their control panel and none of their settings effect this. I believe anymore its something with their shortcode, which is done by using a shortcode generator they supply with the plugin. I feel as though my theme runs this shortcode, and their plugin as well no matter how i set it, causing a double loop?


title: Error when installing theme - "failed to open stream: No such file or directory in..."

text: I'm trying to upload and install a custom theme, and have encountered an error I've not seen before. > Warning: copy(/home/content/38/7184638/html/wp- > content/upgrade/SEWS_theme1/SEWS_theme/img/border.png) [function.copy]: > failed to open stream: No such file or directory in > /home/content/38/7184638/html/wp-admin/includes/class-wp-filesystem- > direct.php on line 200 > > Warning: copy(/home/content/38/7184638/html/wp- > content/upgrade/SEWS_theme1/SEWS_theme/img/border.png) [function.copy]: > failed to open stream: No such file or directory in > /home/content/38/7184638/html/wp-admin/includes/class-wp-filesystem- > direct.php on line 200 > > Could not copy file. /home/content/38/7184638/html/wp- > content/themes/SEWS_theme/img/border.png Theme install failed. I'm not at all sure what that means, any ideas what the problem could be?


title: Dynamically pull the correct email address from a match

text: Here's my current function,                class emailer {       function notifyHeart($post_ID)  {         $interests = get_user_meta(get_current_user_id(), 'interests');         $post = get_post($post_ID);              foreach($interests as $interest) {           if(has_tag($interest, $post)) {             $to = get_the_author_meta( 'user_email', get_current_user_id() );               $email = $to;             mail($email, "An article about Heart", 'A new post has been published!');             break;           }         }       }     }     add_action('publish_post', array('emailer', 'notifyHeart'));      So far it only works with one user, the other user isn't receiving an email when there's a tag from post that match their interest. Ideally, I would like to retrieve an email only when a user's $interest matches a tag from a post, then the appropriate email address will be selected and sent.


title: wp_insert_term doesn't work with custom post type's taxonomy

text: Here is the problem I am having:   1. I have a custom post type called "weddingguests"   2. This custom post type "weddingguests" has a custom taxonomy, "friendsof", hierarchic   3. I want to programmatically insert into this custom taxonomy "friendsof" 2 terms: "Friends of the Bride" and "Friends of the Groom" Here is the function and the action I am using to insert one term:               // programatically add 2 terms to the taxonomy "FRIENDS OF"     function example_insert_category() {         wp_insert_term(             'Example Category',             'friendsof'         );     }     add_action( 'after_setup_theme', 'example_insert_category' );      The problem: wp_insert_term doesn't appear to be working with my custom taxonomy What I have tried:   1. I have tried switching the taxonomy from hierarchic to non-hierarchic - that didn't work   2. I have tried using wp_insert_term (the same code) to add terms to the post "category" - that is working   3. I have tried assigning the custom taxonomy "friendsof" to the posts and then add my term ( I thought there is a problem with the way I am building my custom post types) - that didn't work


title: Media not found / Convinced it's a install issue

text: Used auto installer through my host account and WP installed fine. This install is to an add-on domain under my already running account. In short I already have another site up and running fine under this hosting acct. It's NOT a WP site. Again, followed normal install instructions and choose default options to install this new WP site. Fast fwd to adding media (pics) to a new page and I get this error : It looks like nothing was found at this location. Maybe try a search? I’ve chased different solutions regarding permalinks, file permissions and even did a manual WP install resulting in the same issue. Now here’s why I think the issue has something to do with my install. I have another account with the same hosting Co. It’s not running a site at all. When I attempt to install WP to this account everything works fine as expected. Using this acct I can add media crap until I’m blue in the face and it works just fine. At this point I’m suspicious of how WP may be stepping on the .htaccess at the top level of my already running (non-wp) site. Can anyone please help me get past this bump in the road by either offering up a solution or pointing me to an already resolved topic that I may have overlooked? I’ve exhausted my resources at this point.


title: Permalinks of archive tag wordpress

text: I try to add link of tag archive in text that contain tag. For example:- if i have tag that name "football" and in single.php i display the content like "the_content();", So now when article have word like " football " it must be add link to get me all article have word " football ". I do this function, but i need the the link of tag archive ???               function tag_content_replace($post_content) {        global $wp_query, $post;             if (!is_single() ) return $post_content;       $content_with_tags_link = $post_content;           $posttags = get_the_tags();      if ($posttags) {        foreach($posttags as $tag) {        $tag_name = ' '.$tag->name.' ';       $link_ = ' name.'">'.$tag->name.' ';       $content_with_tags_link =  str_replace($tag_name , $link_ ,$content_with_tags_link)  ;             }     }               $content_with_tags_link = preg_replace('//', '', $content_with_tags_link);                return  $content_with_tags_link;     }


title: Categories to be added by users but kept pending till approved

text: I want Categories to be added by users OR contributors but kept pending till approved by admin. I need this feature in my hindi poems publishing wordpress blog


title: Importing Data from a Non-WordPress database, into WP

text: I'm migrating data from a totally different database style into WP. The main issue I'm trying to wrap my head around is how to import any meta data, given that WP uses a `key` `value` pair style for meta tables. Is there a way to import column data as `key` `value` pairs?


title: Get only last child category link of products

text: At the moment i have this code:               $collections = get_the_terms( $post->ID, 'product_cat' );          foreach( $collections as $collection ) {         $link = get_bloginfo( 'url' ) . '/' . $collection->slug . '/';         echo $link .'  ';     }      That outputs a product terms, taxanomies url of products. Problem is that code returns all of categories for one product like: http://www.rebella.lv/aizsardzibu-no-saules-iedarbibas/ http://www.rebella.lv/dzilu-kondicionesanu/ I need only to show last child one category of products for example only one from list: product_cat. Here is final working code:               $terms = wp_get_object_terms($post->ID, 'product_cat', array('orderby' => 'term_id', 'order' => 'ASC') );     if ( !empty( $terms ) ) :     $project = array();     $project_url = array();     foreach ( $terms as $term ) {         $project[] = $term->name;         $project_url[] = $term->slug;     }     echo '<category_full>' .$project[0] . ' >>'. $project[1]. ' >>'. $project[2]. '</category_full><category_link>' . get_bloginfo( 'url' ) . '/product-category/' . $project_url[0].'/'.$project_url[1].'/'.$project_url[2] . '/' . '</category_link>';     endif;


title: Return Attachments from Custom Post Type

text:
I'm a fairly new WP developer. I am trying to get my `portfolio.php` to display all images attached to my custom post type 'portfolio', and then display them in a masonry format. I've managed to get them to show without the `$post->post_type` query, but not much success when trying to limit WP to retrieving images attached to my custom post type. Any help will be much appreciated, and thanks in advance!                   <?php get_header(); ?>
         <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>         <?php if ( $post->post_type == 'portfolio'  ) {         $attachments = get_posts( array (             'post_type' => 'attachment',             'numberposts' => -1,             'post_parent' => $post->ID         ) );               if ( $attachments ) {     foreach ( $attachments as $attachment ) {         $imgurl = wp_get_attachment_url ($attachment->ID);                 echo '
';                 echo '';                 echo '
';             }              }     }         ?>
         <?php endwhile; endif; ?>         <?php get_footer(); ?>      As requested, my solution. Not very elegant, but it works:                   $query = new WP_Query( array( 'post_type' => 'portfolio', 'posts_per_page' => -1 ) );         if( $query->have_posts() ){             while($query->have_posts()){                 $query->the_post();                 $image_query = new WP_Query( array( 'post_type' => 'attachment', 'post_status'         => 'inherit', 'post_mime_type' => 'image', 'posts_per_page' => -1, 'post_parent' => get_the_ID(), 'order' => 'DESC' ) );         while( $image_query->have_posts() ) {             $image_query->the_post();             $imgurl = wp_get_attachment_url( get_the_ID() );             echo '
';             echo '';             echo '
';         }     }      }


title: Extending WP_Widget throws error when Monster Widget used

text:
I wanted to override the output for the core Recent Comments Widget. I extended `WP_Widget_Recent_Comments` made the changes needed and it displays exactly how I want. However, I have now tested the theme with Monster widget, and for where the Recent Comments widget should be output an error is thrown:               Notice: Undefined index: WP_Widget_Recent_Comments in /Users/tfisher/Sites/mysite/dev/wp-includes/widgets.php on line 1319      Can't figure out why it would only throw an error when used by Monster Widget. Here's my extension class:               Class My_Recent_Comments_Widget extends WP_Widget_Recent_Comments {              function widget( $args, $instance ) {             global $comments, $comment;                  $cache = wp_cache_get('widget_recent_comments', 'widget');                  if ( ! is_array( $cache ) )                 $cache = array();                  if ( ! isset( $args['widget_id'] ) )                 $args['widget_id'] = $this->id;                  if ( isset( $cache[ $args['widget_id'] ] ) ) {                 echo $cache[ $args['widget_id'] ];                 return;             }                  extract($args, EXTR_SKIP);             $output = '';                  $title = ( ! empty( $instance['title'] ) && isset($instance['title']) ) ? $instance['title'] : __( 'Recent Comments', 'mysite' );                  /** This filter is documented in wp-includes/default-widgets.php */             $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );                  $number = ( ! empty( $instance['number'] ) && isset($instance['number']) ) ? absint( $instance['number'] ) : 5;             if ( ! $number )                 $number = 5;                  /**              * Filter the arguments for the Recent Comments widget.              *              * @since 3.4.0              *              * @see get_comments()              *              * @param array $comment_args An array of arguments used to retrieve the recent comments.              */             $comments = get_comments( apply_filters( 'widget_comments_args', array(                 'number'      => $number,                 'status'      => 'approve',                 'post_status' => 'publish'             ) ) );                  $output .= $before_widget;             if ( $title )                 $output .= $before_title . $title . $after_title;                  if ( $comments ) {                 // Prime cache for associated posts. (Prime post term cache if we need it for permalinks.)                 $post_ids = array_unique( wp_list_pluck( $comments, 'comment_post_ID' ) );                 _prime_post_caches( $post_ids, strpos( get_option( 'permalink_structure' ), '%category%' ), false );                      foreach ( (array) $comments as $comment) {                     $output .= '
';                     if(get_avatar($comment)) {                         $output .= '
';                         $output .= '';                         $output .= get_avatar( $comment, 100 );                         $output .= '';                         $output .= '
';                         $output .= '
';                     } else {                         $output .= '
';                     }                     $output .= sprintf(_x('%1$s on %2$s', 'widgets'), get_comment_author_link(), 'comment_ID) )) . '">';                     $output .= get_the_title($comment->comment_post_ID) . '';                     $output .= '
'; // content                     $output .= '
'; // item                 }             }             $output .= $after_widget;                  echo $output;             $cache[$args['widget_id']] = $output;             wp_cache_set('widget_recent_comments', $cache, 'widget');         }     }


title: Can't seem to attach uploaded image to post and set it as thumbnail

text: I'm using this code to submit a post form and upload an image which I want as the post thumbnail. Everything submits perfectly and the image even uploads but I can't seem to figure out how to attach the image to the post and set it as the post thumbnail automatically. Any help would be greatly appreciated.               <?php          $postContentError = '';          if ( isset( $_POST['submitted'] ) && isset( $_POST['post_nonce_field'] ) && wp_verify_nonce( $_POST['post_nonce_field'], 'post_nonce' ) ) {          if ( trim( $_POST['postContent'] ) === '' ) {         $postContentError = 'Please enter a description of this property.';         $hasError = true;     }          $random = rand(1000000, 9999999);          $post_information = array(               'post_name' => sanitize_title( date( 'YmdHis' ). '-' . $random),         'post_title' => 'Property '.date( 'YmdHis' ). '-' . $random,         'post_content' => $_POST['postContent'],         'post_type' => 'properties',         'post_status' => 'publish'     );          $propertyfor = $_POST['propertyfor'];     $propertytype = $_POST['propertytype'];     $bedrooms = $_POST['bedrooms'];          $post_id = wp_insert_post($post_information);          function upload_user_file( $file = array() ) {           require_once( ABSPATH . 'wp-admin/includes/admin.php' );           $file_return = wp_handle_upload( $file, array('test_form' => false ) );           if( isset( $file_return['error'] ) || isset( $file_return['upload_error_handler'] ) ) {               return false;           } else {               $filename = $file_return['file'];               $attachment = array(                   'post_mime_type' => $file_return['type'],                   'post_title' => preg_replace( '/\.[^.]+$/', '', basename( $filename ) ),                   'post_content' => '',                   'post_status' => 'inherit',                   'guid' => $file_return['url']               );               $attachment_id = wp_insert_attachment( $attachment, $file_return['url'], $post_id );               require_once(ABSPATH . 'wp-admin/includes/image.php');               $attachment_data = wp_generate_attachment_metadata( $attachment_id, $filename );               wp_update_attachment_metadata( $attachment_id, $attachment_data );               if( 0 < intval( $attachment_id ) ) {                     return $attachment_id;               }           }           return false;     }          if( ! empty( $_FILES ) ) {       foreach( $_FILES as $file ) {         if( is_array( $file ) ) {           $attachment_id = upload_user_file( $file );         }       }     }          if($post_id) {         // Update Custom Meta         update_post_meta($post_id, 'shru_price', esc_attr(strip_tags($_POST['shru_price'])));         update_post_meta($post_id, 'shru_address', esc_attr(strip_tags($_POST['shru_address'])));              wp_set_object_terms( $post_id, $propertyfor, 'propertyfor' );         wp_set_object_terms( $post_id, $propertytype, 'propertytype' );         wp_set_object_terms( $post_id, $bedrooms, 'bedrooms' );              // Redirect         wp_redirect(home_url('/listings'));         exit;     }          }          ?>


title: Twenty Eleven black jetpack carousel gallery page. How to debug this?

text: I'm using the twenty eleven theme and I want to use the jetpack carousel for my gallery. I've activated it but whenever I click an image, the image doesn't show up. I can see that black screen with the 'WRITE A COMMENT' from the jetpack carousel but the image doesn't display. Also, whenever I try to close the carousel pop-up I can't, so the only way to get rid of it is to refresh the page. Here's my console log:               Uncaught TypeError: Cannot call method 'split' of null (index):52      Not sure how I can fix this. Any help is appreciated. Thanks!


title: Is it possible to change the CSS rules for Disqus comments?

text: I have tried everything I could come up with, including using the '!important' attribute, but have not been able to change the CSS for the Disqus comments on my site. Their CSS not only originates from a file on their website, but I think the comments are in an iframe or something, which would explain why the '!important' attribute isn't working. Is it possible to change the CSS for Disqus comments on a wordpress blog? All I want to add is the following code:               #disqus_thread {     font-family: arial;     font-weight: bold;     font-size: 13px;     }      That's it! Any help would be greatly appreciated.


title: Hiding media uploaded by other users in wordpress multisite?

text: I am using WordPress Multisite and want to hide media which others have uploaded. Like if X User of that site has uploaded any media in the site, Y User should not be able to see or access this from their login.


title: Is there an existing capability to allow editing of only pre-existing pages? If not, a good way to implement this?

text: I'm working on a setup for which I need general users to be able to edit a specific list of pages, but not create any new ones. Looking through the Codex, I don't see anything that will come close to this desired functionality, but I thought I might be looking through it. Failing a pre-set, I started looking into Advanced Access Manager, but it was not immediately obvious to me if it would do what I need. Anyone with experience with this plugin have any idea where to begin?


title: Add an access code form to call a unique page based on page without registration

text:
I've seen some other questions similar but not the totally the same. If I missed in the search, please forgive me. However this what I have so far: I've created a form that has the following: an input field for the access code and a submit button as follows:               <form action="#" method="POST" name="access">
<input id="access_code" type="Text" name="access_code" value="" /> <input type="Submit" name="access1" value="Register" />
     </form>      Then on the backend - I started with something like this:               <?php          if(isset($_POST['Register'])){          if(empty($_POST['access_code'])){     echo "Access Code Must Be Entered";     }          }          $DisplayForm = True;     if(isset($_POST['Register'])){     $DisplayForm = False;     echo $_POST['access_code'];          }          if ($DisplayForm){     ?>     <form action="#" method="POST" name="access">     <input type="Text" name="access_code" value=" " /> <input type="Submit" name="access1" value="Register" />          </form>     <?Php     }          ?>          <?php           echo "<a href="http://www.mysite.com/<?php echo $_POST['access_code'];?>""          ?>      I realize my final echo syntax is also broken. But not quite sure how to write out. I know programmer but this what I had on the simple side. All I want to do is have this form redirect a user to a custom page that's based on the access code they have been given and call it with a short code. For example if the access code is "help" they are then sent to a page of http://www.mysite.com/help or if the password is "contact" they are then sent to a page of http://www.mysite.com/contact I initially wanted to base this on the password protection feature in WordPress where if the page password was also "help" it would just redirect to that url but I may be over complicating things. **So the new code should look like this:**               if(isset($_POST['Register'])){          if(empty($_POST['access_code'])){     echo "Access Code Must Be Entered";     }          }          $DisplayForm = True;     if(isset($_POST['Register'])){     $DisplayForm = False;     echo $_POST['access_code'];          }          if ($DisplayForm){     ?>     <form action="/" method="$_GET" name="access">     <input type="Text" name="name" value="" /> <input type="Submit" name="access1" value="Register" />          </form>     <?Php     }     ?>          <?php           wp_redirect(get_bloginfo('url').'/'.$_POST['access_code']);          ?>      I think I understand it all except the execution of the before `get_header()` part. How would I do that? Sorry - I'm very new to actually programming something. I mostly just make things look pretty.


title: Using custom post types WordPress network

text: Working on a project I am setting up a WordPress network containing sites/blogs for small shops. I would like to use 2 custom post types in the following way: A location post type; The blog admin can change/add a location, which is picked by a Google Maps plugin and inserted in the main blog Google Maps (which can searched and so on...) A sale post type; the blog admin can change/add a sale item, which should be randomly shown on main blog and around relevant Google Maps results. I have been searching for an answer weither this is possible for over a week now. But I just can't believe that this is impossible to realize. Can anyone at least point me in the right direction? EDIT to clarify: I would like every site admin to add these post types and then be able to display them on the network main site.


title: Getshopped (WP-e-commerce): show all protucts on one admin page for drag-and-drop ordering

text: How I can show all my products on one page? I need drag-and-drop products from page 3 to page 1 but I can't do this over pages. Or I can use another solution for manual product sorting? ![Getshopped \(WP-e-commerce\) products](http://i.stack.imgur.com/kaJuI.png)


title: Remove action plugin

text:
i have installed the theme-my-login plugin and i want change the password_fields function: this is the code of custom-password.php of the plugin:                    /**      * Loads the module      *      * @since 6.0      * @access protected      */     protected function load() {         add_action( 'register_form',       array( &$this, 'password_fields' ) );         add_filter( 'registration_errors', array( &$this, 'password_errors' ) );         add_filter( 'random_password',     array( &$this, 'set_password'    ) );              add_action( 'signup_extra_fields',       array( &$this, 'ms_password_fields'       ) );         add_action( 'signup_hidden_fields',      array( &$this, 'ms_hidden_password_field' ) );         add_filter( 'wpmu_validate_user_signup', array( &$this, 'ms_password_errors'       ) );         add_filter( 'add_signup_meta',           array( &$this, 'ms_save_password'         ) );              add_action( 'tml_new_user_registered', array( &$this, 'remove_default_password_nag' ) );         add_action( 'approve_user',            array( &$this, 'remove_default_password_nag' ) );              add_filter( 'tml_register_passmail_template_message', array( &$this, 'register_passmail_template_message' ) );         add_action( 'tml_request',                            array( &$this, 'action_messages'                    ) );              add_filter( 'registration_redirect', array( &$this, 'registration_redirect' ) );     }          /**      * Outputs password fields to registration form      *      * Callback for "register_form" hook in file "register-form.php", included by Theme_My_Login_Template::display()      *      * @see Theme_My_Login::display()      * @since 6.0      * @access public      */     public function password_fields() {         $template =& Theme_My_Login::get_object()->get_active_instance();         ?>
<label for="pass1<?php $template->the_instance(); ?>"><?php _e( 'Password' ); ?>         <input autocomplete="off" name="pass1" id="pass1<?php $template->the_instance(); ?>" class="input" size="20" value="" type="password" />

<label for="pass2<?php $template->the_instance(); ?>"><?php _e( 'Confirm Password', 'theme-my-login' ); ?>         <input autocomplete="off" name="pass2" id="pass2<?php $template->the_instance(); ?>" class="input" size="20" value="" type="password" />
         <?php     }      in functions.php i have added this but not working:                    function init_wp() {          // remove parent theme's header content action     remove_action('register_form', 'password_fields');          // add child theme's header content action     add_action('register_form', 'cust_password_fields');               }          add_action('init', 'init_wp');          function cust_password_fields(){          }      any ideas ?


title: How would I restrict certain user levels from editing categories

text: I have a situation where I need WooCommerce product categories to be edited by an admin only. So, basically I'm looking for a way to prevent other user roles from adding, editing or deleting categories for posts.


title: First post article different on Archives template

text:
Hi I'm trying to make the first post article in the list different for the archive template. Basically they'd all be in order descending, but the first post in the list would be styled differently. Other people have said they've done it but the coding is much different and I don't know how to change the first post using the php in my theme. I want the first post to show the thumbnail and the title larger than the rest. Here is the basic code I'm using. Thanks in advance for any help!               get_header(); ?>
<?php                 if (is_day()):                     printf(__('Daily Archives: %s', 'outspoken'), get_the_date());                 elseif (is_month()):                     printf(__('Monthly Archives: %s', 'outspoken'), get_the_date(_x('F Y', 'monthly archives date format', 'outspoken')));                 elseif (is_year()):                     printf(__('Yearly Archives: %s', 'outspoken'), get_the_date(_x('Y', 'yearly archives date format', 'outspoken')));                 else:                     _e('Archives', 'outspoken');                 endif;                 ?>
                             <?php /* The loop */ ?>          <?php while (have_posts()): the_post(); ?>         <?php get_template_part('content', get_post_format()); ?>     <?php endwhile; ?>              <?php outspoken_paging_nav(); ?>                        <?php get_template_part('content', 'none'); ?>


title: Why is my custom form saving with 'autodraft' as title and slug?

text: I am currently writing a custom theme from scratch, which utilizes a number of custom post types. I am currently trying to build custom posting forms for them. I have hidden all of the normal form fields, and want the title/slug to populate based on one of the custom fields. So far, the metainformation is saving fin, but the title/slug is always 'autodraft'. Does anybody know how I might fix this? I have posted the relevant code snippets below. from functions.php               include_once( 'init/custom_post_types.php' );      from init/custom_post_types.php               function save_custom_post_form( $post ) {         if( file_exists( dirname( __FILE__  ) . '/../submission_handling/' . $_POST ['post_type'] . '.php' ) )             include_once( dirname( __FILE__  ) . '/../submission_handling/' . $_POST ['post_type'] . '.php' );     }     add_action( 'save_post', 'save_custom_post_form');      submission_handling/fixture.php (called when $_POST['post_type'] == 'fixture')               <?php     if(basename(__FILE__) == basename($_SERVER['PHP_SELF'])){exit();}          // save metainformation from custom form. This code works fine          $fixturedate = strtotime( $_POST['fixture-date'] );     update_post_meta($post, 'fixture-date', $fixturedate);     $fixturekickoff = esc_attr( $_POST['fixture-kickoff-time'] );         update_post_meta($post, 'fixture-kickoff-time', $fixturekickoff);     $fixtureoppteam = esc_attr( $_POST['fixture-opposing-team'] );     update_post_meta($post, 'fixture-opposing-team', $fixtureoppteam);     $fixturepat = esc_attr( $_POST['fixture-player-arrival-time'] );     update_post_meta($post, 'fixture-player-arrival-time', $fixturepat);     $fixtureoppteamurl = esc_attr( $_POST['fixture-opposing-team-website-url'] );            update_post_meta($post, 'fixture-opposing-team-website-url', $fixtureoppteamurl);     $fixtureaddy = esc_attr( $_POST['fixture-address'] );     update_post_meta($post, 'fixture-address', $fixtureaddy);     $fixface = esc_attr( $_POST['fixture-facebook-event'] );     update_post_meta($post, 'fixture-facebook-event', $fixface);          // Save title and slug into new post. This doesn't seem to work          if ( ! wp_is_post_revision( $post ) ){         $posttitle = array (              'ID' => $post,              'post_title' => $fixtureoppteam,              'post_name' => $fixtureoppteam,          );               // unhook this function so it doesn't loop infinitely          remove_action('save_post', 'save_custom_post_form');               // update the post, which calls save_post again          wp_update_post( $posttitle );                    // re-hook this function          add_action('save_post', 'save_custom_post_form');     }      **EDIT** Ok, with a bit of debugging, I have worked out that wp_is_post_revision( $post ) is returning the post ID of $post, which is why the post updating code is not firing. After looking at the raw database I have worked out the following. When I add a new post, TWO entries are made in the database, with statuses of 'inherit' and 'publish' respectively. It seems that $post is taking the id of the 'inherit' post, which is why `wp_is_post_revision ( $post )` is failing. The odd thing is that all those `update_post_meta ( ... )` entries are also using `$post` but the meta entries end up linked to the correct post (the 'publish' post). I still have no idea how to solve this problem without removing the `wp_is_post_revision ( $post )` check, which I don't think is a great idea.


title: Load testing for WordPress functionality

text: Does anyone know of (or have) any scripts / processes they use for testing performance under load - especially of WordPress specific behaviours, like posting many comments nearly simultaneously, while under heavy simulated traffic. I typically use apachebench to test general performance (and to make sure caching is working), but I can't see a way of testing comment and posting performance without scripting it myself. Any ideas?


title: Would switching to InnoDB from MyISAM improve performance of comments table?

text: A site I've built gets lots of comments in a short space of time - so perhaps 100 comments might be left in 5 or 10 minutes. This seems to cause a pretty heavy load on the database, especially when combined with recent comment widgets - I've seen server load rapidly spiral up to 40+, and using mtop I can see plenty of blocked queries. So, I'm using MyISAM as the storage engine, which locks the entire table for writing. Would switching to InnoDB which (I believe) uses row locking improve things? Looking at the MySQL docs, it seems perfectly possible to use both engines within the same database. So, the question: Does switching to InnoDB seem like it's a reasonable solution for what i described? Any WP specific experiences / benchmarks?


title: StackExchange clone using WordPress?

text: If you were to build a StackExchange clone site using WordPress, how would you do it?


title: Set the active Navigation Menu from a plugin

text: Is there a way to set the following option from a WordPress plugin, if you know the name of the menu you want to set: ![enter image description here](http://i.stack.imgur.com/FEbSF.jpg) My developer says it's not possible, but I am sure on of you gurus knows a way around this ;)


title: Possible to hide Page if no posts from a CPT?

text: I was thinking this would be an easy solution to accomplish, but I'm stuck since Main Pages in the Front-End are arrayed automatically. Basically I created individual pages to display specific Custom Post Type posts with different Template pages. What I want to accomplish is, if no posts were created for this specific CPT, than the page will not show in the Main Navigation links. Is this possible? Each page is using a unique URL (i.e. site.com/specials). So if no 'Special' post has been created, I do not want that page to show. Is there a function I can create to accomplish this? Thanks!


title: How to make posts appear under pages

text: I have created pages for my website, however when i create a new post, it is not assigned to any page and i am missing the option to place it under a certain page. For example i have a menu like Home Football Basketball if a user clicks on home, i would like them to see the page that i have published about home, which is static, however, when they click on basketball, they must see all relevant posts that have been made on besketball likewise for football.


title: current_page_item not being added in menu output

text: I've created a menu that I call on using following code.               <?php          wp_nav_menu( array(           'menu' => 'Primary Nav',           'container' => '',           'items_wrap' => '<ul>%3$s</ul>',           'depth' => -1           )          );      ?>      For some reason current_page_item is not output even though I'm having parent pages in the menu. I tried adding `depth` as `-1` to the arguments but it doesn't seem to have any effect.


title: Is there an alternative way to upload html without using TinyMCE?

text: I am comfortable editing HTML (I usually use Notepad++). Is there a way for me to upload HTML to my WP site without using the TinyMCE editor? I don't like how it strips tags or puts in unwanted ones. I do not know how else to modify the content of my page without using the Edit Page function in the Admin. I know there are some plugin alternatives (like TinyMCE Advanced), but I have not been able to find any information on how to use an external rich-text editor with WordPress. Thanks.


title: Saving data when javascript state changes

text: how to save data using ajax in wordpress when there is a change in javascript variable's value ? Vimeo Video State Change - http://jsfiddle.net/bdougherty/HfwWY/light/ I'm trying to save the (video finished) state for individual user to database


title: Video slideshow

text:
I have a custom post type using caroufredsel and it works alright but I´d like to add videos too. My current code is: // Initialize Slider               function ikos_slider_initialize() { ?>              <?php }     add_action( 'wp_head', 'ikos_slider_initialize' );      // Create Slider               function ikos_slider_template() {              // Query Arguments         $args = array(                     'post_type' => 'slides',                     'posts_per_page'    => 5                 );                // The Query         $the_query = new WP_Query( $args );              // Check if the Query returns any posts         if ( $the_query->have_posts() ) {       ?>

                 <?php                        // The Loop                 while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
                              <?php                           // Check if there's a Slide URL given and if so let's a link to it                     if ( get_post_meta( get_the_id(), 'ikos_slideurl', true) != '' ) { ?>                         <a href="<?php echo esc_url( get_post_meta( get_the_id(), 'ikos_slideurl', true ) ); ?>">                     <?php }                                    // The Slide's Image                     echo the_post_thumbnail('slider');                           // Close off the Slide's Link if there is one                     if ( get_post_meta( get_the_id(), 'ikos_slideurl', true) != '' ) { ?>                                              <?php } ?>
                  <?php endwhile;  wp_reset_query(); ?>

                       <?php }              // Reset Post Data         wp_reset_postdata();     }      So, I´d like to be able to add videos (youtube,wordpress,vimeo, any solution will do) I tried adding a metabox with the code found here: http://wp.tutsplus.com/tutorials/creative-coding/youtube-and-vimeo-video- gallery-with-wordpress/ but I got the player displaying errors all the time.. Is there a way to add a metabox and how to display it inside the item in the slider content? I tried pasting inside the metabox the shortcode that wordpress generates [video] but it wont work. When I save the metabox strips everything after the =. (It shows only this: [video flv=) Help please!


title: Custom Taxonomy conditionals

text: So I have setup a custom post type 'products' and custom taxonomies / categories 'defence' 'law & enforcement' and 'Commercial'. I have using the following conditional to set some specific css and the correct banner for a product:               <?php if (has_term( 'defence', 'productcat', $post->ID )) { ?>      This works fantastic if the product is in one category. Here's my problem - i have products in multiple categories so i would like a conditional to see how they got to my product page: I have a menu down the left side on taxonomy landing page and on product page, as an example lets say i have product 1 in all 3 taxonomies; down the left hand side there will be the 3 parent taxonomies with the product underneath each one as a child. What i would like to do is have a conditional to set my custom css / banner depending on where the product on the left menu is clicked; ie if product 1 under 'Defense' is click i would like to display the 'Defense' banner, same goes if it is clicked under the other 2 taxonomies. Hope this makes sense. In all honesty i don't think this is possible and products with multiple taxonomies will just have to have the default css and a rotating banner with all taxonomies which it belongs too. Your time and help with this is appreciated **Edit** Just had a thought - if i can get the taxonomies to form part of my permalink ie domain.com/products/taxonomy/product i could use               $_SERVER['HTTP_HOST'] ==


title: “Unexpected error” on update requests

text: It needs connectivity to wordpress.org and is timing out. I am behind a corporate firewall. I have never had this issue come up before in previous versions. Why does themes.php need access to wordpress.org and what can I do so it doesn't (or maybe something that will allow me to use my proxy settings). Adding in error message: > PHP Warning: An unexpected error occurred. Something may be wrong with > WordPress.org or this server’s configuration. If you continue to have > problems, please try the support forums. (WordPress could not establish a > secure connection to WordPress.org. Please contact your server > administrator.) in C:\inetpub\wwwroot\ticket\wp-admin\includes\theme.php on > line 298 This is definitely new to 3.7. We have 3.6.1 installed 4-5 times and no issues. I would have people chopping off my head if they couldn't change their theme. **Update:** 3.8 fixed a lot of the major issues. However we still cannot find plugins, find themes or get and of the dashboard feeds. If anyone has a solution to these - even if it a suggestion for the proxy server, that would be helpful.


title: Extract image from content and set it as the featured image

text: **The problem:**   I'm posting from the Wordpress iPhone app. When adding an image, the image shows up in the description itself, which I don't like. **What I'm trying to do:**   Remove the image from the description and do one of the following (don't know the benefits of one option over the other):   1. Get the image source from the removed image and add it to a custom field. -OR-    2. Set the image as the featured image  I figure either one of those options would help me to isolate the image URL for use in my post templates. **What I've tried:**   Literally everything under the sun. Right now I'm adding code to functions.php but would eventually like to make this a plugin. I think the code below is way off, but I want to post it to show some of the attempts I've made: I've added an action to run a function mpb_remove_post_image on content_save_pre ...               add_action('content_save_pre', 'mpb_remove_post_image');      Problem with that is I don't have access to the post_id (which I need in order to set the featured image) using content_save_pre so I have to get the image url and look for a post with the guid equal to the image src...               function mpb_remove_post_image( $content ){              // strip slashes, I guess we need to readd slashes when we're done?         $content = stripslashes($content);              // get the first image src         $image_src = get_first_image($content);              // if there's an image src we can jam         if(!is_null($image_src)){                  global $wpdb;                  // query the db for an attachment with this image             //$thumb_id = $wpdb->get_var($wpdb->prepare("SELECT DISTINCT ID FROM $wpdb->posts WHERE guid='$image_src'"));             $result = $wpdb->get_results("SELECT ID, post_parent FROM {$wpdb->posts} WHERE guid ='$image_src'");                  $thumb_id = $result[0]->ID;                      $post_id = $result[0]->post_parent;                  // set the featured image             mpb_set_featured_image($thumb_id,$post_id);             // update_post_meta( $post_id, '_thumbnail_id', $thumb_id );              }              // remove any images in the content         $content = preg_replace("/<img[^>]+\>/i", "", $content);              $content = addslashes($content);              return $content;     }      the code above references this function I wrote to get the image...               function get_first_image($html){              require_once('simple_html_dom.php');              $post_dom = str_get_dom($html);              // get the first image         $first_img = $post_dom->find('img', 0);                 // if any images then return the src attribute         if($first_img !== null) {             return $first_img->src;         }              return null;     }      And to set the featured image ...               // set the featured image     function mpb_set_featured_image( $thumb_id, $post_id ){              update_post_meta( $post_id, '_thumbnail_id', $thumb_id );          }      I've also tried to add an action for save_post, but anything I do inside the function that runs seems to trigger another hook that runs save_post again so it turns into an endless loop. Does anyone know (even if it's at a high level) what steps I can take to accomplish this? To recap here's what I want to do... On inserting a post 1) get the first image src 2) set it as a custom field or set it as a featured image 3) remove the image from the post. **edit** - I should mention the code I posted does work if you add the post through the wp admin. But not if you add it via the mobile app.


title: Removing "Sub-menus" from My Sites Drop-down in Admin Bar

text: How does one remove the "sub-menu" that appears to the right of each site listed in the My Sites drop down from the admin bar? That is, I want to have a list of My Sites without the Dashboard/New Post/Manage Comments/Visit Site links appearing to the right of the arrow for each site in the My Sites drop down list. This would simplify the user interface significantly for my users. Any guidance would be greatly appreciated. Thank you.


title: bbPress - select a topic reply as "answer"

text: Folks! I have a good knowledge of Wordpress, and currently I started to use BuddyPress / bbPress to build a project. One of the goals of the project is to set a **"question and answer"** section at each BuddyPress Group. Since bbPress and BuddyPress works well together, I thought to use bbPress forums to build something like that. So, to achieve this, the two things that I need is:   1. Upvote / Downvote a topic reply (witch I could get using a plugin such as bbPress Post Ratings;   2. Select a reply as an "answer", putting it at the top of the replies and highlighting it. For the second item, I found a bbPress plugin named **"Best Answer"** , but I found only the svn repository of it (http://plugins-svn.bbpress.org/best- answer/trunk/) and not a plugin page, so I supose that this plugin is pretty old. If anyone knows a plugin that adds this "mark as answer" feature, or knows a way to do it (or at least a hint to start developing something about it), I'll be very glad! Thanks!


title: Removing filter dropdown in posts table (in this case Yoast SEO)

text: I don’t need Yoast SEO meta box for one post type so I removed it with remove_meta_box(). Removed unneeded columns in post table by unsetting columns with manage_edit-custom_post_columns, but drop down is still left. Is there way to remove it? Of course it is not that hard to do with jQuery, but maybe there is filter or something built in WP?


title: Hightlight search-terms with functions does remove or disable other filters?

text:
I found the following two functions in order to highlight the current search term on my search-results page.               function search_excerpt_highlight() {         $excerpt = get_the_excerpt();         $keys = implode('|', explode(' ', get_search_query()));         $excerpt = preg_replace('/(' . $keys .')/iu', '\0', $excerpt);         echo '
' . $excerpt . '
';     }          function search_title_highlight() {         $title = get_the_title();         $keys = implode('|', explode(' ', get_search_query()));         $title = preg_replace('/(' . $keys .')/iu', '\0', $title);         echo $title;     }      When using this, other filters that are added to `the_excerpt()` are disabled, like e.g. the custom-more-link I added. Now there is plain HTML in my search-results like this `whatever there is class="more-link">` Any ideas how to fix that?


title: Help with issues on "Adding a Taxonomy Filter to Admin List for a Custom Post Type?"

text: This question relates to a solution found here from user somatic and mikeSchinkel I am testing somatic's solution, and it loads and populates the dropdown with no issues, but When you click filter, it does not filter anything. I am on WP version 3.0.4. My custom post type = "listings" my custom taxonomy = "Locations" the code:               add_action( 'restrict_manage_posts', 'my_restrict_manage_posts' );     function my_restrict_manage_posts() {              // only display these taxonomy filters on desired custom post_type listings         global $typenow;         if ($typenow == 'listings') {                  // create an array of taxonomy slugs you want to filter by - if you want to retrieve all taxonomies, could use get_taxonomies() to build the list             $filters = array('Locations');                  foreach ($filters as $tax_slug) {                 // retrieve the taxonomy object                 $tax_obj = get_taxonomy($tax_slug);                 $tax_name = $tax_obj->labels->name;                 // retrieve array of term objects per taxonomy                 $terms = get_terms($tax_slug);                      // output html for taxonomy dropdown filter                 echo "<select name='$tax_slug' id='$tax_slug' class='postform'>";                 echo "<option value=''>Show All $tax_name</option>";                 foreach ($terms as $term) {                     // output each select option line, check against the last $_GET to show the current option selected                     echo '<option value='. $term->slug, $_GET[$tax_slug] == $term->slug ? ' selected="selected"' : '','>' . $term->name .' (' . $term->count .')</option>';                 }                 echo "</select>";             }         }     }      Am I missing something in there to make the filter work? I am organizing my column's with the following code, not what was in step 3 and 4. (not sure if this is the issue?)               add_action("manage_posts_custom_column",  "listing_custom_columns");     add_filter("manage_edit-listings_columns", "listing_edit_columns");          function listing_edit_columns($columns){       $columns = array(         "cb" => "<input type=\"checkbox\" />",         "title" => "Listing Name",         "address" => "Address",         "Locations" => "Location",       );            return $columns;     }     function listing_custom_columns($column){       global $post;            switch ($column) {         case "address":           $custom = get_post_custom();           echo $custom["address_meta"][0];           break;         case "Locations":           echo get_the_term_list($post->ID, 'Locations', '', ', ','');           break;       }     }      Any help would be appreciated. thank you.


title: Get current page's taxonomy

text: I've got some pages with a custom taxonomy for each page and i'm trying to retrieve this taxonomy on the page. I'd basically need something like `the_current_taxonomy()` like `the_title()`. This has to run outside the loop cos i'll use it in a custom `WP_Query` right after. Edit: Found a solution using a different way to retrieve the information i needed. Thanks for your help guys.


title: hosted wordpress.com to local directory?

text: This question was posted at onstartups - one that I frequently hear. Figure that I would ask the experts over here - can one maintain a hosted wordpress.com blog yet make it a subdirectory under their domain? From: http://blog.domain.com to http://domain.com/blog IF so, what step(s) / .htaccess changes are necessary to make it happen? {Edit to clarify some points}   1. user currently has a wordpress.com blog ( http://username.wordpress.com )   2. user currently has a domain / site (http://domain.com)   3. user likes wordpress.com hosting and doesn't want to install a local version of wordpress on domain.com. User is willing to pay wordpress.com for custom url, but doesn't want http://blog.domain.com - (s)he wants blog to be a directory http://domain.com/blog.


title: What are the pros and cons to a WordPress run newsletter v. third party newsletter?

text: I am currently building a site that will use newsletters, email notifications for new posts and email notifications for new comments on posts. I keep going back and forth between running this through third party sites and doing it solely through my WordPress website. I should mention, when I say third party, I am including the WrodPress.com email/comment subscriptions built into Jetpack, maybe FeedBurner for new post emails instead and I am considering MailChimp.com for newsletters. If running it myself, I haven't decided on any plugins yet, but I know plenty are available. I suppose my main reasoning for wanting to run everything myself is so I can have a more fine level of control. I can email specific user roles, etc. As well, I am not a big fan of the double opt-in used by MailChimp and Jetpack. Double opt-in simply annoys me. I prefer ReCaptcha or some other anti-spam method on the signup form I have been trying to come up with pros and cons on each side, other than double opt-in (which I understand, can be a pro or con for both depending on your views), what are pros and cons of each method? Thanks.


title: How can I improve site/page performance of WordPress websites?

text: To improve site/page performance, I added the following code to accept headers:               <php flush(); ?>      It works, but perhaps not as well as it could. Any advice? I also tried to leverage browser caching, using the following code:               # Begin Expires Caching     <IfModule mod_expires.c>     ExpiresActive On     ExpiresByType image/jpg "access 1 year"     ExpiresByType image/jpeg "access 1 year"     ExpiresByType image/gif "access 1 year"     ExpiresByType image/png "access 1 year"     ExpiresByType text/css "access 1 month"     ExpiresByType application/pdf "access 1 month"     ExpiresByType text/x-javascript "access 1 month"     ExpiresByType application/x-shockwave-flash "access 1 month"     ExpiresByType image/x-icon "access 1 year"     ExpiresDefault "access 2 days"     </IfModule>     # End Expires Caching      Again, any advice to optimize the results will be appreciated.


title: Adding 'menu order' column to custom post type admin screen

text: I want to use the `menu order` attribute to control ordering for a custom post type that's going to be used for a specific purpose. It's easy enough to add this to the CPT via `supports => array('page- attributes')` but how do I expose the menu order value on the admin listing screen for this CPT?


title: How to publish page that can't be detected by search engines?

text: I like to publish drafts in my 'Uncategorized' category. This category is not linked anywhere on my site. It's great for allowing contributors to an article to read the draft before it is made public. The problem is that after just 2 or 3 days, search engines begin picking up the draft and people start posting comments. I don't want to password protect the draft. Is there some way to hide it from search engines while it is in the 'Uncategorized' category?


title: WordPress objects class reference

text: In WordPress we have several objects defined through classes that are enough documented. These are the `WP_Query`, `WPDB`, `WP_Post` and other. There are other objects however that are actually created at runtime, usually converting an array to a standard object, or reading from the DB. For instance, the taxonomy object you get from `get_taxonomy()` function. Even though there isn't an actual class that defines these objects, **I wonder if there is any detailed documentation of all properties we can find in these objects** that doesn't require me to alway dig in the code to remember which are the properties names.


title: Check If posts exist in custom post type category, outside of loop

text: I'm building a navigation, outside of the main loop, that includes drop downs. I have a custom post type called 'Events', that has its own categories. I would like there to be a drop down if there are posts within that custom post type and category, but I'm not sure what functions I should be using to determine this... I have...               $hasposts = get_posts('post_type=Events&category=40');     if($hasposts) {         ..// show the drop down menu     }       Should I even be using `get_posts()`? Everything I am getting returned has an empty array, but I know that some of those categories include posts... Many thanks, WA.


title: Advanced Custom Fields and date picker, show posts only if the day is today no matter the year

text: I've created a site made just with custom fields about famous people in sport. In the post page I've a born date and a death date field using the data picker. What I'm trying to achieve is to show posts of people who have died today in the past, if someone has died the 14th of february 1982 I want to show in a page/widget every 14th of february of this year and the next to come. I'd also would like to retrieve from the born and death date only the year. Let's take Jesse Owens. He was born on September 12, 1913 and died March 31, 1980. I would like to have a post like this: Jesse Owens (1913 – 1980)   * Jesse Owens is the title of the post but how to show 1913 and 1980? Thanks!


title: Change how WP e-Commerce calculates price total at checkout

text: My situation: I'm selling a few products. I need to get some options at checkout (like Do you want to add installation services?) that will affect the price, and I need to reference a custom database table to do some complex price calculations to get a total order price. I wanted to use getshopped.org's wp e-commerce shopping cart, but somehow override the checkout page to do what I need, then return my calculated price to wp e-commerce to finish the order up. How would I do this? Would I use a hook? Should I change some method that calculates the totals (without losing my changes on the next update)? Or do I have to drop the plugin and roll my own completely? Thanks so much.


title: How to update same text on two Pages at once

text: One of my sites is for a local organization with different clubs within the one organization. I have to list the upcoming meetings in two separate locations: (1) the home page where the upcoming meeting for all of the clubs is listed (in different tabbed entries), and (2) on the page for the individual club. This is different from a calendar listing. The line of text describing the meeting is formatted differently on the different Pages. Is there a way to enter the text in one place and have it copy automatically to two pages, within the format codes each Page requires? Not a whole page or post worth, just a line of text?


title: Setting get_queried_object

text: I know that `get_queried_object` contains the object that was queried for the current page. My question is, what methods of querying affect the contents of this? For instance:   * `query_posts`   * `get_posts`   * `get_post`   * `new WP_Query`   * etc.


title: Correct folder permissions?

text: I just recently installed PHP and wordpress on our coldfusion box and wordpress is throwing me an dialog saying I need to input FTP information so wordpress can alter the files. I read up on this and basically this only comes up if wordpress cannot manipulate the files directly via PHP/apache user. My question is now how should I set the folder permissions so things are secure and play nicely? The wordpress root folder has the following permissions               drwxrwxr-x  6 wwwtech    root  4096 Feb 21 14:09 home      files and folders within have               -rw-r--r--  1 wwwtech root   418 Sep 25  2013 index.php     drwxr-xr-x  9 wwwtech root 12288 Jan 23 20:17 wp-admin      PHP and apache are running under user `tech`               tech     12465  0.0  0.0   9400   936 pts/0    S+   09:58   0:00 grep --color=auto php      and are part of group               tech : tech root adm dialout cdrom plugdev sambashare lpadmin admin


title: (solved) how to have the gallery shortcode output one single UL list instead of several DL?

text: I need the built-in gallery shortcode to output UL instead of DL. How can I do it? I know I can use the 'post_gallery' filter, but that means almost duplicating the media's gallery_shortcode function. I'd like to find a less 'verbose' solution. Thank you


title: Split Content and Gallery

text:
Is there a way to split up the post content and the gallery short code. I want to display the gallery outside my normal content no matter how or where it is placed. I can use this to get the shortcode itself:               if(has_shortcode(get_the_content(), 'gallery')){         $pattern = get_shortcode_regex();          preg_match("/$pattern/s", get_the_content(), $matches);         echo do_shortcode($matches[0]);     }      But this doesn't work if the gallery short code isn't the first instance. Is there a way to split my content and gallery up completely? * * * **Edit:** I have a semi-solution but it seems like a long winded way to go about it. It first grabs the first shortcode in the post (which needs to be fixed since I only want the "Gallery" shortcode) then removes all shortcodes from the content (again, not really what I want to do.               <?php if(has_shortcode(get_the_content(), 'gallery')) : ?>         <?php              $pattern = get_shortcode_regex();              preg_match("/$pattern/s", get_the_content(), $matches);         ?>
             <?php echo strip_shortcodes(get_the_content()); ?>

             <?php echo do_shortcode($matches[0]); ?>
     <?php endif; ?>      * * * **Edit #2** - Ok, I've been able to only get gallery shortcodes in the post. I've also added a filter to remove the gallery shortcode form `the_content()` - the problem is that its not necessarily removing the shortcode since it does post it, but its not allowing me to run "do_shortcode()" **Functions.php**               function remove_gallery($content) {         global $post;              if($post->post_type == 'artcpt')             remove_shortcode('gallery', $content);              return $content;     }     add_filter( 'the_content', 'remove_gallery', 6);       **The Loop**               <?php preg_match('/\[gallery ids=[^\]]+\]/', get_the_content(), $matches); ?>
         <?php the_content(); ?>

         <?php echo do_shortcode($matches[0]); ?>
      in The Loop it will return my short code **Twice** (i'm on a single page, should be looped twice - so its not running do_shortcode()). Not sure why.


title: Custom Loop Pagination on WordPress

text:
I'm trying to create a magazine style website. For this particular page (not homepage) I'd like to fetch the latest post and style it one way (style1). For all the other posts I'd like to just display smaller (style2). This is working fine, BUT I would also like to enable pagination. Is there anyway to have pagination appear at the bottom, when the user clicks previous older posts will be shown in the second style (style2)? My code so far is below:               <?php      /*     Template Name: Interview     */     get_header(); ?>

Interviews
     <?php         $args=array(         'cat' => '12,3',         'post_type' => 'post',         'post_status' => 'publish',         'posts_per_page' => 3,         'caller_get_posts'=> 1         );         $my_query = null;         $my_query = new WP_Query($args);         while ($my_query->have_posts()) : $my_query->the_post();               $counter++;         if($counter===1) {     ?>
     <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">     <?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'slider-image' );  } ?>
<?php the_title(); ?>
     <?php the_time('j M') ?> | <?php comments_number('No Comments', 'One Comment', '% Comments' );?>          <?php my_excerpt(40); ?>

     <?php } else { ?>
     <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">          <?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'latest-thumb-small' );  } ?>

     <?php the_title(); ?>
     <?php the_time('j M') ?> | <?php comments_number('No Comments', 'One Comment', '% Comments' );?>     <?php my_excerpt(30); ?>

     <?php } ?>          <?php endwhile; ?>          <?php next_posts_link('« Older Entries', $my_query->max_num_pages) ?>     <?php previous_posts_link('Newer Entries »') ?>

     <?php get_sidebar(); ?>
     <?php get_footer(); ?>      TL;DR: Ideally I want to:   1. Display the latest post as style1   2. Display all the other posts as style2   3. When the user clicks NEXT/PREVIOUS, load more posts and style them as style2. Unless they are on the latest post page. UPDATED CODE;               <?php      /*     Template Name: Film     */     get_header(); ?>

     <?php           // Only on the first page     if ( ! is_paged() ) {              // Custom query - latest post         $latest_post = new WP_Query( array(             'cat' => '4',             'post_type' => 'post',             'post_status' => 'publish',             'posts_per_page' => 1         ) );         // Output latest post         if ( $latest_post->have_posts() ) : while ( $latest_post->have_posts() ) : $latest_post->the_post();             ?>
     <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">     <?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'slider-image' );  } ?>
<?php the_title(); ?>
     <?php the_time('j M') ?> | <?php comments_number('No Comments', 'One Comment', '% Comments' );?>          <?php my_excerpt(40); ?>

     <?php          endwhile; endif;         // Don't forget me         wp_reset_postdata();          }          // Main query     if ( have_posts() ) : while ( have_posts() ) : the_post();     ?>
     <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">          <?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'latest-thumb-small' );  } ?>

     <?php the_title(); ?>
     <?php the_time('j M') ?> | <?php comments_number('No Comments', 'One Comment', '% Comments' );?>     <?php my_excerpt(30); ?>

     <?php      endwhile; endif;     ?>
     <?php      // Pagination     next_posts_link();     previous_posts_link();          ?>

                 <?php get_sidebar(); ?>
     <?php get_footer(); ?>      Functions:               function wpse121486_pre_get_posts( $query ) {             // Main blog posts index, first page, main query             if ( is_home() && ! $query->is_paged() && $query->is_main_query() ) {                 $query->set( 'posts_per_page', 9 );                 $query->set( 'offset', 1 );             }         }         add_action(           'pre_get_posts', 'wpse121486_pre_get_posts' );


title: How to Remove Sidebar when get_sidebar() is not get called in page?

text: I see in my WordPress theme, there is no call of get_sidebar() in single.php etc. but sidebar comes. Here it is telling about customizing based on get_sidebar(). I want to use get_sidebar() to include sidebar so that I can think of customization. Is there any default method to include sidebar from where it can come ?


title: How to return count of custom post type posts with a specific custom field value via $wpdb?

text: I am trying to get count of a custom post type with a specific custom field value from wpdb without doing a WP_Query or get_posts since I think it is more resource efficient and I need to return 10 different counts for 10 different values on one page. I can't get the right count to show up. A number is returned, but it is wrong. Here is the code :               $meta_value = key($choices);             $count = $wpdb->get_var(                 $wpdb->prepare (                 "                 SELECT  count(ID)                  FROM    $wpdb->posts, $wpdb->postmeta                 WHERE   $wpdb->posts.post_status = 'publish'                         AND $wpdb->posts.post_type = 'tasks'                         AND $wpdb->postmeta.meta_key = 'task_status'                         AND $wpdb->postmeta.meta_value = %s                 ",                 $meta_value             )); ?>      How can I make it right? key($choices) returns the right value (string) for the $meta_value variable. It is my absolute first use of $wpdb so have mercy. Edit: solved by adding INNER JOIN:               "             SELECT  count(ID)              FROM    $wpdb->posts             INNER JOIN $wpdb->postmeta                 ON $wpdb->posts.ID = $wpdb->postmeta.post_id             WHERE   $wpdb->posts.post_status = 'publish'                     AND $wpdb->posts.post_type = 'tasks'                     AND $wpdb->postmeta.meta_key = 'task_status'                     AND $wpdb->postmeta.meta_value = %s             "


title: Javascript as Jquery Function Call?

text: Refer to Nice scroll to wordpress wordpress runs jquery in noconflicts mode which means that you either need to write your JS code using the jQuery function call               var seq = 0;            $(document).ready(function() {             $("html").niceScroll({styler:"fb",cursorcolor:"#000"});              $("#mainlogo img").eq(1).hide();         function goSeq() {           var nxt = (seq+1)%2;           $("#mainlogo img").eq(seq).fadeIn(2000);           $("#mainlogo img").eq(nxt).fadeOut(2000);           seq = nxt;           setTimeout(goSeq,2500);         };         goSeq();              $(window).load(function(){           setTimeout(function(){             $("#gmbox div").animate({'top':60},1500,"easeOutElastic");           },1500);         });              function trackLink(link, category, action) {           try {             _gaq.push(['_trackEvent', 'tracklink' ,'click',link.href ]);             setTimeout('document.location = "' + link.href + '"', 100)           }catch(err){}         }              $('[rel="outbound"]').click(function(e){                 try {             _gaq.push(['_trackEvent','outbound','click',this.href]);           }catch(err){}         });            });      This is the javascript that i want to add in functions.js using the Jquery function call. To make it work I inserted $ in (). Could you please correct this?


title: Editing or filtering the output of the Genesis navigation

text:
I'm trying to edit or apply a filter to the default Genesis navigation `genesis_do_nav` Currently I'm extending a Walker class to add a `<span>` with data-attribute around the navigation's link text.               class Menu_With_Data_Attr extends Walker_Nav_Menu {         function start_el(&$output, $item, $depth, $args) {             global $wp_query;             $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';                  $class_names = $value = '';                  $classes = empty( $item->classes ) ? array() : (array) $item->classes;                  $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );             $class_names = ' class="' . esc_attr( $class_names ) . '"';                  $output .= $indent . '
ID . '"' . $value . $class_names .'>';                  $attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr( $item->attr_title ) .'"' : '';             $attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : '';             $attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : '';             $attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : '';                  $item_output = $args->before;             $item_output .= 'title.'">';             $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;             $item_output .= '';             $item_output .= $args->after;                  $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );         }     }      How might I apply that walker to the output of the genesis_do_nav?


title: How to make an xml file (just the xml file) available at a specific url?

text: I'm trying to include an xml file in my WP site where you could go to a url, much like this one: **www.example.com/somepage/anotherpage/thefile.xml** and view "thefile.xml" - no header, no footer, just the xml file. I've been searching for ways to accomplish this for awhile now.


title: My php code is not being executed

text: I have a wordpress page that has this code in the text editor part of a web page:               This page creates a cookie and houses a etst link that is only accessible to the holder of the cookie.                Test Link (authentication required).           Syntax:     setcookie(name, value, expire, path, domain);     <?php setcookie(accesscookie, testing1234, time()+86400, /, foo.example.com); ?>      When I navigate to the page it does not create a new cookie. Can somebody tell me what I am doing wrong to create the cookie?


title: Get parse_query filter to return slug instead of id

text: After much headache in the last week I feel like my problem is almost solved. I have been attempting to customize the admin edit.php page of custom post types to display and sort/filter custom taxonomies. I've frankensteined a collection of actions and filters from things found on the web but fear I may be using deprecated code as some of them were quite old. I think I've narrowed the problem down to this filter               add_filter('parse_query','convert_large_feature_id_to_taxonomy_term_in_query');     function convert_large_feature_id_to_taxonomy_term_in_query($query) {         global $pagenow;         $qv = &$query->query_vars;         if ($pagenow=='edit.php' &&                 isset($qv['taxonomy']) && $qv['taxonomy']=='large_feature' &&                 isset($qv['term']) && is_numeric($qv['term'])) {             $term = get_term_by('id',$qv['term'],'large_feature');             $qv['term'] = $term->slug;         }     }         When I choose the dropdown menu for `large_feature` it accurately displays the "categories" (is that what you call them when they are of a custom taxonomy?) and post count, however when it is actually filtered, the query comes up empty. I noticed, however, that when I modified the query URL from               http://www.ampeg.com/2012/wp-admin/edit.php?post_status=all&post_type=ampeg_artists&action=-1&m=0&cat=0&large_feature=291&paged=1&mode=list&action2=-1      to               http://www.ampeg.com/2012/wp-admin/edit.php?post_status=all&post_type=ampeg_artists&action=-1&m=0&cat=0&large_feature=home_page_large&paged=1&mode=list&action2=-1      It displays as intended. This leads me to believe that this filter isn't outputting the slug as it's supposed to... right?


title: Wordpress Theme Options Values

text:
I am designing a wordpress website with theme options: In my theme options I have code that looks like this:                   $class = (isset($this->field['class']))?$this->field['class']:'regular-text';              echo '
field['id'].'-ul">';              if(isset($this->value) && is_array($this->value)){             foreach($this->value as $k => $value){                 if($value != ''){                          echo '
<input type="text" id="'.$this->field['id'].'-'.$k.'" name="'.$this->args['opt_name'].'['.$this->field['id'].'][]" value="'.esc_attr($value).'" class="'.$class.'" /> '.__('Remove', 'nhp-opts').'
';      It displays a text field in my theme options panel, and I am able type in it and save it. Here is my problem, I changed my code to add a text area with the options, and it looked something like this:                   $class = (isset($this->field['class']))?$this->field['class']:'regular-text';              echo '
field['id'].'-ul">';              if(isset($this->value) && is_array($this->value)){             foreach($this->value as $k => $value){                 if($value != ''){                          echo '
<input type="text" id="'.$this->field['id'].'-'.$k.'" name="'.$this->args['opt_name'].'['.$this->field['id'].'][]" value="'.esc_attr($value).'" class="'.$class.'" /> <textaread id="'.$this->field['id'].'-'.$k.'" name="'.$this->args['opt_name'].'['.$this->field['id'].'][]" class="'.$class.'">'.esc_attr($value).'</textarea> '.__('Remove', 'nhp-opts').'
';      Now when I go to my theme options panel, both boxes are there, but if i type something different in each one and save it. Both boxes are displayed to showing the exact same thing. Is there a way I can fix this?


title: Hidden Custom Post Type

text: I am just wondering is it possible to create a custom post type in wordpress which is hidden from the wordpress admin panel?