title: Rewriting Image URLs from dynamic to original

text: Here's the deal: My plugin automatically watermarks images from the WP gallery on the fly using the GD library wherever these images appear. So, I have a physical copy (in wp-uploads) of these attachments, and also a watermarked, dynamic copy of the image which I replace the image source on the page using Simple HTML DOM. So now, I have an image on my page that points to a URL like this: `http://localhost/wp- content/plugins/pluginname/image.php?original=http%3A%2F%2Flocalhost%2Fwp- content%2Fuploads%2F2012%2F09%2FPenguins-300x225.jpg&username=&wmtext=localhost&wmsize=14&wmcolor=%23000000&wmpos=top- center&pin_hoveron=1&pin_hoverimg=http%3A%2F%2Flocalhost%2Fwp- content%2Fplugins%2Fpluginname%2Fadd-to- etc.png&followimg=&pin_on=1&follow_on=1` What I want to do is make the image source APPEAR like it is the original version, but display the dynamic image instead. I've attempted to mess around with rewrite rules, but it never seems to do _anything_ , no matter what I try. The rules get added to .htaccess, but nothing changes. Here's what I was messing around with:               add_action('generate_rewrite_rules', array( $this, 'addRewrites' ) );          public function addRewrites( $content ) {         global $wp_rewrite;         $new_rules = array(             'img/(.*)'      => plugins_url( 'image.php', __FILE__ ) . '?etc=$1',         );         $wp_rewrite->non_wp_rules += $new_rules;     }      Now if I visit an image URL or a page with an image, NOTHING happens. =/ I'm a newbie when it comes to rewrite rules, so this is a bit beyond me.


title: Problem with wp_create_category

