title: show posts only on homepage but using custom post type and taxonomy for query posts via url

text: I would like to do the following: I have a index.php file in which I query all posts from the existing post_types. Like the code below.                <?php if (is_home()); { ?>              <?php         global $wp_query;         query_posts( array('post_type' =>      array( 'movies',      'music', 'featured' ),'showposts' => 10, 'paged'=>$paged )         );?>               <?php }?>      I have a navigation menu e.g. "Movies" which url links to `?post_type=movies` and so on. But when I use it, everytime all posts are shown. When I delete the code above from the index.php everything works. Only the posts of a specific post_type are shown. I only want to have all posts from all custom post types, when it is really the websites home url. How could I do it? is there maybe an option to create a `customposttype.php` or so? like the `taxonomy.php`? thank you! AD * * * Hi Stephen, I have another question: I am getting the titles for each section by using this code here:´post_type; ?>´ in between h2 tags - but now on Startpage I get different names of the post type - but I'd like to have just: "Home" as Title... I tried it with is_home() and with is_front_page() but I had no luck. Do you have a hint? Thank you very much!!


title: Add additional metafields based on value of select box

text: I am faced with a particular issues dealing with metabox fields. I've added a select dropdown list to Pages post type and what I can not figure out is how to add additional metafields based on the value of the select box. I was thinking something like if (metaboxfield.value == 'value1') then display the code for the new metabox field? Here is what I am trying to accomplish...I can't figure out how to pull the value of a select box.               <?php         $page_meta_box = array(             'id'          => 'page_meta_box',             'title'       => 'Page Options',             'desc'        => '',             'pages'       => array( 'page' ),             'context'     => 'normal',             'priority'    => 'high',             'fields'      => array(                 array(                     'id'          => 'page_select',                     'type'        => 'select',                        'choices'     => array(                         array(                             'label'       => 'Value 1',                             'value'       => 'value1'                         ),                         array(                             'label'       => 'Value 2',                             'value'       => 'value2'                         ),                              // If value 2 is selected, display an additional select box                      )                      )             )         );          ?>      From the front end it would be a matter of               $getPageSelect = get_post_meta(get_the_ID(), 'page_select', true);      I've been stuck on this for a while and have yet to figure out the best way to approach this. If someone could point me in the right direction, that would be much appreciated. Thanks!


title: tiny_mce_before_init preventing custom shortcode icon appearing

text: I'm using the following to trim the TinyMCE editor               // Restrict buttons on the rich text editor     function formatTinyMCE($in)     {         $in['remove_linebreaks']            = false;         $in['gecko_spellcheck']             = false;         $in['keep_styles']                  = true;         $in['accessibility_focus']          = true;         $in['tabfocus_elements']            = 'major-publishing-actions';         $in['media_strict']                 = true;         $in['paste_remove_styles']          = true;         $in['paste_remove_spans']           = true;         $in['paste_strip_class_attributes'] = 'none';         $in['paste_text_use_dialog']        = true;         $in['wpeditimage_disable_captions'] = true;         $in['plugins']                      = 'inlinepopups,tabfocus,paste,media,wordpress,wpeditimage,wpgallery,wplink,wpdialogs,infographic';         $in['content_css']                  = get_template_directory_uri() . "/editor-style.css";         $in['wpautop']                      = true;         $in['apply_source_formatting']      = false;         $in['theme_advanced_blockformats']  = 'p,h3';         $in['theme_advanced_buttons1']      = 'formatselect,|,bold,italic,blockquote,|,link,unlink,|,bullist,numlist,infographic|,wp_fullscreen,wp_adv';         $in['theme_advanced_buttons2']      = 'pastetext,pasteword,removeformat,|,undo,redo';         $in['theme_advanced_buttons3']      = '';         $in['theme_advanced_buttons4']      = '';         return $in;     }     add_filter('tiny_mce_before_init', 'formatTinyMCE' );      I then have a plugin to create an extra shortcode button:               function fetchInfographic() {           return 'HERE BE THE INFOGRAPHIC';       }     add_shortcode('infographic', 'fetchInfographic');          function addButton() {           if(current_user_can('edit_posts') &&  current_user_can('edit_pages'))           {               add_filter('mce_external_plugins', 'addPlugin');               add_filter('mce_buttons', 'registerButton');           }       }       add_action('init', 'addButton');          function registerButton($buttons) {           array_push($buttons, "infographic");          return $buttons;       }            function addPlugin($pluginArray) {           $pluginArray['infographic'] = plugins_url('infographic_plugin.js', __FILE__);          return $pluginArray;      }        (infographic_plugin.js)               (function() {           tinymce.create('tinymce.plugins.infographic', {               init : function(ed, url) {                   console.log('url');                 ed.addButton('infographic', {                       title : 'Add an infographic',                       image : url+'/dashboard.png',                       onclick : function() {                            ed.selection.setContent('[infographic]');                            }                   });               },               createControl : function(n, cm) {                   return null;               },           });           tinymce.PluginManager.add('infographic', tinymce.plugins.infographic);       })();        This works great if I remove the formatTinyMCE function, however with it, the button just doesn't appear. As you can see by the function I've tried adding "infographic" to $in['plugins'] and $in['theme_advanced_buttons1'] but it has no effect.


title: get_current_screen() inside add_action('admin_menu')

text: I am successfully using get_current_screen(); to get the post_type to decide whether to manipulate a meta box or not. I also need to use it in:               add_action('admin_menu', 'infographicMetaBox');          function infographicMetaBox() {         // ...         $screen = get_current_screen();         if('post' != $screen->post_type)             return;         // ...     }      however it doesn't seem to be available in that hook function (maybe being called to early?).


title: How to display and use all existing tags at my write-post-at-frontend-panel?

text: I can write and publish posts from my frontend - everything is fine. You know the backend: write-post-style, right? There it lists all existing tags. How can I display all existing tags at frontend and use it the same way, like in backend? Especially the function "click on one existing tag" and use it with the post, that I am currently writing? By the way: I want to use tags from my custom-taxonomy called "wissen"... Do you know a solution, how to use this function at frontend? This is my code: (you can see, how i do now the tags and i hope the code is everything important [my real file is a lot more code]) The code at the beginning of my form-page:               if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) &&  $_POST['action'] == "new_post") {              $title =  $_POST['title'];         $description = $_POST['description'];         $tags = $_POST['post_tags'];              $new_post = array(         'post_title'    =>  $title,         'post_content'  =>  $description,         'post_category' =>  array($_POST['cat']),  // Usable for custom taxonomies too         'tags_input'    =>  array($tags),         'post_status'   =>  'publish',           // Choose: publish, preview, future, draft, etc.         'post_type' =>  'wissen'  //'post',page' or use a custom post type if you want to     );              //SAVE THE POST         $pid = wp_insert_post($new_post);              //SET OUR TAGS UP PROPERLY         wp_set_post_tags($pid, $_POST['post_tags']);              //POST THE POST         do_action('wp_insert_post', 'wp_insert_post');          }      In my body:               <form id="new_post" name="new_post" method="post" action="" enctype="multipart/form-data">              <?php wp_dropdown_categories( 'tab_index=10&taxonomy=category&hide_empty=0' ); ?>         <textarea id="description"  name="description"></textarea>         <textarea id="post_tags"  name="post_tags"></textarea>         <input type="hidden" name="action" value="new_post" />         <input type="submit" value="Eintragen" id="submit" name="submit" />          </form>


title: Only Display Thumbnail if Larger Than

text: Is there a way to only display `<?php the_post_thumbnail( $size, $attr ); ?>` if it is larger/smaller than specified dimensions?


title: How to create a theme specific translation of buddypress?

text: Originally asked on the BuddyPress forums: For distribution purposes I would like to include my customized buddypress language files in my theme alongside my other language files. No matter what I try though I can only get the language files to display if I copy them over to `wp-content/languages` as described in the buddypress codex. I thought that the following would work, but it doesn’t:               function load_buddypress_language_files() {         load_theme_textdomain('buddypress', get_template_directory() . '/lang');     }     add_action('plugins_loaded', 'load_buddypress_language_files');      This is possible isn't it? WP: 3.5.1 BP: 1.7.2


title: Is there a filter/action to add content to WP admin metaboxes?

text: I want to add an instruction into a custom term meta-box. ![enter image description here](http://i.stack.imgur.com/N944O.jpg) Is there a hook to add this or is it easiest just to use JavaScript?


title: Single post as homepage?

text: I'm wanting to set a single post as my homepage. I have a photographer's site. There are a few galleries (weddings, portraits etc). Each gallery is a wordpress post with attached images. The post itself has no content apart from the attached images and I then use the wordpress [gallery] shortcode to display the attachments in a formatted manner. My main menu include links to these single post "galleries". This works well except I also want the home page to also be a gallery. I should add that the gallery posts are styled very differently to the static pages I also have (about, contact etc). Basically I want to set the home page to be a single post. Now I realise this is not possible out of the box and so I need to take extra steps. I suppose I need to create a page template that matches single.php and use that for the homepage? I was wondering what the most elegant solution here might be.


title: Updated multisite locally

text: I manually updated multisite locally with 3.5.1 but now all my subsisites in "My Sites" link to the root site even though if I type the domains directly they work.


title: ajax page template

text:
I am creating a wp theme that gets all its data via ajax (using ajax- admin.php). Now, I've set a div that would have the html of the page there (in the index.php file). My index.php is a simple one, like this:               <?php get_header(); ?>

     <?php get_footer(); ?>      I also setup ajax (as I said via ajax-admin.php), and it works with simple content (for example echoing there some jquery generated text or retrieving a post/page. I have created 4 types of pages as page templates. article_1, article_2, article_3, article_4. What I want is the function that returns the page template html into a variable applied with the page data from an id. Is there a ready function on the codex or a filter/action to do that?


title: how to show Author information in search results

text: Google search result does not show author information or thumbnail images. the source code look like this `<link rel="author" href="https://plus.google.com/115911773396772351667/posts"/>` procedure followed same like what google says. unfortunately the result doesn't appear. here is the website link http://www.mohananvaidyar.org/ if anybody any body know the reason please answer. Thanks in advance


title: Is there a hook between clicking on "Add new" and the edit screen of a new post?

text: At the moment i use 3 custom post types to create "exhibitions", "guided tours" and "regular events". My idea is to combine these events to one custom post type "event" and by creating of this custom post type there should be a pop-up option page where i can choose which type of event it should be. I really do not want to do it later on the edit screen of the post because i would like to adjust the edit screen for every event type and display it prepared. So i need some kind of hook/break after clicking on the "Add New" button and displaying the edit screen. Is it possible?


title: Show the current post's category, without displaying parent category

text: I have a series of posts that all reside within a 'Main' parent category. Various posts are assigned to sub-categories. What I need to do is display the direct parent category for the currently viewed post, without showing other categories. Here is what I have:   * MainCat     * subcat1       * post a       * post b     * subcat2       * post c       * post d       * post e     * subcat3       * post f       * post g When viewing, for example, post 'a', I need to display subcat1 - not MainCat. I want to echo this in a custom template for this post type, and need to display the posts subcategory as a link. I've searched all over, and have found numerous snippets that show categories, subcats, etc.. but none that will only show a posts subcat like this.


title: paginate posts on admin page

text:
I've created a plugin that calls a list of posts and grabs external API data. I am using get_posts to grab the list (because I need to feed the array of links into the API query) For whatever reason, any attempt at pagination either fails completely or loads the same posts. Since nothing I've done has worked, I've removed all the pagination at this point.               add_action('admin_menu' , 'blgs_dashboard_snap');           function blgs_dashboard_snap() {              add_dashboard_page( 'Social Metrics', 'Social Metrics', 'read', 'blgs-social-metrics-snap', 'blgs_metrics_page');     }          function blgs_metrics_page() {               echo '
';     echo '
';     echo '
';     echo '
';          echo '
Social Metrics Dashboard
';     echo '
';                  echo '

Publish Date
Post Title

Comments

Likes

Shares

                  ';                  global $post;                 $args = array(                 'post_type'         => 'post',                 'post_status'       => 'publish',                 'order'             => 'DESC',                 'orderby'           => 'date',                 'posts_per_page'    => 15,             );                       $dash_posts = get_posts( $args );             // build out table                  foreach( $dash_posts as $post ) :   setup_postdata($post);                      $link   = get_permalink();                 $grab   = urlencode($link);                      $request    = new WP_Http;                 $url        = 'http://api.sharedcount.com/?url='.$grab.'';                 $response   = wp_remote_get ( $url );                      if( is_wp_error( $response ) ) {                    echo '
There was an error getting the data. Please try again later.
';                 } else {                     $output = json_decode( $response['body'] );                  }                           $title  = get_the_title();                 $edit   = get_edit_post_link( $post->ID, $title );                 $date   = get_the_date('m/d/y');                      // get my numbers                 $stumble    = $output->StumbleUpon;                 $reddit     = $output->Reddit;                 $delicious  = $output->Delicious;                 $gplus      = $output->GooglePlusOne;                 $twitter    = $output->Twitter;                 $digg       = $output->Diggs;                 $linkedin   = $output->LinkedIn;                      // facebook sub counts                 $fb_total   = $output->Facebook->total_count;                 $fb_cmbox   = $output->Facebook->commentsbox_count;                 $fb_click   = $output->Facebook->click_count;                 $fb_comms   = $output->Facebook->comment_count;                 $fb_like    = $output->Facebook->like_count;                 $fb_share   = $output->Facebook->share_count;                      // set even odd for some fancy                      $altrows = ( ' altrow' != $altrows ) ? ' altrow' : '';                      // now output the data                 echo '

'.$date.'

'.$title.'

'.$twitter.'

'.$gplus.'

'.$stumble.'

'.$linkedin.'

'.$delicious.'

'.$reddit.'

'.$digg.'

'.$fb_total.'

'.$fb_comms.'

'.$fb_like.'

'.$fb_share.'

                     ';                  endforeach;             wp_reset_postdata();          echo '

';          }      any ideas about (a) getting it to work and (b) where it should go?


title: Upgrade to WP 3.2/ and Server to php5 breaks theme?

text: I upgraded to Wordpress 3.2 and my server from php4 to php5 and now my site outputs this error; **Warning: getimagesize() [function.getimagesize]: URL file-access is disabled in the server configuration in /homepages/35/d289582498/htdocs/wp- content/themes/NovatorixFullArchive_Version1.4/novatorix/index.php on line 98 Warning: getimagesize(http://itsadcoi.com/wp- content/uploads/2011/04/head1.png) [function.getimagesize]: failed to open stream: no suitable wrapper could be found in /homepages/35/d289582498/htdocs/wp- content/themes/NovatorixFullArchive_Version1.4/novatorix/index.php on line 98** This is what's on line 98 as the error is stating; **list($width, $height, $type, $attr) = getimagesize($logo_url);** How Can I fix it?


title: Additional fields on Woocommerce's rating system

text:
I need to add additional fields to a Woocommerce product rating system like this: ![enter image description here](http://i.stack.imgur.com/iYfy7.png) I opened this file: /wp-content/plugins/woocommerce/templates/ **single- product-reviews.php** and saw the following lines:               $comment_form = array(             'title_reply' => $title_reply,             'comment_notes_before' => '',             'comment_notes_after' => '',             'fields' => array(                 'author' => '
' . '' . __( 'Name', 'woocommerce' ) . ' ' . '*' .                             '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" aria-required="true" />
',                 'email'  => '
' . __( 'Email', 'woocommerce' ) . ' ' . '*' .                             '<input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30" aria-required="true" />
',             ),             'label_submit' => __( 'Submit Review', 'woocommerce' ),             'logged_in_as' => '',             'comment_field' => ''         );      and this               $comment_form['comment_field'] = '
' . __( 'Rating', 'woocommerce' ) .'<select name="rating" id="rating">                 <option value="">'.__( 'Rate…', 'woocommerce' ).'</option>                 <option value="5">'.__( 'Perfect', 'woocommerce' ).'</option>                 <option value="4">'.__( 'Good', 'woocommerce' ).'</option>                 <option value="3">'.__( 'Average', 'woocommerce' ).'</option>                 <option value="2">'.__( 'Not that bad', 'woocommerce' ).'</option>                 <option value="1">'.__( 'Very Poor', 'woocommerce' ).'</option>             </select>
';      Is there any way I can add another select inputs?


title: Use WordPress as authentication for custom app

text: I am in the process of developing a custom web application which will require users to login. We have developed a WordPress website to manage the signup and payment/subscriptions for the application. The e-commerce solution we are using is WooCommerce. The application is hosted on a different server than the WordPress website. I would like to, if possible authenticate users via the WordPress database. I have been trying out some XMLRPC methods which can communicate with the WordPress site but it is unreliable at best and I would like to find a solid solution. The process would be:   1. User signs up for the product and creates account on WordPress site   2. User receives confirmation email with a link to the application   3. User logs in to the application using the email address and password entered when creating the account on the WordPress site. I am looking for suggestions on how to implement this and if anyone else has achieved done this previously, how they did it. Thanks!


title: Change the Featured image for child posts

text: I have created two post type for my website ("product" and "variation"). Each variation has a feature image and their post parent is a "product" post. I would like to be able to change the different featured images for every variation when I edit the post product. ![Something like this](http://i.stack.imgur.com/KCewS.png) Is there any plugin to resolve this or I have to make a new one?


title: How to automate wordpress installation in subdomain

text: How can I automate the installation of wordpress in a subdomain? Example: Upon registration user1 would get automatically wordpress on user1.domain.com. Then, upon registration user2 would get his own wordpress on user2.domain.com, etc. I can program a little bit PHP, but I would rather avoid any programming and would prefer a ready-made solution if it exists. Thank you in advance for your help. Any hint is appreciated.


title: How to Display Sequential Post Number Count

text: I know this has been answered at least a couple of times already and there is an answer out there from alchymyth2010 but I am looking for a different solution if possible because I have a fairly big wordpress site, around 30,000 posts and the code from http://wordpress.org/support/topic/display-sequential- post-numbercount-not-post-id makes wordpress hang and eventually times out for some reason. Actually I suspect it hangs because is trying to update all the posts in the db and that takes time. Anyway I am not a PHP aficionado but any kind of help would be great


title: Customize individual parts of the list - List Category Posts plugin

text: I was just wondering if there was anyway to customize individual parts of the lists. So for instance if you go to my site at www.r3entertainment.org and check out the Features page, if you look at the top where it says Gaming's Most Memorable Moments.. is there a way for JUST the title link to be underlined and the author to stay normal in each listed post?


title: Two queries – one with checkbox ticked, one without – comparing meta_query

text: I am trying to do the following: Two queries 1. Get all people that have director 'yes' ticked 2. Get all people that don't have director 'yes' ticked I have the first query all set up and works well ('people' is a CPT, and director is an ACF of a checkbox 'yes').               <?php $directors = get_posts(array(         'post_type' => 'people',         'orderby' => 'meta_value',         'meta_key' => 'last_name',         'order' => 'ASC',         'posts_per_page' => -1,         'meta_query' => array(             array(             'key' => 'director',             'value' => '"yes"',             'compare' => 'LIKE'             )         )     )); ?>      What this query does it get all 'people', ordered by their last name, and, using `meta_query` gets all those who have the directors checkbox ticked 'yes'. So, my issue is that now what I want to do, for the second query, is get all those people where 'director' 'yes' isn't ticked. ![enter image description here](http://i.stack.imgur.com/9m1hU.png) Here is what I have so far:               <?php $people = get_posts(array(         'post_type' => 'people',         'orderby' => 'meta_value',         'meta_key' => 'last_name',         'order' => 'ASC',         'posts_per_page' => -1,         'meta_query' => array(             array(                 'key' => 'company',             'value' => '"' . get_the_ID() . '"',             'compare' => 'LIKE'             ),             array(             'key' => 'director',             'value' => 'yes',             'compare' => 'NOT LIKE'             )         )     )); ?>      I have tried a few other compare arguments, but can't seem to get it to work. Any help or ideas?


title: AJAX in wordpress theme loop

text:
I'm trying to make a AJAX request on my theme. I already know wordpress handle AJAX very well, but not directly on theme file. It uses admin-ajax.php for this. I working on this for a long time and really don't know where to put the code. I know there need to put information in admin-ajax.php, function.php and have to specify if user is ou not logged in. Can someone help me with my code? HTML:

      JQUERY:                         EXTERNAL FILE:
Temakis
          <?php     $args = array(         'post_type'      => 'post',         'category_name' => 'temakis');     query_posts($args);     while (have_posts()) : the_post();     ?>
       <img src="<?php the_field("imagem-produto");?>" width="150" height="150" title="<?php echo get_the_title(); ?> "/>

<?php echo get_the_title(); ?>

<? echo get_post_field('post_content'); ?>

R$ <? the_field("preco"); ?>

          <?php endwhile; ?>     <?php wp_reset_query(); ?>      The request is ok, because i`m getting the h3 correctly. Can anyone help me? Thanks!


title: remove base slug from hierarchical custom post type

text: I've tried various methods posted here and on stackoverflow and none of them work unfortunately. My CPT is "service_locations" and by default has this structure for main pages:               /service_locations/city-name/      and this structure for the service page(s) for each city:               /serivce_locations/city-name/service-type/      Here is how i'm declaring my CPT:               add_action( 'init', 'service_locations' );     function service_locations() {         register_post_type('service_locations', array(             'label' => 'Service Areas',             'description' => '',             'public' => true,             'show_ui' => true,             'show_in_menu' => true,             'capability_type' => 'post',             'hierarchical' => true,             'rewrite' => true,             'query_var' => true,             'exclude_from_search ' => true,             'has_archive' => true,             'supports' => array(                 'title',                 'page-attributes'                 ),             )         );     }      What i need/want is this type of URL structure:               /city-name/      and               /city-name/service-type/      Using this method: http://www.markwarddesign.com/2014/02/remove-custom-post- type-slug-permalink/ i was able to get just /city-name/ to show with no further conflicts. However, the child-page of "city-name" just goes 404.               // Remove the slug from published post permalinks. Only affect our CPT though.     function vipx_remove_cpt_slug( $post_link, $post, $leavename ) {         if ( ! in_array( $post->post_type, array( 'service_locations' ) ) || 'publish' != $post->post_status )             return $post_link;         $post_link = str_replace( '/' . $post->post_type . '/', '/', $post_link );         return $post_link;     }     add_filter( 'post_type_link', 'vipx_remove_cpt_slug', 10, 3 );          function vipx_parse_request_tricksy( $query ) {         if ( ! $query->is_main_query() )             return;              if ( 2 != count( $query->query )             || ! isset( $query->query['page'] ) )             return;              if ( ! empty( $query->query['name'] ) )             $query->set( 'post_type', array( 'post', 'service_locations', 'page' ) );     }     add_action( 'pre_get_posts', 'vipx_parse_request_tricksy' );      Another issue i'm seeing is that this will ONLY work if you've set your permalink structure to /%postname%/, but because the site will also have a blog the potential for conflicts increases greatly. Ideally, i'd like to be able to show all blog posts as /blog/some-post-name/ and have my city pages and their respective service type child-pages show as above. Any help here is greatly appreciated.


title: Primary and Secondary Button Classes

text: I'm trying to style some buttons in a function (below) with the default WordPress button classes but the buttons are not being displayed (only the hyperlinked text is showing). I also tried deactivated all plugins and switching to a default WP theme to see if the buttons would display, but this issue still persists. So perhaps there's an issue with the `a` tags or the classes themselves? Here's the function:               add_filter( 'upme_profile_edit_bar','upme_profile_edit_bar', 10, 3 );     function upme_profile_edit_bar( $edit_buttons , $id, $params ) {         $edit_buttons .= 'Custom Button 1';            $edit_buttons .= 'Custom Button 2';         return $edit_buttons;     }      Thanks for any assistance.


title: List child categories from parent category on custom taxonomy page

text: I making some updates to a theme I'm currently working on. I've moved a bunch of categories that have custom post items under them into a parent category that's all within a custom taxonomy. e.g.:               Parent Category     -Child Category     --Item     --Item     --Item     -Child Category     --Item     --Item     -Child Category     --Item     --Item     --Item      I'm able to list them out on a `taxonomy-custom-tax-name.php` page, but when I click on the link of the parent category, it's lists all of the items that are associated the children category and not just the children category themselves. e.g.:               --Item     --Item     --Item     --Item     --Item     ...etc.      I'm trying to get it so it just lists out the children categories with a link to then go to a page with the items attached to that category: e.g.:               -Child Category     -Child Category     -Child Category     -Child Category      I'm currently using this loop on the custom taxonomy page: `<?php global $query_string; query_posts( $query_string . '&posts_per_page=-1' ); if (have_posts()) : while (have_posts()) : the_post(); ?>` I'm not sure if I need to change up my loop statement or if I need to create a `if else` case statement? I've already tried creating separate custom taxonomy pages as well as a separate category page with the parent category name and it's still not working the way I'm try to get it to. I hope that makes sense. This is the first time for me really diving into custom taxonomies so I'm trying to wrap my head around the logic and it seems like there is more than one way to get everything to display correctly.


title: Problem passing id-specific objects to javascript via wp_localize_script

text:
I'm using wp_localize_script to pass multiple arrays of data into a javascript file. To differentiate between the different arrays (and prevent overwriting), they are labelled relative to the post id from which they originated. The objects I need to use in the js file are like this, for example:               playlist150.tracks     playlist257.tracks      I have set DOM elements to match the object name, for example:

      Within the javascript file, I have the following:               jQuery(document).ready(function($) {            $('.playlist-item').each(function() {              var playerId = $(this).attr('id');              var music = new jPlayerPlaylist({           playerId.tracks         });                  });          });      The problem I am having is that whilst the value of playerId is equal to the name of the objects passed into the javascript file (in this case, playlist150 or playlist257), it does not work as a substitute. I must be missing some basic concept of javascript objects here, please help!


title: Using shortcodes that wrap around code

text: I'm using a membership plug in that requires me to wrap protected pages in a short code `[private]content[/private]` I want to use this code in my template so my client doesn't have to manually insert it into the posts/pages. Codex explains to use the following example if there is an opening and closing code like I have.                echo do_shortcode('[iscorrect]'.$text_to_be_wrapped_in_shortcode.'[/iscorrect]');      Now, I have a lot of content to wrap, including HTML + PHP elements. Is there an easier way to wrap my templates than by having to re-format all my code to go inside this echo?


title: Using Nonce for my Form

text:
Essentially I need to verify my data using a nonce, but I'm not sure that I'm doing it right. What I'm trying to do is remove a menu option for a user that isn't an admin. If a checkbox is checked and the form is submitted, that menu item will be removed for anyone that cannot manage options. EDIT: Got my code posted here instead of Gist:               <?php     /*     Plugin Name: Developer Mode Tools 02     Author: Tyler Gerig     Version: 1.1     Description: Add developer mode options to your wordpress installation.     License: GNU General Public License v2 or later     */          function pretty_dump($dump){             echo '
';             var_dump($dump);             echo '
';     }          /**     *Add an options page for the plugin.     *     *@since 1.0.     *     *@return void     */     function check_admin_page(){             $screen = get_current_screen();             //pretty_dump($screen->base);             if($screen->base == 'settings_page_tgdmt_options_page'){                     if($_POST){                                     $menus_to_remove = array();                                     $tgdmt_menus = $_POST;                                     foreach($tgdmt_menus as $tgdmt_menu){                                             if($tgdmt_menu != 'Save Changes'){                                                     $menus_to_remove[] = $tgdmt_menu;                                             }                                     }                                     update_option( 'tgdmt_menu_settings', array_map('sanitize_text_field', $menus_to_remove) );                                     //pretty_dump($menus_to_remove);                     }                  }             if(isset( $_POST[ 'tdgmt_plugin_noncename']) && wp_verify_nonce( $_POST[' tdgmt_plugin_noncename'], plugins_url( __FILE__))){                     echo 'Nonce verified';             }else{                     echo 'Nonce not verified';             }          }     add_action('admin_head', 'check_admin_page');          function tgdmt_remove_menus(){             if(!current_user_can('manage_options')){                     if(get_option('tgdmt_menu_settings')){                             $tgdmt_remove = get_option('tgdmt_menu_settings');                             foreach($tgdmt_remove as $remove){                                     remove_menu_page($remove);                             }                     }             }     }     add_action('admin_menu', 'tgdmt_remove_menus', 11);          function tgdmt_add_options_page(){             //Add new page under the "Settings tab"             add_options_page(                     __( 'Developer Mode Tools Options' ),                     __( 'Developer Mode Tools Options' ),                     'manage_options',                     'tgdmt_options_page',                     'tgdmt_render_options_page'             );     }          add_action( 'admin_menu', 'tgdmt_add_options_page' );               function tgdmt_menu_settings() {         // Register a binary value called ""         register_setting(             'tgdmt_menu_settings',             'tgdmt_menu_settings',             ''         );     }     add_action('admin_init','tgdmt_menu_settings');               function tgdmt_render_options_page(){             ?>

<?php _e( 'Developer Mode Tools Options'); ?>
                     <form action="<?php //plugins_url( 'tgdmt_update_menu.php' , dirname(__FILE__) )?>" method="post">
                             <?php wp_nonce_field(plugins_url(__FILE__), 'tgdmt_plugin_noncename'); ?>                             <?php                             global $menu;                                     //pretty_dump($menu);                                     $i = 0;                                      //if( current_user_can('manage_options')){                                             foreach($menu as $item){                                                          if($item[0] != ''){                                                             $menu_name = trim(str_replace(range(0,9),'',$item[0]));                                                             echo '<input name="menu'.$i.'" type="checkbox" value="'.$item[2].'" ' . checked( 1, '', false ) . ' />'. $menu_name . '
';                                                             $i++;                                                             //echo '<input id="tgdmt_disable'.$i.'" name="tgdmt_disable'.$i.'" type="checkbox" value="'.$item[2].'" ' . checked( 1, $status, false ) . ' />'.__($menu_name, 'tgdmt').'
';                                                     }                                             }                                     ?>                                          <input type="submit" name="submit" id="submit" class="button button-primary" value="<?php _e( 'Save Changes', 'tgdmt' ); ?>">
                     </form>
             <?php                    }


title: How can I make a search form that can search taxonomies and posts?

text:
I have a search bar on the homepage of my theme. I want the user to be able to select from a drop down to search for everything, posts, or taxonomies. I looked at the wp_dropdown function, but its meant for searching under a single tag, and not within a taxonomie group. now I just have a html dropdown next to the search form. how can I use the selection from the dropdown to modify the search? Heres the code im working with               <form class="searchform" method="get" action="#">             <fieldset>                 <legend class="hidden">Search form</legend>
                     <input class="search" name="s" type="text" value="Search Here"/>
                 <select name="cat" id="cat" class="postform" style="display: none; ">                     <option value="0" selected="selected">Everything</option>                     <option class="level-0" value="1">People</option>                     <option class="level-0" value="2">Schools</option>                 </select>                 <button value="submit" class="searchBtn">Submit</button>                              </fieldset>         </form>


title: Set page template for all pages?

text: I know the page template is set in the wpdb as meta_key = _wp_page_template and meta_value = template.php. How can I write a SQL script to set each post where post_type = 'page' to a specific template? **EDIT:** Based on the comments below, I'll add the detail that I am wishing to "normalize" my pages since some are set to custom templates.


title: wp_dropdown_categories by date?

text: Is there any way to specify a time period for wp_dropdown_categories or wp_list_categories or something else...? I want to create a archive page, so that if your in the archive of 2010, you'll see only the categories wich were used in 2010. do i have to write a custom function for this one? if yes, any suggestion where start? tnx for any kind of answer! best regards, kris


title: Passing POST data from one WP post to another

text: I'm trying to pass data between two Wordpress posts via POST method from a form/link. However, the second post does not seem to be able to grab the POST data. I'm wondering if it has anything to do with my permalink structure which has no filenames, only directory paths. Page 1 uses the following form to "link" to page 2 while sending data through a hidden field via POST Method:                <form name="offer" action="http://themotoroilevaluator.com/members-blog/motor-oil-bible-special-offer/" method="post" style="padding: 0px; margin: 0px;">         <input type="hidden" name="discount" value="yes">         <INPUT TYPE="image" SRC="/members-blog/wp-content/uploads/2011/12/special-offer.png" HEIGHT="350" WIDTH="550" BORDER="0" ALT="Discount Plus Additional Special Bonus Downloads - Click Here">     </form>      Then, on page 2 I have the following php code which is supposed to grab the data from that hidden field from the POST array:               $discount = $_POST['discount'];      Should be simple enough, but it's not working. I tried placing the exact same code on a standalone php page and had the form post to that page as the "action", and it worked fine. What do I need to do to get this to work in Wordpress? echoing $discount or $_POST['discount'] yields nothing and print_r($_POST) yields an empty array. Any thoughts?


title: How to programmatically bring back "excerpts" field in post editor in WP 3.1+

text: My theme uses some custom options fields, like post excerpt, that were removed from the editor screen with WP 3.1 I understand and support the intent to clean up the content workspaces. However, as a result of the 3.1 upgrade, I have had several support requests related to the fields that suddenly disappeared with 3.1 I issued a tech bulletin informing my theme owners of the change and how to get the excerpts field back using the "Screen options" button, but its still an issue for many users. Is it possible, from functions.php, to reset the screen options for a given WP screen? For example, I want to bring back the "excerpts" field to the post editor screen as well as the "Posts" selector when editing/creating "Custom Menus". PS: I understand that these options can be manually configured via "Screen options", but you might be surprised how many users have never seen or used that button :-) We tend to narrowly focus on the elements we are intent on working with at that instant and block out everything else. I do it myself and its human nature. Perhaps what we really need is a little electronic genie that whispers into our ear: > "The field you are looking for, the one that was here before and is now > gone, is behind that little button up there. Click it and you will open up a > new wing of your WordPress world...and you will be better for it"


title: Wordpress Login/Logout Single Menu Only

text:
I've written this login/logout for my functions.php in my wordpress theme. The problem is, it's showing a login/logout link in all menus both primary and secondary. Is there a way to get it to appear only in secondary?               add_filter('wp_nav_menu_items', 'add_login_logout_link', 10, 2);     function add_login_logout_link($items, $args) {              ob_start();         wp_loginout('index.php');         $loginoutlink = ob_get_contents();         ob_end_clean();              $items .= '
'. $loginoutlink .'
';          return $items;     }      This is what I ended up using:               add_filter('wp_nav_menu_items', 'add_login_logout_link', 10, 2);     function add_login_logout_link($items, $args) {     if( $args->theme_location == 'top-menu' ) {         ob_start();         wp_loginout('index.php');         $loginoutlink = ob_get_contents();         ob_end_clean();         $items .= '
'. $loginoutlink .'
';     }     return $items;     }


title: RSS feed showing deleted post

text: I'm having issues with the RSS feed on the blog I just set up. When I go to /feed, I see an old post that I've since deleted. But when I go to /?feed=rss (which redirects to /feed/rss), I see the correct feed. Additionally, after after signing in as admin, /feed returns the expected result. I'm confused as to where the "incorrect" feed is coming from. Is it being cached somewhere? FYI I'm on 3.01, and the message "An automated WordPress update has failed to complete - please attempt the update again now." shows up in the dashboard. When I try to re-install 3.01, as the message suggestions, it hangs forever. Thanks!


title: Show Different Custom Menu on Different Category Pages

text:
I have been using in_category function to display a set of menu on the sidebar. However, a much better way would be to show this menu on the top, as a navigation menu -- in the form of custom menus. Question: I already have a custom menu, but is there a way I could replace this custom menu with another one whenever a reader visits a post from a particular category? Example: On homepage, this is the menu: Home | Cat | Dog On a post tagged with CAT category, this is the menu: Home | Cat 1 | Cat 2 From my understanding, this is the current code:               if ( function_exists('wp_nav_menu') ) {     add_theme_support( 'nav-menus' );     register_nav_menus( array( 'primary-menu' => __( 'Primary Menu', 'woothemes' ) )    );     register_nav_menus( array( 'top-menu' => __( 'Top Menu', 'woothemes' ) ) );     }      And...               <?php     if ( function_exists( 'has_nav_menu' ) && has_nav_menu( 'primary-menu' ) ) {         echo '
' . woo_get_menu_name( 'primary-menu' ) . '
';         wp_nav_menu( array( 'sort_column' => 'menu_order', 'container' => 'ul', 'menu_id' => 'main-nav', 'menu_class' => 'nav fl', 'theme_location' => 'primary-menu' ) );     } else {     ?>
             <?php             if ( get_option( 'woo_custom_nav_menu' ) == 'true' ) {                 if ( function_exists( 'woo_custom_navigation_output' ) ) { woo_custom_navigation_output( 'name=Woo Menu 1' ); }             } else { ?>                      <?php if ( is_page() ) { $highlight = 'page_item'; } else { $highlight = 'page_item current_page_item'; } ?>                 <li class="<?php echo esc_attr( $highlight ); ?>"><a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php _e( 'Home', 'woothemes' ); ?>
                 <?php wp_list_pages( 'sort_column=menu_order&depth=6&title_li=&exclude=' ); ?>             <?php } ?>
     <?php } ?>


title: Getting Rid of the WordPress.com Toolbar on Other Sites?

text: I recently started a WordPress blog, and now I get an ajax-loaded toolbar showing up at the top of tonnes of pages. It's all links to my WordPress accounts and blogs and stuff. It's fine that it shows up when I'm on WordPress or working with my blog, but I see it now on all sites that (I'm presuming) are built on WordPress.com). i.e. failblog.org. Is there any way to turn off this toolbar? ![Screenshot of WordPress.com Toolbar](http://i.stack.imgur.com/Vw39N.png)


title: Conditionally Query Custom Post Types by Post Meta for Blog Home Page?

text: _( **Moderator's note:** The question's original title was: "Custom query: Show custom post types plus custom post type with post meta on blog homepage")_ I'm in need of help with a custom query. I have three custom post types: _"News"_ , _"Events"_ , _"Stories"_. On the main blog page, only News and Events will show. The client can choose to mark a Story _as_ News using features of the plugin Verve Meta Boxes. If a Stories post has a post meta key of `'mark-as-news'` then the that post should display on the main blog page as well. So what I need help with writing is this: > If Stories has post meta `'mark-as-news'` then the main blog page will > display custom post types News and Events, as well as Stories, in descending > order. Can someone please assist? Thanks! ### Edit: Perhaps a better way of wording this would be?: > Show custom post types News and Events, and if there is the key `'mark-as- > news'` for `post_meta`, show Stories.


title: Trouble with get_next_post() get_previous_post() returning null

text: I'm using wp as an engine to put blog features in an existing site. I have a place in the blog page where I load `wp-load.php`. I want to get the next and previous posts, but when I load a post from from wpdb, both `get_next_post()` and `get_previous_post()` both return `NULL`. What do I need to do to get those functions to return the proper values? **Edit** Here's the code:               if ( isset($_GET['article_id']) && is_numeric($_GET['article_id']) ) {              $id = $_GET['article_id'];         $objPost = get_post($id);              new dBug(get_next_post());         new dBug(get_previous_post());      } `dBug` is a pretty-printing class. Currently it gives two `NULL`s. I tried this:               if ( isset($_GET['article_id']) && is_numeric($_GET['article_id']) ) {              $id = $_GET['article_id'];         $objPost = get_post($id);         setup_postdata($objPost);         new dBug(get_next_post());         new dBug(get_previous_post());      } but no luck. Still `NULL`.


title: How do I make a theme "plugin-ready"?

text: How do I revise a theme so that I can publish my event hooks and anyone can build a plugin to add new functionality easily to my theme?


title: Use the user_activation_key for other purposes

text: I need to know if it is safe to use `user_activation_key` (from `WP_User`) for other purpose like email verification (a functionality that I would be creating that would send an email verification first before activating the account created)? So here's how things will work. A user will register using my custom registration form which will be available only on front-end. Upon successful registration, the user will be notified via email that the account has been created along the activation link that is created upon registration using the following convention: `http://www.example.com/verify/?key=SAMPLEACTIVATIONKEY4321` Do you think this will be safe?


title: Custom rewrite rule is not picked by Wordpress

text: I am trying to create a custom Rewrite URL something like               function add_my_rule() {             global $wp;          $wp->add_query_var('state');            $wp->add_query_var('state_destination');         add_rewrite_rule('destination/([0-9]+)/([^/]*)/page/([0-9]+)','index.php?pagename=destination&state=$matches[1]&state_destination=$matches[2]&paged=$matches[3]','top');         add_rewrite_rule('destination/([0-9]+)/([^/]*)','index.php?pagename=destination&state=$matches[1]&state_destination=$matches[2]','top');         global $wp_rewrite;         $wp_rewrite->flush_rules();     }     add_action('init', 'add_my_rule');      Idea is to rewrite all URL which have following pattern               www.abc.com/destination/state/state-destination      I have a custom template destination.php and i want all such URL's to be handled there.I have done same in past and that is working fine but now it does not seems working at all as for the given URL               http://localhost/xxx/destination/himachal-pradesh/dalhousie      it always going to `single.php` and not to `destination.php`.I tried to flush the cache and even browser one but seems like either my rewrite Rule is not correct or there is some other issue. Any help in this will help me to move ahead. As an added information my current URL-Structure in WordPress is `/%year%/%monthnum%/%postname%.html` i am using WAMP Server with mode-rewrite enable.


title: Order Posts by Taxonomy and Meta Value

text: It's possible to order posts by Meta Value. It's possible to order posts by more than one value. And thanks to the code below it's possible to order by taxonomy. But how can I alter the code below to order by **taxonomy AND meta_value**? **Added to functions.php**               function orderby_tax_clauses( $clauses, $wp_query ) {     global $wpdb;     $taxonomies = get_taxonomies();     foreach ($taxonomies as $taxonomy) {         if ( isset( $wp_query->query['orderby'] ) && $taxonomy == $wp_query->query['orderby']     ) {                 $clauses['join'] .=<<<SQL     LEFT OUTER JOIN {$wpdb->term_relationships} ON {$wpdb->posts}.ID={$wpdb-    >term_relationships}.object_id     LEFT OUTER JOIN {$wpdb->term_taxonomy} USING (term_taxonomy_id)     LEFT OUTER JOIN {$wpdb->terms} USING (term_id)     SQL;                 $clauses['where'] .= " AND (taxonomy = '{$taxonomy}' OR taxonomy IS NULL)";                 $clauses['groupby'] = "object_id";                 $clauses['orderby'] = "GROUP_CONCAT({$wpdb->terms}.name ORDER BY name ASC) ";                 $clauses['orderby'] .= ( 'ASC' == strtoupper( $wp_query->get('order') ) ) ?     'ASC' : 'DESC';             }         }         return $clauses;     }              add_filter('posts_clauses', 'orderby_tax_clauses', 10, 2 );      **Added to index.php**               <?php $args = array(     'post_type' => 'custom_post_type',     'posts_per_page' => -1,     'meta_key' => '_EventStartDate',     'orderby' => 'taxonomy_cat',     'order' => asc     );     $the_query = new WP_Query( $args );          if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query-    >the_post(); ?>          etc. etc.      **Changing this doesn't work**               'orderby' => 'taxonomy_cat meta_value',


title: Calling the Next category link on an archive page - Wordpress

text:
I've been working on creating a link in my header, should say "see _enter next category name here_ " I've been using this code, found here (I would comment again to ask directly on that question, but I'm not allowed)                   function get_adjacent_category($category_slug,$taxonomy,$type){     global $wpdb;     if($type=="next"){         $operater=" > ";         $orderby=" ORDER BY tt.`term_id` ASC ";     }else{         $operater=" < ";         $orderby=" ORDER BY tt.`term_id` DESC ";     }     $query="SELECT *,(SELECT `term_id` FROM wp_terms WHERE `slug`='".$category_slug."') AS given_term_id,         (SELECT parent FROM wp_term_taxonomy WHERE `term_id`=given_term_id) AS parent_id         FROM  `wp_terms` t         INNER JOIN `wp_term_taxonomy` tt ON (`t`.`term_id` = `tt`.`term_id`)         HAVING  tt.taxonomy='".$taxonomy."' AND tt.`parent`=parent_id AND tt.`term_id` $operater given_term_id $orderby LIMIT 1";     return $wpdb->get_row($query);              }              $next_category =  get_adjacent_category($slug,$taxonomy,"next");         $previous_category =  get_adjacent_category($slug,$taxonomy,"previous");      and while I'm not getting an errors, it's not pulling the next category up for me. Just a blank space. Here's the code I'm using to call the function:
See<?php get_adjacent_category($slug,$taxonomy,"next"); ?>
      Am I calling it incorrectly? If it helps, I'm working with Thesis theme, and here's the website I'm working with. I'm trying to place it on an archive page, mirroring to the "back to blog" link at the top. Any insight would be greatly appreciated!!


title: Get my site session in wordpress?

text: I am using a custom site build in zend frameword, i also have a wordpress installed in this directory, for example:               www.mywordpressSite.com // here is my wordpress site..     www.mywordpressSite.com/frameWorkSite // here is my framework site..      All i need to get a framwork session inside wordpress theme, i tried by accessing direcct like,               $_SESSION['userId'];      I tried by making a class in framework and by including this in my wordpress site, but in vain.. Any helpful idea is greatly appreciated..


title: Should I host support forum on wordpress.org or my own website?

text: I have a Wordpress plugin WP Pipes hosted at http://wordpress.org/plugins/wp- pipes/. I see that it is convenience for users to ask question right in the support page at http://wordpress.org/support/plugin/wp-pipes, but it will be a pain when we have lots of topics in there. Is there anyone here have experience about that? Should we offer support service right there in wordpress.org or host it in our own website? Any help would be appreciate. PS: I posted this question on stackoverflow but not has much answers for it.


title: wp-cron still running even though DISABLE_WP_CRON is true

text: I have created a cron job to run wp-cron.php for me but I am seeing in my FPM logs where it's still running. From what I understand, is that with the cron job it wouldn't be hitting FPM to create any logs. Is there a way to trace this and figure out whats running the file?


title: appointment plugin doesn't display all appointments

text:
I'm trying to create a appointment plugin, and so far it is working that I can create appointments and see the detail view from the appointment. The problem is, on a page called "appointments" where I wan't to list all appointments, nothing is displayed. I also would like to know, how I can modify the way all appointments are styled. I would like to have it placed in 4 columns. I know the markup for this columns, but I don't know where I have to modify the plugin. Here are the 5 files from my plugin: termine.php               <?php          /**      * Plugin Name: Termine      * Description: Terminverwaltung für Wordpress      * Author: Me      * Version: 1.0      */              setlocale(LC_ALL, 'de_DE.UTF-8');         require_once('posttype.php');         require_once('datumsbox.php');         require_once('termineansicht.php');         require_once('seite.php');          ?>      posttype.php               <?php               add_action('init','post_type_termine');              function post_type_termine(){                  register_post_type(                 'termine',                       array(                     'labels' => array(                         'name' => 'Termine',                         'singular_name' => 'Termin',                         'add_new_item' => 'Neuen Termin anlegen'                     ),                     'public' => true,                     'show_ui' => true,                          'supports' => array(                         'title','excerpt','editor','thumbnail','custom-fields'                     )                 )                  );              }          ?>      datumsbox.php (used to place a box with appointment-details in the backend)               <?php              add_action('add_meta_boxes','nw_termine_addmetaboxes');              add_action('save_post','nw_termine_savedata');              function nw_termine_addmetaboxes(){                  add_meta_box(                 'termine_metabox',                 'Datum und Ort',                 'termine_datumsbox',                 'termine',                 'normal',                 'high'             );              }              function termine_datumsbox(){                  wp_nonce_field('termine_action', 'termine_name');                       echo 'Tag: ';              $wert1=get_post_meta(get_the_ID(), '_tag',true);             echo '<input type="number" step="1" min="1" max="31" id="myplugin_new_field" name="myplugin_field1" value="'.$wert1.'" style="width:4em"/>';                  echo 'Mon.: ';              $wert2=get_post_meta(get_the_ID(), '_monat',true);             echo '<input type="number" step="1" min="1" max="12" id="myplugin_new_field2" name="myplugin_field2" value="'.$wert2.'" style="width:4em" />';                    echo 'Jahr: ';              $wert3=get_post_meta(get_the_ID(), '_jahr',true);             echo '<input type="number" step="1" min="2011" max="2020" id="myplugin_new_field3" name="myplugin_field3" value="'.$wert3.'" style="width:5em"/>';                  echo '
Stunde: ';             $wert4=get_post_meta(get_the_ID(), '_stunde',true);             echo '<input type="number" step="1" min="0" max="23" id="myplugin_new_field4" name="myplugin_field4" value="'.$wert4.'" style="width:4em"/>';                    echo 'Min.: ';             $wert5=get_post_meta(get_the_ID(), '_minute',true);             echo '<input type="number" step="1" min="00" max="59" id="myplugin_new_field5" name="myplugin_field5" value="'.$wert5.'" style="width:4em"/>';                    echo '
Bis: ';             $wert7=get_post_meta(get_the_ID(), '_bis',true);             echo '<input type="text" id="myplugin_new_field7" name="myplugin_field7" value="'.$wert7.'" /> (beliebiger Text)';                     echo '

Adresse für Google Maps:
';              $wert6=get_post_meta(get_the_ID(), '_geo',true);             echo '<input  id="myplugin_new_field6" name="myplugin_field6" value="'.$wert6.'" style="width:90%" />';                     echo '

Angezeigte Adresse:
';              $wert8=get_post_meta(get_the_ID(), '_geoanzeige',true);             echo '<input  id="myplugin_new_field8" name="myplugin_field8" value="'.$wert8.'" style="width:90%" />';                 }                   function nw_termine_savedata($post_id){                  if( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) return false;             if( !current_user_can('edit_post', $post_id) ) return false;             if ( !wp_verify_nonce($_POST['termine_name'],'termine_action') ) return false;                       update_post_meta($_POST['post_ID'], '_tag', $_POST['myplugin_field1'], false);             update_post_meta($_POST['post_ID'], '_monat', $_POST['myplugin_field2'], false);             update_post_meta($_POST['post_ID'], '_jahr', $_POST['myplugin_field3'], false);             update_post_meta($_POST['post_ID'], '_stunde', $_POST['myplugin_field4'], false);             update_post_meta($_POST['post_ID'], '_minute', $_POST['myplugin_field5'], false);             update_post_meta($_POST['post_ID'], '_geo', $_POST['myplugin_field6'], false);              update_post_meta($_POST['post_ID'], '_bis', $_POST['myplugin_field7'], false);             update_post_meta($_POST['post_ID'], '_geoanzeige', $_POST['myplugin_field8'], false);                  $zeitstempel=mktime((int) $_POST['myplugin_field4'],(int) $_POST['myplugin_field5'],0,(int) $_POST['myplugin_field2'],(int) $_POST['myplugin_field1'],(int) $_POST['myplugin_field3']);                  update_post_meta($_POST['post_ID'], '_zeitstempel', $zeitstempel, false);              }     ?>      termineansicht.php (detailview of an appointment)               <?php              add_action('the_content','nw_termine_ansicht');              function nw_termine_ansicht( $content ){                  if ( get_post_type() != 'termine') return $content;                  $custom = get_post_custom (get_the_ID());                  $datumsformat = "%A, den %e. %B %G";                  $zeitanzeige = strftime($datumsformat,$custom['_zeitstempel'][0]);                  if(strftime('%R',$custom['_zeitstempel'][0])!='00:00'){                 $zeitanzeige.=strftime(', um %H:%M Uhr',$custom['_zeitstempel'][0]);             }                  if(isset($custom['_bis'][0]) AND $custom['_bis'][0]!=''){                 $zeitanzeige .= ' bis '.$custom['_bis'][0];             }                  $datum='
'.$zeitanzeige.'
';                  $ort='';                  if(isset($custom['_geo']) AND $custom['_geo'][0]!=''){                 $geo=urlencode($custom['_geo'][0]);                      if(isset($custom['_geoanzeige'][0]) AND $custom['_geoanzeige'][0]!='') $adresse=$custom['_geoanzeige'][0];                 else $adresse=$custom['_geo'][0];                      $ort='
Ort: '.$adresse;                 $ort.='';                 $ort.='Auf Google Maps anzeigen »';                 $ort.='
';             }                  return $datum . $content . $ort;              }          ?>      termine.php (a list of all appointments)               <?php          class terminadd{              function rewrite_post($mypost){                  $mypost = stripslashes($mypost);                  if(preg_match("/\[termine\]/",$mypost)){                      $termininfo = "Termin";                      // Hole alle Termine                     // die vergangen sind oder noch kommen                   if(isset($_GET['archiv'])){                     $order='DESC'; $compare='<';                     $title="Vergangene Termine";                 }else{                     $order='ASC'; $compare='>=';                     $title="Kommende Termine";                 }                      $posts = get_posts(                     array('post_type'=>'termine',                             'orderby' => 'meta_value',                             'meta_key' => '_zeitstempel',                             'order' => $order,                             'meta_query' => array(                                     array(                                         'key' => '_zeitstempel',                                         'value' => time(),                                         'compare' => $compare                                     )                             )                         )                 );                            $termininfo = "$title ";                          ob_start();                 global $post;                      foreach ($posts AS $post){                     setup_postdata($post);                     get_template_part( 'content', get_post_format() );                      }                      $mypost = preg_replace("/\[termine\]/",ob_get_contents(),$mypost);                 ob_end_clean();                  }                  return $mypost;         }          }          add_action('the_content', array(new terminadd(), 'rewrite_post'));      I've uploaded these files here: appointment plugin download


title: User editable blocks per page

text: I'm pretty sure this question has been asked a million times but I can't seem to find an answer. Imagine a page template with multiple sidebars. What I want the site admin to be able to do is create blocks in Wordpress, this could be an image, text, or both. Each block is assigned to a particular sidebar. The site admin should then be able to edit a page and select which blocks are to appear on that page. I've come across various plugins which allow you to select which widgets appear on which pages, but I can't seem to find anything that would let a user essentially create their own widget within the admin interface, and then select which pages that widget should appear on. So, the solutions I've found so far only half solve the problem. Wordpress Page Widgets is one plugin that kind of does what I want, but although I can select which widgets appear on which page, I can't see to create widgets that are blocks of user created HTML, yes I can drag a 'text' widget into the sidebar and add HTML there, but then you can't really select/deselect that to be visible on different pages. I could resort to creating a plugin to do this, but surely it's a fairly common request?


title: Calling Function from link in wordpress

text: I am creating a wordpress plugin in which i have a function               <?php          add_action('init','update_subscription');          function update_subscription($category,$user_name){           update_option($category,$user_name);          }      and in same page i have some links.               Subscribe      i want to call the above function when the link is clicked. how to do that


title: Two different pages that share the same content?

text: I have a self-hosted WordPress site. I need to display the same content on two different pages (a contact page and another page used for promotion purposes). They will need to have minor tweaks such as a different heading for the H1 and show two different form fields based on the page. I've used the Advanced Custom Fields plug-in to make it easier for content editors to modify the pages, but I cannot figure out how to just have one place they can go to edit the form fields, sub-text, images, etc. and display this info in two different pages. Can someone help point me in the right direction?


title: How can I hide media library images from general users?

text: As an admin I really like the features and functionality of the WordPress 3.5 media manager. With a multi-user site however all users can see all images in the media library - whether uploaded by them or not. Previously a `functions.php` script could mask / restrict access.   For example:               // Hide Media Library tab Tab from each individual agent     function remove_medialibrary_tab($tabs) {         if ( !current_user_can( 'update_core' ) ) {             unset($tabs['library']);             return $tabs;         }    }     add_filter('media_upload_tabs','remove_medialibrary_tab');      This no longer works as I believe the media library is now JavaScript based. **The question:** how can I now hide or mask the WordPress 3.5 media library images from users that did not upload the images in the library? I want users to only see their own images or to only see the images they uploaded to this specific post or page. The current structure and design is great for the likes of a newspaper that wants to share images across their entire organization of users - but not so good for sites that have needs for stricter controls with independent multi- user access. I am not a coder - or am an amateur at best - but it occurs to me that options might include: masking or coding out all attachment filters in the new 3.5 library dropdown menu only leaving the "uploaded to this page" in the list - or - possibly a switch that would allow admins to switch visibility on or off to the media library images for general users. Any guidance or direction on this would be appreciated.


title: Can't remove Wordpress post image height/width attributes?

text: I know a few people have asked this question previously; however, I think something may have changed recently in the Wordpress update. I'm building my own responsive theme for my portfolio, and for embedded post images I have added a filter to functions.php to remove the height/width attribute that Wordpress adds to the image automatically. I have used this filter before on other sites therefore I know it should work. However, no matter what I try I can't get Wordpress to embed the image without the height/width attributes, meaning the image doesn't resize on mobiles/tablets. Demo for the image in question is here: http://demo.iamdannygreen.com/cients/dragonfly-pr/ Any help would be greatly appreciated. Thanks Danny


title: hide specific categories from showing

text: I'm trying to hide specific categories from showing up on a portfolio home page. I was told that this was the concerned line of code on the php template file               <?php the_terms($post->ID, 'skill-type', '', ', ', ''); ?>      but there is no way to exclude certain types from this function by default. I would need to create a custom function in order to do so. since I don't know much about php, I was thinking maybe some kind of expert could help me over here ? thanks


title: Trying to show link "Use as featured image" from Attachment window from t31os script

text:
i found this great script from **t31os** that give me the chance to hide fields and buttons when we have to add images on a post in wordpress.               function myAttachmentFields($form_fields, $post) {     // Can now see $post becaue the filter accepts two args, as defined in the add_fitler     if ( substr( $post->post_mime_type, 0, 5 ) == 'image' ) {         $form_fields['image_alt']['value'] = '';         $form_fields['image_alt']['input'] = 'hidden';              $form_fields['post_excerpt']['value'] = '';         $form_fields['post_excerpt']['input'] = 'hidden';              $form_fields['post_content']['value'] = '';         $form_fields['post_content']['input'] = 'hidden';              $form_fields['url']['value'] = '';         $form_fields['url']['input'] = 'hidden';              $form_fields['align']['value'] = 'aligncenter';         $form_fields['align']['input'] = 'hidden';              $form_fields['image-size']['value'] = 'thumbnail';         $form_fields['image-size']['input'] = 'hidden';              $form_fields['image-caption']['value'] = 'caption';         $form_fields['image-caption']['input'] = 'hidden';              $form_fields['buttons'] = array(             'label' => '',             'value' => '',             'input' => 'html'         );         $filename = basename( $post->guid );         $attachment_id = $post->ID;         if ( current_user_can( 'delete_post', $attachment_id ) ) {             if ( !EMPTY_TRASH_DAYS ) {                 $form_fields['buttons']['html'] = "" . __( 'Delete Permanently' ) . '';             } elseif ( !MEDIA_TRASH ) {                 $form_fields['buttons']['html'] = "" . __( 'Delete' ) . "
" . sprintf( __( 'You are about to delete %s.' ), $filename ) . "                          " . __( 'Continue' ) . "                          " . __( 'Cancel' ) . "
";             } else {                 $form_fields['buttons']['html'] = "" . __( 'Move to Trash' ) . "" . __( 'Undo' ) . "";             }         }         else {             $form_fields['buttons']['html'] = '';         }     }     return $form_fields;     }     // Hook on after priority 10, because WordPress adds a couple of filters to the same     hook - added accepted args(2)     add_filter('attachment_fields_to_edit', 'myAttachmentFields', 11, 2 );      But one thing is missing the **Use as featured image** link is not appearing. Is someone have an idea on how i can make appearing the link **Use as featured image** beside the delete link? It is the only thing missing from this great script but i'm not a php expert i try to figure it out but didn't find the soluiton. Thank for any help. Regards


title: How to get comments by post ID?

text: I have this custom post query to list all the posts within a specific category. For example I have this:               $args = array('cat' => 'home','post_type' => 'post'));     $post_obj = new WP_Query($args);     while($post_obj->have_posts() ) : $post_obj->the_post();      // do stuff here     endwhile;      So for this page I would like to show the list of posts but also the accompanying comments. I am only showing maximum 2 comments for each post. Is there a built in function to do this?


title: How can I default a new post to being saved?

text: I'm trying to figure out how to make it so that as soon as the post-new.php page for a custom post type is loaded, the post is saved. Basically, I'm trying to make sure the post has it's postID saved before anyone even starts entering anything. I suppose I could probably "fake-click" the "Save Draft" button, but I'm wondering if there's a more legit way to handle it.


title: Posting as different users

text: I'll try to make this brief. I am a webmaster for a newspaper and in a single day i am uploading an issue of the paper where there are multiple authors to several articles. Question is: how do i make a post and display a custon author name without having to log into a different user just to get it to display correctly. I really want to be able to do this all from one admin account. Thanks folks i really appreciate any help!


title: truncate post with gallery tag

text: I have one problem I use this function for truncate posts               function truncate_post($amount,$quote_after=false) {     $truncate = get_the_content();     $truncate = apply_filters('the_content', $truncate);     $truncate = preg_replace('@<script[^>]*?>.*?</script>@si', '', $truncate);     $truncate = preg_replace('@<style[^>]*?>.*?</style>@si', '', $truncate);     $truncate = strip_tags($truncate);     $truncate = substr($truncate, 0, strrpos(substr($truncate, 0, $amount), ' '));     echo $truncate;     echo "...";     if ($quote_after) echo('');     }      but in my posts there is wordpress gallery call               [gallery ids="614,592,591"]      And now I need this truncate to not calculate this gallery tag.. because I get empty fields.. is this can be done? to truncate just text...


Anyone can recognize the current Wordpress backend, but I don't want that. I want to change it using my own design and I want to have a seamless navigating experience for my users. How can I change the dashboard appearance? I googled a lot of posts and questions, and it seems like you can only change the CSS of most things and some people were using hooks to add their own code and what not.


title: Wordpress Genesis Child Theme Filter divs

text: I'm trying to html5ize a Genesis child theme. So far I've figured out how to replace the Doctype via hook but am having trouble figuring out how i can change the divs to sections and articles without touching the core files. Can anyone point me in the right direction?


title: Twitter links in widget don't work?

text:
I am displaying a twitter feed on my homepage: http://www.fairwaterrights.com The feed works fine. But if I click on a link in the twitter post, it doesn't open. For instance, instead of opening `http://bit.ly/lNWyT9` in the browser, it tries to open `http://www.fairwaterrights.com/%22http:/bit.ly/lNWyT9%22`. How can I fix this? Here is the code:               <?php     $username = "fairwaterrights"; // Your twitter username.     $limit = "4"; // Number of tweets to pull in.          /* These prefixes and suffixes will display before and after the entire block of tweets. */     $prefix = ""; // Prefix - some text you want displayed before all your tweets.     $suffix = ""; // Suffix - some text you want displayed after all your tweets.     $tweetprefix = "@fairwaterrights "; // Tweet Prefix - some text you want displayed before each tweet.     $tweetsuffix = "

"; // Tweet Suffix - some text you want displayed after each tweet.          $feed = "http://search.twitter.com/search.atom?q=from:" . $username . "&rpp=" . $limit;          function parse_feed($feed, $prefix, $tweetprefix, $tweetsuffix, $suffix) {          $feed = str_replace("<", "<", $feed);     $feed = str_replace(">", ">", $feed);     $clean = explode("<content type=\"html\">", $feed);          $amount = count($clean) - 1;          echo $prefix;          for ($i = 1; $i <= $amount; $i++) {     $cleaner = explode("</content>", $clean[$i]);     echo $tweetprefix;     echo $cleaner[0];     echo $tweetsuffix;     }          echo $suffix;     }          $twitterFeed = file_get_contents($feed);     parse_feed($twitterFeed, $prefix, $tweetprefix, $tweetsuffix, $suffix);     ?>      Thanks for your help!


title: Get_Posts, only if in both categories

text: get_posts('numberposts=5&category=93+85')get_posts('numberposts=5&category=9385') Is there a way to have get_posts grab only posts that are in BOTH categories, as above?


title: Run javascript code after wp_login hook?

text: After using the `wp_login` hook, is it possible to add a snippet of javascript code to the page seen immediately after the login in wordpress? I want to use this top implement a notification system that notifies the user when they login.


title: Getting Different Size Of Attachment Images

text: I'm confused, because there are a lots of functions about attachments . I've tried a lots of functions. I'm setting a _featured image_ for my every blog post. I have to get different sizes of this image. FOr example a need this variations of _featured image_ 600px*400px 300px*150px 64px*64px (Images can be cropped). I'm adding these new image sizes (in `functions.php`):               add_image_size('custombig', 600, 400, TRUE);     add_image_size('customsmall', 300, 152, TRUE);     add_image_size('customimage', 64, 64, TRUE);      (in `single.php`)                <?php             // inside a Loop             if (has_post_thumbnail( $post->ID ))                 $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'customsmall' );         ?>         <img alt="" src="<?php echo $image[0]; ?>" />      But it's printing full size of image. Not cropping or resizing it. Can you teach me getting different sizes of attached images, or suggest me a few articles about this ?


title: How do you present WordPress to a designer who is afraid?

text: I have two groups of talented designers that I am trying to nudge away from doing Dreamweaver sites — AKA static pages that are based on "templates" — and toward WordPress. In both cases I have encountered what I can only describe as fear. This fear seems to be based on (a) a concern that they won't be able to "cut it" in this new world, and (b) that if they are "just" doing the main templates (and not all of the generated pages) they will lose billable hours. I think (a) is a matter of education and I'm working on it, but (b) is harder to answer. I believe that they will be able to address oft-stated customer requests for "editable websites," and that they will be able to bid on sites that require more functionality and dynamic interaction with the user than they have dealt with in the past. **Question:** Does anyone have any studies / examples / success stories / whatever that I can use to show them that WP may actually be a major step forward in their ability to find and please customers? It is important that these be from a _designer's_ point of view. Some of this will be anecdotal, but I'm hoping for something more ... concrete. _After thought:_  I wish I could give out more than one Correct Answer. I felt a bit stupid when I saw _case studies_ because that should have been one of the first things I searched on. I liked the comment about The Loop because it gave me a little insight from a designer's point of view about what might be intimidating. I'm going to look for more of those. Addressing _The Fear_ is a bit more difficult because fear, by it's very nature, is not purely rational. Many people have been deeply traumatized by the recession — watching your billables drop by 75-80% overnight through no fault of your own can make you really nervous about _anything_ changing. I saw this in my parents, who were in their 20's during the Great Depression; fifty years later they still had a sense of scarcity in the world.


title: wp_register_script not loading as expected

text: I am loading scripts like this:               //load scripts     //wp_register_script( $handle, $src, $deps, $ver, $in_footer );          add_action('wp_enqueue_scripts', 'load_scripts');          function load_scripts() {              if (!is_admin()) {                  wp_register_script('modernizr', get_bloginfo('template_directory') .'/scripts/modernizr-latest.js',false);             wp_enqueue_script('modernizr');                  wp_enqueue_script('jquery', true );                  wp_register_script('cookie',get_bloginfo('template_directory') . '/scripts/cookie.js', array('jquery'), '1.0',true);             wp_enqueue_script('cookie');                  wp_register_script( 'Gmaps', 'http://maps.google.com/maps/api/js?sensor=false', true );             wp_enqueue_script ('Gmaps');                  wp_register_script('plugins', get_bloginfo('template_directory') .'/scripts/plugins.js',true);             wp_enqueue_script('plugins');                  wp_register_script( 'maps_scripts',  get_bloginfo('template_directory') . '/scripts/maps.js', array('Gmaps'), '1.0', true );             wp_enqueue_script ('maps_scripts');                  wp_register_script('history', get_bloginfo('template_directory') .'/scripts/history.js', array('jquery'), '1.0',true);             wp_enqueue_script('history');                   }     }      With this I expect to see all scripts except modernizr loaded into the footer. Instead it is an incorrect mish-mash. From this example jquery, google maps, and the plugins.js still load in the header even though `$in_footer` is set to true. Cookie, maps, and history load in the footer as expected. Can someone please help explain this to me?


title: Difference between a theme and a plugin?

text: I'm curious as to what the specific differences are between a theme and a plugin. I get the gist of it...themes have to do with look and feel (html / css) and plugins have to do with adding functionality (code / php). However, a theme like the popular twitter inspired P2 seems to add functionality...not simply enhance the look and feel. That leaves me a bit confused. Can someone on this rockin exchange enlighten me? Much appreciated. Eddie


title: Update widget form after drag-and-drop (WP save bug)

text: I've posted a bug-report about this a few months ago (on WordPress trac (Widget Instance Form Update Bug)) and I thought I'd try writing about it here too. Maybe someone has a better solution to this issue than me. Basically the problem is that if you drop a widget into a sidebar, the widget form doesn't get updated until you manually press save (or reload the page). This makes unusable all the code from the `form()` function that relies on the widget instance ID to do something (until you press the save button). Any stuff like ajax requests, jQuery things like colorpickers and so on will not work right away, because from that function it would appear that the widget instance has not yet been initialized. A dirty fix would be to trigger the save button automatically using something like livequery:               $("#widgets-right .needfix").livequery(function(){       var widget = $(this).closest('div.widget');       wpWidgets.save(widget, 0, 1, 0);       return false;     });      and add the `.needfix` class in `form()` if the widget instance doesn't look initialized:                <div <?php if(!is_numeric($this->number)): ?>class="needfix"<?php endif; ?>        ...      </div>      One drawback of this solution is that if you have lots of widgets registered, the browser will eat lots of CPU, because livequery checks for DOM changes every second (tho I didn't specifically test this, it's just my assumption :) Any suggestions for a better way to fix the bug?


title: Disabling TinyMCE keyboard shortcuts altogether

text: I've disabled pretty much every button in the visual editor, besides bold and underline. The problem is that the functionality of the other buttons are still there with the keyboard shortcuts. Is there someway to disable the keyboard shortcuts. I don't need them at all.


title: Has WP and MU fully merged?

text: I'd heard that WP and MU were fully merging in WP 3.0. Did this happen? Is it now just a matter of installing the latest version of WP and turning on a multiple blog support switch...or is it more complicated than that? Any insight anyone can provide would be most appreciated. Eddie


title: Convert existing site to network

text: We have an existing WP3 site and would like to make it multiuser instead of the multiple installs we have now. I add the "WP_ALLOW_MULTISITE" CODE and relaunch - start the Network and then add the multisite code to wp-config and the .htaccess file. As soon as I do that and log out - it no longer finds a database connection. I noticed on previous attempts that a network database has wp_blogs table, and several other tables, where a standard install doesn't have that- I've checked all our other sites/databases. Is there more to do? We have our main site with another independent install within it that handles press releases. I'm looking to consolidate to one and need the separate permalink structure(the second install puts the posts at /resources/media_center/pr


title: How to force load a page in plugin?

text: I have a plugin which do very simple task...               if ( $_SERVER["REQUEST_URI"] === '/foo' )     {        // How to display the content of page of ID = 3, without using wp_redirect()     }      So the url is staying at `/foo`, but show the content of page ID = 3 Any idea?


title: How do I get /blog on my WordPress multisite

text: I have a 3.0.1 site with `MULTISITE` enabled and would like one of the sites to live at `/blog`, but when I try to create a new site with that path, I get this error:               The following words are reserved for use by WordPress functions and cannot be used as blog names: page, comments, blog, files, feed      How can I get a site at `/blog`?


title: How Do I Add Custom CSS To Only Certain Widgets

text: I have a standard dynamic sidebar using `register_sidebar` and `dynamic_sidebar` and I need the last widget in the sidebar (which will not have a set number of widgets) to have a distinct class (`'last_widget'`) added to the `<li>` that wraps it. What's the best way to do this?


title: Generate a Menu that Displays Child Pages using wp_list_pages() with the New Menu Functionality in WordPress 3.0?

text: Previously, I was able to selectively load child pages for a currently- selected parent page using logic such as:               if(  $post->post_parent ) {       $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");     } else {       $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");     }          if ($children) { ?>        <ul id="subnav">          <?php echo $children; ?>        </ul>     <?php      } else {     }      There doesn't seem to be a native way to do this using the new register_nav_menus()/wp_nav_menu() functionality. Anyone know how I could patch this together at this point? Here's a screenshot of what I'm trying to achieve: ![Drop down Child menu screenshot](http://i.stack.imgur.com/WJaXb.png)


title: Automagic Link Shortening for Non-Hosted WP

text: Blogs hosted on wordpress.com get automatic link shortening via http://wp.me/, but for those who prefer to seek out our own hosting solution is there a plugin that will, upon publishing a new post/page, make an api call to bit.ly (or other such service) store the resulting url and return it from `wp_get_shortlink()`? I have searched without success. Any help would be appreciated.


title: Update template without undoing all my edits?

text: I want to edit a wordpress template to have a look and feel more like I want. With things like my flair on it. After I change the template, does this mean I can no longer update it without reverting my changes?


title: An array of latest wp_titles

text: I want to get the latest titles with the_title() in an array so that I can loop through them in my javascript function. How can I create this array? Many thanks!


title: Converting a simple plugin to be placed inside of functions.php

text: First off, I know it's better practice to use plugins separately than to integrate them in functions.php but this is for a theme framework that will be deployed to multiple sites and it will be easier to have it packaged as part of the theme. I am having trouble using the following code from the plugin located here. My PHP knowledge is limited, I have tried copying and pasting the code directly but it does not work, but works fine when used as a plugin.               class Filosofo_Custom_Image_Sizes {          public function __construct()     {         add_filter('image_downsize', array(&$this, 'filter_image_downsize'), 99, 3);          }          /**      * Callback for the "image_downsize" filter.      *      * @param bool $ignore A value meant to discard unfiltered info returned from this filter.      * @param int $attachment_id The ID of the attachment for which we want a certain size.      * @param string $size_name The name of the size desired.      */     public function filter_image_downsize($ignore = false, $attachment_id = 0, $size_name = 'thumbnail')     {         global $_wp_additional_image_sizes;              $attachment_id = (int) $attachment_id;         $size_name = trim($size_name);              $meta = wp_get_attachment_metadata($attachment_id);              /* the requested size does not yet exist for this attachment */         if (             empty( $meta['sizes'] ) ||             empty( $meta['sizes'][$size_name] )         ) {             // let's first see if this is a registered size             if ( isset( $_wp_additional_image_sizes[$size_name] ) ) {                 $height = (int) $_wp_additional_image_sizes[$size_name]['height'];                 $width = (int) $_wp_additional_image_sizes[$size_name]['width'];                 $crop = (bool) $_wp_additional_image_sizes[$size_name]['crop'];                  // if not, see if name is of form [width]x[height] and use that to crop             } else if ( preg_match('#^(\d+)x(\d+)$#', $size_name, $matches) ) {                 $height = (int) $matches[2];                 $width = (int) $matches[1];                 $crop = true;             }                  if ( ! empty( $height ) && ! empty( $width ) ) {                 $resized_path = $this->_generate_attachment($attachment_id, $width, $height, $crop);                 $fullsize_url = wp_get_attachment_url($attachment_id);                      $file_name = basename($resized_path);                      $new_url = str_replace(basename($fullsize_url), $file_name, $fullsize_url);                      if ( ! empty( $resized_path ) ) {                     $meta['sizes'][$size_name] = array(                         'file' => $file_name,                         'width' => $width,                         'height' => $height,                     );                          wp_update_attachment_metadata($attachment_id, $meta);                          return array(                         $new_url,                         $width,                         $height,                         true                     );                 }             }         }              return false;     }          /**      * Creates a cropped version of an image for a given attachment ID.      *      * @param int $attachment_id The attachment for which to generate a cropped image.      * @param int $width The width of the cropped image in pixels.      * @param int $height The height of the cropped image in pixels.      * @param bool $crop Whether to crop the generated image.      * @return string The full path to the cropped image.  Empty if failed.      */     private function _generate_attachment($attachment_id = 0, $width = 0, $height = 0, $crop = true)     {         $attachment_id = (int) $attachment_id;         $width = (int) $width;         $height = (int) $height;         $crop = (bool) $crop;              $original_path = get_attached_file($attachment_id);              // fix a WP bug up to 2.9.2         if ( ! function_exists('wp_load_image') ) {             require_once ABSPATH . 'wp-admin/includes/image.php';         }              $resized_path = @image_resize($original_path, $width, $height, $crop);              if (              ! is_wp_error($resized_path) &&              ! is_array($resized_path)         ) {             return $resized_path;              // perhaps this image already exists.  If so, return it.         } else {             $orig_info = pathinfo($original_path);             $suffix = "{$width}x{$height}";             $dir = $orig_info['dirname'];             $ext = $orig_info['extension'];             $name = basename($original_path, ".{$ext}");              $destfilename = "{$dir}/{$name}-{$suffix}.{$ext}";             if ( file_exists( $destfilename ) ) {                 return $destfilename;             }         }              return '';     }     }          function initialize_custom_image_sizes()     {     new Filosofo_Custom_Image_Sizes;     }          add_action('plugins_loaded', 'initialize_custom_image_sizes');      I'm aware I can achieve the same results using TimThumb but I would much prefer to use the built in functionality of WordPress Here's a link to the plugin in question:- http://wordpress.org/extend/plugins/custom-image-sizes/ Thanks in advance! Steve


title: why doesnt is_home() work in functions.php

text: I'm pulling in scripts.php through functions.php. this is in scripts.php but for some reason, wordpress isn't recognizing is_home(). i've tried resetting the query, but to no avail. Am I hooking into the right function?               if(is_home()){          function my_scripts_method2() {         wp_register_script('cycle', get_template_directory_uri() . '/js/cycle.js', array('jquery'));         wp_enqueue_script('cycle');     }     add_action('wp_enqueue_scripts', 'my_scripts_method2');          function my_scripts_method() {         wp_register_script('homepage', get_template_directory_uri() . '/js/homepage.js', 'cycle');         wp_enqueue_script('homepage');     }     add_action('wp_enqueue_scripts', 'my_scripts_method');     }


title: Site Migration to WordPress: Handling Feeds

text: I'm moving a site hosted with another blogging system to WordPress. This site's RSS feed is hosted at the URL               http://example.com/home?format=rss      I want to ensure that users with this RSS Feed in their feed readers continue to get updates when I move to WordPress. Is there a standard way in stock WordPress to handle this? If not, is there a standard plugin to handle this? If not, how **are** people handling this? Apache redirects? Something else?


title: Why plugin ajax response is -1?

text:
I do not know why this response me -1 always? I am using this code in my plugin file. i want response on click p tag               <?php    function myajax(){ ?>             <?php         echo'
click
';         }              add_shortcode("my_ajax", "myajax");                   add_action('wp_ajax_stravyfuncajax22', 'testfunc11');         add_action('wp_ajax_nopriv_stravyfuncajax22', 'testfunc11');              function testfunc11() {         echo "2";         die();         }     ?>      **EDIT** : added php tag now....


title: Nav Walker current menu item not displaying

text: I'm building a theme on top of a starter theme (wp-bootstrap) and am having trouble getting the Nav Walker to show the current menu item. current-menu- item is not there when I use a web inspector on the output html. So therefore I can't style it. This is the code in my template file:                         <?php            /** Loading WordPress Custom Menu  **/            wp_nav_menu( array(               'menu'            => 'main-menu',               'container' => '',               'container_class' => 'navbar-blue',               'menu_class'      => 'nav',               'menu_id' => 'main-menu',               'walker' => new Bootstrapwp_Walker_Nav_Menu()           ) ); ?>      And this is the code in function.php:               include 'includes/class-bootstrapwp_walker_nav_menu.php';      And finally this is the code from the customer nav walker file:               class Bootstrapwp_Walker_Nav_Menu extends Walker_Nav_Menu {          function __construct() {     }       function start_lvl(&$output, $depth) {          $indent = str_repeat("\t", $depth);     $output .= "\n$indent<ul class=\"dropdown-menu\">\n";       }     }      I've looked over a few stackexchange answers and tried changing the code to match them, but nothing has solved the issue (ie: nothing has made current- menu-item appear in the html output). Any help would be appreciated.