title: register_activation_hook() not activate plugin

text: I am writing a plugin that on the activation must create a new table in database. To do this i am using:               register_activation_hook( __FILE__, 'createTable' );      When i run the activation, my plugin creates the new table in the database but when the plugin-page is reloaded my plugin is listed as not active. So i have still the links: activate|delete. Why this happends? how to fix? Here is my function:                   function createTable(){                   $link = mysql_connect('localhost', 'user', 'pass');         if (!$link) {             die( 'Could not connect: ' . mysql_error() );         }         mysql_select_db (db_name);               $sql = "CREATE TABLE IF NOT EXISTS UsersExtra (           user_id INT NOT NULL,           first_name VARCHAR(25) NOT NULL,           last_name VARCHAR(25) NOT NULL,           address VARCHAR(80) NOT NULL,           city VARCHAR(30) NOT NULL,           province CHAR(2) NOT NULL,           postcode CHAR(7) NOT NULL,           interests TEXT NULL,           bio TEXT NULL,           signature TEXT NULL,           skills TEXT NULL,           PRIMARY KEY (user_id),           FULLTEXT KEY (interests, skills)         ) ENGINE=MyISAM  DEFAULT CHARSET=utf8";              mysql_query($sql) or die( mysql_error() );         mysql_close($link);          }


title: BuddyPress - Redirects on Login and Logout

text: Using BP theres a way to:               1. On login redirect to member profile.          2. On logout redirect to facebook.com      Thanks in advance.


title: __autoload in a plugin throws an error in WP - not able to locate translation_entry.class.php

text: Ok, I'm going to try to explain this as simple as possible. I'm trying to modify a plugin called smart-lencioni-image-resizer v2.0. to be used in WP-Multisite. I'm trying to display an image through SLIR using the following URL: http://subsite.mainsite.no/wp-content/plugins/wp- filebrowser/slir/?w=90&h=90&c=1:1&i=http://bekkelaget.stiengenterprises.no/files/seniorsenter/DSC_3535.jpg I've done this successfully in v.1.4.2. But v2.0 is using a different method for including files. The `index.php` file looks like this:               function __autoload($className)     {       var_dump($className);           require_once strtolower($className) . '.class.php';     }          new SLIR();      Now, where ever I try to include WP header:               require_once($_SERVER['DOCUMENT_ROOT'].'/wp-blog-header.php');      I get the following error message: * **Warning: require_once(translation_entry.class.php) [function.require-once]: failed to open stream: No such file or directory in I:\Development\wamp\www\mysite\wp-content\plugins\wp-filebrowser\slir\index.php on line 43*** Line 43 in the `index.php` is:               require_once strtolower($className) . '.class.php';      For some reason the `__autoload` function makes WP look for files in the SLIR directory. This is of cours wrong :( **UPDATE** I found one solution on the web that kind of works:               function __autoload($className)     {       if(file_exists(strtolower($className) . '.class.php')) {         require_once strtolower($className) . '.class.php';       }     }      This allows WP header file to be loaded. But for some reason it loads `mainsite.no` and drops executing the URL I added at the top. Is there any other way I can solve this problem? **UPDATE2** There is an .htaccess file in the SLIR folder. The file looks like this:               <IfModule mod_rewrite.c>     RewriteEngine On     RewriteRule . index.php [L]     </IfModule>          # Prevent viewing of the error log file in its default location     <Files slir-error-log>     Order Deny,Allow     Deny from All     </Files>      Could it be that when I include the WP header file, it ignors the .htaccess file from SLIR?


title: How do I create a system to track logged in users' views each time an individual CPT post is viewed?

text: I have a custom post type created in a plugin I'm working on, using Piklist (as I have a lot of other things I can use it for in this project, in general). So my first step would be to create a table to store the data.               global $vl_db_version;      $vl_db_version = "1.0";          function vl_install() {          global $wpdb;          global $vl_db_version;         $table_name = $wpdb->prefix . "listingviewlog";         $sql = "CREATE TABLE $table_name (              id mediumint(9) NOT NULL AUTO_INCREMENT,              time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,              name tinytext NOT NULL,              text text NOT NULL,              url VARCHAR(55) DEFAULT '' NOT NULL,             UNIQUE KEY id (id)          );";         require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );          dbDelta( $sql );         add_option( "vl_db_version", $vl_db_version );      }          function vl_install_data() {         global $wpdb;          $welcome_name = "Mr. WordPress";         $welcome_text = "Congratulations, you just completed the installation!";         $table_name = $wpdb->prefix . "listingviewlog";         $rows_affected = $wpdb->insert(              $table_name,              array(                  'time' => current_time('mysql'),                  'name' => $welcome_name,                  'text' => $welcome_text              )          );      }      But the fields I actually need after id and time are not name, text, and url, but user_id and cpt_id, foreign keys... or do they need to be foreign keys? Why should they be? Because the actual logging action code should add those in anyway right... Then I'll use Piklist to make an admin table and stats section.


title: how to add a page

text: It's probably really simple, but i can't figured out, i have a php file and 3 folders css, js( with inside libs ), and image. so i put the php file and the css inside the theme root, the js in /js folder. after that i just created a new page and use as template attributes the about. doesn't work http://www.inspirates.net/?page_id=554 there is the file: http://pastebin.com/YYP31cfr i don't know what is wrong, i know there are a lot of topic about custom page, but my problem is to include all the file.


title: Get custom fields when hover link of post

text:
I have custom page and get some links of post               if( $my_query->have_posts() ) {            while ($my_query->have_posts()) : $my_query->the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>" target="_blank"><?php echo str_replace($xx,'',get_the_title()); ?>
              <?php            endwhile;          }      I want to get custom fields (e.g description, post-image) of post when hover every link of post and put them into `div` (tooltip), do I create new file for get custom fields and get file using ajax or just call using wp_query to get custom fields?


title: Styling Taxonomy Terms Individually

text:
I am trying to solve a problem and need help :) First, I have a custom grid displaying terms and images from my custom taxonomy. This is the code I'm using currently:               <?php          $terms = get_terms( 'industrygroups' , 'hide_empty=false' );          echo '
';          foreach ( $terms as $term ) {              // The $term is an object, so we don't need to specify the $taxonomy.         $term_link = get_term_link( $term );              // If there was an error, continue to the next term.         if ( is_wp_error( $term_link ) ) {             continue;         }              // We successfully got a link. Print it out.         echo '
' . $term->name . '
';     }          echo '
';          ?>      What I would like to accomplish now is to use a custom field from my taxonomy term (which has been added via ACF. The field is a dropdown, displaying different Levels 1-5. I want each chosen level to output a different color border/background around the tax term shown in the grid - In the Front End Now, I have been trying to follow this tutorial which addresses how to accomplish this with posts, however I'm struggling to transfer this train of thought to apply to taxonomy terms. I would love some advice. Thank you.


title: setlocale for date

text: So I purchased a premium wordpress theme, but I can't get through its Polish localization - the dates outside the_time or the_date are displaying in English (default server's language). I read that I have to use setlocale(LC_ALL, 'pl_PL'); to change it, but I don't know in which file or where it should be included and/or if I need something more. Below is an excerpt of code displaying English date:               $event_date = get_post_meta(get_the_ID(), 'event_date');     $event_from_time = get_post_meta(get_the_ID(), 'event_from_time');     $event_to_time = get_post_meta(get_the_ID(), 'event_to_time');     $event_address = get_post_meta(get_the_ID(), 'event_address');          echo date('j F Y', strtotime($event_date[0])).'  '.$event_from_time[0].' do '.$event_to_time[0];      I appreciate your time and help.


title: Wordpress - Allow dynamic text to be added into a sidebar upon page creation

text: I have a page template in WordPress that allows new pages to be created to display and explain treatment details. E.g.   * Chiropractor Page   * Acupuncture Page When a new treatment page is created from the template, it is required to put which clinics provide the treatment in the sidebar. The clinics listed will vary for most treatment pages so this information cannot be hard-coded. I'm unsure on how I should be doing this? I have a unique sidebar that the template uses but I'm not sure how I incorporate this dynamic functionality into that sidebar? I guess it would make most sense that when I create the page within WordPress, there is something like the 'Featured Image' option where I can drop this information in. All help is greatly appreciated. Thanks


title: Global Parent theme for all sites

text: I have 15 different wordpress sites installed on my server. They are independent installations , not multisite. I have developed a parent theme and copied it in all sites. Now whenever I have to make a change in parent theme, I have to access parent theme of all sites and make changes in each theme. Is it possible that I can globalize this parent theme such that I do change on one place and it reflects on all 15 sites (Without using Multisite feature). Though I wrote a php script that copies parent theme in all sites but not satisfied since I have to call that script everytime.


title: WordPress not working locally

text: I am attempting to get a local version of a live WP site working. I have pulled down the entire file structure. I have a copy of the DB. After setting up locally, I get a few random issues such as:   1. Permalinks not working properly   2. Javascript error   3. Content generally not loading properly.   4. 500 errors (probably caused by the .HTACCESS)   5. This error caused by a plugin: **Warning: Parameter 1 to ace_where() expected to be a reference** I suspect it has something do with a server setting of which I am unaware. The live server is IIS. I am running OSX with the built-in Apache. I have many other WP installations working fine locally. Any thoughts, comments, or suggestions are appreciated. Here is the .htaccess:               RewriteEngine on     RewriteCond %{HTTP_HOST} ^client.com$     RewriteRule ^(.*)$ "http\:\/\/www\.client\.com\/$1" [R=301,L]     # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /~client/     RewriteCond /home2/client/public_html/wp-content/sitemaps%{REQUEST_URI} -f     RewriteRule \.xml(\.gz)?$ /~client/wp-content/sitemaps%{REQUEST_URI} [L]          RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /~client/index.php [L]     </IfModule>          # END WordPress


title: Why the custom post type links don't work if not login?