text: I have simple code:               add_action('init', 'categoryTransfer');          function categoryTransfer(){     //some code         for($i=0; $i < count($categories); $i++)             wp_create_category($categories[$i]->name);     }      But when it executes i get:               Fatal error: Call to undefined function wp_create_category() in /Users/noname/Sites/wp-content/plugins/my_plugin/my_plugin.php on line 95      Where is a problem?


title: Adding body class when post contains a specific shortcode

text: **Simple shortcode function :**               function my_shortcode_function($atts,$content=null){       // Do something       return $content;     }     add_shortcode('my_shortcode','my_shortcode_function');      I wonder how to add more extra body class when user use this shortcode in contents. **I can't do something like :**               function my_shortcode_function($atts,$content=null){       // Do something       add_filter('body_class','my_body_class');       return $content;     }     function my_body_class($classes) {        $classes[] = 'foo';        return $classes;     }     add_shortcode('my_shortcode','my_shortcode_function');      Any idea ?


title: Gravity Forms After Submission - GFFormsModel::update_lead_field_value?

text: I am working with Gravity Forms. This code works with a couple issues :               add_action('gform_after_submission_14', 'post_contract_update', 10, 2);     function post_contract_update($entry, $form) {         $form ='3';         $lead = $entry['4'];         $statusvalue_update = 'Under Contract';         GFFormsModel::update_lead_field_value($form, $lead, '', '', 154, $statusvalue_update);     }      After form 14 is fired, it does what it is supposed to using Gravity Forms Model : update_lead_field_value. Only problem is - once my $lead (lead_id) goes over 9, to a double digit, the entry gets truncated. So for example, in this image below, I actually put in 448 into $lead. In the DB it's only showing as 4. ![Gravity forms sql shown](http://i.stack.imgur.com/TMrvD.png) The storage field is correct int 10 - and adding directly via sql works. So far I have -   * added directly via PHP   * move firing of the function around   * changed priority   * changed themes just in case   * deactivated plugins just in case   * single qouting, double qouting   * printed out array - everything looks perfect   * change string to intval etc... Nothing seems to work, no matter what - once my $lead id goes above a single digit. Am I missing something incredibly easy? Am I unaware of limitations on GFFormsModel::update_lead_field_value? Is the model expecting some specific number format?


title: Pages with posts filtered by category

text: My site has a few categories, such as "business", "techology", "news" etc. I'd like to display the latest posts from most categories on the front-page, except for a few special ones which I can filter out as described here. Is there an easy way to add pages in such a way that they automatically display all recent posts from a given set of categories? E.g. a "business & technology" page which automatically displays the most recent posts categorized under "business" or "technology"?


title: assign default pages to newly craeted site in wordpress multisite

text: I have created new multisite and it runs successfully. I want to crate 3-4 pages from super admin and assign these pages to my already created sites and when new site create than I want to assign these pages to site. and also I want to do is in child sites there is no option for crated new page. he can manage only those pages which is created from super admin. Is it possible?


title: Best Way to Setup a Network of WP Sites?

text: What, in your opinion, is the best way to setup a network of WP sites with a shared login?   * I want users to stay logged in to their account when they switch sites   * I want this to be used with different domains


title: No Edit / Delete Links for Custom Post Type?

text:
I've created a custom post type for "testimonials" as well as rearranged the edit post display with custom columns for that post type... Everything works as expected EXCEPT for the fact that when I hover over one of these custom posts, the list of "action links" that normally appears beneath it enabling you to edit/delete that post aren't there... Here's a screenshot of what I mean: ![enter image description here](http://i.stack.imgur.com/hzLsg.png) Here's all the related code:               function wpg_edit_testimonials_columns($columns) {       $columns = array(         'cb' => '<input type="checkbox" />',         'testimonial_author' => __('Author', 'quotable'),         'testimonial_text' => __('Testimonial', 'quotable'),         'attribution_link' => __('Attribution Link', 'quotable'),         'date' => __('Date Added', 'quotable')       );       return $columns;     }          function wpg_manage_testimonials_columns($column, $post_id) {       global $post;       $custom = get_post_custom($post->ID);       $testimonial_author_name = $custom['testimonial_author_name'][0];       $testimonial_author_link = $custom['testimonial_author_link'][0];            switch($column) {              case 'testimonial_author':           echo $testimonial_author_name;         break;              case 'testimonial_text':           echo $post->post_content;         break;              case 'attribution_link':           echo $testimonial_author_link;         break;              default :           break;       }     }     add_filter('manage_edit-testimonials_columns', 'wpg_edit_testimonials_columns');     add_action('manage_testimonials_posts_custom_column', 'wpg_manage_testimonials_columns', 10, 2);      My only guess is that maybe it has something to do with the fact that the "title" column isn't being used? I didn't see any need in using the title column since the post type doesn't even support the use of "titles", as it's just a testimonial. ## EDIT: Ok, I've confirmed that it is, in fact, due to the fact that the title column isn't being used... I added "title" to the list of columns in the array and the links appeared... However, since titles aren't supported in this post type, the title is being listed as "Auto Draft" for all of the testimonials. ## EDIT AGAIN: Taking the advice of @helenhousandi, I've rolled my own set of links... but now I'm running into an entirely new problem. The delete/trash link uses a nonce, which I've added... but I'm apparently missing a step somewhere, because it's not actually completing the action when clicked. Instead I'm getting a WordPress failure notice: ![enter image description here](http://i.stack.imgur.com/MzwPX.png) Here's the edited portion of my code:               $wpg_row_actions  = '
ID.'&action=edit">Edit | ';     $wpg_row_actions .= 'Quick Edit | ';     $wpg_row_actions .= 'ID.'&action=trash', 'delete-post_'.$post->ID).'" title="'.__('Move this item to the Trash', 'quotable').'" class="submitdelete">Trash';               switch($column) {       case 'testimonial_author':         echo $testimonial_author_name.$wpg_row_actions;     break;


title: Verify if tag is used on posts

text:
I'm using site tags for a glossary. I would like to display a link to the tagged page if the tag exists, otherwise just display the tag title. Is there a check which would allow me to determine if the tag is has been tagged on posts?                   $tags = get_tags( array( 'hide_empty' => false ) );         if ($tags) {           foreach ($tags as $tag) {             if ($tag->description) {               echo '
term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $tag->name ) . '" ' . ' style="text-decoration:none;">' . $tag->name.'

' . $tag->description . '
';             }           }         }      (Working) Update from Chip's recommendation                   $tags = get_tags( array( 'hide_empty' => false ) );         if ($tags) {           foreach ($tags as $tag) {             if ($tag->description) {               echo '
';                   if ( 0 < $tag->count ){                     echo 'term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $tag->name ) . '" ' . ' style="text-decoration:none;">' . $tag->name.'';                   } else {                     echo $tag->name;                   }               echo '

' . $tag->description . '
';             }           }         }      Example end result http://i.imgur.com/aFs6z.png


title: Wordpress Multisite: Set template languages for a domain?

text: I have two domains set up in a Wordpress 3 Multisite blog. One of them is supposed to be in Swedish and the other in English. The template contains some texts that I want to translate for the different sites. How do I set up different languages for the sites' frontend (using the language files in my template)?


title: Is it a good idea to edit an already existing plugin to add more functionality?

text: I need to add a relatively small bit of functionality to a Wordpress plugin and I have the option to either edit the plugin directly, or scrap the plugin completely and repurpose PHP code from another site to do the same thing. Repurposing non-Wordpress PHP code for such a small change seems silly and I have the few lines of PHP I would use when editing the plugin. My question is, is it a good idea to edit a plugin? I know that when editing a theme, if the edits are done directly to the old code, when the theme is updated the changes will be lost. Does this happen with plugins too? Is there a way around this? For those wondering how complicated the changes are, I'll explain briefly. The client I have wants a form submission to go to a dealer and the user. But on certain circumstances depending on the user's email address (if it ends in ".gov" or a few other endings... yes I know this isn't the best idea and I tried to convince the client but they were adamant) the client wants the email to go to someone else. Naturally this could be cured with a few small PHP lines in the plugin but the plugin doesn't have the functionality for "conditional recipients" based on content sent by the user. So I'd like to either add that functionality just for this site (if it can be done quickly) or I'd like to replace the plugin with straight php which seems like it would cause more problems than it would fix initially. Time is of the essence. Thank you so much for your help!


title: I want my post to republish again after adding a custom field

text: I wanted a code in Wordpress that could allow me to republish the post every time I add a new custom field. For example, if I already have a post and wanted to add an update to it; I want it to appear at the top of the site after updating it. Is that possible ? Thanks in advance


title: Image on rss feed on post

text: I want my website to display post of bloggers fashion posts from a virtual world second life. I've started using blogger, they have a simple widget "bloglist", just put the url of the blogger it also show pictures of recent post per url. Someone told me to move to wordpress because it's better layout. I'm using Wordpress now, but I'm totally lost. What type of plugins, codes or widgets do I need to get this same result in Wordpress? I know rss feed, but it does not show an image with the post feed. What do I need to achieve this? Here are examples of what I'm trying to achieve > behappyinsl.wordpress.com/ > > www.old-london-docks.de/ fashionfeedofsl.com/


title: Loading Canvas & WooCommerce translation file in child theme

text: I'm trying to localise a site (Canvas child theme). I already have the translated .po and .mo files. I uploaded the WooCommerce translation files to `child- theme/woocommerce/i18n/languages/` in the child theme and the Canvas translation file to `child-theme/lang/`. This follows the same directory structure as the parent theme and plugin. I have also defined WPLANG as 'af_AF' In my functions.php I have the following function               function weg_localisation() {      load_theme_textdomain('woothemes', get_stylesheet_directory() . '/lang');      unload_textdomain('woocommerce');      load_textdomain('woocommerce', get_stylesheet_directory() . '/woocommerce/i18n/languages.woocommerce-af_AF.mo');      }      add_action('init', 'weg_localisation');      Unfortunately I'm having no success with this. Any idea where I'm going wrong? Thanks,


title: Include content of file into plugin (ob_start();;include;ob_get_clean()) without <<<EOT

text: I am writing a plugin that requires a large chunk of html. Now the way how it is set up now works.               return <<<EOT  EOT;      But I want to split the file into different php files that i can include. Now I tried this, but it does not work:               ob_start();     include(plugin_dir_url( __FILE__ ).'file.php');     return ob_get_clean();      Any know how this could be done? =====================   **_EDIT_** Ok thanks Chris Carson to I have found the small error, I changed the code to:               ob_start();     include(plugin_dir_path( __FILE__ ).'/file.php');     return ob_get_clean();      This is working ok now, except for one small problem. In the previous code I used something like this:               $variable = 'Hello!';          return <<<EOT         {$variable}     EOT;      This would have made the following in html:               Hello!      But now this:               $variable = 'Hello!';          ob_start();     include(plugin_dir_path( __FILE__ ).'/file.php');     return ob_get_clean();      This just prints               {$variable}      Any way to get the code working with variables.


title: Using the loop to set locations for all posts on a single google map

text:
Firstly, hi all! I am new to worpress stackexchange. I have been trying to build my own google map to show the location of all my posts. But I don't seem to be able to get the markers to display on the map. Edit: I have changed the code a bit since my origional post, I am now returning data but with errors. This is the data being returned:

Dubai

Testing the plugin even more

Sydney

Still testing the plugin

Singapore

Testing Plugin

Abu Dhabi

This is a test of the Maps

                And this is the maps.js file:               var infowindow = new google.maps.InfoWindow();     var pinkmarker = new google.maps.MarkerImage('/wp-content/themes/travel-bones/library/images/pink_Marker.png', new google.maps.Size(20, 34) );     var shadow = new google.maps.MarkerImage('/wp-content/themes/travel-bones/library/images/shadow.png', new google.maps.Size(37, 34) );          function initialize() {         map = new google.maps.Map(document.getElementById('map'), {              zoom: 12,              center: new google.maps.LatLng(38.898748, -77.037684),              navigationControl: false,                 backgroundColor:'none',                 streetViewControl: false,             mapTypeControl: false,             mapTypeId: google.maps.MapTypeId.ROADMAP          });              for (var i = 0; i < locations.length; i++) {               var marker = new google.maps.Marker({                 position: locations[i].latlng,             icon: pinkmarker,                 shadow: shadow,             map: map             });             google.maps.event.addListener(marker, 'click', (function(marker, i) {               return function() {                 infowindow.setContent(locations[i].info);             infowindow.open(map, marker);               }             })(marker, i));         }          }      And then this is how I am doing the query in the index.php               <?php if ( have_posts() ) : ?>
                     <?php $i = 1; ?>                     <?php while ( have_posts() ) : the_post(); ?>                         <?php if ( get_geocode_latlng($post->ID) !== '' ) : ?>                             <div id="item<?php echo $i; ?>">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
                                 <?php the_content(); ?>
                         <?php endif; ?>                         <?php $i++; ?>                     <?php endwhile; ?>

                  <?php else : ?>
Error 404 — Page not found.
             <?php endif; ?>      The query is obviously working as the results are being returned. However I am getting this error on the maps.js file:               for (var i = 0; i < locations.length; i++) {       Uncaught TypeError: Cannot read property 'length' of undefined      And this error where the queried content shows...               var locations = [          latlng : new google.maps.LatLng(25.271139, 55.30748500000004),     Uncaught ReferenceError: google is not defined                                            },      This is the tutorial I have been following... code is modified to pull lnt/lng data from a geocoder pulgin. http://martyspellerberg.com/2012/02/tutorial- integrating-wordpress-and-google-maps-api-v-3/


title: Are there ways to have a functioning editing workflow in Wordpress?

text: The Cooking blog has two admins (I am one of them) and lots of contributors. A contributor writes a post, then the first admin edits it, then the second admin edits it, then we two admins talk about possible differences (contradictory comments turned out to confuse the author :P) then it goes back to the original author, who is supposed to implement, accept or reject our edit suggestions (which can be changes directly in the text, or comments describing what is wrong). The whole cycle is repeated 2-3 times until a post is finalized. We have found no way to do this in Wordpress. Currently, we receive the draft in a format the contributor finds convenient (directly in Wordpress, as a .doc file, in an email body, shared in Google docs). The only tool we have which has a "track changes" functionality is a full-blown word processor, so we copy it there and return it that way to the contributor. When the editing process is finalized, we transfer the text to Wordpress, manually adjusting all the formatting. This is a time-intensive process, and in the end it can happen that the contributor is unhappy with some formatting details, so they have to go over the post again and ask us to change it. During this process, everybody has to actively message the others that he has just made some changes and it is "their turn". This is failure-prone, as we have had cases where two people were editing in parallel without noticing, and cases where a planned task didn't get done because everybody thought somebody else is currently doing it. Besides, for longer-term posts we forget at which stage they are/whose "turn" it is and have to search through chat transcripts and hope that the message we have found reflects the current situation. A perfect solution would allow us to move the whole workflow to WordPress. Specifically, we need:   * a "track changes" function    * a function for leaving comments related to a specific place in the text    * a system for tracking the current "status" of a blog. In a perfect world, that would include a custom list of stati, such as "waiting for edit by rumtscho", but even a cruder system ("waiting for a review by and editor") would be better than nothing.    * active messaging which automatically notifies everybody associated with the post of a change in status, for example by sending an email. (Not something which is visible only when that person is logged in, because this is a side project for all of us and we don't visit the dashboard often).    * a schedule. Not just the simple "schedule for publishing on $date" thing for posts, but a calender accessible to authors and contributors, where events can be linked to existing posts and drafts.  It is probably wishful thinking to hope that all of this will be present in some way. But are there solutions which at least come close in some way, or which offer other good ways to solve our problems and create a working process out of this chaos?


title: SQL Bulk Move old posts by one author to another category

text: I'm looking to move a number of old posts by one author from one category to another category and was hoping someone could help me do this? I figure the easiest way would be through an SQL command? I'm aware that you can bulk 'move' posts via the post editor screen but this only adds another category and doesn't in fact move the posts. There are a number of different plugins out there that can bulk move posts but none of them allow you to select specific users and specific dates. In essence what I'm trying to achieve:   * select all posts from user with ID: 2   * **IF** posts are made **_before_** 15 Feb 2012 **AND** in category XYZ **THEN** move to category ABC Any help would be greatly appreciated.


title: get_the_tags() not iterating through for/while loop, but will with foreach

text: I'm having a very peculiar issue with Wordpress right now that I can't understand, and hopefully someone here will have experience with it to help solve it. I'm trying to iterate through the array returned by `get_the_tags()` using a standard loop (not foreach), but whenever I attempt to access it through index, it doesn't return anything. According to the Wordpress Codex, `get_the_tags()` returns an array of tag data that is associated with the post. Weirdly enough, a `foreach` structure works perfectly fine when dealing with it; however indexing it does not. Here's what I've tried:               $tags = get_the_tags();     $total = count($tags);     echo($total); // Returns 2          // This one does nothing         for($i=0; $i<$total; $i++){        echo($tags[$i]->name); // Does nothing     }          // This one works:     foreach($tags as $tag){         echo($tag->name); // Prints the tags, as it should     }      So for whatever reason, the above example using the index does _not_ work when it comes to `get_the_tags()`, but it works fine in a foreach loop. But that's not all that's weird. Using `get_tags()` to get all tags for the blog in an array in a similar fashion works fine in both situations! So for example:               $tags = get_tags();     $total = count($tags);     echo($total); // Returns 4          for($i=0; $i<$total; $i++){        echo($tags[$i]->name); // Prints the 4 tags     }          foreach($tags as $tag){         echo($tag->name); // Prints the 4 tags     }      They both return arrays of tags according to the Wordpress Codex, so what gives for the top one not working using an index? I'm trying to do something that requires access to the index (and dealing with more than 1 array, so it can't be a foreach). Would anyone have any ideas on how to fix it (or at least access the data)? Has anyone else experienced this bizarre issue?


title: First time using Multsite, not sure how to handle domains

text: So, I have a hosting account with a registered domain. I also have a domain with a different hosting company. Instead of installing two copies of WP in two different directories I'm giving Multisite a shot for the first time. I just need some clarification on how to handle the domain that's hosted elsewhere. I'm under the impression I need to use and configure the Domain Mapping plugin to point the offsite domain to the installation directory for the second site? Or, is there a better way?


title: How to make registration form ajax?

text: I have a registration form and I would like to make it ajax, is there such plugin or how can I adjust the standard wordpress registration page to be ajax without reloading page. Thanks in advance.


title: Exclude single page from function

text: //wraps the permalink around each thumbnail     add_filter( 'post_thumbnail_html', 'my_post_image_html', 10, 3 );          function my_post_image_html( $html, $post_id, $post_image_id ) {            $html = '' . $html . '';       return $html;      }      As the comment says, wraps the permalink around each thumbnail, but I'd like to exclude the link on single pages so I tried               //wraps the permalink around each thumbnail     add_filter( 'post_thumbnail_html', 'my_post_image_html', 10, 3 );          function my_post_image_html( $html, $post_id, $post_image_id ) {            $html = '' . $html . '';       return $html;       else {       if( is_single() ) {            $html = '';           return $html;                }                }     }      It breaks my site.


title: migrate a MU sub blog to a single install

text: I would like to convert one of my WordPress multisite blogs back to a single install on another server. it's not the main site but one of the subdomains. Is this possible?


title: Reverse chronology of post listing

text: I"m working on modifying a theme that is based on 2010. I want to make the posts on this blog display earliest to oldest, but I don't see how to do this in the theme: I understand I need to add `. "&order=ASC"` to a wp_get_posts query, but I can't find any. Just index.php: `get_template_part( 'loop', 'index' );` and loop.php it seems to have the posts already: `while ( have_posts() ) : the_post();` Where should I look?


title: Should I use SVN or Git?

text: I've never used version control before, but I'm starting to work more collaboratively on WordPress plugins and themes and I think it would be a good idea to have a record of versions and updates. WordPress seems to favour SVN, but Git seems to be the new, cooler alternative. Which version control do you use currently? And which system would you choose today if you were starting out in WP theme and plugin dev?


title: WPDB Insert or if exists Update

text: I'm not crazy familiar with WPDB or SQL in general but I have a custom table for my project and I'm trying to assign some metadata to it. What I'd "like" to happen is if a row exists, update it and if not insert it. I've read both Insert and Update in the WPDB Codex but neither really went into an "either or" situation. I thought i could work with update, so my code so far looks like this:               $wpdb->update(         $wpdb->prepare(             $wpdb->prefix.'item_info',             array(                 'post_id'       => $post_id,                 'item_stock'    => $item_stock             ),             array('post_id' => $post_id)         )     );      Does WordPress have anything like an "IF exists Update, ELSE Insert", or do I need to run custom SQL to achieve this, or do I need to query the database first to see if an ID exists in my table THEN decide whether to update it or insert it?


title: is it possible to replace the use of gd_lib with imagick or ImageMagick?

text: i'm looking around for a solution since weeks and can't make anything work yet. the problem is that my server is running debian/lenny and it's not supporting the bundled gd_lib which i need for thumbnailing/cropping stuff. but i could make use of imagick or imagemagick (package vs plugin). my question is: is there any way to replace the gd functions in media.php with the ones from imagick? AND is there a smarter way then modiyfing the media.php to do so? thanks


title: Is there any plugin to show number of clicks on the link?

text: I have a post having different links. I have to show number of clicks on each link. Is there any link to show number of clicks on the link?


title: Wordpress site isn't working with http, but https is fine

text: I'm hosting a wordpress site on the AWS EC2 plan, and I've set up an Elastic IP so I can host multiple sites. However, the wordpress site is only working when accessed with the https: protocol. When I use the http: protocol, only the front-page.php html gets loaded; no css, images, etc. I don't know if this is a problem with my Apache configuration or Wordpress, and my hunch is both; however, the reason I'm posting here is because the Wordpress site is _at least_ accessing the front-page.php. I only have one plugin installed, and I've updated it with Wordpress 3.9.2. In a nutshell: my GET requests to anything but '/' return a 404 when used with http; however, with https, everything works fine.


title: Will a plugin able to know is_user_logged_in?

text: I am currently building a plugin and it doesn't know when a user is logged in.               global $current_user;     echo $current_user->ID;      It works when embedded on a template but not on a plugin? I have a custom database that depends on user_id, whenever I insert a record, user_id field always has a zero value while others have the correct one.


title: Singular custom taxonomy label

text:
I have a custom taxonomy called "Artists" which has the taxonomy singular name set to "Artist". If a post only has 1 artist I would like the label to be "Artist" instead of "Artists". How could I achieve this? My current code is below. Thanks!               <?php               $taxo_text = "";               $artists = get_the_term_list( $post->ID, 'artists', "

Artists

 ", '

', '

' );                    if ( '' != $artists ) {                   $taxo_text .= $artists;               }                    if ( '' != $taxo_text ) {                    echo $taxo_text;                    } // endif                    ?>


title: Make Customizer Load Specific Page

text: Is it possible to force the WordPress Theme Customizer to load a specific page? Or a page template? What about sample content. So instead of loading the home page content load dummy content that will help the user understand what it will look like with typical content instead of the content that's there right now. I haven't tried anything and am looking for some suggestions where to start. Perhaps some hooks to look at.


title: When using Tribe Events Calendar, querying for a specific event category returns nothing

text: I'm still new to wordpress and I'm trying to write a plugin but for some reason this code is producing nothing. Why? I am completely stumped. I have followed the examples here to a tee.               <?php         /*         Plugin Name: Text         */              add_action("init", "init_stuff");              function x_get_event_posts(){             $all_events = tribe_get_events(                 array(                     'eventDisplay' => 'all',                     'posts_per_page' => -1,                     'tax_query'=> array(                         array(                             'taxonomy' => 'tribe_events_cat',                             'field' => 'slug',                                 'terms' => 'xmlworkshopdonotuse'                             )                     )                 )             );                  echo count($all_events); // produces "0";         }              function init_stuff() {             x_get_event_posts();         }          ?>


title: Nested Shortcode Detection

text: If you are familiar with this code               <?php       $pattern = get_shortcode_regex();       preg_match('/'.$pattern.'/s', $posts[0]->post_content, $matches);       if (is_array($matches) && $matches[2] == 'YOURSHORTCODE') {         //shortcode is being used       }     ?>      from this website, but it does not work for nested shortcodes. Does anyone know how to make it work for nested shortcodes?


title: Get child terms of current term of the current post

text:
I have custom post type "product" and taxonomy is "product_cat". There are two child terms -Music and videos. Under Music i have two more child terms albums and single. Now when i go to music category i want to get all the child terms of the music. I am using the following code               <?php $page_id = get_the_id(); ?>          <?php $cat_terms = wp_get_object_terms( $page_id, 'product_cat' ); ?>
<?php var_dump($cat_terms); ?>
               <?php foreach ($cat_terms as $terms  ) {?>     <?php $array = (array) $terms; ?>

<?php echo $array["name"]; ?>

                 <?php                        $args = array( 'post_type'=>'product',                       'tax_query' => array(                              array(                           'taxonomy' => 'product_cat',                           'field' => 'slug',                           'terms' => $array["name"],                         )                       )                     );                     $postslist = get_posts( $args );                             ?>                     <?php foreach ($postslist as $post) : ?>                         <?php $array1 = (array) $post; ?>                              <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'shop_thumbnail' ); ?>
<img src="<?php echo $image[0]; ?>" alt="">
                     <?php endforeach; ?>
                 View all

     <?php } ?>      But this is giving me the Music category and one child i.e albums . But i just want album and single . Please help me out


title: Front-End Form Submission in Shortcode

text: The plugin I am working on contains shortcodes with forms on them. Upon form submission (POST), I do some database work, and then planned on redirecting to another page after the db work is complete. When I attempt this, I get the "Headers Already Sent" warning. Within the shortcode function, how do I call my redirect sooner than get_headers? Do I need to use some separate callback function?


title: How do I cleanly override a plugin's CSS with a child theme?

text: folks! I have taken it upon myself to adhere to WordPress conventions so I can have a clean, sexy child theme. However, I am unsure how to proceed on a certain issue. I would like to override the CSS for some plugins in my WordPress website, and this wonderful post was a great step in the right direction. My only concern is that I would like to do everything I can to **avoid overriding** the `header.php` file in my parent theme in order the do this. Is there another wonderful way to do this? Thanks for your help! **Update** : As was pointed out by another user's comment, this is in fact dependent on how the plugin implements its styles. This aside, assume that the plugins do provide a way for styles to be implemented in the `style.css` sheet of the child theme, or, in my case, a separate `styles` folder linked to that `style.css` sheet. I also know I can use `!important` all over the place, but this is generally frowned upon.


title: Worldpress uses local IP for URLs

text: I installed Worldpress in my PC and setup URL forwarding to my router to access the site from outside my home. everything works fine. but when I tried to load the page from outside it does not load the CSS and image files. I found reason that all the URLs uses the my home PC IP address. As example image urls like               http://192.168.1.2/wordpress/image1.jpeg      It is possible to configure WordPress to work without local IP


title: Qtranslate + Woocommerce (multiple tinymce)

text: I am using WooCommerce and qTranslate to develop an ecommerce website. I run into the following problems. I've googled it and days of trying to no avail. On the top of the product edit pages, the tinyMCE text area looks ok. It has several languages tabs along with visual and text editor tabs. However, at the bottom, the TinyMCE box for Short Description isn't integrated well with the qTranslate. The tool bar of it doesn't show up and there is no language tabs neither. Additionally, switching between the visual and text editor tabs is not working properly. A workaround I found on the Internet is to refresh the page every time. But it is not a solution. Apart from the problems above, every time the page refreshes, it seems that the cursor focuses in the box of the Short Description. If the Short Description is at the last section of the product edit page, the page will automatically scroll to where it is after reloading. I also tried to install TinyMCE Advanced and Ultimate TinyMCE to see if these two plugins can fix the problems, but also no luck. Cheers!!


title: Letting users create a post that is a custom post type from a page

text: I'm trying to create a kind of "Request for Proposals" system for a blog that belongs to a client of mine. I'm not too sure how to go about this, but so far I've outlined this much.. I know there will be two kinds of users for this. 1. Proposers 2. Speculators Proposers will be able to submit their proposals from the front-end of the site. Speculators will be able to login and see the page that lists all the most recent proposals, as well as view them individually. Speculators should be the only role allowed to do this. Now, I'm having a hard time figuring out how to create these two user types. I can see in Press Permit videos that he's got user roles like "Student" and a few others. But there isn't any video that shows how he was able to create those users.


title: Having Multisite websites expire

text: I'd like to have sites in a multisite installation expire and get deleted together with all their content and users, after a particular timeframe, say 1 week. How can I do this?


title: How can I get url from image tag in feed with fetch_feed?

text: I used this piece of code in `functions.php` to add featured image in `<image>` tag in feed               add_action('rss2_item', 'add_my_rss_node');          function add_my_rss_node() {         global $post;         if(has_post_thumbnail($post->ID)):             $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'medium');              $url = $thumbnail[0];             echo("<image>{$url}</image>");         endif;     }      then the URL of featured image displayed in feed as I expected. Now I want to pull this URL out, I tried `<pre>$item->get_title()</pre>` but it didn't show anything. Now I wonder how can I get this URL out? this' my feed: http://techdaily.vn/feed and I follow this guide to use feed_fetch http://codex.wordpress.org/Function_Reference/fetch_feed


title: Retrieve First Image Function

text: I am using this function to retrieve the first image from a gallery in a post. However this doesn't work properly when I re-order the images in the gallery. It is stuck with the first image at the first time of the upload. Any other ideas on always getting the first image as shown in the gallery?               function echo_first_image ($postID)     {                        $attachments = get_children(                                 array(                                       'numberposts' => -1,                                       'order'=> 'ASC',                                       'post_mime_type' => 'image',                                       'post_parent' => get_the_ID(),                                       'post_type' => 'attachment'                                       ));                         $first_attachment = reset($attachments);                    //$last_attachment  = end($attachments); or last image                    echo wp_get_attachment_image($first_attachment->ID, 'full');     }


title: Wordpress Widget plugin and input file

text: I am writing a widget plugin; and I want to insert an input tag:`<input type="file">` to browse for a pattern in my widget plugin admin panel; but I have problem to save its value(address of the pattern). It seems that `<input type="file">` doesn't work in widget plugins. Is it correct? Are there any other ways to browse a file from the admin panel? here is the input file code in the widget form function:               <fieldset id="customize">      <label>Browse pattern:</label>     <input type="file" accept="image/*" size="15" id="<?php echo $this->get_field_id('menupattern'); ?>" name="<?php echo $this->get_field_name('menupattern'); ?>" value="<?php echo $instance['menupattern']; ?>" />      </fieldset>       @s_ha_dum, I have been read the link about `enctype` ; but it wasn't helpful. please note that in the widget plugins I have to send data by the widget `form( $instance )` function, and I want to let the user to select a photo from the webserver; not to upload it!


title: How to get the deleted category id?

text: I want to do some action at the time of deleting a category using that category id. Is it possible to get the category id?


title: Remove swfobject.js in wp_head()

text: I have gotten rid of the wlwmanifest_link and jquery, since I load it from a compressed version and at the footer, but I can't find a way to get rid of the swfobject.js. This is the code I used to get rid of the other two in my functions.php file: `remove_action('wp_head', 'wlwmanifest_link'); if ( !is_admin() ) wp_deregister_script('jquery');` Replacing either with 'swfobject' does not remove it, so there must be another way.


title: CSS classes for theme

text: Does anybody know predefined (suggested by WP) CSS classes which should I use in my theme? I have seen somewhere in Internet a list of all CSS classes, which are used in WP theme, but can't find it. **UPDATE:** I have found the site where I've seen this list: http://www.wpbeginner.com/wp-themes/default-wordpress-generated-css-cheat- sheet-for-beginners/


title: Dashboard says "no posts found" even though there are some posts

text: I have a weird bug on the dashboard: the dashboard says there are a total of 3 posts, but the list is empty and says "No posts found" (see image below) ![enter image description here](http://i.stack.imgur.com/b6AoZ.png) It's a fresh install on a shared Windows hosting, using SQL Server as the database with the WP Db Abstraction plugin. I tried reinstalling WP completely and the bug is still there. Before I reinstalled WP, I had configured it for multi-site, and I had the same issue in the site list. I'm a complete newbie with WordPress and I have no idea how to fix this... any help would be greatly appreciated! * * * UPDATE: I investigated the queries issued to the database, and it seems that the query that is supposed to return the list of posts is this:               SELECT TOP 0 *     FROM wp_posts     WHERE 1=1     AND wp_posts.post_type LIKE 'post'     AND (wp_posts.post_status = 'publish' OR wp_posts.post_status LIKE 'future' OR wp_posts.post_status LIKE 'draft' OR wp_posts.post_status LIKE 'pending' OR wp_posts.post_status LIKE 'private')     ORDER BY wp_posts.post_date DESC      And of course, `TOP 0` returns 0 rows... this query seems to be generated by the DB abstraction plugin when it tries to translate the `LIMIT` clause to SQL Server. So I guess my only options are:   * fix the bug (doesn't seem easy, since there is no obvious translation for `LIMIT` in SQL Server)   * or switch to a MySQL database...


title: Reposition Woocommerce Message

text: I'm trying to reposition the messages in my Woocommerce theme. For example the successfully added to cart message. They appear to automatically be placed at the very top of where the woocommerce wrapper start begins. I've already found this link which allows me to change the wording of the message but what I need is to remove the message from where it is and reposition it elsewhere. I've scoured the woocommerce forum, this forum and the woocommerce template files. There is a messages.php but that only appears to contain the markup for the messages. I cannot figure out how to change where the messages appear. Any help on this would be greatly appreciated.


title: multi level menu not working and not displaying correctly

text:
I have created a multi level menu with wordpress and no matter what i try the menu will not display correctly. here is the genereated menu

Latest

apps

app store

blackberry

play store

tablet apps

wp store

business

gadgets

galaxy note 2 and 3

galaxy s3/s4

htc one

huawei

iphone

meizu

motorola

nokia, LG

pantech

sony

mobile

iphone

android

blackberry

windows phone

tablets

acer

asus

ipad

note 10.1

note 8

surface

products

      here is the css i tried, its long so i put it in jsfiddle. i tried a few of the menus found on this site css menu maker and was able to get one to work. I know the css has #cssmenu ul li.has-sub and thats why it doenst work but i did change it to #cssmenu ul ul.sub-menu li for where it was needed and it didnt work. I tried looking for wordpress barebone multi level menu css so that i can work off of it but wasnt able to find anything.


title: How to add javascript just before the closing body tag in the footer of WordPress

text: I'm following some of the other people's advice here about adding my js file before the closing body tag but it doesn't seem to work for me. If someone would be so kind as to check this for me please?               <?php       /*load the js file into the footer*/       function myscript()        {        if( wp_script_is( 'jquery', 'done' ) ) {       ?>          <script type="text/javascript" src="js/scripts.js"></script>       <?php       }      }       add_action( 'wp_footer', 'myscript' );     ?>      Many thanks **EDIT:------------------------------------------------** This is the short solution.. `<script language="javascript" src="<?php bloginfo('template_directory'); ?>/js/scripts.js"></script>` not the right answer though is it? **EDIT---------------------------------------------------** This is what I am trying based on the WP codex examples and your points Fischi but think I am still doing something wrong..               function my_scripts_method() {     wp_enqueue_script(         'myscript',         get_bloginfo('template_directory') . '/js/scripts.js',         array( 'jquery' ),          '',          true     );      }               add_action('wp_enqueue_scripts', 'my_scripts_method');      The file still doesn't load into the footer.


title: Media Upload Directory to MMYY instead of YYYY/MM

text: Is there a way to change the upload directory's location and format from `YYYY/MM` (`/wp-content/uploads/2013/06`) to `MMYY` (`/news/0613`)?   I've searched everywhere and could not find an answer - in fact, the latest version of WP even removed the ability to change where to even put the upload directory. Thank you! :)


title: Remove 'rel' attributes from the_category() output

text:
I am trying to get the categories associated with a post in it's meta section by using the following code:
FILED AS: <?php the_category(' • ')      ?>
      WordPress is generating the markup as:
FILED AS:          Uncategorized
      This part `rel="category tag"` is making my code invalid. W3C validator throws an error saying: > Bad value category tag for attribute rel on element a: The string category > is not a registered keyword or absolute URL. Whitespace in path component. > Use %20 in place of spaces. > > …w all posts in Uncategorized" rel="category tag">Uncategorized Any idea how to rectify this?


title: How to give a download link to a .csv file from the custom plugin?

text: I have made a custom plugin, which exports MYSQL table contents into a **.csv** file which gets saved in to wp uploads directory. Now, I am trying to give a download link for downloading directly a **.csv** file. But, I am getting this error " **Warning: Cannot modify header information - headers already sent** " I'm so very grateful for all of the help you all give. I've searched for this topic and couldn't find it, if this topic is already answered here, please comment with the link to the question with the answer. Thanks. **Code Which I tried for Downloaing:**               header( "Cache-Control: must-revalidate, post-check=0, pre-check=0" );     header( "Content-Length: " . strlen( $out ) );          // Output to browser with appropriate mime type, you choose ;)     header( "Content-type: text/x-csv" );     header( "Content-Disposition: attachment; filename=$filename" );          echo $out;     exit;


title: Performance impact of rewriting WordPress URLs

text: I'm currently rewriting author URLs in WordPress.   1. I've removed the author base slug `/author/`. Please note I have total control over page slugs so can guarantee there will be no conflicts.   2. I've added 3 endpoints (posts, comments, articles) so that author links can look like: example.com/username/posts example.com/username/comments example.com/username/articles Will rewrite rules such as this have an impact on my website's performance? For theoretical sake let's say the number of authors were in the millions. **References:** Endpoints https://make.wordpress.org/plugins/2012/06/07/rewrite-endpoints-api/ Rewrite rules http://codex.wordpress.org/Rewrite_API/add_rewrite_rule


title: Getting post content within wp_nav_walker

text:
I have a custom walker set up designed to add content into the nav menu. The problem being that it is not pulling the content. The post object returned by the get_post/get_page has an empty post_content attribute. What is causing this? Walker:               class mobile_walker_nav_menu extends Walker_Nav_Menu {                    function start_lvl( &$output, $depth ) {     // depth dependent classes     $indent = ( $depth > 0  ? str_repeat( "\t", $depth ) : '' ); // code indent     $display_depth = ( $depth + 1); // because it counts the first submenu as 0     $classes = array(         'sub-menu',         ( $display_depth % 2  ? 'menu-odd' : 'menu-even' ),         ( $display_depth >=2 ? 'sub-sub-menu' : '' ),         'menu-depth-' . $display_depth         );     $class_names = implode( ' ', $classes );          // build html     $output .= "\n" . $indent . '
' . "\n";     }               function start_el( &$output, $item, $depth, $args ) {     global $wp_query;     $indent = ( $depth > 0 ? str_repeat( "\t", $depth ) : '' ); // code indent          // depth dependent classes     $depth_classes = array(         ( $depth == 0 ? 'main-menu-item' : 'sub-menu-item' ),         ( $depth >=2 ? 'sub-sub-menu-item' : '' ),         ( $depth % 2 ? 'menu-item-odd' : 'menu-item-even' ),         'menu-item-depth-' . $depth     );               $depth_class_names = esc_attr( implode( ' ', $depth_classes ) );          // passed classes     $classes = empty( $item->classes ) ? array() : (array) $item->classes;     $class_names = esc_attr( implode( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) ) );     // build html     $output .= $indent . '
ID . '" class="' . $depth_class_names . ' ' . $class_names . ' ' . $theBack . '">';          // link attributes     $attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->attr_title ) .'"' : '';     $attributes .= ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) .'"' : '';     $attributes .= ! empty( $item->xfn )        ? ' rel="'    . esc_attr( $item->xfn        ) .'"' : '';     $attributes .= ! empty( $item->url )        ? ' href="'   . esc_attr( $item->url        ) .'"' : '';     $attributes .= ' class="menu-link ' . ( $depth > 0 ? 'sub-menu-link' : 'main-menu-link' ) . ' ' . $class_names . '"';          $item_output = sprintf( '%1$s%3$s%4$s%5$s%6$s',         $args->before,         $attributes,         $args->link_before,         apply_filters( 'the_title', $item->title, $item->ID ),         $args->link_after,         $args->after     );          // build html     $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );          $output .= '
';     var_dump(get_page($item->ID));     if(is_page($item->ID)){             $the_page = get_page($item->ID);             var_dump($the_page);             $output .= apply_filters('the_content', $the_page->post_content);     } elseif (is_single($item->ID)){             $the_post = get_post($item->ID);              $output .= apply_filters('the_content', $the_post->post_content);     }     }          function end_el( &$output, $item, $depth = 0, $args = array() ) {         $output .= "

\n";     }     }


title: Upgrading themes never works

text: I have a Wordpress installation running on my own server at home, serving a domain name I bought. It's running on Debian Linux, currently installed under `/usr/share/wordpress`. When I'm in the Admin panel, I see notifications for updates to the themes or plug-ins. So, I SSH into my server, turn on the FTP daemon, then start the update. Below is an example output:               Downloading install package from http://downloads.wordpress.org/plugin/akismet.3.0.0.zip…     Unpacking the package…     Installing the plugin…     Could not create directory. /var/lib/wordpress/wp-content/plugins/akismet/     Plugin install failed.      This is starting to get a little annoying. The directory exists, and the user that the FTP is running on (www-data) has write access to the folder. Why can the Updater not remove the old plug in, then install the new one? * * * Meta Discussion about being on or off topic


title: How to create network-wide taxonomy terms on multisite?

text: I am trying see if it's possible to create shared network-wide taxonomy _terms_. Specifically, I want to create a few custom taxonomies for Users (a network- wide resource) and I want them to all share the same available terms. One solution I have found for network-wide taxonomy terms is Multisite Global Terms. The problem with this plugin is that it directly manipulates `$wpdb->terms` to use the main site as the "master site" for ALL terms. This will not work for me, as I still need the individual sites to have their own terms for other taxonomies. Other solutions I have seen hook into actions for create/delete terms and merely sync all sites to have the same ones. This is also not what I'm looking for. Some possible solutions I have thought of are:   * creating a global user query class based on `WP_User_Query` which is modified to manipulate `$wpdb` similarly to the way MGT does, but returns it to the way it was after the query. (or just creating a function that wraps the query with this)   * creating new db tables for global taxonomies, terms and relationships and mimicking existing taxonomy/term related code to interact with it. (this might be the best solution as it wouldn't be object-specific).   * giving up and using user meta instead.. Does anyone have any experience with this? Any comments or other possible solutions are much appreciated!


title: Make a vertical dynamic list of posts in alphabetically order and in columns

text: I have a page that lists all the posts from a given category of an custom post type dynamically. I do this with a plugin that list posts and a shortcod and with css i created 9 columns where they are sorted horizontal after letter. Instead I would like to have this in a vertical alphabetically dynamic ordered lists, preferably sorted under a letter. like this: http://skatematic.com/channels Since css doesn't seem to cut it with this, I'm not sure where to start. Any pointers?


title: Forced profile plugin ..and link to field

text: I use the plugins Bp forced profile that display a message for complete a missing required field with a list of field (title). Howto link a title to the field missing in the message ? if you have more field in plus tab ..the user require navigate to all tab for find the missing field required, but if linked to come directely to tab with missing required field and speedup the completation. if any have a code inminded for this thankyou +++ sara


title: List posts related to category on a div

text: i want to display posts related to selected category at the same page(on a different div). What i want is as the image attached, when i click the category name on the left side, all related posts must be listed on right. Thanks in advance   **EDIT** i couldn't set up the logic, the code is not my issue. i couldn't realize how to solve the matter. i dont ask for codes, i just want an idea ![Display of my page](http://i.stack.imgur.com/m0N2i.jpg)


title: Remove arrows from previous and next link

text: In the wordpress theme I am developing I inserted some code to display links to the previous and next posts which appears at the bottom of each post. The code looks like this..               <?php previous_post_link(); ?>     <?php next_post_link(); ?>      The problem is that these arrows << and >> appear next to them. Does anyone know how to get rid of them? Any help will be appreciated.


title: How to disable hoverIntent in Wordpress 3.3 admin

text: I don't like hoverIntent in the new flyout menus or admin bar; to me, it makes my page feel slow. What would be the Wordpress-friendly way to disable hoverIntent (or change its options) in the new Wordpress admin and toolbar? The only place I see hoverIntent in the Admin page source is here: `<script type='text/javascript' src='http://mysite.com/wp-admin/load- scripts.php?c=1&load=admin-bar,hoverIntent,common,jquery- color,suggest,inline-edit-post,jquery- form&ver=26e0371f31adb44206d9f999828c9182'></script>`


title: Paypal buttons disappear in the text editor

text: I have a series of paypal buttons on a web page that I am trying to migrate from another site onto Wordpress. When I copy the html and paste it into the (HTML TAB) of the wordpress editor, I can see the buttons. But when I press save the code disappears...


title: Site blocked by WebSense on fresh WP Install

text: Just put up a new WP 3.2.1 install running twenty eleven, with one post "coming soon". I haven't yet begun developing the site. At my place of business, it is currently blocked by WebSense as "potentially damaging content", yet I was able to access the site yesterday. Does it appear as if my site is hacked or has spam links, or does the web filter just not like my newfound sense of freedom? :) The site is here, I can't currently check into it due to the whole web filter issue. It does look fine on my iPhone, but I can't view source. **Theme** : Twenty Eleven (no modifications)   **Plugins** : Remove Double Space


title: Get current page id, title, url, etc

text: Sorry but I get lost on Wordpress's codex. I am trying to add a mail this page sharing link and want to include some info from the page. In pseudo code is this possible? `<a href="mailto:?subject=".CURRENT_BLOG_NAME." ".CURRENT_PAGE_TITLE."&body="intro%20text%20".WP_PLUGIN_URL.$_SERVER['REQUEST_URI'].">Mail to a friend</a>` Where `CURRENT_BLOG_NAME` is ??? and `CURRENT_PAGE_TITLE` is ??? `WP_PLUGIN_URL.$_SERVER['REQUEST_URI']` **does** get me the path to the current page.


title: Html and links via Quick press

text: Is there anyway I can add an html link from the quick press on the Wp-admin Dashboard? Does it accept html? If only I could do that, I wouldn't have to go to create new post everytime I wanted to blog.


title: Want to add a custom author link to a single.php

text: I want to add a custom link to linkedin near author name. It should be very easy if it would be only one author, but now it's not. So, I have to add something on all single.php and somewhere the real links. Can anybody help me with this? Thanks!


title: woocommerce questions - trying to pic an ecommerce solution

text: I need to have a conversation with someone familiar with woocommerce. Is there a phone number for support, i am willing to pay for the support call. I have a company that messed up the redo of my website and is willing to rewrite it in either WordPress or Magento. I told them wordpress and they are using woocommerce as my eCommerce solution. I sell medical products and will use it as a catalog for my more expensive products but want a robust eCommerce site for the smaller products. I am looking for: 1. excellent SEO and Filtering. 2. great newsletter potential. nothing fancy but I need to be able to have a doctor inform me of a product that he needs or has to sell me and turn the email around to me list quickly and efficiently as this is how i source my used equipment. 3. i could have over 1000-2000 products. There are more things that i need but that's why I would like to discuss them with someone who understands the product at a high level. That's also why i like the WordPress backbone because I pretty much know what it can do. Magento on the other hand seems to get great reviews from developers but not so good reviews from the people who work the site on a daily basis, huge file sizes, bulky code, slow and not so user friendly. Please let me know if there is a resource that i can talk to. . Thank you. Rick


title: Create hooks based on an array of hook names?

text: I have this idea where I would create a class that would take in a set of hook names then create them, for me to use when ever, and where ever. Currently the way to create a hook is we do something like:               function some_hook_name(){         do_action('some_hook_name');     }      And then from there we write some other function, well call - add_content and then pass it to the action as such:               add_action('some_hook_name', 'add_content');      and there we go. But what if I wanted to create a class where I do something like:               $array_of_hook_names = array(         'hook_one', 'hook_two', ...     )      so that later on, I could do:               add_action('hook_one', 'add_content');      Is there any way to do this? Could I just do something like:               public function setup_hooks($array){         foreach($array as $hook_name){             do_action($hook_name);         }     }      Ideas?


title: Add tinymce to widget textareas

text: I've got several custom widgets which are extended from WP_widget. Many of these have textarea fields. I'd like to be able to apply a special css class to certain of these textareas in order to convert them to rich text areas with a basic TinyMCE toolbar control. How involved is this to do? I'd like to implement a solution that inherits most or all of its code from the WP core and just piggyback off that.


title: How to specify expiration of cacheable resources?

text: I'm trying to speed up a wordpress site -- this site: http://richardclunan.net I'm following the observations here: http://gtmetrix.com/reports/richardclunan.net/9ps7Zc0j The first item says: "The following cacheable resources have a short freshness lifetime. Specify an expiration at least one week in the future for the following resources:" How do I specify expirations for those things? (I'm not very technically-minded, and likely won't know relevant terminology -- really appreciate baby-steps explanation if possible :)


title: How to use wp_editor(); in functions.php then retrieve content in the template

text: I want to use wp_editor(); (custom editor) I've tried several methods but I am lost and I can't get it to save the post and retrieve the content in template How to edit posts with the new wp_editor api? also               add_action( 'edit_page_form', 'my_second_editor' );     function my_second_editor() {         // get and set $content somehow...         wp_editor( $content, 'my_second_editor' );     }      Looking for a simple solution which allow me to post the content and display in a same manner as the_content(); would with default editor... any ideas?


title: Affect on speed of wordpress membership plugins -- currently trying s2member

text: I'm taking a look at s2member -- I have it running, and my site is very slow -- it's taking on average about 9 or 10 seconds to load. This is the site: http://richardclunan.net I want to figure out if the s2member plugin is causing it to be slow. And whether there are other faster membership plugins... 3 questions:   1. Are there particular settings or things specific to s2member that I should take care of to ensure s2member doesn't make my site slow?   2. If I deactivate the plugin to test the speed of the site with the plugin deactivated, will that mean I'll have to respecify s2member settings when I reactivate it? After it's reactivated will members' accounts work ok?   3. Anybody have observations on s2member or other wordpress membership site plugins and their affect on site speed?


title: Word count not accurate - potential bug

text: My editors reported that there appears to be an issue with my word count on the post edit page. Testing this proved true, check the word count: ![wordcount](http://i.stack.imgur.com/46gOk.png) This is affecting all posts, for instance, a post with around 1600 words shows as 8000+ words. My question is, what can be the cause of this? How do I troubleshoot this and find a solution? Is anyone else experiencing similar issue on Wordpress v3.5.1? I am baffled... **Update** : Appears it calculates characters (instead of words). It sums all letters without spaces. It doesn't count periods or other symbols either. Now, this is getting obscure. **Update 2** : The perks of moving servers. Once moving server, I could start debugging this issue on the old server to find the cause. So I deactivated all plugins, same problems. Finally, I found this code hiding in the theme of which I used as a template:               // Tells wp_trim_words() function to use characters instead of words     function et_wp_trim_words_to_characters( $default_translated_text, $original_text, $context ) {         if ( 'words' == $original_text && 'word count: words or characters?' == $context ) {             return 'characters';         }              return $default_translated_text;     }     add_filter( 'gettext_with_context', 'et_wp_trim_words_to_characters', 20, 3 );      My question is, **what would be the purpose of this code**? I suspect that it was not intended to conflict with the word count on the post edit page.


title: Sort Posts by Multiple Meta Values

text: 1) Custom Post Type named "Buying_Locations" 2) Each Post has three meta values of: State, City, Store Name **QUESTION:** How can you show a list of these posts sorted alphabetically by State, then City and then the Store Name? For example... **STATE 1**   * CITY 1     * STORE NAME     * STORE NAME     * STORE NAME   * CITY 2     * STORE NAME     * STORE NAME     * STORE NAME   * CITY 3     * STORE NAME     * STORE NAME     * STORE NAME **STATE 2**   * CITY 1     * STORE NAME     * STORE NAME     * STORE NAME   * CITY 2     * STORE NAME     * STORE NAME     * STORE NAME **STATE 3**   * CITY 1     * STORE NAME     * STORE NAME   * CITY 2     * STORE NAME     * STORE NAME     * STORE NAME   * CITY 3     * STORE NAME I've gotten a little further with this:               $mypost = array(      'post_type' => 'buy_locations',      'posts_per_page' => -1,      'meta_key' => 'store_city',      'orderby' => 'meta_value title',      'order' => 'ASC'      );      $loop = new WP_Query( $mypost );       Just need to figure out how to sort by the State first, then the city, then title. Not sure how to add the extra "meta_key" value. How do I add the 3rd sorting request?               $mypost = array(          'post_type' => 'buy_locations',          'posts_per_page' => -1,          'meta_key1' => 'store_state',          'meta_key2' => 'store_city',          'orderby' => 'meta_value1 meta_value2 title',          'order' => 'ASC'          );


title: How to change value of $menu_class in ep_nav_menu?

text: How can i change value of $menu_class parameter in wp_nav_menu() so that I can give a special css class to one of items in menu for example "Home"? here is some code but they didn't show me the message at all:               function clear_nav_menu_item_id($id, $item, $args) {         echo "nav_menu_item_id";     }          add_filter('nav_menu_css_class', 'clear_nav_menu_item_class', 10, 3);     function clear_nav_menu_item_class($classes, $item, $args) {         echo "nav_menu_css_class";     }


title: Passing conditional arrays to WP_Query()

text: I've looked around at a few places and could not find an answer. I was wondering what the best way to create a WP_query from possibly empty variables were. I have about 16 of these $_GET variables.               if( isset($_GET['promotion']) ){         $promotion = $_GET['promotion'];              if($promotion == 'promotion'){             $promo = 1;         } else if($promotion == 'regulier'){             $promo = 0;         }     }      In some cases `$promo` might not be set. So how can I create a `meta_query` let's say with dependant on if `$promo` is set or not.               'meta_query' => array(         array(             'key' => 'model-promotion',             'value' => $promotion         )     )      If the `meta_query` is not set but present in my `WP_query()` the query breaks. Thanks for the help!


title: Wordpress communication through XML-RPC.NET

text: I'm currently using XML-RPC.NET library to communicate with my Wordpress site. I have successfully created a simple client for adding postings under Posts. However, I cannot seem to find something that can add or edit new things under Gallery. Can anybody guide me or help me on this? Does the current XML-RPC.NET library support this feature? Thank you very much. CookComputing supports the XMl-RPC method called metaWeblog.newPost, but this is for Posts. Is there anything for Gallery? Thanks again. ![enter image description here](http://i.stack.imgur.com/sHPfs.jpg)


title: How to disable wp content editor while using qtranslate for custom post types in wp-admin

text: Is it possible to remove the editor completely for some CPTs?   * If you remove the editor support for the CPT, qtranslate does not init for the title field. So, if you want to use it, you should get the tinymce no matter what.


title: Get All In One SEO Pack to use custom field instead of Content

text: I'm having an issue with a custom theme whereby All in One SEO pack isn't auto-generating descriptions because I am using a custom field to enter the main body of the page/post. Is there way to specify that All in One SEO uses a specific field to read from for the purpose of generating the SEO content automatically?


title: Creating a custom abstract/excerpt function: retrieving text between a specific tag or id

text: Unfortunately, the functions for retrieving the abstract and the excerpt don't fit my needs. I want to define a part in my text that should function as abstract without falling back to JavaScript/jQuery as I do not want my readers to necessarily have it enabled for reading the content. I want to define a custom tag or shortcode like [my_abstract] and retrieve the text between it. It also could be a div-tag with a specific id. Unfortunately, I'm not well versed in PHP, could this be done?


title: How can I use 'orderby' => 'meta_value_num' to order by the numerical value even if the value starts with a word?

text: I'm using `'orderby' => 'meta_value_num'` to order some boats I have as a custom post type, the meta values ordered by, are boat models, which are normally just numbers but if you look at this page: `http://boats- barcos.com/brands/ferretti/` you will see the ALTURA 840 is listed last when it should be between the 800 and 870. This is obviously because the value starts with a word. How can I get the `orderby` query to only order by the numerical value and ignore the word?


title: Delivering Page Templates With Plugins

text: My company is asking me a lot of requests that are "theme territory" for a plugin that inserts a custom types and taxonomies. My current approach has been using 'wp_ajax_nopriv_' to set a function that responds a JSON object of the posts, and displays theme on the frontend. However, they also have the need to search using the WordPress native search, and to display taonomies and custom type single requests using templates. I've been using:               function my_taxonomy_template() {              $term = get_queried_object();                   $templates = array();              if ( $term ) {             $taxonomy = $term->taxonomy;         }                   $plugin_dir = plugin_dir_path(__FILE__);         if ( $taxonomy == 'my_taxonomy' ) {                  if(file_exists($plugin_dir. '/includes/taxonomy-sponsorship_category.php'))                 return $plugin_dir . '/includes/taxonomy-sponsorship_category.php';         }          }          add_filter('taxonomy_template', Array($this, 'my_taxonomy_template' ));      But seems error prone, specially since now I'm about to use advanced searching using wordpress' default search, etc. I've seen some plugins instructing the user to add the pages manually and set them to use a shortcode. What's the recommended way to do this?


title: Cant use php fopen() function in functions.php

text: I am trying to simple run fopen() in the **functions.php** , and have also tried it in a **test.php** wordpress template file. But it does not work. If I move the test.php file and csv file to a location outside the theme folder then it works first time.               function csv_to_array($filename='', $delimiter=',')     {         if(!file_exists($filename) || !is_readable($filename))             return FALSE;              $header = NULL;         $data = array();         if (($handle = fopen($filename, 'r')) !== FALSE)         {             while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)             {                 if(!$header)                     $header = $row;                 else                     $data[] = array_combine($header, $row);             }             fclose($handle);         }         return $data;     }          echo '<pre>';     print_r(csv_to_array('csv/nationality-codes.csv'));     echo '</pre>';      This is my folder structure in the theme file... ![enter image description here](http://i.stack.imgur.com/KqrBF.png) Any ideas why it does not work?


title: wp_insert_link not working

text: Im using this code to insert links into my blog:                       $linkdata = array(                  'link_name' => $title,                  'link_url' => $url,                  'link_catetory' => 3, // my cat id                  );                  $link_id = wp_insert_link( $linkdata );       Links are inserted, but not in the correct category, I missed something?


title: Getting a 'slide down' js panel implemented within WP

text:
**I'm trying to implement a very simple vertical slide down panel in Wordpress** , I've tried jbar _(http://tympanus.net/codrops/2009/10/29/jbar-a- jquery-notification-plugin/)_ and an easy JS method I found in **http://jsfiddle.net/ahr3U/** But I still cannot get this implemented, I've tried inserting the below code in the _footer.php_ right before it's close, and within the _header.php_ and still nothing appears.                     **And CSS:**               #notification {         background-color: #F00;         color: #FFF;         height: 25px;         position: absolute;         top: -25px;         width: 100%;         transition: top 0.5s;         -moz-transition: top 0.5s;         -webkit-transition: top 0.5s;         -o-transition: top 0.5s;     }          #notification.visible {         top: 0px;     }      **The HTML CTA via the div, I've tried calling with the** `<head>` and `<body>`
Page load complete...


title: Customing Annual Archive plugin

text: I'm using the Annual Archive plugin which shows the year in the sidebar. I want to display in the dropdown only the years that have posts in category 17. How can i achive this?   My code is below...                   function widget( $args, $instance ) {              extract($args);         //$c = $instance['count'] ? '1' : '0';         //$d = $instance['dropdown'] ? '1' : '0';              $format = empty($instance['format']) ? 'html' : apply_filters('widget_type', $instance['format']);         $type = empty($instance['type']) ? 'yearly' : apply_filters('widget_type', $instance['type']);         $before = empty($instance['before']) ? '' : apply_filters('widget_type', $instance['before']);         $after = empty($instance['after']) ? '' : apply_filters('widget_type', $instance['after']);         $limit = apply_filters('widget_limit', $instance['limit']);         $title = apply_filters('widget_title', empty($instance['title']) ? __('Annual Archive', 'anarch') : $instance['title'], $instance, $this->id_base);              //$wpdb->query('select * from my_plugin_table where foo = "bar"');              echo $before_widget;         if ( $title )             echo $before_title . $title . $after_title;              if ($format == 'option') {             $dtitle = __('Select Year', 'anarch');             if ($type == 'monthly'){                 $dtitle = __('Select Month', 'anarch');             }             else if($type == 'weekly'){                 $dtitle = __('Select Week', 'anarch');             }             else if($type == 'daily'){                 $dtitle = __('Select Day', 'anarch');             }             else if($type == 'postbypost' || $type == 'alpha'){                 $dtitle = __('Select Post', 'anarch');             }              ?>         <select name="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'> <option value=""><?php echo esc_attr(__($dtitle, 'anarch')); ?></option>  <?php wp_get_archives(apply_filters('widget_archive_dropdown_args', array('type' => $type, 'format' => 'option', 'show_post_count' => $c, 'before' => $before, 'after' => $after, 'limit' => $limit))); ?> </select>         <?php         } else {         ?>         <ul>         <?php wp_get_archives(apply_filters('widget_archive_args', array('type' => $type, 'limit' => $limit, 'format' => $format, 'before' => $before, 'after' => $after, 'show_post_count' => $c))); ?>         </ul>         <?php         }              echo $after_widget;     }


title: category_description() shows raw html after version 3.x?

text: Just looking for some history on the output of category_description() I have categories whose "description" fields are formatted with rich text and I'm trying to understand the differences in WP version with respect to the output of this method so that I can do a version check if necessary to implement desired output. For example, before 3.0.1, it appears that category_description() returned the output stripped of any html markup. However, with the current 3.3.1 release, the output appears to be raw.


title: How to show products attributes in loop?

text: I added custom attributes to my products, and I would like to show one of these on the product loop page(loop/price.php). The attribue name is: "garan".               $garanvalues = get_the_terms( $product->id, 'pa_garan');          foreach ( $garanvalues as $garanvalue ) {         echo $garanvalue->name;         var_dump($garanvalue);     }      I used the code above, but the var_dump output the following:               array(1) {   ["invalid_taxonomy"]=>   array(1) ..      I hope you know solution. Thank you very much!


title: Show validation warning if no Excerpt is added

text: Is it possible to display a warning in the admin section when posting if the excerpt section hasn't been filled out to stop a post being published without an excerpt? Does anyone know of a plugin that has this facility?


title: Carrington Build: Overriding module view file not working

text: I am attempting to create a filter in my theme to override the view file used for the Loop Module in Carrington Build, but nothing is happening.                           function my_load_loop_view($view, $data) {                     if (is_home() || is_front_page()) {                              $view = trailingslashit(get_stylesheet_directory()). 'views/cfct-module-loop-view.php';                     }                     return $view;                 }                 add_filter('cfct-module-loop-view', 'my_load_loop_view', 10, 2);                      If I'm understanding the documentation correctly, this is pretty much exactly how it's done. This is the example the manual shows:               function my_load_callout_view($view, $data) {         if (is_home() || is_front_page()) {             $view = trailingslashit(get_stylesheet_directory()).'views/callout-home-view.php';         }         return $view;     }     add_filter('cfct-module-cfct-callout-view', 'my_load_callout_view', 10, 2);      I've also experimented with different values for the add_filter() priority, but that had no effect.


title: Specific custom searches (user profiles by their user name and posts by their title only)

text: I need to make these kinds of searches on my site:   1. Search for user profiles by user name.   2. Search for posts by post title only (i.e., exclude their content). How should I go about this?


title: Changing www prefix in General Settings and Interior Links

text: This may be the most redundant/dumbest question known to man, but if I go into Wordpress' General Settings and modify my Site Url to include a `www`, so               http://mysite.com      becomes               http://www.mysite.com      do I need to run a MySQL query to find/replace my image sources, my interior page links, etc? They all currently point to an address without the `www`, will this cause an issue?


title: Disable registration on certain condition

text: I have a certain condition in my code (if the user is visiting the page from a network range) and I can ask for this condition easily, let's say:               if ( $user_in_allowed_range)      What I want is to offer the registration button only to users who fulfill this condition, and other users should still be able to login. Is there any way to do this in WordPress without hacking the core? An additional custom login form is not a solution as the original one is still available. I found some hooks (`login_form`, `login_head`, `user_register` …) and the theme function `wp_login_form()` but they do not offer my needed feature.


title: Saving Custom Post types and fields to a custom table

text: I have a project in which I am trying to import a large amount of data into a WordPress installation and from that data, create pages on my site (as a custom post type). Since these pages will be visited far less often than the rest of our site, we decided to keep the data separate from posts and postmeta, so that it doesn't affect load times. The information does need to create the custom posts so that they can be added to the sitemap (using google xml sitemaps - too many to add by hand). I have created a custom post type and created the beginning of a plugin that creates a custom table in the database. My thought is that I could then create a function that saves the post information to this database rather than post or post meta when it is being created. I know enough php to get by and am new to sql, but have help to turn to if I need it. Unfortunately, they are less well versed on the wordpress side than on coding, so I would like to try to gather as much information as possible before turning to them. So does this sound like a reasonable plan and does anyone know of resources where I could get a feel of what I would need to do?


title: Help with rewrite rule

text: I have a probleme with a rewrite rule. On my page, I have a link to : mySite/pubmed/article/23919219 I would like to convert it to               http://example.com/index.php?page_id=165&article_id=23919219      to catch it with my plugin. My page with id 165 exists of course. My rule is :               add_action( 'init', 'pubscore_addMyRules' );     function pubscore_addMyRules(){         add_rewrite_rule('^pubmed/article/([^/]*)/?','index.php?page_id=165&article_id=$matches[1]','top');         add_rewrite_tag('%article_id%','([^&]+)');     }      But it doesn't work, I have a 404 error.


title: Change twentytwelve sidebar responsive relocation?

text: I'm using twentytwelve as a base theme and I want to change a behavior of the sidebar. When viewing in mobile view (you can collapse your browser window all the way horizontally to see the same view) the sidebar items drop below the content. I would like one item (the top item) of my sidebar to go above the content but stand under the navigation. So for example say I have recent posts, recent comments and subscribe in my sidebar. When in mobile view I want recent posts to stay on top of the content, and recent comments and subscribe to go below. Is this possible? Thanks a bunch for any and all help! Best, George


title: How to load javascript on custom page template?

text: I have a custom page template where I would like to load some javascript. I suppose I could always include the javacsript in the actual file, but that seems ugly. Is there any way to identify if wordpress is loading my custom- page.php file so I can enqueue the script only on that page? It should work dynamically, so checking page id is not an option.


title: Subpage Conditional

text: I am looking for a way to write a condition for a subpage...in other words `if` we're on the subpage "duck" then do something...`if` not do something else. I found some code I thought would work, but it shows up on all of the pages under a given parent page, not just on its individual page...I'm only trying to target the individual page. This goes in functions:               // Subpage Shortcode     function is_child($page_id_or_slug) {         global $post;         if(!is_int($page_id_or_slug)) {             $page = get_page_by_path($page_id_or_slug);             $page_id_or_slug = $page->ID;         }         if(is_page() && $post->post_parent == $page_id_or_slug ) {             return true;         } else {             return false;         }     }      This is my `if`:               if (is_child("Youth")) {         echo "duck";     } else {         echo "something else";     }      Thanks,   Josh


title: Excerpt with image

text:
I would like to use my excerpt field to display a different image for each post to represent that post. For instance a post about a new album instead of having a title/text excerpt would simply be an image of that album. I create i new post like :                                           TEST               `single-photos.php` :               <div <?php post_class() ?> id="post-<?php the_ID(); ?>=">         <?php   echo get_the_excerpt(); ?>
        With this code, displays only the text, and not the image. I want to display only image or gallery. How to do that? Thanks.


title: How do i best handle custom plugin page actions?

text: I'm constantly running into the same annoyance, so i thought i'd see if there's any ideas or experience out there... I've created a plugin that uses it's own admin page. It has to. Now that i sorted out the WP_List_Table() stuff, i must say it's great...but.... Custom plugin pages always load as `admin.php?page=...` unless i want to load them from the plugin directory directly, which i don't. Now if i do an 'action' from that page, i need to process that somehow and then redirect back to the page _without_ the action parameter. No matter if i do a GET or POST, really. On all it's internal pages WP does this on the same page, it checks if there's an action, if so processes it and then redirects to itself without the action. This is possible, because on these pages the `admin-header` hasn't been loaded, yet. If you try doing it on your own page, though, half the admin interface has already been sent to the browser, so a redirect isn't possible anymore. Clearly, the solution is to POST/GET directly to another page, load the WP framework on that, do the processing and then redirect back to the original page...but...that's a bit annoying, because...my original page is loaded via a callback, so it runs within a method of my class. That's beautiful. If i load a separate page, i have to manually include `wp-load.php` and am outside of my class, which is annoying, and in my particular case bugs me especially, because i'm only instanciating my plugin class anonymously so that no-one can access it from the outside. So after this long story...did anyone come up with a good solution to load another page via a callback _without_ having the whole admin interface already setup around it? (I know of a workaround...i can hook a function into `load-....` that checks for the action parameter and does the processing and redirect. But i'm wondering if there's a better way.) Thanks.


title: Display latest post depending on Meta Box content

text: What I want to do is display my latest post's content on a custom template page, ONLY if a meta box is filled in with the right word. In other words, if the post has a meta box named, "FEATURED" with a value of "YES", then I would like to show the post on my custom template page. If the "FEATURED" meta box says, "NO", then I do not want the post to show up. With some previous help, I am currently using the following to show the latest post on my homepage:               $my_most_recent_post = get_posts( 'numberposts=1' );     $my_most_recent_post_id = $my_most_recent_post[0]->ID;      My homepage will show the latest post no matter what, but on this particular page, I only want it to display conditionally depending on the meta box. So can I take that code and make it work in a conditional statement?


title: Make homepage the newest post of a custom post type

text: I am using the plugin "Custom Post Types" to create an issue based magazine, where one of my types is "Covers." There will be one of these posts for each issue and will include the cover art and an list of articles in the issue. My question is, how can I make the main page default to display a single view of the newest post of this type?


title: Custom Post Types and Taxonomies

text: I am building an issue based wordpress magazine and am running into a few issues with custom post types and taxonomies. I created a taxonomy called "Issues" so that any custom post type could be attached to a specific issue. I also create a custom post type called "Covers" which has the main cover art and issue information on it. The cover will be the main hub for each issue, providing access to all posts linked to the specific issue in the taxonomy. My question is, how can I automatically generate a list of links to all the posts of an issue on the Covers post? Could I create a custom template for the Covers post type and include a query to grab all posts of any post types (besides the cover) with the same issue set? Would there be a better/easier way of doing this? I'm just trying to avoid having to manually generate the index of each issue.


title: php nested IF statements to hide content (possible syntax error)

text:
I cannot see what is incorrect here, I'm trying to hide an entire element if all (and some) options are empty, but it is hiding everything even though at least options are filled in. My code:                   <?php $sitename = get_bloginfo( 'description' );               $phone1 = get_option( 'show_phone1' );               $phone2 = get_option( 'show_phone2' );               $email = get_option( 'show_email' );               $address1 = get_option( 'show_address1' );               $address2 = get_option( 'show_address2' );               $town = get_option( 'show_town' );               $county = get_option( 'show_county' );               $postcode = get_option( 'show_postcode' );         if ( ! empty( $sitename ) && ( ! empty( $phone1 ) || ! empty( $phone2 ) ) && ! empty( $email ) && ( ! empty( $address1 ) && ! empty( $address2 ) ) && ! empty( $town ) && ! empty( $county ) && ! empty( $postcode ) ) : ?>
                  <?php if ( ! empty( $sitename ) ) : ?>                 <?php echo get_bloginfo( 'name' ); ?>                  <?php endif; if ( ! empty( $phone1 ) ) : ?>                 <?php echo get_option( 'show_phone1' ); ?>                  <?php endif; if ( ! empty( $phone2 ) ) : ?>                 <?php echo get_option( 'show_phone2' ); ?>                  <?php endif; if ( ! empty( $email ) ) : ?>                 <a href="mailto:<?php echo get_option( 'show_email' ); ?>" title="Send and email to <?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>"><?php echo get_option( 'show_email' ); ?>                  <?php endif; if ( ! empty( $address1 ) ) : ?>                 <?php echo get_option( 'show_address1' ); ?>                  <?php endif; if ( ! empty( $address2 ) ) : ?>                 <?php echo get_option( 'show_address2' ); ?>                  <?php endif; if ( ! empty( $town ) ) : ?>                 <?php echo get_option( 'show_town' ); ?>                  <?php endif; if ( ! empty( $county ) ) : ?>                 <?php echo get_option( 'show_county' ); ?>                  <?php endif; if ( ! empty( $postcode ) ) : ?>                 <?php echo get_option( 'show_postcode' ); ?>                  <?php endif; ?>
         <?php endif; ?>      Any help is much appreciated, please bare in mind I (obviously) do not code PHP.. I'm just trying my hand at some editing.. which is always fun.


title: Previous and Next Navigation buttons take the user to the wrong posts

text:
I am currently developing a portfolio section on my website and when the single posts are viewed, there are some previous and next links to take the user to the next post. Upon reaching the first post single view, the previous button takes the user to the fifth post in the series rather than looping to number 12 in the series as expected. Here is the code I used to generate the previous and next buttons,

<?php previous_post_link('%link'); ?>

<a href="<?php echo get_permalink( 187 ); ?>" class="backportfolio">My link

<?php next_post_link('%link'); ?>

      the portfolio test site is at http://sandpit.jonathanbeech.co.uk/portfolio- two/ Is there a way of configuring these buttons to allow them to move to the appropriate post


title: How to change the order of elements within a post?

text: I have a site with several thousand posts. They all have just a single attached image of varying size. All posts are displayed in full (no thumbnail view). I'd like to be able to change the way the elements display within the posts to be:   * date (at the top)   * image caption   * the attached image (actual size)   * post title   * post text content   * tags


title: Sort category page with custom field

text:
This is similar to another question I asked, but I can't recognize how this query string works. I have a custom field called "category_order" and I would like to sort my category page by this order (and not the date). Here is my code:               <?php wp_reset_query(); ?>

               <?php if (is_category()) {                 $cat_ID = get_query_var('cat'); ?>                    <?php echo '
'; wpzoom_breadcrumbs(); echo'
'; ?><?php }                  elseif (!is_category() && !is_home()) { ?>                 <?php echo '
'; wpzoom_breadcrumbs(); echo'
'; ?>                 <?php }                 else { ?>
Recent Videos
                 <?php } ?>

              <?php if (have_posts()) : ?>
                 <?php             $i = 0;                       while (have_posts()) : the_post();                     $i++;                 ?>


title: Get page by template?

text: I'm in a complicated situation. I'll try to explain it as easy as possible. Imagine the following pages:   * Page 1   * Page 2      * Subpage 1     * Subpage 2     * Subpage 3 Each subpage of page 2 lists posts from a custom post type with a specific taxonomy. Let's call the post type Objects, and the taxonomy just Categories, to keep it simple. To list the different posts from the different Categories, i have three different page templates for the subpages: `subpage-1-templ.php`, `subpage-2-templ.php` and `subpage-3-templ.php`. Each one of these templates lists the posts from a specific Category for the post type (Objects). It's hardcoded. So far all good, it works as expected. It's a little ugly to have to hardcode it but i don't know of any other way, so this'll have to work for now. (I'd prefer to ditch wordpress alltogether but that's another story) All of those subpages lists the siblings in a sub menu. So, if you're on subpage 2 it will show subpage1, 2 and 3 (but subpage 2 has a current class on it). Works good. Now to the actual problem; when you click one of the posts listed in a subpage, you get to a page which displays more info for the post, as expected. The problem is i want to show the submenu for page 2 in there (so, subpage1, 2 and 3). I don't know how to do that without hardcoding it. Perhaps, and i don't know if this will work, but maybe i can find a page by it's template. I can create a template for page 2 (not for it's children, the actual parent page) called `objects-template.php` and then on a post, i can grab the page that uses the template, then get all it's children, and then just simply list them up. I just don't know how to get a page by it's template, if that's even possible (Preferably by the template file name, but the template name works too). Any suggestions? **Edit**                   // Query looks fine right?         $query = new WP_Query(array(             'meta_key' => '_wp_page_template',             'meta_value' => 'objects-parent-page-template.php'         ));         // Dump the id (also tried just getting the object with get_queried_object(), still get null)         echo '<pre>'; var_dump($query->get_queried_object_id()); die();


title: Add a class to a menu item depending on a body class

text: I need to have a class of current-menu-item added to a li with the id of #menu-item-127 if the body class is post-type-archive-team I can do this with jQuery -               $(function(){         if ($('body').hasClass('post-type-archive-team')) {             $('#menu-item-127').addClass('current-menu-item');         }     });      But it's needed before jQuery loads to make something else work. Any ideas if I can do this with PHP? Thanks in advance


title: How to display non-page / post content

text: I have a custom made Twitter stream on my site. I want to have a permalink for each tweet which would go to a page which would display only the tweet - no other content - surrounded by my custom theme. Ideally I would get Wordpress to display a Page Template on a certain url (something like /tweet/<tweet_id>), but I don't want to create a Page because it will appear in the main menu. I'm happy to write a plugin but my Google-fu is failing help me to figure out how to display just that plugin's content on a page.