title: how to remove filter from wordpress shortcode output

text: Twitter URL plugin add the filter to the_content. This filter messing up the output of my plugin shortcode output. So I wish to remove this filter only for my shortcode output.               add_filter('the_content', 'twitter_url');      I know this can be removed using below filter               remove_filter('the_content', 'twitter_url');      But, How to apply this filter only to my shortcode output. My shortcode               add_shortcode('xxx', 'func_xxx');      Shortcode callback function               function func_xxx(){           return 'xxx';     }      So please guide me to do this!


title: Is it possible to enqueue a raw CSS string directly from within a template file?

text: I was wondering if it's possible to enqueue raw CSS as a string directly from within a template file? I'm writing a custom template for a page and need to add some style rules for it. What I want to do is write the styles out as a string var in PHP then use the enqueue_style function to load these styles, rather than me having to add them in to 'style.css' or some other external style-sheet. I assumed that so long as I enqueue my styles before calling the 'get_header' function, and if I hook in to the 'wp_head' or 'wp_enqueue_styles' actions, that this would work but it doesn't appear to and I'm not sure if 'wp_enqueue_style' can take a raw CSS string. Anyone got any advice please? Kind regards, Chris


title: Get Original Dimension Featured Image on the homepage

text:
I'm trying to integrate a custom slider using a 3rdParty jQuery plugin onto the homepage. I'm almost there. I need the original featured images and not the cropped ones.               <?php if (is_home()): ?>     <?php     $featured_posts = new WP_Query(array(         'post_type' => 'post',         'showposts' => 5,         'tag' => 'featured'     ));     ?>
     <?php while($featured_posts->have_posts()): $featured_posts->the_post(); ?>         <?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'featured-image'); ?>                                 <a href='<?php the_permalink(); ?>'>             <img src="<?php echo $image[0]; ?>" style="width:940px;height:500px" />              <?php endwhile; ?>
     <?php endif ?>                      The problem here is that all the images are of 516x340 dimension. How I get the original dimensioned image ?


title: Client cant see the Updated dynamic content

text: I have came across an issue... whenever I upload new content to the site.. and i send the link to the client.. He can not view the changes instead what he see is the previously updated content. Looks like there is some caching issue.. but i have never seen dynamic content being cached. Even I have to clear my cache on Safari to view the dynamic changes.. I am using a theme Village . Not sure if that is the theme issue.. Is there any solution to this which i may try rather than waiting for the Theme developer to respond? I use the following code to make sure that the updated content is loaded everytime the page load. `<?php header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); header('Cache- Control: no-store, no-cache, must-revalidate'); header('Cache-Control: pre- check=0, post-check=0, max-age=0'); header ('Pragma: no-cache'); ?>` But will it Re-load everything including Js and css files?? If that is the case, then i shouldn't be using this technique? Thanks, Nasir


title: Place a cookie when a specific page has been viewed?

text: I'm trying to direct new site visitors to a custom registration page **for the their first visit only**. The registration collects detailed information relating to an upcoming event, it is **not** designed to register the visitor as a user of the WordPress installation. The registration page contains a Gravity form which when submitted redirects to a thank you page. I would like to know the correct way to **place a cookie in WordPress only when the visitor lands on the thank you page**. Thanks in advance. NB: I should also say that I've added the following to the functions.php file:               /* SET NEW USER COOKIE */     function set_newuser_cookie() {         if (!isset($_COOKIE['newtcpa_visitor'])) {             setcookie('newtcpa_visitor', 1, time()+3600*24*100, COOKIEPATH, COOKIE_DOMAIN, false);         }     }     add_action( 'init', 'set_newuser_cookie');      I'm unsure about COOKIEPATH & COOKIE_DOMAIN. I've tried the following settings, but I'm not having much luck at isolating the WP template/page:               setcookie('newtcpa_visitor', 1, time()+3600*24*100, '/', '.mydomain.com', false);      and               setcookie('newtcpa_visitor', 1, time()+3600*24*100, '/', '.mydomain.com/thank-you/', false);      _Apologies for the multiple edits... first post on WordPress Answers_


title: variable value disappears in a second loop

text:
i can't manage to "see" the value of `$originalArticle` in `echo '/'.$originalArticle.'== &'.$sameArticle;` : i tried with "global" before, but it does not work... The output is for example : > /== &48 Any help?               <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>                          <?php $originalArticle = the_ID(); //this works ?>
…

…
                     <?php                      $cats = get_the_category();                     $cat_obj = array_shift($cats);                     $cat_id = (int) $cat_obj->cat_ID;                          $second_query = new WP_Query( 'cat='.$cat_id.'&posts_per_page=2' );                     while ( $second_query->have_posts() ) : $second_query->the_post();                              $sameArticle = get_the_ID();                              /* HERE */ echo '/'.$originalArticle.'== &'.$sameArticle; //output : /== &48                              if ( $originalArticle == $sameArticle )                         {                         } else {                             //...      Thanks for your help


title: how to add user registration and signup in wordpress and create members only page?

text: i'm trying to add a user login system in my wordpress as like regular php sites. when a user logged in then , i wanna show the specific page content otherwise no. Is there any process to add nice registration and login system in wordpress and no back end access also ? thanks


title: Check if action hook exists before adding actions to it

text: I am trying to add a `rel=next` and `rel=prev` link tags to the head element of `image.php` template file. I have Wordpress SEO installed and I like to hook to this plugin `wpseo_head` action hook to achieve that. What I would like to do is to check if the `wpseo_head` action hook exists before I attach my action to it, and if not like in the case of the plugin is not installed or deactivated, I would use `wp_head` instead. I have tried `has_action('wpseo_head')` function, but the problem with that is if there are no functions attached to this hook it will return `false` even if the plugin is installed activated.               if (has_action('wpseo_head')) {         add_action('wpseo_head', 'ad_add_link_tag_image_head');     } else {         add_action('wp_head', 'ad_add_link_tag_image_head');     }      What is the way to check for actions that may not exist in Wordpress? Thanks.


title: Why does this search.php not work?

text:
This search.php shows all the results from a said search however, doesn't include the title, The Search Results For...... and search query amount; or even the no searches found and prints the searchform.               <?php get_header(); ?>     <?php if ( have_posts() ) : ?>
<?php printf( __( 'Search Results for: %s', 'nothing' ), '' . get_search_query() . '' ); ?>

           <?php if (have_posts()) : while (have_posts()) : the_post(); ?>               <?php      $featured = get_post_meta($post->ID,'_thumbnail_id',true);      $attachments = get_children( 'post_type=attachment&orderby=menu_order&exclude='.$featured.'&post_mime_type=image&post_parent='.$post->ID );      $vimeo = get_post_meta($post->ID, 'rw_post-vimeo',true);?>
               <time datetime="<?php the_time('Y-m-d')?>"><?php the_time('F jS, Y') ?></time>              <?php  get_template_part( 'includes/inc-image' ); ?>     <?php endif; ?>                         <?php  get_template_part( 'includes/inc-detail' ); ?>     <?php endwhile; endif; ?>
     <?php wp_pagenavi(); ?>

                                   <?php else : ?>
<?php _e( 'Nothing Found', 'nothing' ); ?>