text: I have created a custom post type "events" to display event information. All links to the events work well when I am logged in. However, if I am not log in, all the links for events that set in the future are broken - having a page not found message; but these pages will display as soon as I log in. -- all links for events in the past are working well no matter log in or not. Please advice what cause the problem and how to fix it. Thanks I have the following code in the functions.php in my child theme:               function enable_event_posttype() {         register_post_type( 'events',             array(                 'labels' => array(                     'name' => __( 'Events' ),                     'singular_name' => __( 'Event' ),                     'add_new' => __( 'Add New Event' ),                     'add_new_item' => __( 'Add New Event' ),                     'edit_item' => __( 'Edit Event' ),                     'new_item' => __( 'Add New Event' ),                     'view_item' => __( 'View Event' ),                     'search_items' => __( 'Search Event' ),                     'not_found' => __( 'No events found' ),                     'not_found_in_trash' => __( 'No events found in trash' )                 ),                 'public' => true,                 'scheduled' => true,                                  'supports' => array( 'title', 'editor', 'comments'),                 'capability_type' => 'post',                 'rewrite' => array("slug" => "events"), // Permalinks format                 'menu_icon' => get_bloginfo('stylesheet_directory') . '/images/date.png',  // Icon Path                 'menu_position' => '5'             )         );     }          add_action( 'init', 'enable_event_posttype' );


title: Order Custom Post Type Archive by multiple values in functions.php

text: Sorry in advance for my limited PHP skills. I saw this post and the function helped to fix my pagination problem for the archives pages for my custom post type. pagination doesn't show up for custom post type The challenge I have is I need this same type of function to account for ordering the archive in ASC order and by a custom field value which is tied to a DATE value I created. I'm trying to figure out how to write the function by grabbing code from other places and trial and error. I'm hoping someone here can point me in the right direction. Thank you for your thoughts. RESOLVED... SORT OF I added these other $query->set parameters and it seems to work for the archive listing / _CUSTOM ARCHIVE FOR EVENTS_ / function events_pagesize( $query ) { // exit out if it's the admin or it isn't the main query if ( is_admin() || ! $query->is_main_query() ) return; // so its not admin, and its the main query, is it the tr-events post archive? if ( is_post_type_archive( 'tr-events' ) ) { // it is!! Set the posts_per_page to 6 $query->set( 'posts_per_page', 4 ); $query->set( 'order' , 'asc' ); $query->set( 'meta_key', 'wpcf-tr-order- date'); $query->set( 'orderby', 'meta_value'); return; } } add_action( 'pre_get_posts', 'events_pagesize', 1 ); While not ideal, for other page templates, this works for the Custom Post Type Archive page.


title: Autologin only working the second time

text: I want to auto-login visitors to WP through email links. I use a "userid" parameter with their email and a "redirect_to" one to know where to point them. There are some protected areas in the site, just for registered visitors, and they can't see them if they don't log in first (that's the reason of the auto-login). My problem is that the auto-login works fine, but only the second time someone follows the link. Otherwise, they get a message saying that page is protected. Should I try another hook? This is my code:               class zelfunctions     {            public function __construct()       {         add_action( 'init', array(&$this, "autologin"));       }            public function autologin(){        if (!is_user_logged_in()) {              $redirect = isset($_GET['redirect_to']) ? esc_attr($_GET['redirect_to']) : false;          $useremail = isset($_GET['userid']) ? sanitize_user($_GET['userid']) : false;         if ($user = get_user_by( 'email', $userid )) {           wp_set_current_user($user->ID, $user->user_login);           wp_set_auth_cookie($user->ID);           do_action('wp_login', $user->user_login);           if (!$redirect) {           //If there isn't any redirect set, just redirect to the home (already logged in)              $final_url = home_url('/');           } else {              $final_url = home_url('/'). $redirect;           }           wp_redirect($final_url);           exit;           }         }             }     }


title: Set jpeg_quality for certain post-types

text: Without using timthumb, does anyone know of a way to set jpeg_quality for certain post-types or posts?


title: Plugin list-category-posts - How can I use "id" or "name" parameters?

text: In "list-category-post", the shortcode parameter options [catlist **id=1,2,3** ],[catlist **id=-99** ],[catlist **name='TestCategory'** ] don't work correctly. It always shows posts from **All categories**. How do I use "id" or "name" option? All other options are shown correctly. My WordPress version is 3.3.1 and I use twentyten theme. My code is below:               [catlist id=-1,-2,-3 thumbnail=yes thumbnail_size=thumbnail orderby=date order=DESC numberposts=10 date=yes author=yes excerpt=yes excludeposts=999,1000,1001 content=no catlink=yes comments=yes morelink="Read more" categorypage=yes post_type=post]


title: Issue when showing metabox value on post type permalink?

text: I want to show the custom post type value on permalinks like yourdomain/metabox_value/post_title. By the below code I achieve the goal but after appling this code only this post type permalinks is working but other pages and post permalinks are not working. Please, let me know the solution. What is the error on my code? Here listing is post type name and city is metabox               add_action('init', 'tdd_add_rewrite_rules');     add_filter('post_type_link', 'tdd_permalinks', 10, 3);     function tdd_add_rewrite_rules()     {         global $wp_rewrite;         $wp_rewrite->add_rewrite_tag('%listing%', '([^/]+)', 'listing=');         $wp_rewrite->add_rewrite_tag('%VARIABLE1%', '([^/]+)', 'VARIABLE1=');          $wp_rewrite->add_permastruct('listing', '/%VARIABLE1%/%listing%', false);      }     function tdd_permalinks($permalink, $post, $leavename)     {             global $post;         $no_data = 'no-data';         $post_id = $post->ID;         if($post->post_type != 'listing' || empty($permalink) || in_array($post->post_status, array('draft', 'pending', 'auto-draft')))             return $permalink;         $var1 = get_post_meta($post_id, 'city', true);              $var1 = sanitize_title($var1);          if(!$var1)         $var1 = $no_data;            $permalink = str_replace('%VARIABLE1%', $var1, $permalink);            return $permalink;     }


title: Using ajax on categories and wordpress loops

text: I want my index.php to be a simple page with a horizontal list of category names on the top. But instead of having the page reload with the list of posts in that loop each time a category is clicked on, I want the set of posts from each category to display instantaneously after every click on a different category. Is this possible in Wordpress?


title: Wordpress Author Posts Review After Every Change In The Same Worpress Post

text: guys pardon my english, I am new to wordpress & I have been trying to set up a wordpress website for product reviews where new users will submit their reviews for the product/products. New user who registers on the website will have the role of a 'Author'.   1. User 'XYZ' registers on the website.   2. 'XYZ' wants to add a review of the product.   3. 'XYZ' submits the review.   4. Admin user 'ABC' gets notified via email that the new post has been pending for the review.   5. 'ABC' approves & publishes the review/post on website. **Now the problem is that** XYZ user can again make changes in the same post and can publish them without the approval admin user a.k.a ABC ,because the post have been already approved. This can cause problems. **What I want to do is** Every time 'XYZ' user make changes in the post which is already approved, the post should be approved by the admin a.k.a 'ABC' user again.


title: Toggle nested comments

text: I am trying to find a solution to toggle (hide/show) threaded comments. I need to see only comments 1,2,3 etc... and hide 1.1,1.2,1.3 etc... Clicking "show comments" will toggle and display the thread of comments. example: 1 --- -----clicking "show more comments" shows ----- 1.1 ----- 1.2 ----- 1.3 ----- ... 2 --- -----clicking "show more comments" shows ----- 2.1 ----- 2.2 ----- 2.3 ----- ...


title: Wordpress Post # of # filtered by category slug

text: I want to show post #4/100 at the top for each post for which I'm using following code               function updateNumbers() {     /* numbering the published posts: preparation: create an array with the ID in sequence of publication date, /     / save the number in custom field 'incr_number' of post with ID  /     / to show in post (within the loop) use <?php echo get_post_meta($post->ID,'incr_number',true); ?>     / alchymyth 2010 */     global $wpdb;     $querystr = "SELECT $wpdb->posts.* FROM $wpdb->posts WHERE $wpdb->posts.post_status = 'publish' AND $wpdb->posts.post_type = 'post' ";     $pageposts = $wpdb->get_results($querystr, OBJECT);     $counts = 0 ;     if ($pageposts):     foreach ($pageposts as $post):     setup_postdata($post);     $counts++;     add_post_meta($post->ID, 'incr_number', $counts, true);     update_post_meta($post->ID, 'incr_number', $counts);     endforeach;     endif;     }            add_action ( 'publish_post', 'updateNumbers' );     add_action ( 'deleted_post', 'updateNumbers' );     add_action ( 'edit_post', 'updateNumbers' );          <?php echo get_post_meta($post->ID,'incr_number',true); ?>      This code seems to work fine for me but I just want to filter posts by category slug & only count posts for that particular category Thanks


title: Delete some text and change html tag with Jquery

text:
Im looking a way to change the following HTML:
Rating: +5 (from 5 votes)
      and produce:

+5

      Thanks in advance.


title: WP_Query meta compare must include ALL array values

text: I am allowing users to query posts using a form with checkboxes. I want the posts to be filtered by the checkboxes but instead of showing all posts that include the ANY of the meta values selected I want to show posts that contain all of the selected values. Is this possible? Here is what I currently have using the "IN" operator which just checks if the post contains any single value in the array.               $the_query = new WP_Query(array(                 'post_type' => 'listing',                 'posts_per_page' => -1,                 'post_status' => 'publish',                  'category_name' => 'private_rental',                 'orderby' => 'rand',                 'meta_query' => array(                         'key' => 'row_amenities',                         'value' => $amenities,                         'compare' => 'IN'                         )             ));


title: Add a button or image button that calls wp functions in the wp-admin