<?php _e( 'Sorry, but nothing matched your search criteria. Please try again with some different keywords.', 'twentyten' ); ?>
     <?php get_search_form(); ?>     <?php endif; ?>          <?php get_footer(); ?>      Interesting though the posts in their li tag appear witin the opening
      So i assume its a statement issue but cannot figure it out :( Any ideas?


title: Garbled HTML pulled for page description "caption id=attachment..."

text: Whenever someone links to my wordpress blog, whether it's on Facebook, ScoopIt, or whatever, instead of a description, it automatically pulls information from the image: ![Example of this happening on ScoopIt](http://i.stack.imgur.com/bg65C.png) How do I get this to stop happening? I'd prefer the meta description or something, not some garbled HTML.


title: wp_insert_post at same time as saving post results in 502 Bad Gateway

text: I'm currently trying to create/update one post while also saving the current post that I'm on. It's all happening here:               add_action('save_post', 'wysiwyg_save_meta');     function wysiwyg_save_meta(){         global $post;         $editor_id = WYSIWYG_EDITOR_ID;         $meta_key = WYSIWYG_META_KEY;              if(isset($_REQUEST[$editor_id])) {             update_post_meta($post->ID, WYSIWYG_META_KEY, $_REQUEST[$editor_id]);                  $thankYouPost = get_thank_you_post($post->ID);                  $postArgs = array(                 'post_content'   => $_REQUEST[$editor_id],                  'post_name'      => 'thank-you',                 'post_title'     => "Thank You",                 'post_status'    => $post->post_status,                 'post_type'      => 'landing_page',                 'post_parent'    => $post->ID,             );                  if ($thankYouPost->ID) {                 $postArgs['ID'] = $thankYouPost->ID;             }             wp_reset_postdata();             wp_reset_query();             wp_insert_post($postArgs);             wp_reset_postdata();             wp_reset_query();         }     }      Now, this works and saves both pages, but it doesn't seem like it's actually working. The page just sits and tries to load and eventually I get back a 502 Bad Gateway error. However, manually refreshing the page shows me that the action was successful. What could be causing this? Any more information I will be happy to provide. Thank you for your time.


title: syntax error unexpected '}' at 364 line

text: I am getting this error on my website and am not able to access admin dashboard. The error occurs when I am a new theme on my website. Can you please help me to find this error. > Parse error: syntax error, unexpected '}' in /home/content/html/wp- > content/themes/imag-mag/functions.php on line 364


title: Conditional check to see if a bootstrap.css is included in a theme

text: I am creating a shortcode plugin for Bootstrap framework that will go along with my theme. However since this would be released to the plugin, if a users's theme already has Bootstrap.css included, is there a way for me to check this from a plugin?


title: Large Unwanted Space at the Bottom of Blog Posts

text: I'm a bit stumped as the why there is such a large space at the bottom of the blog posts. I've tried removing the "more" tag, I've inspected the element multiple times, but just cant seem to get rid of it. Any suggestions? http://gregtaylordesignstudio.com/sayyes/?page_id=10


title: Single Product Navigation within Category for WooCommerce

text:
I'm working on a website for a client who would like to have product navigation on each single product page. The navigation will go through each product within the category and when it reaches the last product it will return to a product overview page. I've tried a number of different approaches, but the only approach that has kind of worked thus far is using the wordpress post navigation:
<?php previous_post_link('%link','prev'); ?>

<?php next_post_link( '%link','next'); ?>      but this cycles through all products, not just category specific. I've also tried setting the prev/next post link like this, trying to remain within the category:
<?php previous_post_link('%link','prev', TRUE); ?>

<?php next_post_link( '%link','next', TRUE); ?>
      but as it turns out, the post category is not being set because Woocommerce handles the category as a product category and not a post category. To try to work around this, I came up with this function:               function save_product_cat(){     global $post;         $terms = get_the_terms( $post->ID, 'product_cat' );         wp_set_post_categories( $post->ID, $terms );         wp_set_object_terms( $post->ID, $terms->slug, 'category');      }          add_action('save_post', 'save_product_cat');      I'm trying to hook into when a post is saved so that I can grab the product category and set it as the category. When I test to see what the product category/ies are I'm still getting an empty array. Any ideas as to why my category isn't getting saved? Or a better way to go about single product navigation within product category?


title: Override plugin with functions.php

text: add_action('wp_head','add_gpp_gallery');     function add_gpp_gallery() {         if( ( is_single() || is_page() ) && ( !is_page_template('page-blog.php') ) ){             remove_shortcode('gallery', 'gallery_shortcode');             add_shortcode('gallery', 'gpp_gallery_shortcode');         }     }      Hi All, I pulled the above function out of the plugin's core functions file, and I was hoping to change it to only replace the WP default gallery on my custom post type. So I changed the if statement above to:               if (is_single() && is_post_type('post_type'){      So I changed it and put it into my functions.php - but I'm getting an error that stating that I can't redeclare add_gpp_gallery How would I override the plugin's functions without touching the plugin code? thanks **EDIT** I tried:               remove_action( 'wp_head', 'add_gpp_gallery' );     add_action('wp_head','jason_add_gpp_gallery');     function jason_add_gpp_gallery() {         if ( is_single() && is_post_type('listings') ){             remove_shortcode('gallery', 'gallery_shortcode');             add_shortcode('gallery', 'gpp_gallery_shortcode');         }     }      and I get a fatal error - > Fatal error: Call to undefined function is_post_type() in > /home/hostspro/public_html/movemaine.com/wp- > content/themes/movemaine/functions.php on line 269 **EDIT #2** I had cross wired my functions, and was forgetting to change out the is_post_type. The following code is working and thanks for the help               remove_action( 'wp_head', 'add_gpp_gallery' );     add_action('wp_head','jason_add_gpp_gallery');     function jason_add_gpp_gallery() {         if ( is_single() && 'listings' == get_post_type() ) {             remove_shortcode('gallery', 'gallery_shortcode');             add_shortcode('gallery', 'gpp_gallery_shortcode');         }     }


title: How to put a Worpdpress theme in spanish (having the po file)?

text: I am building a Wordpress blog system in Spanish and I'd like to have the default theme also translated to "es_ES". I am already running this Wordpress installation in Spanish. What I'd like to know is how to do the same with the default theme (twenty-eleven). This site allows us to download the po file with the translation: http://translate.wordpress.org/projects/wp/3.2.x/twentyeleven/es/default But I don't know what to do next. Thanks.


title: How to include the latest post of a specific category on a matching page

text: I have a number of pages, and on each I would like to display the latest post from the category which matches that page. So I have page 1, 2 and 3, and on page 1, I'd like the latest post from category A. 2 -> B, 3 -> C, and so on. I have been trying to code this myself, but I can't find a solid enough CMS resistant way of linking the page to the post category. Thus if someone changes the page, I'd lose the post. I have found the plugin, http://wordpress.org/extend/plugins/list-category- posts/ which seems to do what I want, however adding a shortcode to my page, just displays the shortcode and doesn't do anything. I assume this is because it supports WP 3.1.4 and I'm running 3.2.1. Can I code this functionality myself, or will I need to create a link table in the database? I'd rather use the WP framework, but if I can't crack this, I'll just write a script to do it in plain old php and just include it, which I don't want to do.


title: Display only the latest post from multiple categories

text: I have a jQuery slider at the top of my index.php, which works fine. The only problem is that I would like to use query_posts to only display the latest post from five different categories, and always show one from each. So when a new post is created in, lets say the category interview, this will be displayed. But the interview post which was posted one day earlier will then not be displayed, but the latest post from the four other categories are still there. I think this is a bit complicated, no?


title: wp_footer hook running twice

text:
I have created a widget that have to run some code using the wp_footer hook as well. But if you extend the WP_Widget, the wp_footer runs twice! Has someone already past for the same issue? Here is an example:               /*     Plugin Name: Test     Description: Test Plugin by Romulo De Lazzari     Version: 1.0     Author: Romulo De Lazzari     */          new Test();          class Test extends WP_Widget{              public function __construct(){                  parent::__construct('test-widget', 'Test Widget');                        add_action('widgets_init', array($this, 'register_my_widget'));             add_action('wp_footer', array($this, 'do_something'));         }              public function register_my_widget(){             return register_widget("Test");         }              public function do_something(){             echo "
Hello! This is a test!
";         }              public function widget($args, $instance) {              }              public function form($instance){              }              public function update($new_instance, $old_instance){              }          }      The method do_something() is running twice here, if I take off the "Widget part" it runs well. Could someone help me? Thanks in advance, Romulo


title: How do i create a loop that list and divide posts into months?

text: I was wondering if there was any way to make a custom loop that divides posts into months. I would use it on the Archive page to list all posts within a given category with a title that indicated what month it was posted. Like this: ## January: post1 post2 post3 ## February: post4 post5 post6 Any help would be appreciated. Thanks!


title: Recent Posts slider, using WP_Query(), loads duplicate sliders

text:
I have written a small piece of code for Wordpress that will show the most recent top 4 posts in a slider (the Filament Group Responsive Carousel). It works, displaying the posts and sliding them etc, but there are 4 sliders, each with the 4 posts in them. I must have positioned some of the code with `WP_Query()` wrong. Here is my code:
         <?php             $topNews = new WP_Query();             $topNews->query('showposts=4');              while ($topNews->have_posts()) : $topNews->the_post(); ?>                 <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>                                              <?php if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.                             the_post_thumbnail('full');                     } ?>
<a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'android_and_tea' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?>

             <?php endwhile; ?>
      So my question is, what code do I need to reposition/change/add/remove to get it to display one slider with the 4 most recent posts, instead of 4 sliders with the 4 most recent posts?


title: How can I sort my loop based on meta data, using a form?

text: I've created a custom post type called 'properties' with custom meta boxes of 'price' and 'rooms'. I have a custom loop-property-archive.php to display the properties. What I would love to have is a method to sort the properties based on the meta data from those two meta boxes. Ideally I would have a drop-down called 'sort by', with the options of 'price asc.', 'price desc.', 'rooms asc.', and 'rooms desc.'. When the user selects an option the page is re-sorted. I can currently query by custom taxonomies, which creates a URL like: mysite.com/?post_type=properties&area=high-ridge&university=birmingham. I need to be able to filter that page or any other combination of area and university. Therefore building individual templates with custom queries is out of the question. I tested out appending meta_key=_price&orderby=meta_value to the URL but that doesn't work. Any ideas why? I'm open to server or client side suggestions. Server may be better because if there is pagination involved I think that would be handled better. Obviously client side has the advantage of no page refreshes though. Thanks!


title: How to Sort posts by Vote Count?

text: Does anyone know how to automatically sort posts by Vote Count? I am using a plugin called WP Voting where a visitor can vote on a post. The plugin keeps track of how many votes each post has. The author offered some code that would sort them posts in the main blog page and it works, but it unfortunately broke the Category view. The code is below and it is dropped into the `functions.php`               <?php      /**      * SORTS THE POSTS BY VOTE COUNT      */     add_filter('posts_orderby', 'edit_posts_orderby');     add_filter('posts_join_paged','edit_posts_join_paged');              function edit_posts_join_paged($join_paged_statement) {         global $wpdb;         $join_paged_statement = "LEFT JOIN ".$wpdb->prefix."wpv_voting ON ".$wpdb-                >prefix."wpv_voting.post_id = $wpdb->posts.ID";         return $join_paged_statement;     }          function edit_posts_orderby($orderby_statement) {         global $wpdb;          $orderby_statement = "(".$wpdb->prefix."wpv_voting.vote_count) DESC";         return $orderby_statement;     }      ?>


title: error with WP custom form

text: I have set up a custom form in my locally hosted WP and I made a page where user goes after successfully done with the form but I got two issues : 1- the form validation code appears on the interface how can I hide it 2- there's no data sent to my DB and I've been directed to a blank page when I run the php file that does the data storage process I land on the page that show the user the success of the forum filling here is my html code+ form validation code(WP side) :               <?php     function validateForm()     {     /* Validating name field */     var x=document.forms["myForm"]["name"].value;     if (x==null || x=="")     {     alert("Name must be filled out");     return false;     }     /* Validating email field */     var x=document.forms["myForm"]["telephone"].value;          if (x==null || x=="")     {     alert("telephone must be filled out");     return false;     }     }      ?>          <form action="C:\xampp\htdocs\wordpress\process.php" method="post" name="myForm">     Name <input id="name" type="text" name="name" />     Telephone <input id="telephone" type="text" name="telephone" />     Fax <input id="fax" type="text" name="fax" />     Web address <input id="webaddress" type="text" name="webaddress" />     State <input id="state" type="text" name="state" />     Address <input id="address" type="text" name="address" />     <input type="submit" value="Submit" /></form>                    <script type="text/javascript">// <![CDATA[     /* JS validation code here */     ...     ...     // ]]></script>      and this is the php for the Data storage function:               <?php      //establish connection     $con = mysqli_connect("localhost","xxx","xxx","android_app");      //on connection failure, throw an error     if(!$con) {       die('Could not connect: '.mysql_error());      }      ?>          <?php      //get the form elements and store them in variables     $name=$_POST["Name"];      $telephone=$_POST["Telephone"];      $fax=$_POST["Fax"];      $webaddress=$_POST["Webaddress"];      $state=$_POST["State"];      $address=$_POST["Address"];      ?>          <?php      $sql="INSERT INTO `android_app`.`islamic_organisation` ( `Name` , `Telephone` , `Fax` , `WebAddress` , `state` , `Address`) VALUES ( '$name','$telephone', '$fax', '$webaddress' , '$state', '$address')";          mysqli_query($con,$sql);      ?>          <?php     //Redirects to the specified page     header("Location: http://localhost/wordpress/?page_id=857");      ?>      I hope somebody can give some help thanks


title: How to direct user to actual 404 page when a check is false in single.php?

text: Can someone tell me how to direct a user to the main 404 file instead of having to print an error message saying "file not found" in single.php? For example:               <?php          if (!$myVar) {       // go to 404.php and return an official file not found header     } else {       // show the following HTML     }          ?>


title: Where and how does WordPress store and use its plugin and hook information?

text: When WordPress installs a plugin, where does it keep the fact of a hook/plugins existence? For example, wp-includes/plugin.php I can see `do_action`, but I'm not familiar enough to know how WP loads its plugins. Does it have the hook name in the database along with the new plugged in hook name? I looked in wp_options, but did not anything.


title: Plugin developement and SVN

text: I'm going to develop a plugin for WordPress. My environnement is all set up with a local wordpress installation and Aptana Studio. I also have my own subversion server. I have now to determine how I'm going to use subversion. I see mainly two possibilities :   * Register my plugin at WordPress.org and use from the very beginning of my development the repository provided. Problem : to register, I need to give a link to my plugin, which doesn't exist yet.   * or, develop my plugin with my own repository on my own svn server. When the plugin is ready (or at least a working beta version), register it at WordPress.org. Problem : I would have two repositories : mine and the one provided by WordPress.org. How am I going to deal with these ? Another question : no matter where the repository is (on my own server or on WordPress servers), where should I check it out ?   * Into my local wordpress installation, in the plugin folder : this means if I want to test it with several wordpress versions, I would have multiple check-ins. Advantage is that I can put the whole wordpress site into Aptana and take advantage of the autocompletion.   * Into another folder and symlink to this folder from my difference local wordpress installations. Disadvantage : I don't have autocompletion in Aptana.   * Or is there a better solutions ? Thanks for your help


title: Remove Default Blogroll Links via Plugin script

text: I have a plugin that I use on all my new sites to set up site defaults (deletes the "hello world" post, the "about" page, the "Mr WordPress" comment, etc...) I'd like to add a routine that removes all the default links under "Blogroll". I'm not sure what function to call. Any ideas?


title: Take Variables Set in Functions.php and Echo Them Inside My Custom Post Template

text:
I have the following function set up in my functions.php file to allow my custom post type "Slideshow" to work.               add_action( 'the_post', 'paginate_slide' );          function paginate_slide( $post ) {              global $pages, $multipage, $numpages;              if( is_single() && get_post_type() == 'lom_slideshow' ) {         $prefix = "slide{$i}";         $multipage = 1;         $id = get_the_ID();         $custom = array();         $pages = array();         $i = 1;              foreach( get_post_custom_keys() as $key )             if ( false !== strpos( $key, 'slide' ) )                 $custom[$key] = get_post_meta( $id, $key, true);              while( isset( $custom["slide{$i}-title"] ) ) {              $hide = $custom["slide{$i}-hide"];         $slidetype = $custom["slide{$i}-slidetype"];              if( 'on' == $hide ) {         $i++;         continue;                             }                  $page = '';             $title = $custom["slide{$i}-title"];             $image = $custom["slide{$i}-image"];             $desc = $custom["slide{$i}-desc"];             $embed = $custom["slide{$i}-embed"];             if(isset($image))             $imgdisplay = "";             else             $imgdisplay = '';              if( 'Video' == $slidetype )                   $page = "

{$title}

{$embed}

";         else             $page = "

{$title}

{$imgdisplay}

{$desc}
";             $pages[] = $page;             $i++;         }         $numpages = count( $pages );         }     }      This part displays the output:               $page = "

{$title}

{$embed}

";      It displays there where `the_content` is called in my template. Rather than putting the pieces together there in my functions.php I'd like to be able to call each piece directly in my Custom Post template exactly where I want it. For example, by putting `<?php echo $desc; ?>` in my template file where I want the Description to display and `<?php echo $title; ?>` where I want the Title to display. I've tried a couple different ways but can't get anything to display. **Without starting over from scratch or redesigning my whole template how can I make these variable more modular (able to be placed at will within my template)?**


title: Button not working?

text: In my code `add_post_meta` is ignoring the button around it and is executing anyway. Why is this so? I've tried the following:               <input type="submit" value="Test" id="submit">         $thisid = wp_insert_post ( $post, true);         if(!isset($_POST['submit'])){             if ( is_wp_error($thisid) ) {                 return get_error_codes();                 echo "not ok";             }else{                      wp_insert_post($thisid);                 add_post_meta( $thisid, 'field_123123eee12312', $column2);                 echo "ok";             }         }      Added the two echo's and the echo `ok` is showing. No idea why this is so. Also a request, can anyone add a tag for `add_post_meta` it seems get/update are there but not add.


title: Lots of attachments is causing slow load

text: I have a wordpress site with 400k unattached images. When I try to view any single attachment page it loads quite slow. Is there anyway to improve performance?


title: Remove p tags in wordpress posts

text:
WORDPRESS VERSION: 3.8.1 PHP version: 5.3 I have a trouble with wordpress posts. How can I remove the auto P tags added? This is my final html code:

     Livelli Vip

Invalid Displayed Gallery

      There is another trouble, wordpress add slashes (magic_quotes_gpc on my server is Off):
      I tried to put this code in functions.php or single.php and even comment these lines in wp-includes/default-filters.php but is not working:               remove_filter( 'the_content', 'wptexturize'        );     remove_filter( 'the_content', 'convert_smilies'    );     remove_filter( 'the_content', 'convert_chars'      );     remove_filter( 'the_content', 'wpautop'            );     remove_filter( 'the_content', 'shortcode_unautop'  );     remove_filter( 'the_content', 'prepend_attachment' );      What can i do?


title: Importing users to Buddypress with custom fields

text: Here's the setup:   * The client uses a proprietary custom-coded PHP CMS and is wanting to move to WordPress with BuddyPress.   * The old, custom CMS has a roster functionality, which I'm using BuddyPress custom fields to replace.   * The custom fields are basic contact info (Phone, Fax) and company info (Text field). What is the best way to import these? It seems my two options are:   1. Create a pretty large SQL query that reformats this data between databases (I'm about 3 hours into doing it this way so far)   2. Export it into some sort of JSON format and use the Ning importer. If the best option is using the Ning importer, know where I can get an example Ning user list CSV so I may format the user data accordingly? If the best option is using a big MySQL query, what are some things I should look at in terms of row values WordPress expects? Many thanks!


title: Let both the admin and post author update comment meta

text: I have a function which lets the post author set the "best comment". I want the admins to also be able to set the "best comment". Who can this be best achieved?               // Set Best comment for post     function select_best_comment($best_comment_id, $best_comment_parent_question) {         // Prevent Non Logged In Users from making updates         if ( !is_user_logged_in() ) { return new WP_Error('not_logged_in_post', 'sorry cant do this'); }              $post_data = get_post($best_comment_parent_question);         $current_user = wp_get_current_user();          // Make sure the post author is selecting the best comment             if ($current_user->ID == $post_data->post_author) {                      include (TEMPLATEPATH . '/translations.php');                         global $wpdb;                 $get_comments = "SELECT * FROM " . $wpdb->prefix . "comments WHERE comment_post_ID ='". $best_comment_parent_post . "'" ;                 $best_post_comments = $wpdb->get_results($get_comments);                      $best_comment = get_comment($best_comment_id);                      foreach($best_post_comments as $comment) :                     setup_postdata($comment);                     update_comment_meta($comment->comment_ID, 'best_comment', 'no');                 endforeach;                      $currentPointNumber = intval(get_user_meta($best_comment->user_id, 'points', true));                      $newPointNumber = $currentPointNumber + 2;                        $best_comment_user = get_userdata($best_comment->user_id);                      update_comment_meta($best_comment_id, 'best_comment', 'yes');                      // Add 2 Points for being Selected as Best comment                 $has_been_best_comment = get_comment_meta($best_comment_id, 'has_been_best_comment_before', true);                 if ($has_been_best_comment == 'no' || $has_been_best_comment == '') {                     update_user_meta($best_comment->user_id, 'points', $newPointNumber);                     update_comment_meta($best_comment_id, 'has_been_best_comment_before', 'yes');                 }                      setcookie("best_comment_selected_".$best_comment_parent_post,"yes", time()+10);                 $post_data = get_post($best_comment_parent_post);                 wp_redirect($post_data->guid);               }         }


title: Pagination difficulty using custom query in genesis-based custom theme

text: I am creating a genesis child theme. I have a category called 'faculty' with about 60 posts in it. I am modifying the category template file so that it displays this category in a customized fashion. The desired result is that the faculty appear in random order, they do not appear more than once they appear in groups of four per page Here is the relevant code from my page (category-faculty.php):               remove_action('genesis_loop', 'genesis_do_loop');     add_action('genesis_loop', 'hdo_faculty_loop');          function hdo_faculty_loop() {       global $paged;       $args = array(         'category_name' => 'faculty',         'posts_per_page' => 4,         'orderby' => 'rand',         'paged' => $paged       );       genesis_custom_loop(  $args );          }          genesis();      What I am getting is <>:   * 4 faculty per page [yay!] random order [yay!]    * previous and next navigation at the bottom of the page [yay!]    * only 6 pages (24 faculty)instead of the expected 15 [boo!]    * duplicate faculty in the set of 24 [boo!]    * a "next" loop on the sixth page that navigates to a 404


title: Using WP rather than .htaccess to redirect pages/posts

text: I run a site with over 100 specific redirects in the htaccess for legacy html files that were subsequently brought into WP. There are also rules for pages within a date range to redirect to the home page, and all sorts of other nasties. Given that WP handles redirects and permalinks internally, and without using a plugin, what would be the best way to programatically redirect these links and keep my .htaccess file clean?


title: Add title to image post

text:
I can't add the title on a featured image in the recent posts. try this but only get the alt               <?php                $default_attr = array(         'src'   => $src,         'class' => "attachment-$size",         'alt'   => trim(strip_tags( $attachment->post_excerpt )),         'title' => trim(strip_tags( $attachment->post_title )),     );     $pages = wp_get_recent_posts();      ?>
         <?php foreach ($pages as $page): ?>
                 <?php echo get_the_post_thumbnail($page["ID"],'',$default_attr); ?>
         <?php endforeach; ?>
      **EDIT OUTPUT FIXED:**

      Any idea? **SOLUTION** This work for me               <?php $pages = wp_get_recent_posts(); ?>
         <?php foreach ($pages as $page): ?>             <?php             $attachment_id = get_post_thumbnail_id( $page->ID );             $attachment = get_post( $attachment_id );                  $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );             ?>
                 <?php echo get_the_post_thumbnail($page["ID"],'', array( 'title' => esc_attr($page["post_title"]), 'data-thumb' => $url)); ?>
                 <?php echo esc_attr($page["post_title"]) ?>
         <?php endforeach; ?>


title: Double thumbnails?

text: is it possible to use the thumbnail mechanic twice? I find the thumbnail API really useful for allowing users to place in there own graphics, so that I can control size and position easily. All they have to do is remember to click featured image. I would like two such mechanisms on my page, any idea how I could do this? Preferably hand coding.


title: Unable to upload/install any WordPress themes

text: I have a version 3 installation of wordpress on my hosting package that I installed myself Everything else so far seems ok such as posting etc, but I'm unable to install any new themes I have tried to install a theme from clicking one of the "featured" themes, and have tried to upload a ZIP from the wordpress themes website, but each time it just hangs on "Unpacking" or "downloading" and nothing ever happens, I don't get any errors I've noticed that under `/wp-content/uploads` I can see a zip I select for upload, its filesize seems ok Any ideas?


title: query_posts ->using meta_compare / where meta value is smaller or greater or equals

text: I am using `query_posts( $args )` to filter the Loop. I want to filter posts based on their `meta_value` "vote", sometimes smaller than, sometimes equals and so on.... I definitly want to use the `query_posts()` function and pass my filter through `$args`! I don't want to use `add_filter('posts_where', 'filter_where');` and then add an `AND` statement to the query. I want to use the given functionality of WordPress to filter posts with `meta_key`, `meta_value` and `meta_compare` like this:               $args = array( 'meta_key'=>'vote', 'meta_compare'=>'>=', 'meta_value'=>5, 'posts_per_page'=>100 ) )          query_posts( $args );      The result of this is:               SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) WHERE 1=1 AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') AND wp_postmeta.meta_key = 'vote' AND wp_postmeta.meta_value >= '5' GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 100      The problem of that is:               wp_postmeta.meta_value >= '5'       It should be:               wp_postmeta.meta_value >= 5      Then it would work fine. I don't understand why WordPress adds quotes. I'm using the predefined parameter from WordPress (`<`, `>`, `<=`, `>=`) and it's obvious that this will only work with numbers and not strings which would need to be in quotes. The documentation says: > Returns posts with custom field key of 'miles' with a custom field value > that is LESS THAN OR EQUAL TO 22 > > `query_posts('meta_key=miles&meta_compare=<=&meta_value=22');`


title: pre get posts changing the query

text: i need to change the posts in taxonomy.php page. I have a meta_key which i want to compare to meta value. But currently my code is not returning anything. I am sure i am missing something. Please let me know what i am doing wrong!               add_action('pre_get_posts', 'add_event_date_criteria');     function add_event_date_criteria(&$query)     {         // We only want to filter on "public" pages         // You can add other selections, like here:         //  - Only on a term page for our custom taxonomy         if (!is_admin() &&             is_tax('event-tag') || is_tax('event-category')) {             $query->set('meta_key', 'start_time');             $query->set('meta_compare', '>=');             $query->set('meta_value', time());             $query->set('meta_key', 'start_time');             $query->set('orderby', 'meta_value_num');             $query->set('order', 'ASC');         }          }


title: Suggestions for creative use of post format feature, or themes that use them well

text: I'm looking for themes or examples of sites that use the post format feature in an interesting way. I suppose adding special styling for each post format would be a good start. But if anyone knows of it being used in a cool or creative ways by a premium or free theme feel free to chime in.


title: What action should I hook into when adding roles and capabilities?

text: I'm going to be using add_role() and $role->add_cap() to set up a new custom role and attach a new capability to existing roles. I'm wondering where the best place to do this is? Obviously I can do it straight inside functions.php and be done with it. But is this the best practice? Do I only need to do this on admin_init? or should I do it on init? I'm not entirely sure what the best practices are around using init action hooks rather than just dropping a direct function call inside functions.php. thanks for your input!


title: Passing parameters to a custom page template using clean urls

text: I am now passing parameters to a custom template in the following format               www.example.com/?pageid=12&rid=24&title=this-is-the-title      I have created two tables . So I need to fetch data and display them on those pages. I would like it to be using clean URL format like:               www.example.com/pageid/12/rid/24/title/this-is-the-title      Can anyone tell how this can be achieved? Thanks


title: Why do I get a WAMP homepage when clicking on specific website's URL on LocalHost?

text: Using WAMPSERVER for windows 7, smartgit and Safe Search Replace I have pulled a wordpress code from my git, downloaded a database and inserted into my localhost's phpmyadmin. My home page works but when I click on one of the links I get the WAMP homepage. What am I doing wrong? I have tried the following in WP-Config to use the localhost URL instead of the one saved to the database but it didn't work:               define('WP_HOME','http://127.0.0.1/website');      define('WP_SITEURL','http://127.0.0.1/website');


title: Non-Latin Characters in permalinks

text: I was opened this idea 7 months ago:   http://wordpress.org/extend/ideas/topic/non-latin-characters-need-love   Still i couldnt find a solution for it. **Simply what i want?**   Want to use "şŞ İı Ğğ Üü Öö çÇ" turkish characters in permalinks / slugs.


title: What exactly is ReAuth?

text: Searching for " **WordPress Reauth** " and the like all result in folks who are having problems with `ReAuth=1`. What exactly is ReAuth?


title: Displaying Child Categories in carousel

text:
Basically I am making a carousel using carouFredSel that displays post. I have that part working fine but instead of showing an endless list of posts from a certain category I want it to just show posts from a child category on each "slide". So basically the carousel is pulling a query of all children of a category, the posts shown in the carousel are only the post of one child category at a time (i.e. on load 3 posts are show from "Child A" when you hit next it loads the 4 posts of "Child B") This company is doing it well and uses both CarouFredSel and Wordpress: HERE Here is the documentation I changed the code from:HERE Here is my code I am trying to work:
         <?php             $args = array(                 'type'                     => 'post',                 'child_of'                 => 0,                 'parent'                   => 'location',                 'orderby'                  => 'name',                 'order'                    => 'ASC',                 'hide_empty'               => 1,                 'hierarchical'             => 1,                 'taxonomy'                 => 'category',                 'pad_counts'               => false );             $carouselPosts = new WP_Query($args);             ?>             <?php while ($carouselPosts->have_posts()) : $carouselPosts->the_post(); ?>

<?php get_the_category( $id ) ?>

                      <div id="<?php get_the_category( $id ) ?>">

                             <?php the_post_thumbnail( $size, $attr ); ?>

                      prev                 next
         <?php endwhile; ?>


title: Postmeta not saving

text:
I'm created a postmeta box but it doesn't appear to be saving anything to the DB. I'm check in wp_postmeta and there is nothing there relevant to this metabox. I believe it is something wrong with the nonce due to the `die` error been displayed. question: What is causing my metabox not to save to the database therefore not allowing me to output the results. here is my code that creates/saves the metabox.               <?php     // Add the Meta Box       function ge_add_subtitle_meta_box() {           add_meta_box(               'excerpt_meta_box', // $id               'Excerpt Meta Box', // $title                'ge_show_subtitle_meta_box', // $callback               'page', // $page               'normal', // $context               'high'); // $priority       }            //hook the function to add meta boxes     add_action('add_meta_boxes', 'ge_add_subtitle_meta_box');            // Field Array       $prefix = 'getextra';       $custom_meta_fields = array(           array(             'label' => 'Subtitle',             'desc'  => 'Insert a small description of the page underneath this title.',               'id'    => $prefix.'subtitle',               'type'  => 'textarea'              )     );            // The Callback       function ge_show_subtitle_meta_box() {       //make array globalscope and call $post to acces global array     global $custom_meta_fields, $post;       // Use nonce for verification       echo '<input type="hidden" name="subtitle_meta_box_nonce" value="'.wp_create_nonce(basename(__FILE__)).'" />';                // Begin the field table and loop           echo '
';           foreach ($custom_meta_fields as $field) {               // get value of this field if it exists for this post               $meta = get_post_meta($post->ID, $field['id'], true);               // begin a table row with               echo '
                      '.$field['label'].'	                      ';                       switch($field['type']) {                           // case items will go here                           // text       case 'text':           echo '<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$meta.'" size="30" />
'.$field['desc'].'';       break;       // textarea       case 'textarea':           echo '<textarea name="'.$field['id'].'" id="'.$field['id'].'" cols="60" rows="4">'.$meta.'</textarea>
'.$field['desc'].'';       break;      // checkbox       case 'checkbox':           echo '<input type="checkbox" name="'.$field['id'].'" id="'.$field['id'].'" ',$meta ? ' checked="checked"' : '','/>              '.$field['desc'].'';       break;      // select       case 'select':           echo '<select name="'.$field['id'].'" id="'.$field['id'].'">';           foreach ($field['options'] as $option) {               echo '<option', $meta == $option['value'] ? ' selected="selected"' : '', ' value="'.$option['value'].'">'.$option['label'].'</option>';           }           echo '</select>
'.$field['desc'].'';       break;                       } //end switch               echo '
';           } // end foreach           echo '
'; // end table       }            // Save the Data       function getextra_save_subtitle_meta($post_id) {           global $custom_meta_fields;                // verify nonce           if (!wp_verify_nonce($_POST['subtitle_meta_box_nonce'], basename(__FILE__))) {             return $post_id; } else { die( 'failed to verify nonce' ); }              // check autosave           if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)               return $post_id;                // check permissions           if ('page' == $_POST['post_type']) {               if (!current_user_can('edit_page', $post_id))                   return $post_id;               } elseif (!current_user_can('edit_post', $post_id)) {                   return $post_id;           }                // loop through fields and save the data           foreach ($custom_meta_fields as $field) {               $old = get_post_meta($post_id, $field['id'], true);               $new = $_POST[$field['id']];               if ($new && $new != $old) {                   update_post_meta($post_id, $field['id'], $new);               } elseif ('' == $new && $old) {                   delete_post_meta($post_id, $field['id'], $old);               }           } // end foreach       }       //hook into save the post     add_action('save_post', 'ge_save_subtitle_meta');         ?>


title: fetch_feed returning rss feeds on same server as empty

text:
I'm trying to use fetch_feed to pull a feed that is hosted on the same server (but uses a different domain name). So, my site is, for example, bullfrogs.com and I'm trying to pull an RSS feed of events from tadpoles.com, which is hosted on the same server but not in the same WP install and using a different domain name. It doesn't work. It says there are "no items" in the feed. Now, I can use the exact same fetch_feed function to pull any other validated RSS feed (such as from, say, CNN or Gawker) from an external server into bullfrogs.com. I can also use the same code block on another site of mine on a completely different web host/server, turtles.com, and it will pull the RSS from tadpoles.com with no problems. The RSS feed from tadpoles.com validates with the W3C RSS validator tool. Assume I don't know much about the server, and that I don't manage it and need to ask a sys admin to help me if the issue is anything that can't be fixed from the WordPress dashboard. He has already reported that he doesn't see anything in the debug stuff or site logs aside from a 500 error on the rss feed. How do I ask about other possibilities, and what things should I be looking for? The code is from this site and looks like this:                   <?php if(function_exists('fetch_feed')) {              include_once(ABSPATH . WPINC . '/feed.php');               // include the     required file         $feed = fetch_feed('http://tadpoles.com/feed'); // specify the source feed              $limit = $feed->get_item_quantity(7); // specify number of items         $items = $feed->get_items(0, $limit); // create an array of items              }     if ($limit == 0) echo '
The feed is either empty or unavailable.
';     else foreach ($items as $item) : ?>
         <a href="<?php echo $item->get_permalink(); ?>"            title="<?php echo $item->get_date('j F Y @ g:i a'); ?>">             <?php echo $item->get_title(); ?>

         <?php echo substr($item->get_description(), 0, 200); ?>          [...]
          <?php endforeach; ?>      Thanks in advance.


title: Wordpress Automatic Update to 3.9.1 breaks Permalinks

text: Yesterday, WordPress 3.9.1 Maintenance Release May 8, 2014 updated my version from the latest and all of the sudden, my inside pages were broke - no one could reach anything except the home page. I went to permalinks, re-saved the custom permalinks to %postname% as they were. Unfortunately, this impacted visibility for some hours. How can I allow this auto-updater to fix security issues, but prevent this permalink break from happening in the future?


title: Loading shortcode stylesheet only when shortcode is in text widget

text: I would like to load shortcode stylesheet only when it will be put in text widget. Please help somebody.


title: Session Cookie security questions

text: I am a .NET developer but I also administer all of our corporate websites, which are all Wordpress. I inherited the sites from someone who is no longer at my company. My company recently spent a bunch of money on a security audit by consultants and they found the following issues regarding login/cookie and how they work in Wordpress. -User session cookies are not secure -session validation is not destroyed and is still active when a user logs out -session cookie includes the username in it Is there any way do fix these issues?


title: Change User Role based on Point System Issue

text: Trying to change user role based on points. This is working seems fine till it keep increasing points. The problem happens when if we decrease points it is not changing role back to below stage. Means if I have 600 points for administrator role and if user earn and role changed to administrator. After than if points goes down to 500 due to some type of negative system it should change role back to below administrator respecting to the point value in condition but this is not happening. Once role set to upper it is never going down even if point decrease.               global $wpdb;     $pref = self::qa_prefix();     $u = new WP_User($u_id);          $user_point = $wpdb->get_row("SELECT userid, points FROM {$pref}userpoints WHERE userid = {$u_id}");          if(!is_super_admin()) {                  if($user_point->points >= 600) {             $u->set_role('administrator');         } elseif($user_point->points >= 150 && $user_point->points < 600) {             $u->set_role('editor');                         } elseif($user_point->points >= 100 && $user_point->points < 150) {             $u->set_role('contributor');                         } else {             $u->set_role('subscriber');         }          }      Any suggestion or idea please.... :)


title: WP e-Commerce plugin is breaking drop down menus functionality

text: After installing WP e-Commerce plugin primary theme menu functionality got broken. Here is theme with installed WP e-Commerce plugin: http://www.interactstaging.net/clients/tozzi/ and here clean theme install which custom theme is based on: http://interactstaging.net/fusiontheme/ Any clue what can be wrong? PS. I have adjusted CSS to get sub menus to work, but still have no clue why WP e-Commerce is breaking them. PS2. Looks like CSS trick doesn't work on IE10 :\


title: How to customize reset_url or $reset_url

text: I'm trying to change the confirmation link with key and username sent by wordpress when a user forget his password. The link looks like:               /wp-login.php?action=rp&key=VZUyDIiJxJz&login=user_name      And I want to change it this way:               /new-password/?action=rp&key=VZUyDIiJxJz&login=user_name      But I don't know what filter I must use to change it. Thank you in advance for your help and time. Found a solution, putting this code in my theme functions.php. Maybe there's a best solution out there... I think change all the message is not a good way:               function reset_password_message( $message, $key ) {          if ( strpos($_POST['user_login'], '@') ) {         $user_data = get_user_by('email', trim($_POST['user_login']));     } else {         $login = trim($_POST['user_login']);         $user_data = get_user_by('login', $login);     }          $user_login = $user_data->user_login;          $msg = __('The password for the following account has been requested to be reset:'). "\r\n\r\n";     $msg .= network_site_url() . "\r\n\r\n";     $msg .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";     $msg .= __('If this message was sent in error, please ignore this email.') . "\r\n\r\n";     $msg .= __('To reset your password, visit the following address:');     $msg .= '<' . network_site_url("new-password/?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . ">\r\n";          return $msg;          }          add_filter('retrieve_password_message', reset_password_message, null, 2);


title: Wordpress metaboxes - textfield suggestion automatically populated

text: **[Long story short]** Is there any Wordpress plugin/function that would allow the creation/integration of a metabox's textfield that automatically populates a dropdown menu (in the admin area, while in the article creation screen) where to pick the desired value withouth having to write it down by hand every time? And if so, is there anything like that? **[A little bit of information]** I'm taking care of an infected Wordpress site by doing a fresh new installation and configuring it from scratch. The owner used "Verve metaboxes" in order to manage 3 custom fields (coutry, town, and address): he states that - while creating a new article - he could click on the country textfield and pick from a populated dropdown menu the correct value. He then proceded to say that once   he selected a county and clicked on the "town" textfield, he would get a list of the towns of THAT and ONLY country. The same goes for the street (once selected the town, he would get only results for that town only). Verve Metaboxes is now discontinued due to vulnerabilities and I cannot (nor want) to use it - I've then spent a few hours trying to find an alternative and/or a tutorial that would allow me to duplicate this feature but I couldn't find any. So I wonder, is there anything like that or the owner of that website is merely delusional/trying to ask for new features without any clue? Thanks in advance


title: BP Multi Network & Members Directory

text: With bp-multi-network it appears members are shared across all networks. Example - networks based on location. newyork.mydomain.com, losangeles.mydomain.com, vancouver.mydomain.com At present a member of any network is listed in any other network's members directory if they are active in the other network. So each Members Directory lists all members of the entire installation who have accessed that network. So if a "New York" member becomes active on the "Los Angeles" network they are listed in the Los Angeles Members Directory and vice-versa Now what if I also wanted a members list of just those members who joined in New York and a members list of just those members who joined in Los Angeles and a members list of just those members who joined in Vancouver etc etc. A viable solution is perhaps if I had 1) a required registration field (Your Location) drop down with the locations and then 2) a page on each network listing the members who have listed this location in the required field registration form I understand this involves interacting with WP_Query about which I have not got the faintest clue. If there is anyone out there who can attempt this or even point me in the right direction I'd be thrilled.


title: How to hide certain plugins from other admins?

text: I'm running a WP site for a client (who has an admin account) and I'd like to hide certain plugins that I've installed. Is there a way to hide certain plugins (not all) from the list for specific users? I'm not interested in user _roles_ , rather hiding certain plugins from specific user _names_. Thanks!


title: if is_home(), change class of menu-item-225 of wp_nav_menu

text: Thanks for taking the time to check this out. I know it's outdated, but I'm using Wordpress 3.2.1. I have a Custom Home Page - where I created a Page for it and titled it as my Home Page with the custom URL. I was hoping someone on here will know how to target the Custom page (whether by PHP, Javascript, etc), so that if it's on the home page, I can change the `menu-item-225` to have a class of `current_page_item`. On my header.php, I have the following code.               if (is_home()) {             wp_nav_menu(array('depth'=>0,'menu_class' => 'mainNavigation','container_id' => 'navwrap','menu'=>'Main Menu','link_before'=>'','link_after'=>''));                                }             else {                 wp_nav_menu(array('depth'=>0,'menu_class' => 'mainNavigation','container_id' => 'navwrap','menu'=>'Main Menu','link_before'=>'','link_after'=>''));                                }


title: Adding Contact Form 7 to my anti-spam rules in .htaccess

text: I have the following rules set in my `.htaccess` file to block spam. It works by not allowing anyone to login, register, or make a comment unless the conditions are met. It works, but I would like to add **Contact Form 7** _(version 3.2)_ in there somehow.               RewriteCond %{HTTP_COOKIE} !^PHPSESSID=\w+ [OR]     RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?example\.com/ [NC,OR]     RewriteCond %{HTTP_USER_AGENT} ^$     RewriteRule ^wp-(comments-post|login|register)\.php http://example\.com [R=301,L,NS]      I've tried using `wp-contact-form-7.php` and `submit.php`. I've also tried using the uri `/contact-us/` where the contact form is located and none work.


title: New image size version only for the Featured Image file

text: I'm worried about too many files created when adding a new image size. All uploaded files will generate the new size, **I need a specific image size only for the file set as Fetured image, is there some way to do this?**. The _thumbnail_ , _medium_ , etc are ok, but there is no need to create the new size for every file. I think this should work right after setting the Featured Image.


title: How can I include active content in a custom post type?

text: Related to my How do I create a custom post type for a training CMS in WordPress? question, if I have a custom page type created for the presentation of training content, how could I include active content, such as a multiple choice test in some of these training pages? would very much prefer that the training page (i.e. my custom post type) is aware of the test, and acts as a micro-LMS, handling navigation back and forth between questions etc. It would break my cold, hard heart to simply plug the test into an iframe, so what else can I do?


title: Cannot use 'CSS' in post title

text: **Issue?**   Whenever I use the term 'CSS' in a post title, the rest of the title (after the term 'CSS'), is inserted at the top of the single post page. **What steps will reproduce the problem?**   1. Create a new post.   2. Type 'CSS' somewhere in the post title.   3. Preview/publish the post. **What is the expected output? What do you see instead?**   I expect to see the page title appear as normal, which it does. However, at the top of the page, above the opening body tag, everything in the title after the term 'CSS' is inserted. **What version of the product are you using?**   WordPress 3.3    Here is a link to illustrate the issue: http://joshnh.com/2001/12/test-css- title/


title: How do I create a custom post type for a training CMS in WordPress?

text: I need to create a custom post type based on the existing 'Page' type, for a WordPress based training CMS. I have no problem simply creating a new post type, but I would like to offer some kind of templating in these training pages for the inclusion of standard, repeated content such as instructions, as well as the possible inclusion of simple multiple choice tests in each page type. How can I go about this? What areas of the Codex should I be studying?


title: How could I create a 'private comments' section on a custom post type?

text: Related to my How do I create a custom post type for a training CMS in WordPress? question, I would like to know how I can create a private comments section for a custom post type (or any post type for that matter, if possible), where these comments are only visible to their author. I am working on a training CMS and students should be able to make private study notes on the training content pages as they work through them.


title: Custom Post Type Template Based on Page Slug?

text: I have a hierarchical custom post type (missions) setup. I want to create a few child pages for it (discuss, petition, educate), but I want each of those child pages to display a different template. There does not appear to be a way to use a selected template, like on a normal page, so I thought maybe I could just have the child custom post type pages display content based on their slug. So the permalinks would appear as:               /mission/mission-01/      - /mission/mission-01/discuss/      - /mission/mission-01/petition/      - /mission/mission-01/educate/          /mission/mission-02/      - /mission/mission-02/discuss/      - /mission/mission-02/petition/      - /mission/mission-02/educate/      Since they are children, and the Discuss pages could all use the same slug, maybe a function that gives all pages with slug /discuss/ the page-discuss- template.php from my theme directory. Thanks for any help!


title: How should I add links to other pages/posts from my post?

text: I'm wondering how should I link to other posts from one of my posts. Ideally I would use a function like get_permalink() but php is not available in post content, so how can I link to other pages ensuring the links won't break if I change the post/pages slugs?


title: The Loop isn't working

text: I can't get the loop to work as it's supposed to, without using the not-so- recommended:               <?php query_posts('post_type=post&post_status=publish&paged='. get_query_var('paged')); ?>      I'm using a custom page template named "template-blog.php" with this content: http://pastebin.com/raw.php?i=9W3akEcX And here's the "content.php" file: http://pastebin.com/raw.php?i=EH6xhzLQ Using that loop, I get only one post, which is actually a page to which I've assigned the "template-blog.php" template, in the form of a post - only the title, since I haven't added any content to it when I created it the dashboard. Is there anything wrong with my code above? Thanks.


title: Why is my Blog Page ID == First Post ID?

text:
It is possible that I'm doing something wrong. Currently I'm using `index.php` as the main blog page. I have a page setup for the Blog and set it up in my Settings. When I try to get the Blog Page ID though it always shows the first posts ID instead. I'm not running any additional queries anywhere besides the normal Loop. Why is my code showing the Post ID versus the Page ID? **Index.php Code:**               <?php get_header(); ?>          <?php get_sidebar(); ?>          <?php         echo $post->ID;  // First Post ID         echo get_queried_object_id(); // First Post ID     ?>
     <?php if(have_posts()) : ?>                     <?php while(have_posts()) : the_post(); ?>                         <div <?php post_class('blog-entry') ?> id="post-<?php the_ID(); ?>">
                                 <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">                                     <?php the_title(); ?>
                                                              by Company <?php the_time('F jS, Y') ?> /                                  <a href="<?php the_permalink(); ?>/#comments">Share Comment
                                 <?php the_excerpt(); ?>

                                                                      <a href="<?php the_permalink(); ?>" title="Read More">Continue Reading »

                     <?php endwhile; ?>
                         <?php previous_posts_link('« Previous Page'); ?>                         <?php next_posts_link('Next Page »'); ?>
                 <?php endif; ?>
     <?php get_footer(); ?>


title: How to use is_multisite() in a must-use-plugin?

text: I want this code to be executed in a plugin in the _mu-plugins_ folder. When executing in _functions.php_ everything works fine, but when I try it as a plugin in _mu-plugins_ this creates a blank page.               if (( is_multisite() && !current_user_can('manage_network') ) || ( !is_multisite() && !current_user_can('create_users')))  {       add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_version_check' );" ), 2 );       add_filter( 'pre_option_update_core', create_function( '$a', "return null;" ) );       add_filter( 'pre_site_transient_update_core', create_function( '$a', "return null;" ) );     }


title: Posting via HTTP requests?

text: Is there any way to do auto blogging on WordPress? What I want to do is to submit a new blogging entry through a HTTP request rather than through the WordPress UI. I know that I can do it using email, but I don't want to go through any mail server.


title: Formatting Standard Post Format

text:
I'm looking to display an image for all the "standard" post formats on my site. I have done some research on how to add quote, video, photo, etc and have been able to implement these images into the site but when it comes to the "standard" post type I get nothing! I have done all the necessary steps in the functions.php file:               add_theme_support( 'post-formats', array( 'aside', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video', 'audio' ) );       And my code to display the images is as follows:
          <?php if(has_post_format('video')) { ?>         <img src="<?php bloginfo('template_url'); ?>/post-icons/video.png" alt="Video" />         <?php } ?>          <?php if(has_post_format('image')) { ?>         <img src="<?php bloginfo('template_url'); ?>/post-icons/photo.png" alt="Photo" />         <?php } ?>          <?php if(has_post_format('standard')) { ?>         <img src="<?php bloginfo('template_url'); ?>/post-icons/text.png" alt="Text" />         <?php } ?>          <?php if(has_post_format('audio')) { ?>         <img src="<?php bloginfo('template_url'); ?>/post-icons/audio.png" alt="audio" />         <?php } ?>          <?php if(has_post_format('aside')) { ?>         <img src="<?php bloginfo('template_url'); ?>/post-icons/aside.png" alt="aside" />         <?php } ?>          <?php if(has_post_format('gallery')) { ?>         <img src="<?php bloginfo('template_url'); ?>/post-icons/gallery.png" alt="gallery" />         <?php } ?>          <?php if(has_post_format('link')) { ?>         <img src="<?php bloginfo('template_url'); ?>/post-icons/link.png" alt="link" />         <?php } ?>          <?php if(has_post_format('quote')) { ?>         <img src="<?php bloginfo('template_url'); ?>/post-icons/quote.png" alt="quote" />         <?php } ?>          <?php if(has_post_format('status')) { ?>         <img src="<?php bloginfo('template_url'); ?>/post-icons/status.png" alt="status" />         <?php } ?>          <?php if(has_post_format('false')) { ?>         <img src="<?php bloginfo('template_url'); ?>/post-icons/standard.png" alt="standard" />         <?php } ?>          <?php if(has_post_format('chat')) { ?>         <img src="<?php bloginfo('template_url'); ?>/post-icons/chat.png" alt="chat" />         <?php } ?>      Can anyone help me out on how to get the standard post images to display?


title: How Do I Allow Comment Moderation for Other User's Posts?

text: I want to setup a user account that only has access to moderate comments - for all posts - but doesn't have access to edit any posts. When I give the user the moderate comments privilege (using an old role manager plugin), it doesn't let them moderate comments on other articles. Is there a plugin that does this, or something I'm doing wrong?


title: Attaching taxonomy data to post with wp_insert_post

text: I am implementing (trying) a front end posting system which shows taxonomy data in several dropdown select fields, each of the dropdowns is named by using the "name" $arg in wp_dropdown_categories.               <?php wp_dropdown_categories('taxonomy=location&hide_empty=0&orderby=name&order=asc&name=location') ?>        as you can see taxonomy is "location" and select name is "location". I then add the variables for each of the taxonomy select dropdowns like so along with post_title, post_content etc:               $title      = trim($_POST['wpuf_post_title']);     $content    = trim($_POST['wpuf_post_content']);     $tags       = wpuf_clean_tags($_POST['wpuf_post_tags']);     $customcategory      = trim($_POST['customcategory']);     $cat        = trim($_POST['cat']);     $location        = trim($_POST['location']);     $sale_rental        = trim($_POST['sale_rental']);     $price        = trim($_POST['price']);      and finally i add the extra info into an array ready to be sent by wp_insert_post, im quite stuck on whether i am doing the right thing by adding tax_input into the array like below as this is what i seem to be understanding from codex that i need to do.               'tax-input'    => array( $location,      $sale_rental,      $price      ),      so that it all ends up looking like this:               $my_post = array(                 'post_title'    => $title,                 'post_content'  => $content,                 'post_status'   => $post_status,                 'post_author'   => $userdata->ID,                 'post_category'    =>    array($_POST['cat']),                 'post_type' => $customcategory,                 'tags_input'    => $tags,                 'tax_input'    => array( $location,                                          $sale_rental,                                          $price                 ),         );          $post_id = wp_insert_post($my_post);      however when i submitted the new post, all the standard post data (and also my custom post type) goes in ok, but the taxonomies do not, im obviously doing something wrong, but what?


title: Plugin directory "Last Updated" not changed after initial commit?

text: I released the first version of my Rewrite analyzer plugin with a commit on 2010-05-12. The WordPress.org plugin directory however still displays 2010-11-27 as the "Last Updated" date - this is the date when the plugin directory was created in the repository. The Developer FAQ states: > Last updated time   >  Time of last check in to the appropriate directory (trunk/ or the stable > tag directory) **after a version number change**. Most developers commit their first version right after their plugin directory gets created, so you won't notice the difference. But I have seen the same discrepancy in other plugins that were committed more than one day after the directory was created. I committed both the `trunk/` and `tags/1.0/` directories in one go (with a local copy and then a commit), but the other plugin with this problem did it like most people do: a commit of `trunk/` and then a remote copy to `tags/1.0/`. Otto recently said: > The only time the readme gets parsed and the entry gets rebuilt is when the > version of the plugin changes. However, for people using tags, this > generally happens after they make the new tag and update the Stable Tag. The readme file got parsed, so I don't know what else I could have done to make it update correctly?


title: Difference between after_setup_theme and init action hooks?

text: What is the difference between the `after_setup_theme` and `init` action hooks? It seems they are both called right before any page in WordPress is loaded (even admin pages).


title: Is there a faster way to git-svn clone a wordpress plugin from the subversion repository?

text: When cloning a SVN repo with git-svn it searches laboriously through every revision for changes that are relevant (at least as I understand it). Is there anyway to make this process quicker? I found this link: http://stackoverflow.com/questions/747075/how-to-git-svn- clone-the-last-n-revisions-from-a-subversion-repository that suggests it is possible to limit the number of revisions, just need to figure out how far back to go and how to find that number


title: Twenty Eleven unregister all default sidebars?

text: I need to unregister all the default sidebars in the Twenty Eleven theme so I can add custom left and right sidebars via the functions.php file in a child theme. This function below is for Twenty Ten; but I don't know where to find the correct strings for the widget areas for Twenty Eleven, which are called Main, Showcase and Footer Areas one, Two and Three.               function remove_some_widgets(){              // Unregister some of the TwentyTen sidebars              unregister_sidebar( 'first-footer-widget-area' );         unregister_sidebar( 'second-footer-widget-area' );         unregister_sidebar( 'third-footer-widget-area' );         unregister_sidebar( 'fourth-footer-widget-area' );     }     add_action( 'widgets_init', 'remove_some_widgets', 11 );


title: Stop wordpress automatically escaping $_POST data

text: I have a custom front end form which creates a custom post type post and have just discovered WordPress automatically escapes $_POST data in the same way that Magic Quotes does. I have Magic Quotes disabled and have created a test form that I run on the same domain. When run on it's own, no data is escaped. However when I run it as a page template for a WordPress page the raw $_POST data is escaped, i.e. using print_r($_POST) so before there has been any processing done. I have also tried this with multiple themes and the same result. Anyone know where / how to shut this off? Is there a filter I can suppress for this form? Cheers.


title: How can I include a setting that has a variable number of values in a settings page using register_setting?

text: I have one option on a settings page that can have between 1 and 5 values. I have a basic understanding on how to set up single value settings using the Settings API, but how do I go about generating the markup etc. for the setting with a variable number of values?


title: js error on post editing page

text: I'm getting a Javascript error on the wp-admin/post.php page which prevents me from adding tags/editing the post's link.. pretty much everything with JS... anyway, the error is:               > Error: d.delegate is not a function     > Source File:     > http://www.mysite.com/wp-admin/load-scripts.php?c=1&load=hoverIntent,common,jquery-color,schedule,wp-ajax-response,autosave,wp-lists,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-resizable,jquery-query,admin-comments,suggest,jquery-ui-sortable,postbox,post,word-count,thickbox,media-upload&ver=c1c854f5d9062306d43d7331055686c9     > Line: 42      **UPDATE**   Only solution that seemed to work was downgrading the Wordpress website to 3.0.5   I'm not sure why is this happening, but after 5 hours of debugging - I don't care


title: WP & Server Speed [Teacher Question]

text: I'm a teacher and have used multisite WP for two years now as a resource for completing assignments. This spring semester, I have the most students that I've had on my site (30). Prior to this semester I've a max of 26 with no problems. Unfortunately, I've had constant slow downs: **either timing out, 500s, or the WP error establishing connection to database**. I use hostmonster as my host and have emailed them. They told me to install a cache plugin and activated it site-wide (WP Super Cache). This didn't really help, though. Besides server-side issues, I'm wondering about two different possible problems:   1. Connection speed / firewall issue in my school district (which I'm waiting to hear back)   2. The location of this install on the grandchild level of the server: public_html (main domain for the server) -> add-on domain -> sub-directory -> student sites Could #2 be my problem? The server is based off of my personal site/domain and any other additional. It views add-on domains as sub-directories (domain1.com/domain2), but parks it as it's own domain (domain2.com). Could all the sub-directories be the problem? Is there anything I could be missing? Does this make sense? Help? Please and thank you.   :)


title: How to combine custom fields to make one order-able value

text: I have three different custom fields, for day (01-07) hour (01-12) and minute (00-59) and I really need to combine them into one custom value so I can actually order them using wp_query. I cant actually just use custom field for the whole thing; it would be easier I know, but it needs to be easy on the user to input day/time. So that option is out of the question. Is it possible to join those three numerical values for use in wp_query? Thanks in advance for any help. David


title: Monkey Man Rewrite Analyzer says my rule will trigger but it doesn't

text: I installed Monkey Man Rewrite Analyzer, i got a rule installed, it shows in the list, if i test it with monkey man it says it will fire but it doesn't in reality, whats wrong?               add_action('init', array($this, 'register_crr_jsonwebservice'), 99);          public function register_crr_jsonwebservice() {              //Add the rewrite rule for this specific json controller         add_rewrite_tag( '%ticket%', '([a-zA-Z0-9]+)');         add_rewrite_rule( 'cjson/fullticket/([a-zA-Z0-9]+)/', 'index.php?p=1312&ticket=$matches[1]', 'top' );         flush_rewrite_rules();          }      Test this rule in MMRA: > cjson/fullticket/231412tgsxcasfasdfas/ Works fine, test it out on wordpress directly copying the same url? 404, not found... what am i doing wrong?


title: gravity forms : use previous dropdown choice as variable in gform_pre_render?

text: I have a question regarding gform_pre_render? I have dealer form. Which basically you choose your county, and then your dealer. **Dropdown A = Dealer Country   Dropdown B = Dealer Name** I have about 15 countries, and I am using get_terms in the gform_pre_render function to list all my countries that I have assigned to a dealer post...               // Dropdown A - Dealer Country     add_filter("gform_pre_render", "dropdown_dealer_country");     add_filter("gform_admin_pre_render", "dropdown_dealer_country");     function dropdown_dealer_country($form){              if($form["id"] != 3)            return $form;              $terms = get_terms("dealer-country");              $items = array();         $items[] = array( "text" => __('Select country...','mission-theme'), "value" => 0 );              foreach($terms as $term)             $items[] = array( "text" => $term->name, "value" => $term->slug );              foreach($form["fields"] as &$field)             if($field["id"] == 6){                 $field["choices"] = $items;             }              return $form;     }      OK so the above function works perfectly in Dropdown A. Now what I am trying to do in Dropdown B is display all my dealer names. I have named each dealer custom post-type title with the name of the dealer, and this is what I am pre populating my secondary drop down with...               // Dropdown B - Dealer Name     add_filter("gform_pre_render", "dropdown_dealer_name");     add_filter("gform_admin_pre_render", "dropdown_dealer_name");     function dropdown_dealer_name($form){              if($form["id"] != 3)            return $form;              $dealers = get_posts(array(             "post_type" => "dealer",             "dealer-country" => $dealerCounty,             "post_status" => "publish",             "orderby" => "title",             "order" => "ASC",             "posts_per_page"  => -1         ));              $items = array();         $items[] = array( "text" => __('Select dealer...','mission-theme'), "value" => 0 );              foreach($dealers as $dealer)             $items[] = array( "text" => $dealer->post_title, "value" => $dealer->post_name );              foreach($form["fields"] as &$field)             if($field["id"] == 7){                 $field["choices"] = $items;             }              return $form;     }      ...and as you can see in line 11, I have a variable in my get_posts array **"dealer-country" => $dealerCounty** My question, is it some how posible to get the choice that is made in **Dropdown A** into my $dealerCounty variable in my **Dropdown B** function? Any tips or help would be much appreciated as my **Dropdown B** is currently very long, and I need to filter it down by country.    If any one knows a method that would be great. Thanks in advance.


title: Need custom picture field for pages

text: I want to have a picture or multiple pictures on each page in wordpress. AFAIK there are two standart ways of doing this   1. in WYSIWYG editor, attach file etc   2. widgets. Problem is, those wont do for my clients. So how can I make a custom field on each page, where the user selects a pic if he wants. I know there is a plugin, "sidebar per page" but i would like to do it without plugin, and if possible all the page editing happens on admin>pages>page x without the need to go to widgets are and so on. Pls share if there is a way to do this, or what it would take. TY


title: php to add a link into wp widget without specific url

text: I'm trying to write a plugin to a specific page that the plugin creates. The issue is how do i add a link to that page from the widget. I know the page but the url has to be picked up from the site it is installed on.


title: wordpress radio button on single post page

text:
I have two radio buttons that enable/disable the particular category posts from my wordpress homepage, I have also added these two buttons on single.php, this is what I'v done, If the post belong to category 'ABC' and button is enable then show the following messgae, "PLEASE Disable the button" (the button is right under this message) but when i choose disable option i am redirecting to the index.php automatically :S it works really fine for category pages but doesn't work for single.php , WHY? buttons code,
         <form name="f1" method="POST" action="<?php echo $PHP_SELF;?>">             Family filter:

<input type="radio" name="r1" value="o" onClick="submit();" <?php echo (!$_SESSION['r1'] || $_SESSION['r1'] == "o") ? 'checked="checked"' : ''; ?> />On

<input type="radio" name="r1" value="p" onClick="submit();" <?php echo ($_SESSION['r1'] == "p") ? 'checked="checked"' : ''; ?> />Off

         </form>
      this is code inside category.php and it is working fine,               <?php               if ( in_category($category) && $_SESSION['r1'] == "o" ) { // See if the user is inside restricted category or if the Family filter is On (if one)             echo "
";             echo "Please turn Off the 'Family filter' in order to read these SMS.
 these text messages are not suitable for user unders age 17";             echo "
";             echo "
";         }     ?>      This is the code inside single.php,               <?php                      $currentCat = get_the_category();  // Get the Array of Categories of current Post                 $filterCategory = $currentCat[0]->cat_ID; // store the First category in filterCategory                 if (($filterCategory == $category) && ($_SESSION['r1'] == "o" )){ //                  ?>          please disable the button
         <form name="f1" method="POST" action="<?php echo $PHP_SELF;?>">             Family filter:

<input type="radio" name="r1" value="o" onClick="submit();" <?php echo (!$_SESSION['r1'] || $_SESSION['r1'] == "o") ? 'checked="checked"' : ''; ?> />On

<input type="radio" name="r1" value="p" onClick="submit();" <?php echo ($_SESSION['r1'] == "p") ? 'checked="checked"' : ''; ?> />Off

         </form>
      This is the code inside every one of them,               $choice = $_POST['r1'];         $id = $category;         if ($choice == 'o') // Family Filter !!! If 'ON'             query_posts("cat=-.'$id'&".$query_string); // Remove Post from Category of particular ID         else if (!$_SESSION['r1'] || $_SESSION['r1'] == "o") // If there is nothing in Session (opening page for the frst time) Remove the posts             query_posts("cat=-.'$id'&".$query_string);          else {             $_POST['r1'] = 'p';         }      The code works for index.php / archieve.php but not working on single.php (i am redirecting onto index,php after choosing "disable/off".


title: list category posts are not ordering any more

text: I am not sure if this started with the latest upgrade (didn't notice it until yesterday), but the lists are no longer ordering by either asc or dsc. Doesn't matter which I chooose, or which list, they have all stopped ordering alphabetically. (I use orderby=title order=asc)


title: Metabox Input Not saving

text:
I haven't made any meta-box's in quite some time so quickly threw together this one for a website I'm developing. My problem is that when I input some text in the box's and hit save the text disappears so I'm left with empty text box's and no saved data. I'm guessing this is something to do with my `save_post` function updated* Now the title field works but the content one doesn't.               //intialising the metabox and using the callback function                    add_action( 'add_meta_boxes', 'owl_mb_create' );          function owl_mb_create() {                  add_meta_box( 'owl-meta', ' Inner Page Box', 'owl_mb_function', 'page', 'normal', 'high' );          }          ?>               <?php          function owl_mb_function( $post ) {                  //retrieve the metadata values if they exist             $owl_mb_content_one = get_post_meta( $post->ID, 'owl_mb_content_one', true);             $owl_mb_title_one = get_post_meta( $post->ID, 'owl_mb_title_one', true);             $owl_mb_content_two = get_post_meta( $post->ID, 'owl_mb_content_two', true);             $owl_mb_title_two = get_post_meta( $post->ID, 'owl_mb_title_two', true);             $owl_mb_content_three = get_post_meta( $post->ID, 'owl_mb_content_three', true);             $owl_mb_title_three = get_post_meta( $post->ID, 'owl_mb_title_three', true);                  echo 'Please fill in the forms below';     ?>
title:<input type="text" name="owl_mb_title_one" value=" <?php echo esc_attr( $owl_mb_title_one ); ?>" />

content:
<textarea cols="1" rows="8" name="owl_mb_content_one" id="excerpt"value=" <?php echo esc_attr( $owl_mb_content_one ); ?>"></textarea>

title:<input type="text" name="owl_mb_title_two" value=" <?php echo esc_attr( $owl_mb_title_two ); ?>" />

content:
<textarea cols="1" rows="8" name="owl_mb_content_two" id="excerpt"value=" <?php echo esc_attr( $owl_mb_content_two ); ?>"></textarea>

title:<input type="text" name="owl_mb_title_three" value=" <?php echo esc_attr( $owl_mb_title_three ); ?>" />

content:
<textarea cols="1" rows="8" name="owl_mb_content_three" id="excerpt"value=" <?php echo esc_attr( $owl_mb_content_three ); ?>"></textarea>               <?php } ?>               <?php          //hook to the save the meta box data          add_action( 'save_post', 'owl_mb_save_meta' );                  function owl_mb_save_meta ( $post_id ) {                                  //save the metadata                          update_post_meta( $post_id, 'owl_mb_content', strip_tags( $_POST['owl_mb_content_one'] ) );                     update_post_meta( $post_id, 'owl_mb_title', strip_tags( $_POST['owl_mb_title_one'] ) );                     update_post_meta( $post_id, 'owl_mb_content', strip_tags( $_POST['owl_mb_content_two'] ) );                     update_post_meta( $post_id, 'owl_mb_title', strip_tags( $_POST['owl_mb_title_two'] ) );                     update_post_meta( $post_id, 'owl_mb_content', strip_tags( $_POST['owl_mb_content_three'] ) );                     update_post_meta( $post_id, 'owl_mb_title', strip_tags( $_POST['owl_mb_title_three'] ) );                  }          ?>      Many Thanks :)


title: Post Format single-loop.php using get_template_part

text: I have set up to use post formats gallery and video in addition to the standard. I am editing the loop-single.php to give it different layouts for each post format, but I'm to include get_template_part for each post format. This is what I have:               <?php     /**      * The loop that displays a single post.      *      * The loop displays the posts and the post content.  See      * http://codex.wordpress.org/The_Loop to understand it and      * http://codex.wordpress.org/Template_Tags to understand      * the tags used in it.      *      * This can be overridden in child themes with loop-single.php.      *      * @package WordPress      * @subpackage Twenty_Ten      * @since Twenty Ten 1.2      */     ?>          <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>               <?php              if ( has_post_format( 'gallery' )) {           // code to display the gallery format post here                get_template_part( 'news' 'gallery' ); // News Gallery Template (news-gallery.php)               } else if (has_post_format('video')) {            // stuff to display the video format post here                  get_template_part( 'news' 'video' ); // News Gallery Template (news-video.php)               }else {            // code to display the normal format post here                  get_template_part( 'news' 'standard' ); // News Gallery Template (news-standard.php)               }              <?php endwhile; // end of the loop. ?>               ?>      It is coming up with an error when I'm testing: Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/judddev/public_html/pitch/wp-content/themes/pitch/loop-single.php on line 26 Any help would be greatly appreciated.


title: Publish a message on facebook after having posted a comment

text:
I would like some advice on how to improve the code I use for allowing people to comment posts. Users can only submit a comment if they are connected with Facebook. I started developping this feature directly in the comments.php template. It works but there is another feature which permit people to publish a message on their wall if they tick a checkbox before sending the comment. I have some troubles for developping this functionnality because I need an instance of the Facebook class. I already have it in my comments.php and I was wondering if there was a way to use it instead of creating a new one. Here is the code : **comments.php:**               <?php      locate_template( 'include/facebook.php', true );          $config = array();     $config['appId'] = get_option( 'appId' );     $config['secret'] = get_option( 'secret' );          $facebook = new Facebook($config);     $session = $facebook->getUser();     if(!$session){         $loginUrl = $facebook->getLoginUrl(array('scope'=>'publish_stream, email', 'redirect_uri'=>'http://www.myredirecturi.fr'));     }          if( !isset( $session ) || empty( $session ) ){             ?>

                 <a href="<?php echo $loginUrl; ?>"><img src="<?php echo get_template_directory_uri(); ?>/img/btn-fb.png" alt="">

         <?php     }          $nb_coms = get_comments_number();     if( $nb_coms != 0 ){         wp_list_comments('callback=custom_comment&avatar_size=50');     }     ?>          <?php     if($session){             try {                 $me = $facebook->api('/me');             $username = $me['username'];             $firstname = $me['first_name'];             $email = $me['email'];                  // I display here my custom comment form                 }             catch(FacebookApiException $e){                 error_log($e);             }     }     ?>      **functions.php**               <?php     add_action( 'comment_post', 'custom_save_comment_data' );       function custom_save_comment_data( $comment_id ) {                add_comment_meta( $comment_id, 'fb_username', $_POST['fb_username'] );              //if( isset($_POST['publish']) ){         //  $params = array(         //                  'message'       =>  "Hurray! This works :)",         //                  'name'          =>  "This is my title",         //                  'caption'       =>  "My Caption",         //                  'description'   =>  "Some Description...",         //                  'link'          =>  "http://stackoverflow.com",         //                  'picture'       =>  "http://i.imgur.com/VUBz8.png",         //              );         //  $user = $_POST['fb_userid'];         //    $post = $facebook->api("/$user/feed","POST",$params);         //}     }     ?>      What do you recommend for pass the facebook object ? Does the way I developped these features is correct ? or should I create a plugin ? if it's the case, why ?


title: Limit number of characters in different excerpts

text: I've been using this little snippet from another answer on here to limit the number of characters that display in the excerpt;               add_filter('wp_trim_excerpt', function($text){             $max_length = 140;         if(mb_strlen($text, 'UTF-8') > $max_length){             $split_pos = mb_strpos(wordwrap($text, $max_length), "\n", 0, 'UTF-8');             $text = mb_substr($text, 0, $split_pos, 'UTF-8');         }              return $text;     });      The problem is that I now have multiple excerpts and one global character limit isn't a viable option anymore. Is there a way that I could define the character limit on individual excerpts? (So, for example, one excerpt could show 150 characters while another shows 200?)