text:
I have a custom post type of products that I've setup to upload PDF's using metaboxes. When I generate the metaboxes on the wp-admin, I look to see if the metabox already has a pdf uploaded to it or not. If it DOES I generate a link to the pdf. If it doesn't I generate a file upload control where they can pick a file to upload if they want. Here's what my function looks like that generates this metadata.               function products_pdf_uploads_show_meta() {         global $meta_box_pdf_uploads, $post, $prefix;              echo '
';         echo '
Upload your PDFs here
';         foreach ($meta_box_pdf_uploads['fields'] as $field) {                         //Get current PDF meta             $pdf_array = get_post_meta($post->ID, $field['id'], true);             //Grab the filename from the end of the path             $pdf_filename = substr(strrchr($pdf_array['url'], "/"), 1);                  echo '
',                     '';                                              //If Empty, show file upload dialog                         if(empty($pdf_array)) {                              echo '<input type="file" style="width: 700px;" name="', $field['id'], '" id="', $field['id'], '" />';                              } else {  //Else if pdf exists, show link to pdf and add DELETE button                             echo '
'. $pdf_filename . '
';                         }                  echo    '	',                  '
';         }         echo '
';      What I'd like to do is if there is a PDF metadata (meaning there's a pdf already uploaded), I'd like to put a DELETE button next to the PDF Link.                } else {  //Else if pdf exists, show link to pdf and add DELETE button           echo '
'. $pdf_filename . '
' ;           //I Want to add a delete button after the above echo          }      The delete button will remove all metadata from the PRODUCT post type, and delete the file off the server. SO I guess my question is how can I make a button that hooks into wordpress functions such as `delete_post_meta` ? I'm using `wp_upload_bits()` to upload the pdf's mostly because I don't want the PDF's added to the media library, just want to upload them to the server and get a path. Thanks!


title: How to use post_id with a Class?

text: I made a plugin for some calculation.               Class Math {     var $id; // I want to map this id to post_id     var $a;     var $b;     var $c;          function calculate{      $this->a = $value_from_post_meta_input_box;      $this->b = $data_generated_in_calculating_process;      $this->c = $result_of_some_function;     }     }      After activating the plugin, and setting up the post meta input box for $a, I am able to get $a saved in post meta. Now, how can I save $b and $c to post meta? How to say the current calculation is an instance of Math with current post_ID ?


title: Theme Stylesheet Loads Into Dashboard

text: I am hoping that I am authorized to post this. I saw another thread but I don't seem to be authorized to comment or answer or otherwise ask any questions about it. The site in question has been up and running for over a year, and only in the last few days did I notice this issue when I went to add a category. When I load my dashboard, it comes up normally, then it loads the dashboard with the theme's css, and loads the site under Wordpress news - it looks to be doing that at the same time Wordpress News is loaded. Then it refreshes again, and goes to a blank screen. I have tested this by turning off all of my plugins, changing to theme twenty-fourteen, deleting wp-admin/wp-includes and all other standard wp files and re ftp-ing them. I've ensured I have nothing extra in my .htaccess file, or in my wp-config.php file. I've removed wp-super-cache and all related files, removed ithemes security and all related files and database entries. The site looks fine, but I can not manage the site from the dashboard,and I'm not able to add categories to my posts. I'm at a loss, and apparently not very many people have run into this problem, so I'm having a problem diagnozing it.


title: Count images in post then add class if just one

text: I'm trying to add a function to my site that will count the number of images attached to a post, and if only one, to add a class to either that `<img>` or to the containing `<a>`. I think I'm fairly close, but don't have the PHP syntax skills to finish it up. The code I've hacked together, sourced from various threads on the topic, is:               /**      *      * Single-image posts will receive a separate class name      *      */          add_filter( 'the_content', 'single_image_content_filter', 20 );          // Count images in post     function single_image_content_filter( $content ) {          $attachments = get_children(array('post_parent'=>$post->ID));     $imgcount = count($attachments);              // If only one attachment, add a new CSS class         if ( $imgcount === 1 ) {                  global $post;             $classes = 'single-img'; // separated by spaces, e.g. 'img image-link'                  // check if there are already classes assigned to the anchor, and/or add one via $classes             if ( preg_match('/<a.*? class=".*?">/', $content) ) {             $content = preg_replace('/(<a.*? class=".*?)(".*?>)/', '$1 ' . $classes . '$2', $content);           } else {             $content = preg_replace('/(<a.*?)>/', '$1 class="' . $classes . '" >', $content);           }          return $content;              }     }


title: WPML: getting page title in different language

text: i'm running my web in english and german using the WPML plugin. my question: when in english mode - is it possible getting the page_title() but in german? thanks


title: H1 tags for header image?

text:
In `heading.php` of the Leaf Theme there is the following code: * * *                   <?php $header_image = get_header_image();         if ( ! empty( $header_image ) ) { ?>             <a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home">                 <img src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" />                     <?php } else { ?>              <hgroup>
<a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?>

<?php bloginfo( 'description' ); ?>
              </hgroup>             <?php } ?>      I want to add a text to the header image and wrap that text into H1 tags for the homepage and h6 for all other pages. _The Else part doesn't have too much importance as I will only be using a image. I included it because it´s part of the code._ I have tried for a while now but I simply don´t know enough of PHP to pull it off.


title: Search options/filters

text:
I'm trying to add some checkbox options to a sidebar search box, similar to this, where the user has the option to choose whether to search `All Words`, `Some Word`, or the `Entire phrase`. I did find this after some searching - Wordpress Search Phrases. The 'sentence' option seems to work well, but the others not so good. The code below is what I'm working on at the moment, but would really appreciate some help to get this working properly. Many thanks in advance, S. (I do not wish to use plugins for this).               <form action="<?php bloginfo('home'); ?>/" method="post">
                 Search the site                            <input type="text" name="s" id="search" value="Enter search term" onblur="this.value = this.value || this.defaultValue;" onfocus="this.value = '';" />                       <input type="submit" name="submit" value="GO" class="s-btn" />
Search Options

          <input type="radio" name="sentence" value="" checked="checked" />All Words
          <input type="radio" name="sentence" value="or" />Some Word
          <input type="radio" name="sentence" value="and" />Entire phrase

</form>          **EDIT: The answer below doesn't actually work after all : ( Anybody else have any ideas please?**


title: How to have H1 for site title only on Homepage?

text:
I´m using the Leaf Theme and in the header the following code can be found:               <?php $header_image = get_header_image();                             if ( ! empty( $header_image ) ) { ?>                                 <a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home">                                     <img src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" />                                                              <?php } else { ?>                                  <hgroup>
<a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?>

<?php bloginfo( 'description' ); ?>
                             </hgroup>                                  <?php } ?>      Right now the on all pages the site-title has the H1 tag and the site- description the H2 tag. I want this only on the homepage. On all other pages the title should have H6 and the description H7. How can I do this? _The first part of the code is for when you use an image instead of title/description. I included it because it is included in the php if_


title: User capability of create page/new page

text: I am working with the Role and Capabilities API for the first time today and making use of the the excellent Members plugin. Having tinkered around for some time I notice that the "edit pages" capability does two things:   1. Allow the user to create a new page   2. Allow the user to edit existing pages I am trying to split this capability into two. I want my user to:   1. Not be able to create any new pages   2. Allow the user to edit existing pages I am looking to write some code for my theme that allows this to happen. I can create a new capability very easily. The challenge is then getting WordPress to respond accordingly to it. Any thoughts would be appreciated.


title: Multiple developers / editors working on a site in progress

text: **Background** I'm nearing the final stages of constructing my first fairly large WordPress site, and I'm now encountering some friction. For the most part, the site was developed on my local machine and I would push changes up to a staging server for review (see this question for more background). The solution I ended up with worked quite well when it was just me editing content, but now some other people are editing the content while I still have features to add. The idea was: we could get things done more quickly if the features and the content came together in concert... but now I'm not so sure. Currently there is different content in the database on the staging server than on my local machine. That's fine by itself, as I don't need the final body copy on my local machine, but I need to do more development which will affect the database (install/write a couple more plugins which need their own tables). **My question is:** Is there an easy way to automate the merging of databases so that multiple people can work on a WordPress install? I could, of course, just export the tables which I _know_ have changed on my local machine and push them to the staging server, but it's possible that there are also things on the staging server I would like to bring down. I could grab the SQL output of both DBs and diff them... but that seems tedious and hackish. I'm wondering if this is a problem others have solved; if there's a community-accepted way to handle this sort of thing. Thanks!


title: Visiting posts results in 404 errors after host migration

text: I have migrated my WordPress blog from one host to another by way of transferring the files and exporting/importing my database, updating URL references where needed. On my new host, I can successfully view the front-page of my blog however visiting posts results in "404 - Page not found" errors, seemingly regardless of my permalink settings. My blog as it resides on the new host can be found at www.erogol.com Any one know the reason?


title: Way to check if we are in Theme Customizer mode?

text: > **Possible Duplicate:**   >  How to execute conditional script when on new customize.php (Theme > Customize) screen Is there a Conditional Tag, or any other method, that we can use to check if we are customizing the theme? I want to include some extra stylesheet while customizing the theme. so I'd like to have sth like:               if ( theme-customizer-is-active ) {         // load some extra styles     }


title: How to hide some options from a select with functions.php

text: In page and post editor page Wordpress i've a box provided where i can choose from a select, for example: Select sidebar to associate with this page:               <select id="#idselect">     <option value="s1">Sidebar 1</option>     <option value="s2">Sidebar 2</option>     <option value="s3">Sidebar 3</option>     <option value="s4">Sidebar 4</option>     <select>      I want to hide options depending on user role. If i'm ADMIN-1 i want to disable selection and set only "s1" in the select. If i'm ADMIN-2 o want only "s2", etc.... How can i hide options i don't want when i enter in backend editor for pages and posts with functions.php? Is it possible? Thanks a lot


title: Heartbeat API: How to access data already enqueued?

text: I'm having problems when trying to access data that I've queued using the Heartbeat API. I'm queuing data using `wp.heartbeat.enqueue()`. For example:               var data = {          my_key: 'value'     };     wp.heartbeat.enqueue( 'my_handle', data, false );      Then later on in my script, I'd like to access the data I've queued. For example:               $( document ).on( 'click', '#button', function() {         // Here, I want to access the data I've enqueued.     });      I've tried doing the following but that doesn't work:               $( document ).on( 'click', '#button', function() {         var my_data = wp.heartbeat.getQueuedItem( 'my_handle' );         alert( my_data.data.my_key );     });      Hoping someone can suggest where I'm going wrong?


title: Plugin error on activation - breaks page encoding and prints the code of plugin php files

text: I have WordPress multisite install, everything was working properly. Developed a custom pugin on my local server (same configuration of Nginx, PHP, MySQL, Memcached, the only difference is OS - Windows 7 locally vs Ubuntu 14.04 LTS on server) and it works just fine. Plugin handles custom front-end reistration, login, password reset and user activation, custom profile page and profile editing (profiles are custom post type with some custom taxonomies). All forms are submitted via ajax. Everything works locally. When I try to activate the plugin on a server it kind of activates but completely messes up cyrillic encoding and prints some code from my plugin files on top of the pages (frontend and backend). Tried to disable all plugins and themes, revert to default. I even switched to new empty database, installed network again and activated on a fresh install. Same error. I also have this function in one of my files:               add_action( 'init', 'feup_output_buffer' );     function feup_output_buffer() {              ob_start();          }      So it can't be 'header already sent' issue (and if yes - it would throw a php warning). Debug is on, no php errors, warning or notices. Any ideas? Here's the screenshot ![enter image description here](http://i.stack.imgur.com/LlIra.jpg)


title: register child class in another plugin

text: I think this should be relatively easy, but somehow I cannot figure out how to do this. essentially there's a preexisting plugin that does this:               add_action('widgets_init', create_function('', 'register_widget("Foo");'));     if ( ! class_exists( 'Foo' ) ) {     class Foo extends WP_Widget {             /*constructs etc*/     }}      now i would like to write another plugin (extension essentially), that extends the above. I tried to do something like the following (and also tried - in vain - to find some examples/documentation )               add_action('widgets_init', create_function('', 'register_widget("Bar");'));     class Bar extends Foo {              function __construct() {             /*do stuff*/         }     }      but all i ever get is               <b>Fatal error</b>:  Class 'Foo' not found in ...      so I suppose it's a question of making 'Bar' execute AFTER Foo, but I dunno how. any hints/ideas/snippets or even just links to docs etc would be much appreciated as I am failing at the first hurdle here..:(


title: User's total comment count excluding comments on their own posts

text: I'm currently working on a plugin that I hinted at here and so far I have managed to code everything, only missing one piece of the puzzle. This is how I get the total comment count for the `current_user`:               global $wpdb, $current_user;     get_currentuserinfo();     $userID = $current_user->ID;          $where = 'WHERE comment_approved = 1 AND user_id = ' . $userID ;     $comment_count = $wpdb->get_var("SELECT COUNT( * ) AS total           FROM {$wpdb->comments}          {$where}");          echo 'Total Comments: ' . $comment_count;      I want to `echo` the `current_user`'s total comment count on **other users posts** , so I don't want to count the comments on the author's own posts. Is such thing possible? And if so, how?


title: Add a Custom Field in Comment Box AFTER text area BUT BEFORE Send button

text: I was inspired by this Q&A: Add a Custom Field in Comment Box next to the Text area but I have to insert the custom field after the textarea but before the Send button. I did not found the proper action to customize and I guess it not exists at all. comment_form_after_fields puts my output before textarea   comment_form_after puts my output after Send button Am I wrong?                   add_action( 'comment_form_after', 'test');          function test(){         echo "TEST";     }         add_action( 'comment_form_after_fields', 'test');          function test(){         echo "TEST";     }


title: Remove Woocomerce shop page

text: I know this question is about Woocomerce but I want to give it a try. Is there a way to remove the shop page? I use them as parts of a custom post type, and I don't need that page, but it exists. What is the best way to remove or hide this page from users?


title: How to map secure.domain.com to www.domain.com or domain.com with "WordPress MU Domain Mapping" on the primary multisite domain?

text: We have a multisite setup, the primary site needs to have `example.com`, `www.example.com` and `secure.example.com` mapped in wordpress so the primary site's content loads on them. `secure.example.com` will be over HTTPS. The problem we are facing is everything except `secure.example.com` works. When attempting to access `https://secure.example.com` there is a `302` redirect to: `http://www.example.com/wp-signup.php?new=secure.example.com` `secure.domain.com` has a SSL Certificate to server secure content. Obviously it can't just redirect otherwise it wouldn't be secure any longer. WordPress MU Domain Mapping is installed but doesn't appear under the primary site's menus. When trying to access the plugin directly via `~/wp- admin/tools.php?page=domainmapping` we recieve the message > "You do not have sufficient permissions to access this page." Note: We are logged in as Super Admin. Any suggestions regarding to this would be highly appreciated.


title: Custom wp_trim_words() function not trimming right

text: I have this custom `wp_trim_words()` function set to give me excerpts of only 20 words, and for the most part, it works fine. Except for some reason, on posts that contain lists, it outputs way more than 20 words. (See the posts at the bottom of this page.) How can I fix this? I tried removing `<ul>,<ol>,<li>,` from the `function insight_allowedtags()` but that did nothing. Ideally, I'd like to make the custom excerpt output at least 20 words and end at the end of a sentence regardless of whether or not the post contains a list. This is the custom function I am using (as suggested in this post):               // Custom Excerpt for Insights Posts on Insights Page & Category Pages     function insight_allowedtags() {         // Add custom tags to this string             return '


title: Why won't my site automatically apply updates after upgrade to 3.7?

text: I've just upgraded to 3.7 and one of the features in this release is the automatic application of security releases. However once I upgraded it said > "This site is not able to apply these updates automatically. But we’ll email > (my email address) when there is a new security release." What is it about my site that stops these updates being applied automatically?


title: Localise settings section headline

text: Assuming i've got a bunch of setting sections. I add these sections to my plugin page in the following way.               $sections = array('notifcations', 'updates');          foreach ($sections as $section)     {         add_settings_section(             $section .'_section',             $section,             array( $this, 'disable_callback_warnings' ),             'sgnc'         );     }      Everything works as expected but i wonder how to localise the section headline? As far as i know i can't pass any variables to the locale functions `_e()` and `__()`. So this won't work:               $sections = array('notifcations', 'updates');          foreach ($sections as $section)     {         add_settings_section(             $section .'_section',             __($section),             array( $this, 'disable_callback_warnings' ),             'sgnc'         );     }      http://codex.wordpress.org/Function_Reference/add_settings_section


title: Match two taxonomies to display a specific content

text: I have a page divided in two bars.   * The left bar is a side menu, which shows contents for a specific country (ie: if I am in the Mexico page, there are options listing Cancun, Acapulco, Mexico City... if I am in Italy page, there are options listing Rome, Milan, Florence and so on);   * The right bar is the full content, that display the pack information of the destination, so if I am in the Italy page and click on Rome, the user will see in this right bar all the information regarding prices, flights, sightseeing and so on; I have to match these two bars each other. When I am checking the content of the destination in the right bar, the left bar should match the correct menu country. The way I analyzed it was applying taxonomies for the menu and for the pack information. So, when I am making a page for Rome, I apply the "Italy" taxonomy, or if I am making a page for Cancun, I apply the "Mexico" taxonomy and so on for many other destinations I have. That is the way I am querying the left bar/side menu (content-sidemenu.php)               <?php       $args = array(           'post_type'     => 'side_menu',           'posts_per_page'=> 1,           'tax_query'     => array(             'relation'    => 'AND',             array(               'taxonomy' => 'countries',               'field'    => 'slug',               'terms'    => array( **??????** )               )             )       );       $the_menu = new WP_Query( $args );       if ( have_posts() ) : while ( $the_menu->have_posts() ) : $the_menu->the_post(); ?>     ?>      The right bar is slightly similar (just the `post_type` has different values depending on the page), but the `tax_query` is the same. So, how could I make them match?? Thank you!


title: The concept of non-blog content

text: I'm fairly new to this wordpress stuff and wrapped my head around the blogging part. Now it comes to the non-blog part of a webpage. I understood the principle of creating static pages and displaying them using various templates, but there is one major problem that i do not understand: If i'm correct, i can have just one main-block of content for a page. For example, i could have an about section on my front-page and write it's content with the WP editor. But what if i need two or more sections? Should i create a (child)-page for every content-block and load it in the front-page's template file? This would be unnecessary bloating, wouldn't it?


title: Is there a way to create invisible pages?

text: I'd like to add a page that does not appear anywhere on the site (especially not in the header or wherever your pages are listed) unless the URL is typed in directly. Additionally, the page/post should be password-protected. I know how to add a password, but I found no way to remove the page from being listed.


title: Add dashboard widget to page created with add_menu_page()?

text: I've created a standard page with a top level menu using add_menu_page() and I want to turn that page into a bespoke dashboard, ie to have a number of boxes like the dashboard widgets using something like wp_add_dashboard_widget(). I cannot find any documentation that even suggests this is possible and I've looked into creating dashboards widgets and then doing something like               global $wp_meta_boxes;     $my_widget = $wp_meta_boxes['dashboard']['normal']['core']['example_dashboard_widget'];     unset($wp_meta_boxes['dashboard']['normal']['core']['example_dashboard_widget']);     $wp_meta_boxes[$my_dashboard]['normal']['core']['example_dashboard_widget'] = $my_widget;      where $my_dashboard has variously been a $hook from $hook=add_menu_page() and the page slug etc, but it hasn't worked. As you can tell, I'm shooting in the dark here but this functionality would be _very_ useful to me. Does anyone know how this can be done? Edit: I've found the answer to my own question here http://www.code-styling.de/english/how-to-use-wordpress-metaboxes-at-own- plugins


title: need advice on how to do a lists using custom post types - taxonomy vs postmeta

text: i am building a lists plugin .... i want to have a custom post type "lists" and then obviously also there would be a number of list items for each list .... i have read a fair bit of stuff about taxonomies vs postmeta but i'm still unsure as to which i should use or maybe something else ... it seems taxonomies are really more for categorising things ( like taxonomy colour, group etc ) and postmeta is more for attributes associated with a post eg ( url, phone number, price etc ) .... so it would seem that list items should be postmeta data, but my problem is that i want to have unlimited list items in the same way you could have unlimited taxonomy terms however is postmeta suitable for this .... it doestn look to me like something you'd create a new one of on the fly.... any comments ..... or maybe i should be doing it a different way altogether also i will need to be able to somehow group list items also and do a couple of other things with them eg sorting them via ajax (drag and drop)


title: I can't format text in th edit page (or posts) whats wrong..?

text: Well like it says - I edit a Page, I want to use bold or italics, or colours. Or I want to add a break so that text appears on different lines, but whatever I do - when I save the page and view it Alla the formatting is gone and the text all appears on the same line. If I click the 'visual' tab it looks just as I'd like it, but not when I view the web site. Would a style sheet override my formatting..? Any help would be greatly appreciated! Tony.


title: Allow authors to create article image

text: I want to allow contributors to upload images while creating posts. But the catch is, I am building the post display pages out of my own custom PHP. Every article written will follow the same template:               ImageOfArticle     UserAvitar     Name     Content     Footer      Is there a way to allow them to upload an image in the default post editor, and to be able to access that somewhere with PHP, and display that in the 'ImageOfArticle'?


title: Getting redirect to happen before header output

text: Anyone know of a way to trick WordPress into doing a header location redirect. I have to check whether users are logged in or not, and if not redirect them to our organizations authorization system which is an external site. I am getting output before my header() call, from WordPress outputting the queued scripts.               Warning: Cannot modify header information - headers already sent by (output started at /.../wp-includes/class.wp-scripts.php:128) in ...      I have a plugin, that had a class handler, that handles this with this method:               ...     public function populateInfo($form) {         $email = $this->hasEmail($form);         /*$name = $this->hasName($form);         $address = $this->hasAddress($form);         $phone = $this->hasPhone($form);*/              // let's get some auth info         if($email !== false || $name !== false || $address !== false || $phone !== false) {             $ldap = new LDAP();             $webAuth = new Auth();             $curPage = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];             $webAuth->url = $curPage;             if($webAuth->isLoggedIn()) {                 $ldap->search($webAuth->getID());                      // set up form variables                 $form['fields'][$email['key']]['defaultValue'] = $ldap->getEmail();             } else {                 // this is where redirect fails                 wp_redirect($webAuth->login_url);                 return;             }         }              return $form;     }     ...      ## Update: This method is called via a GravityForms filter:               add_filter('gform_pre_render', array($this, 'populateInfo'));      Which basically loads up info into a page form. The user must be logged in, in order for this form to populate (thus the `$webAuth->isLoggedIn()` check). Obviously I am aware that the headers are being output beforehand, my question is, how to properly workaround this in WordPress, so that I can redirect unauthorized users to the log in, without being brick-walled by preceding headers?


title: Recover WordPress blog from an inactive domain name

text: I have a WordPress blog for which the domain name has expired. I can still nearly access the blog via a new domain name at the same host, but it seems like the original domain name is quite solidly baked into WordPress. Every time I get WordPress to serve just one page, when I all links on that page still point to the old domain name. What is wrong with relative URL's is another question for the WordPress team, but my real question here is how can I recover my blog and reopen it under a new domain name?


title: Passing a hardcoded page/post ID into `get_post`

text: I see people using this to pull in page content on their home pages, remove specific categories from archives etc.. e.g.               $post = get_post( 5 );      Someone suggested this was bad practice. Why is it bad and what should users do instead?


title: Custom Post Type Author Array Problem

text:
I am trying to create an author.php page that calls custom post types by the author appearing on that page. My problem is that when using the code below -- which filters for the post type 'video' -- the code outputs all custom post types, not just 'video'. The caveat is when I remove the array's author key and variable `'author' => $author` which then has the effect of allowing the code to output the desired custom post type 'video' but from every author. Any ideas of how to fix this? **Code used:**               <?php         $args = array(             'post_type'      => array( 'audio' ),             'posts_per_page' => 10,             'author'         => $author         );                   $author_videos = new WP_Query( $args );              if ( $author_videos->have_posts() ) : while ( $author_videos->have_posts() ) : $author_videos->the_post(); ?>
<a href="<?php echo get_permalink(); ?>"><?php the_title(); ?>
                    <?php endwhile;                 wp_reset_postdata();     endif; ?>


title: Insert custom post type with taxonomies

text: I am tryig to insert my custum post type with a specific taxonomies , but it doesn't work Here my Custum post type               add_action( 'init', 'create_annonce' );     function create_annonce()     {     register_post_type( 'wp_annonce',             array(                 'labels' => array(                     'name' => __( 'Annonces' ),                     'singular_name' => __( 'Annonce' ),                     'add_new' => __( 'Ajouter une annonce' ),                     'all_items' => __( 'Tous les annonces' ),                     'add_new_item' => __( 'Ajouter une annonce' ),                     'edit_item' => __( 'Modifier annonce' ),                     'new_item' => __( 'Nouvelle annonce' ),                     'view_item' => __( 'Voir annonce' ),                     'search_items' => __( 'Recherche annonces' ),                     'not_found' => __( 'makayench :D' ),                     'not_found_in_trash' => __( 'No announce found in trash' )                     //'menu_name' => default to 'name'                 ));     // my taxonomy          register_taxonomy( 'annonce_category', 'wp_annonce',                 array( 'hierarchical' => true,                     'label' => __( 'Categories des annonces' )                 )             );         }      I created all categories i need ('a','b','c') and I gave the user a list of checkbox to check a category               if (isset($_POST['category']) && is_array($_POST['category'])) {         foreach($_POST['category'] as $category)              {echo $category;         $tableau=array($_POST['category']);}     }      The array is nt empty , now I try to insert the post with my categories               // $post is declared in my code      $the_post_id=wp_insert_post($post);     wp_set_post_terms($the_post_id,$tableau,'annonce_category',true);      Now , the Costum post type is created but without a categories , Any help


title: query to use to link to taxonomy single page

text: Hi & thanks in advance to those who could help me sot out he below:   * I have customized my home page, using tpl-home.php to show the authors (eg users...) of the most recent posts - nothing specific yet...-.    * I have customs fields (using ACF) and customs taxonomies, among which the 'member' taxonomy. Some members can be post authors (eg. defined users...) , and I want to create a link from the post author to the corresponding member page (eg. sing-member.php) page. Of course , I defined a custom field within ACF with the post_author ID value, which takes the author/ user_id. In short: I have a custom field 'member_author' with the user_id, pull the post_author value from the list of most recent posts and want to link that to the single-member.php to show the details for the said author if & when he also is amember here are link to my modified home page and to the single-member.php page for the related $post->author / member_author ID Many thanks again for those patient enough to put me on the right track! Regards, JMB


title: How to achieve post_status__not_in

text: How to fetch all posts with any status except trash and draft               function pre_filter( $query ){               if ( isset( $_GET['post_type'] ) && $_GET['post_type'] == $this->post_type ) {                 if ( !isset( $_GET['post_status'] )  ) {                    $query->set('post_status__not_in', array( 'trash', 'draft' ) );            }               }          }


title: How do I display the popular post and again display another set of popular post after sometime including the 1st sets of popular post?

text:
What I want to do is I want to display the popular post as a page. I have created a template page to display the popular post. But it is not working as I want it to. The thing that I want it to do 1. Display the 1st set of popular post, may be one set contain 10 post. 2. After sometime another set of popular post is displayed but the 1st set of popular post must be down at the button of the 2nd set of popular post. 3. The posts of 1st sets of popular post should not be displayed in 2nd set of popular post. Till now i have written the following code.               <?php     /*     Template Name: Hotpage     */     ?>          <?php get_header(); ?>

                              <?php if ( is_day() ) : /* if the daily archive is loaded */ ?>                 <?php printf( __( 'Daily Archives: %s' ), get_the_date() ); ?>             <?php elseif ( is_month() ) : /* if the montly archive is loaded */ ?>                 <?php printf( __( 'Monthly Archives: %s' ), get_the_date('F Y') ); ?>             <?php elseif ( is_year() ) : /* if the yearly archive is loaded */ ?>                 <?php printf( __( 'Yearly Archives: %s' ), get_the_date('Y') ); ?>             <?php else : /* if anything else is loaded, ex. if the tags or categories template is missing this page will load */ ?>                 NGAG is your best source of fun.             <?php endif; ?>

           <?php query_posts('orderby=comment_count&order=DESC&paged=' . get_query_var('paged'));?>                     <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

                                 <?php if(has_post_thumbnail()) :?>
                                         <?php the_post_thumbnail(); ?>
                                 <?php endif; ?>
                                  <?php the_excerpt(); ?>

                                    <a href="<?php the_permalink(); ?>"><?php the_title(); ?>

                                     <?php the_category(', ') ?>

                                    <?php echo get_the_date(); ?>at<?php echo get_the_time(); ?>

<?php comments_number( 'No comments', 'One comment', '% comments' ); ?>

                                                 <a href="https://twitter.com/share" class="twitter-share-button" data-url="<?php the_permalink() ?>" data-text="<?php the_title(); ?>" data-count="horizontal">

                                                 <iframe src="//www.facebook.com/plugins/like.php?href=<?php the_permalink() ?>&send=false&layout=button_count&width=85&show_faces=false&action=like&colorscheme=light&font=arial&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:85px; height:21px;" allowTransparency="true">

              <?php endwhile; else: ?>

<?php _e('There has been an error.'); ?>

<?php _e('We apologize for any inconvenience, please hit back on your browser or use the search form below.'); ?>
                 <?php get_search_form(); /* outputs the default Wordpress search form */ ?>
         <?php endif; ?>

<?php next_posts_link('« Older Entries') ?>

<?php previous_posts_link('Newer Entries »') ?>

     <?php get_sidebar(); ?>     <?php get_footer(); ?>      I am not able to do any of the thing I want to do. Any help is really appreciated. look here               <?php query_posts('orderby=comment_count&order=DESC&paged=' . get_query_var('paged'));?>                     <?php if (have_posts()) : while (have_posts()) : the_post(); ?>      Right Now It just displays the top popular post. I want to change this in a way so that I can show the popular post as I want in above points.


title: Is it possible to list non-empty connection_type(s) of a object?

text: I checked the documentation and did some research, of course, but I did not find what I'm looking for. I'm testing Posts2Posts plugin in a project. As I need a lot a interconnections between pages and post types, so I end up associating all CPT with any page. This is how I did it on a plugin file :               function launch_connections() {          $post_types_list = get_post_types( array( 'public' => true, '_builtin' => false ), 'names', 'and' );          foreach ( $post_types_list as $post_types_item ) {              p2p_register_connection_type( array(             'name' => 'p2p_' . $post_types_item,             'from' => 'page',             'to' => $post_types_item,             'sortable' => 'from',             'admin_box' => array ( 'show' => 'from', 'context' => 'advanced' )         ) );              }     }          include_once( ABSPATH . 'wp-admin/includes/plugin.php' );     if ( is_plugin_active( 'posts-to-posts/posts-to-posts.php' ) ) {     add_action( 'p2p_init', 'launch_connections' );     }      So what I need now is to check, on any page, if there is any non-empty connection. But, as I understand the documentation, there is no function to do that. Each time we need to retrieve the connected posts, we need to run a full query with `WP_Query()` or `get_posts()` with the name of the `connection_type`. Do I really ned to run as many queries as there is of `connection_types` to get this information ? Thanks. OR is there any way to do something like :               $connections = get_connected_types( $post->ID ); // Return all non-empty connections for this object ID     foreach ( $connections as $connection ) {         // run the query, retrieve posts     }


title: Plugin Using get_the_content Causing Issues With <!--more--> Tag

text: I'm testing out the Woothemes "Our Team" plugin to see how it works for future project purposes. The plugin uses at CPT for Team Members as well as a shortcode to allow users to display members on a page. The issue that I'm bumping into is that the content that is output by the shortcode is not honoring the `<!--more-->` tag. I'm assuming it's because in the woothemes-our-team-template.php file on line 196 it's using `get_the_content` as shown below: `$content = apply_filters( 'woothemes_our_team_content', wpautop( get_the_content() ), $post );` It appears that there is also a filter that should be able to be hooked into called "woothemes_our_team_content" but no matter what I try to add into my functions.php I can't get it to recognize that there is a `<!--more-->` tag. All my efforts have only managed to remove all the content. Essentially I'd like to hook into the filter, have it recognize the `<!-- more-->` tag, and then change "Read More" to say "Read Full Bio...". Doe anyone have any suggestions on the best way to achieve this? Thanks in advance!


title: Allow shortcode for custom widget

text: The following code allows shortcode parsing for 'text' widget:               add_filter('widget_text', 'do_shortcode');      How to make a similar one for a custom widget? I tried the following one but it didn't work:               add_filter('widget_CUSTOM_WIDGET_NAME', 'do_shortcode');


title: persist a variable set in header.php all the way down to footer.php

text: I look up a custom post field value in header.php, and store it in a global variable. In most of my template files, the includes go like this:               include header          ...do a bunch of stuff          include sidebar     include footer      I can not persist the variable into the footer.php file... is there any way to do this so that I can avoid having to call back to the database again to look up the custom field value again?


title: Modify front-end delete button to publish pending posts

text: I've found this helpful snippet to make a delete post link on the front-end:               <?php if (current_user_can('edit_post', $post->ID))          echo "ID) . "'>Delete" ?>      What I am wondering if there is a way to modify this code and create a complementary Publish link, which would publish a pending post, from the front end. I've tried the following with no luck...               <?php if (current_user_can('edit_post', $post->ID))          echo "ID) . "'>Publish" ?>      If anyone knows if or how a front-end Publish post link would be possible, and if it could be derived from the delete post link, that would be awesomely helpful. Thank you!


title: How do I list in the backend all users that were assigned to a custom role?

text: From my previous question How to create and retrieve data from a special registration form? I would like to know how do I list in the backend all users that were assigned to a custom role? Is it possible to put them in a separate admin page?


title: Custom taxonomies capabilities

text: I have registered several custom taxonomies for a custom post type. Code for one of them is the following:               $labels = array(         'name'              => __( 'Genre', 'textdomain' ),         'singular_name'     => __( 'Genre', 'textdomain' ),         'search_items'      => __( 'Search Genres', 'textdomain' ),         'all_items'         => __( 'All Genres', 'textdomain' ),         'parent_item'       => __( 'Parent Genre', 'textdomain' ),         'parent_item_colon' => __( 'Perent Genre:', 'textdomain' ),         'edit_item'         => __( 'Edit Genre', 'textdomain' ),          'update_item'       => __( 'Update Genre', 'textdomain' ),         'add_new_item'      => __( 'Add New Genre', 'textdomain' ),         'new_item_name'     => __( 'New Genre', 'textdomain' ),         'menu_name'         => __( 'Genres', 'textdomain' ),     );     $args = array(         'labels'            => $labels,         'public'            => true,         'show_admin_column' => true,         'show_ui'           => true,         'hierarchical'      => true,         'capabilites'       => array(             'manage_terms'  => 'edit_posts',             'edit_terms'    => 'edit_posts',             'delete_terms'  => 'edit_posts',             'assign_terms'  => 'edit_posts'         )     );     register_taxonomy( 'genres', 'book', $args );      I'm having issues with capabilities, as far as I want that one of the custom tax could be managed by authors. If I define capabilities as the code above like `'manage_terms' => 'edit_posts'`, authors are not allowed to add new terms to the custom taxonomy even when authors have edit_posts capabilities. I have also tried to add custom capabilities to author role and assign this capabilities when registering the custom taxonomy, but no success. What does work is add 'manage_categories' to authors role, but this solution is not satisfactory as far as all the taxonomies are then editable by authors. Thanks in advance.


title: How to edit buddypress templates?

text: I am using a child theme of twentyten. I have installed buddypress but I need to edit the templates so I can add in my sidebar. But 1. I cannot find the right template to edit the category page which shows all my forums under that category and 2. I am reading about creating a buddypress child theme, but as I see it, this is just a wordpress child theme, and I alreayd have this. Please help if you can.


title: Automatically set default password to all posts in a specific category

text: Let's say that we have a category with slug `protected_category` and some posts in it. Is there a way to force all posts in that category to be password protected using a default password? **UPDATE:** I found a solution how to set a default password to all posts in a custom post type:               add_filter( 'default_content', 'set_default_values', 10, 2 );     function set_default_values( $post_content, $post ) {         if ( $post->post_type )             switch ( $post->post_type ) {                 case 'protected_post':                     $post->post_status = 'protected';                     $post->post_password = '123123';                     break;             }              return $post_content;      }      So how can I modify this to target a specific category?


title: Plugin Code ONLY on Post Edit Page

text: I have a wordpress plugin that is interfering with the function of another plugin. But, I believe the interference only occurs on the admin side. I've found the lines within the code that are interfering, and they appear to be loading html code on the header and footer of ALL admin pages. I would like to restrict these lines of code so that they only display on the post/page edit pages of the admin. Not exactly sure how to do that. I know I'll need some sort of conditional statement, but not sure EXACTLY how the code should read or what the best condition would be to use. Any help would be greatly appreciated.


title: How to add a class to meta box

text: When adding a metabox, i.e.:               add_meta_box(          'metabox_id',         'Metabox Title',         'my_metabox_callback',         'page',         'normal',         'low',          array( 'foo' => $var1, 'bar' => $var2)     );      how do I add a `class` to it for css styling? I'd like to avoid having to call each `id` in the style rule for metaboxes that contain elements having the same style.


title: How can I query the db to access current post information?

text: Alright y'all. I want to dynamically display the information of the 2 most current posts to the screen. So far I have only been able to get results by hard coding the ID into the query. Is there a way to retrieve this data dynamically?               query_posts('showposts=2');            while (have_posts()) : the_post(); ?>          <?php $x = get_the_ID();      echo $x;     $postStuff = $wpdb->get_row('select * from wp_posts where ID = "$x", ARRAY_A);     print_r($postStuff); ?>          <?php endwhile;?>


title: Clicks registering on Preview DNS site

text: I set up my site on a PreviewDNS, I have since pointed my Domain to the correct place and changed all the links to non-previewDNS links. However I can see (using Jetpack) that visitors to my site are somehow able to click on some images (I have the no right click plugin as well as no urls on images) I do not want people to be able to click on images as they are taken away from the main site and see just the image in a browser window. How can I disable all clicks on the previewdns urls? The site is www.Hutchisonhaines.co.uk an example URL is http://hutchisonhaines.co.uk.previewdns.com/wp- content/uploads/2012/01/DSC02296.jpg or http://hutchisonhaines.co.uk.previewdns.com/wp-content/uploads/2012/02/Olly- Murs_2-600x394.jpg in fact most links clicked are pointing to PreviewDNS site ![enter image description here](http://i.stack.imgur.com/UuY9R.png)


title: Perform an action when post is updated/published

text: I'd like to run a custom query using some meta data whenever a post is updated or published. Is there something I can put in functions.php to fire when those events occur?


title: Highlight nav menu terms

text: OK so i have `custom post types` and `custom taxonomies`. I have a sub-menu that is made of the custom taxonomies. ### Example: **registered taxonomy:** _Movies_ and **terms:** _action_ , _adventures_ , _etc_. (= menu items) ### Problem: Now **I need to add a _highlight_ -class** to the terms when the currently displayed page is an archive of one of the terms. I am almost looking to use my nav menu as a breadcrumb so to speak.


title: Show specific menu item from wp_nav_menu based on id

text: I have a wp_nav_menu "Main Menu" such as the following:   * Top Level (#menu-item-1)      * Sub Item     * Sub Item   * Top Level (#menu-item-2)      * Sub Item   * Top Level (#menu-item-3)      * Sub Item A     * Sub Item B        * Sub Item a.1     * Sub Item C Then in my template I want to be able to echo wp_nav_menu Main Menu sub items for say top level with id of menu-item-3 where menu-item-3 is the current menu top item. So something like this: (but that would actually work of course)               wp_nav_menu( array('menu' => 'Main Menu' 'menu-item-id' => '3' ));      And that would return:   * Sub Item A   * Sub Item B      * Sub Item a.1   * Sub Item C If it matters this is so I can show the sub items as side menu interior based on which main menu item section your in dynamically. Thanks in advance! To note, this is not a duplicate of, "http://wordpress.stackexchange.com/questions/2802/display-a-portion-branch- of-the-menu-tree-using-wp-nav-menu". Though that page has several similar answers, none work as expected with the current version of WordPress. That is showing on particular submenu item and all of its, children, their children and so on (unlimited depth).


title: Close secoundary database connection

text: I have two website. first one is in wordpress and second one is in corephp. My Question is that i am connection database by $wpdb. /* Core php database */ $newwpdb = new wpdb( 'username', 'password', 'database', 'localhost' ); Database connection is done. Now i am fetching some data using second database. After fetching i want to close the connection of core php database. I have checked but not found any solution of it. Database connection close So anybody knows than please help me for solution. Thanking in advance


title: Limiting posts_join, where, etc to a specific WP_Query object?

text: I hope this makes any type of sense. I want to be able to add clauses to a specific query object without effecting the main loop on a page, for example for content in a side bar or footer. Is it possible?


title: CPT, Custom User Role and problem with user manager

text: i've create a custom user role using this code:                   /* aggiungi ruolo */     add_role('brokers', 'Brokers', array(     'read' => true, // True allows that capability     'edit_pages' => true,     'edit_others_pages' => true,     'edit_published_pages' => true,     'publish_pages' => true,     ));      Then i've create two CPT using this code               // Sinistri     add_action( 'init', 'register_cpt_sinistri' );     function register_cpt_sinistri() {     $labels = array(          'name' => _x( 'Sinistri', 'sinistri' ),         'singular_name' => _x( 'Sinistro', 'sinistri' ),         'add_new' => _x( 'Aggiungi Sinistro', 'sinistri' ),         'add_new_item' => _x( 'Aggiungi Nuovo Sinistro', 'sinistri' ),         'edit_item' => _x( 'Modifica Sinistro', 'sinistri' ),         'new_item' => _x( 'Nuovo Sinistro', 'sinistri' ),         'view_item' => _x( 'Guarda Sinistro', 'sinistri' ),         'search_items' => _x( 'Cerca Sinistri', 'sinistri' ),         'not_found' => _x( 'Nessun Sinistro Trovato', 'sinistri' ),         'not_found_in_trash' => _x( 'Sinistri non trovati', 'sinistri' ),         'parent_item_colon' => _x( 'Parent Sinistro:', 'sinistri' ),         'menu_name' => _x( 'Gestione Sinistri', 'gallery' ),     );     $args = array(          'labels' => $labels,         'hierarchical' => true,         'description' => 'Image galleries for teachers classes',         'supports' => array( 'title', 'editor', 'author'),         'public' => true,         'show_ui' => true,         'show_in_menu' => true,         'show_in_nav_menus' => true,         'publicly_queryable' => true,         'exclude_from_search' => true,         'has_archive' => false,         'query_var' => true,         'can_export' => true,         'rewrite' => true,         'capability_type' => 'post',         'capabilities' => array(             'edit_post' => 'edit_sinistri',             'edit_posts' => 'edit_sinistris',             'edit_others_posts' => 'edit_other_sinistris',             'publish_posts' => 'publish_sinistris',             'read_post' => 'read_sinistri',             'read_private_posts' => 'read_private_sinistris',             'delete_post' => 'delete_sinistri'         ),         // as pointed out by iEmanuele, adding map_meta_cap will map the meta correctly          'map_meta_cap' => true     );     register_post_type( 'sinistri', $args );     flush_rewrite_rules();     }      and this code:               //Area Clienti Riservata     add_action( 'init', 'register_cpt_area_clienti' );     function register_cpt_area_clienti() {         $labels = array(              'name' => _x( 'Area Clienti', 'area_clienti' ),             'singular_name' => _x( 'Area Clienti', 'area_clienti' ),             'add_new' => _x( 'Add New', 'area_clienti' ),             'add_new_item' => _x( 'Add New Area Clienti', 'area_clienti' ),             'edit_item' => _x( 'Edit Area Clienti', 'area_clienti' ),             'new_item' => _x( 'New Area Clienti', 'area_clienti' ),             'view_item' => _x( 'View Area Clienti', 'area_clienti' ),             'search_items' => _x( 'Search Area Clienti', 'area_clienti' ),             'not_found' => _x( 'No area clienti found', 'area_clienti' ),             'not_found_in_trash' => _x( 'No area clienti found in Trash', 'area_clienti' ),             'parent_item_colon' => _x( 'Parent Area Clienti:', 'area_clienti' ),             'menu_name' => _x( 'Area Clienti', 'area_clienti' ),         );         $args = array(              'labels' => $labels,             'hierarchical' => false,             'description' => 'Gestione clienti agenzia assicurativa',             'supports' => array( 'title', 'editor' ),                  'public' => true,             'show_ui' => true,             'show_in_menu' => true,             'menu_position' => 5,                  'show_in_nav_menus' => true,             'publicly_queryable' => true,             'exclude_from_search' => true,             'has_archive' => false,             'query_var' => true,             'can_export' => true,             'rewrite' => true,             'capabilities' => array(             'edit_post' => 'edit_sinistri',             'edit_posts' => 'edit_sinistris',             'edit_others_posts' => 'edit_other_sinistris',             'publish_posts' => 'publish_sinistris',             'read_post' => 'read_sinistri',             'read_private_posts' => 'read_private_sinistris',             'delete_post' => 'delete_sinistri'         ),         );         register_post_type( 'area_clienti', $args );         flush_rewrite_rules();     }      Then i've setting the user role with this code:               function add_theme_caps() {         // gets the administrator role         $roles = get_role( 'brokers');         $roles->add_cap( 'edit_sinistri' );          $roles->add_cap( 'edit_sinistris' );          $roles->add_cap( 'edit_other_sinistris' );          $roles->add_cap( 'publish_sinistris' );          $roles->add_cap( 'read_sinistri' );          $roles->add_cap( 'read_private_sinistris' );          $roles->add_cap( 'delete_sinistri' );               $admins = get_role( 'brokers','administrator' );         $admins->add_cap( 'edit_area_clienti' );          $admins->add_cap( 'edit_area_clientis' );          $admins->add_cap( 'edit_other_area_clientis' );          $admins->add_cap( 'publish_area_clientis' );          $admins->add_cap( 'read_area_clienti' );          $admins->add_cap( 'read_private_area_clientis' );          $admins->add_cap( 'delete_area_clienti' );      }     add_action( 'admin_init', 'add_theme_caps');      But i've a problem. I can see the CPT only with brokers role and not also with administrator role. How can i see the two CPT with brokers and administrator roles? Thanks


title: Change the avatar ratio?

text: Is there any way to change the aspect ratio of the WordPress Avatars? Or is this hardcoded? Greetings, .wired


title: Display one post based on ID from $_GET

text: I am using products as a 'custom post type' then I'm displaying a gallery of all products on the home page with a buy button next to each one. When the buy button is clicked, I would like it to redirect to a page with some more info of that product and a checkout form. What do I need to send to the URL using the button to retrieve this type of page? Should I just write my own query or is there something in wordpress that can do this for me? This is my form right now:               <form class='product_form' action="checkout" method="get">     <input name="post_id" type="hidden" value="<?=$post->ID?>"/>     <input type='image' src='<?php  bloginfo('template_url'); ?>/images/buy.png' class='wpsc_buy_button' />      </form>


title: Change post status based on meta value

text: I have this cron set up to trash posts x days after it is posted. This works. Edit: Added my answer to my question.               add_action( 'wp', 'do_trash_ads' );     function do_trash_ads()     {         if ( ! wp_next_scheduled( 'delete_classifieds' ) )             wp_schedule_event( time(), 'daily', 'delete_classifieds' );     }          add_action( 'delete_classifieds', 'expire_posts' );     function expire_posts()     {         global $wpdb;         $daystogo = "14";              $post_ids = $wpdb->get_results( "             SELECT ID              FROM {$wpdb->posts}             WHERE post_type ='classifieds'              AND post_status = 'publish'              AND DATEDIFF(NOW(), post_date) > '{$daystogo}'         " );         foreach( $post_ids as $id )         {             $postid =  $id->ID;                  $my_post = array();             $my_post['ID'] = $postid;             $my_post['post_status'] = 'trash';             wp_update_post( $my_post );         }     }        > **What I would like to do** : Include posts in the above function that are > based on a meta field value (21 days is the default, but a user can select > an earlier date). I set up a 2nd cron to do this.               add_action( 'wp', 'do_trash_ads_user' );     function do_trash_ads_user()     {         if ( ! wp_next_scheduled( 'delete_ads_user' ) )             wp_schedule_event( time(), 'daily', 'delete_ads_user' );     }          add_action( 'delete_ads_user', 'expire_posts_user' );     function expire_posts_user()     {        global $wpdb;             $post_ids = $wpdb->get_results( "           SELECT ID            FROM {$wpdb->posts}           WHERE post_type ='classifieds'            AND post_status ='publish'        " );             foreach( $post_ids as $id )        {            $postid =  $id->ID;            $expiration_value = get_post_meta( $postid, 'ecpt_ad-expire-date', true );                 if( $expiration_value )            {                $todays_date = date( "Y-m-d" );                $today = strtotime( $todays_date );                $expiration_date = strtotime( $expiration_value );                if ( $expiration_date > $today )                {                      }                else                {                     $my_post = array();                    $my_post['ID'] = $postid;                    $my_post['post_status'] = 'trash';                         wp_update_post( $my_post );                }             }         }     }      I don't know if this is the best method but it is working.


title: Remove template drop down for certain pages

text: I have a number of custom templates which are assigned to different pages in my admin. Is it possible to hide/lock the templates dropdown for certain pages? For instance, I have an `Events Calendar` template which will only ever be assigned to the Events Calendar page and so there is no need for the client to see this in the dropdown box however it should still be accessible for admins. Thanks for help or guidance.


title: Custom taxonomy in short code

text:
I am using short codes in theme for grid display. Code only considers category ids. I also want to add custom taxonomies so it give output as both category posts as well as custom taxonomy posts.                   function five_col( $atts ) {         extract( shortcode_atts( array(             'cats' => '1',             'num' => '2',             'offset' => '0',         ), $atts ) );         $sq = new WP_Query(array('posts_per_page' => $num, 'post_status' => 'publish', 'order' => 'desc', 'ignore_sticky_posts' => 1, 'cat' => $cats, 'offset' => $offset));         if ($sq->have_posts()) :         $count = 1;         $col = 5;         $out = '
';         while ($sq->have_posts()) : $sq->the_post();                     $thumbClass = ($count == $col) ? 'last' : '';                         $permalink = get_permalink();                         $title = get_the_title();                         $bloginfo = get_template_directory_uri();                         if ( has_post_thumbnail()) {                             $img_src = wp_get_attachment_image_src( get_post_thumbnail_id($GLOBALS['post']->ID), '');                             $thumbnail = $img_src[0];                         }                         else $thumbnail = '';                         $default_thumb = $bloginfo.'/images/post_thumb.jpg';                         $thumbnail = ( $thumbnail == '' ) ? $default_thumb : $thumbnail;                             $format = '

%4$s

';                             $out .= sprintf ($format, $bloginfo, $thumbnail, $permalink, $title );                 $count++;                 if($count > $col){                 $col = $col + 5;                 $out .= '

';                     }                     endwhile;                     $out .= '
';                     return $out;             endif;         wp_reset_postdata(); // Restore global post data stomped by the_post().     }


title: Get link value only from the_content()?

text:
I have my news in posts and I am trying to display the two latest news articles (posts) on my main page. I've got that solved by getting the title using `the_title()` and getting a little bit of the text using `the_excerpt()`. I want to show a _more..._ link that takes you to the post. However, some of the news articles that I am posting have some text in the post body that's a link, how do I only get the link within the body of a post so that my _more..._ link takes your there directly? For example, sometimes we will link to news articles in PDFs that are on another server. I'm using the following code.               <?php query_posts('category_name=news2011'); ?>     <?php if (have_posts()) : while (have_posts()) : the_post(); ?>         <?php /* the_ID(); */ ?>          <?php /* the_date('F Y'); */ ?>

<?php the_title()?>

<?php the_content(); ?>

     <?php endwhile; endif; ?>


title: Custom Comments - Parent / Nested Reply

text:
I am making a custom theme and have edited comments.php, but I'm unable to get the comments to save as a reply to another comment. I have succeeded in showing the comment parent id to show as a hidden value in the source code, but it doesn't save it accordingly in the database (instead, it always saves the comment_parent as 0). Also, the commenter IP address isn't saved either for some reason (comment_author_IP appears as "::1"). Here's the code I have so far:                   <?php         if ( post_password_required() )             return;     ?>
              <?php // You can start editing here -- including this comment!              $fields = array(         'author'               => '
' . __( 'Name', 'domainreference' ) . ' ' . ( $req ? '*' : '' ) . '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' />
',         'email'                => '
' . __( 'Email', 'domainreference' ) . ' ' . ( $req ? '*' : '' ) . '<input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' />
'         );              $defaults = array(         'fields'               => apply_filters( 'comment_form_default_fields', $fields ),         'comment_field'        => '
' . _x( 'Comment', 'noun' ) . '<textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea>

' . __( 'five plus two', 'domainreference' ) . ' ' . ( $req ? '*' : '' ) . '<input id="math" name="math" type="text" value="' . esc_attr( $commenter['math'] ) . '" size="30"' . $aria_req . ' />

<input type=\'hidden\' name=\'comment_post_ID\' value=\'\' id=\'comment_post_ID\' /><input type=\'hidden\' name=\'comment_parent\' id=\'comment_parent\' value=\''.$comment_parent.'\' />',         'must_log_in'          => '
' .  sprintf( __( 'You must be logged in to post a comment.' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( ) ) ) ) . '
',         'logged_in_as'         => '
' . sprintf( __( 'Logged in as %2$s. Log out?' ), admin_url( 'profile.php' ), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( ) ) ) ) . '
',         'comment_notes_before' => '
' . __( 'Your email address will not be published. Required fields are marked *' ) . ( $req ? $required_text : '' ) . '
',         'comment_notes_after'  => '',         'id_submit'            => 'submit',         'title_reply'          => __( 'Leave a Reply' ),         'title_reply_to'       => __( 'Leave a Reply to %s' ),         'comment_form_title'       => __( 'Leave a Reply', 'Leave a Reply to %s' ),         'cancel_reply_link'    => __( 'Cancel reply' ),         'label_submit'         => __( 'Post Comment' )         );              comment_form($defaults);         ?>


title: What is the purpose of $merged_filters?

text: Savvy WordPress user here, or at least trying to be. I have the hang of hooks and filters with the code in WP's plugin.php The only thing I cannot seem to understand is the $merged_filters global. The value for a tag is unset when a filter or action is added. However, when an action or filter is executed, the $merged_filters[$tag] value is set to "true". What is the purpose of this? Thank you


title: What could cause my plugin's options/settings page not to load?

text: I'm having an issue with one site in which my plugin is installed. The "settings" page will not load. When I click on "settings", it loads the settings page but the page is blank after the "Upgrade to 3.1" nag div as if there was a die() there. I have two files, plugin.php and plugin-admin.php I've got code in plugin.php to set up the admin page:               $my_dir = plugins_url('/img', __FILE__);     add_options_page(          'MY! Settings',          'MY! Settings',          'manage_options',          'my-plugin-admin.php',          'my_settings_admin',          $my_dir.'/favicon.png', 'top'     );     register_setting( 'my_settings_options', 'my_settings', 'my_settings_validate' );          function my_settings_admin(){         global $wp_rewrite;         $wp_rewrite->flush_rules();         include_once dirname(__FILE__) . '/my-plugin-admin.php';     }          define( 'my_BASENAME', plugin_basename( __FILE__ ) );     define( 'my_BASEFOLDER', plugin_basename( dirname( __FILE__ ) ) );     define( 'my_FILENAME', str_replace( my_BASEFOLDER.'/', '', plugin_basename(__FILE__)));      The "My Settings" link shows up under the "Settings" menu fine, and the link appears to be going to the correct page, but the script does not load and nothing will trace inside of my-plugin-admin.php Any ideas? UPDATE: with t31os help, here's the updated function that fixes the problem:               function my_settings_admin(){         include_once dirname(__FILE__) . '/my-plugin-admin.php';         global $wp_rewrite;         $wp_rewrite->flush_rules();     }      I simply had to move the wp_rewrite and flush rules after the include statement. Although I don't know why.


title: TimThumb & htaccess : clean url

text: Do you know if there's a way to alter via htaccess the **timthumb** urls ? My question is if i can change for example urls like this thumb.php?src=http://mysite.com/images/image.jpg&h=200&w=350&zc=1&q=80 to http://mysite.com/images/image.jpg


title: Why is the admin bar appearing (on certain pages) for non logged-in users?

text: The admin bar is appearing for non logged-in users on one of my sites, but only for two specific pages (/work and /contact, for what it's worth). Has anyone heard of this happening before? It appears as though one of the site's users is logged in (their username is displayed), but clicking any links on the admin bar lead to the login page. If I click Log Out under that users name in the admin bar, I get a prompt to ensure I want to logout, then a redirect to /wp-login.php. However, upon returning to /work or /contact, the admin bar still appears.


title: Expected 'add_filter' (T_STRING)

text: I am trying to add a filter for get_avatar so I could implement an avatar alignment but when I do, I received **expected 'add_filter' (T_STRING** First Approach               add_filter('get_avatar', 'remove_photo_class');     function remove_photo_class($avatar) {        return str_replace(' avatar', $image_align , $avatar);     }      Second Approach               function mytheme_get_avatar( $myavatar ) {        $myavatar = '<img class="'.$image_align.'" src="<' . get_template_directory_uri() .      '/images/authors/' . get_the_author_meta('ID', $user_id) . '.jpg" alt="' . get_the_author() . ' ">';        return $myavatar;     }     //add_filter( 'get_avatar', 'mytheme_get_avatar' );      Both return the same error. Entire code can be found here in Pastebin.


title: custom login form redirect problem

text: I'm facing a strange problem here with this custom login form:               <form name="loginformfooter" class="loginform" id="loginformfooter" action="<?php bloginfo('url'); ?>/wp-login.php" method="post">             <input type="text" name="log" id="user_login" class="input" tabindex="1" />        <input type="password" name="pwd" id="user_pass" class="input" tabindex="2" />        <input type="submit" name="wp-submit" id="wp-submit" value="Login" />        <input type="hidden" name="redirect_to" value="http://<?=$_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];?>" />        <input type="hidden" name="testcookie" value="1" />     </form>      The most of the times it redirect me to the correct page, but few other times, especially at first login, it redirects me to the admin page. I'm not able to determine precisely when the problem occours. Does anyone found a problem like that? Or is there a better solution to get the same result? Thanks!


title: Sorting date results from a query

text: I have a site I run which shows the weddings and anniversaries of some friends. I have this running to show the users (and their anniversaries) according to what month it is:                $args = array(          'meta_key' => 'anniversary_date',        'meta_value' => 0,      );                  $user_query = new WP_User_Query( $args );       $users = $user_query->get_results();             foreach( $users as $user ):         echo $user->display_name;        echo ' will be celebrating their anniversary on ';          echo get_user_meta( $user->ID, 'anniversary_date', true );         endforeach;       * * *               function anniversary_user_query( $query ){             if( $query->query_vars['meta_key'] == 'anniversary_date' && $query->query_vars['meta_value'] === 0 ):              global $wpdb;                  $thismonth = date('m');                $query->query_where = "WHERE 1=1 AND ( $wpdb->usermeta.meta_key = 'anniversary_date' AND ( MONTH( $wpdb->usermeta.meta_value ) = $thismonth ) )";         endif;        return $query;      }      add_action( 'pre_user_query', 'anniversary_user_query' );       The dates in my database are structured like YYYY-MM-DD. How can I sort the dates that will appear on the page so that they are ordered from earliest in the month (by day) to latest? Thanks


title: In what part of the Wordpress core does the users table and usermeta table get joined?

text: I have been trying to work out just where in the massive jungle of Wordpress include classes the usermeta table is joined onto the users table and if so, how does it work? The one confusing thing about the usermeta table to me is that it is using key/value fields for the database fields and not actual values like first_name or last_name. How does Wordpress know which fields to pull out by default and are there hooks, actions and filters for adding and retrieving data from the usermeta field?