title: Custom date changer post_date => future - missed schedule error

text: I'm working on a custom event scheduler for my website that allows people to easily go in and set the article to post in the future. The reason I'm overriding the normal Wordpress functionality is because I wanted to make it super easy to choose the date, since the sermons should only be posted on a Sunday. So I have a custom dropdown calendar that only allows you to select the Sunday's of a month. Anyways my problem is that all my posts give an error of "Missed Schedule" in the admin panel. I'm able to get around this by using the "post_status" => "future" to list posts on the page, but this is kinda "hacky"... Why would this code be giving me that "Missed Schedule" error?               function cfc_reset_sermondate( $data ) {          if($data['post_type'] == 'sermon_post') {         if($_POST['cfc_sermon_date']) {             $date = $_POST['cfc_sermon_date'];            // $date = DateTime::createFromFormat('D - M j, Y', $date);            // $date = $date->format('Y-m-d');             $date = createFromFormat($date);                       $postDate = strtotime($date);                  $data['post_date'] = $date;                  $todaysDate = strtotime( date( 'Y-m-d' ) );             if ( $postDate > $todaysDate ) {                 $data['post_status'] = 'future';             }         }     }     return $data;     }          add_filter( 'wp_insert_post_data', 'cfc_reset_sermondate', '99', 1);      Here's the createFromFormat function:               function createFromFormat($date_ugly) {        $schedule = 'Sunday - Sep 15, 2000';         // %Y, %m and %d correspond to date()'s Y m and d.         // %I corresponds to H, %M to i and %p to a         $ugly = strptime($date_ugly, '%A - %b %e, %Y');         $ymd = sprintf(             // This is a format string that takes six total decimal             // arguments, then left-pads them with zeros to either             // 4 or 2 characters, as needed             '%04d-%02d-%02d',             $ugly['tm_year'] + 1900,  // This will be "111", so we need to add 1900.             $ugly['tm_mon'] + 1,      // This will be the month minus one, so we add one.             $ugly['tm_mday'],              $ugly['tm_hour'],              $ugly['tm_min'],              $ugly['tm_sec']         );         $new_schedule = new DateTime($ymd);         return $new_schedule->format('Y-m-d');     }      ![Custom Date Calendar](http://i.stack.imgur.com/aha51.png) ![Missed Schedule Error](http://i.stack.imgur.com/9XAzA.png)


title: convert more tag to shortcode

text: is there is a way to convert `<!-- more -->` to shortcode


title: Remove Custom Taxonomy Slug only without removing Custom post type slug in permalinks

text: I have a problem currently that is related to permalinks. I have a custom Post type " **workshop** " and two taxonomies named " **manufacturer** " and " **models** ". What i want to get and tried is this URL pattern. **Current permalinks for accessing posts under this post type**               www.domain.com/workshop/[manufacturer name]/[models]/post name     e.g www.domain.com/workshop/Rover/R1/postname      And for accessing taxonomies terms For manufacturer               www.domain.com/manufacturer/[term name]      What i want to get is this URL for accessing **Taxonomy terms**               www.domain.com/[custom postype slug]/[term name]/     www.domain.com/workshop/rover/      Means to add only Custom post type slug as a base and to remove Taxonomy Base slug from URL,s I have tried some plugins e.g **Remove custom taxonomy base slug** but what they did is this URL pattern ( they remove both custom post type and taxonomy slug from URL )               www.domain.com/[term name]/     www.domain.com/rover/      Can its possible to do this with rewrite structure so i can only remove taxonomy slug not custom post type slug from URL,s ?


title: WP_Query create html structure

text:
I have a page here to illustrate my question http://www.ttmt.org.uk. The first grid is hard coded using the html structure I want - div's to contain each row and then div's inside that to contain each block. My problem is how do I create this structure in a WP_Query. If I output the row in the WP_Query it will give me 1 block in each row. I want three blocks in each row. Do I need some sort of loop within a loop?               <?php get_header(); ?>

Post 1

Post 2

Post 3

Post 4

Post 5

Post 6

Post 7

Post 8

Post 9

With WP_Query
                  <?php                 $grid_args  = array(                     'post_type' => 'post',                     'order' => 'ASC',                     'orderby' => 'menu_order'                 );                      $grid_loop = new WP_Query($grid_args);                      if($grid_loop->have_posts()):                     while($grid_loop->have_posts()):                         $grid_loop->the_post();                  ?>

<?php the_title(); ?>

                  <?php                 endwhile;                 endif;             ?>                  <?php wp_reset_postdata(); ?>
               <?php get_footer(); ?>


title: posts order by title second word

text:
This is a common question, i haven't been able to find a straightforward answer to.   I want to generate a list of a custom post type titles. im using `'orderby' => 'title'` to have them display alphabetically. The titles are names and last names and i want to sort by the last name. I know i could create meta fields with seperated first and last names and order by the last name field. But i'd really like to see if there is no good method to `explode` the `'title'` and pass the second word in to `orderby'. This is the basic code:               <?php     // Get the 'Actors' post type          $args = array(     'post_type' => 'actors',     'orderby' => 'title',     'order' => 'ASC',     'nopaging' => true,     'cache_results' => false,     'update_post_meta_cache' => false     );     $loop = new WP_Query($args);          while($loop->have_posts()): $loop->the_post();     echo '
' . get_the_title() . '
';     endwhile;     wp_reset_query();     ?>       Iv'e tried to:               $gettitle = get_the_title();     $lastname = explode(" ", $gettitle);      and then change to `'orderby' => $lastname[1],` . but it doesnt work.   Is there no GOOD way to use the second word in the title to sort posts?


title: link header to homepage (for wp multisite)

text: I am using the genesis framework and have added this code to change the way genesis uploads a header image:               remove_action( 'wp_head', 'genesis_custom_header_style' );     add_action( 'genesis_header', 'andym_header' );     function andym_header() {     echo '';     }      This code just puts the header image in the html instead as a css background. I would also like to link the header to user homepages like the h1 site title links to homepages. I tried changing the header function in the code above to:               function andym_main_header() {     echo '<a href="<?php bloginfo('url'); ?>">  ';       } but got a syntax error, unexpected T_STRING, expecting ‘,’ or ‘;’ I don't know php very well, any help appreciated


title: Wordpress add_rewrite_rules for custom URLs ending in .html

text: It's pretty common to see Wordpress running on pretty permalinks in the style of:               /blog/2012/04/my-post/      However I'm trying to customize a fresh Wordpress install with a different set of URLs. I believe wp_rewrite is my best method, writing a small block of code inside functions.php. I have seen a few examples of wp_rewrite_rules but none appear to be simply changing all post URLs. Ideally I'd like to have them setup like this:               /blog/2012/04/my-post.html      I would love any help on this if possible.. it's been a struggle finding good code examples for even basic rewrite rules. Let me know if I can provide any more details.


title: :first-child applying to all links

text:
I am trying to remove the margin-left:10px; from the first menu item in my main navigation. I am ussing a wordpress custom navigation for my site. I have tried the :first-child method but this seems to remove the margin for all links not just the first. Is there another method you know of that can do this? Below is the html for my menu:

overview

Strategy

business

leadership

governance

csr

sustainability

careers

      CSS:               ul.menu li,a {     text-decoration: none;     display: inline;     padding-bottom:5px;     margin-left: 10px;     }     ul#menu-menu-1 > li,a:first  {     margin-left: 0px;     }


title: On selecting shortcode generate selected shortcode table inside page editor worrdpress

text:
i want to create a different different shortcode while choose particular shortcode relative table is show on page editor for example when user choose [some_random_code_sc] that shortcode   then relative table is

Basic

$4.99

Per month

5 GB storage

Enhanced security

8 Databases

2 Users License

Ads-free

Moderation tools

30 day trial

Sign up

       while choosing [some_random_code_sr] it show relative table

Standard

$5.99

Per month

5 GB storage

Enhanced security

8 Databases

2 Users License

Ads-free

Moderation tools

30 day trial

Sign up

      all selective table shows on wordpress page editor can anyone suggest me what should do to create table in editor using shortcode.


title: Current state to a button when on a single page

text:
I am having trouble figuring out how to keep the current state active once on a single page of the post. For example: Recipes displays a list of all my post that are under a specific category. Once you click one of the posts it brings you to single.php. The active state is only working when I am displaying all my post and is removed once I am on the single post. How can I set up my code to display a current state to my link once on the single.php page? I am not using wordpress menu system because I was unable to place my icons class inside of the link. A side note, I have my permalink setup to read category-name/post-name and the category name is recipe.

<a href="<?php bloginfo('url'); ?>/about/" class="iconMain icon-about">About

<a href="<?php bloginfo('url'); ?>/recipes/" class="iconMain icon-recipes">Recipes

<a href="<?php bloginfo('url'); ?>/garden/" class="iconMain icon-garden">Garden

<a href="<?php bloginfo('url'); ?>/contribute/" class="iconMain icon-con">Contribute

             to display my current state i am using js                 $("#footerNav a").each(function() {                if (this.href == window.location.href) {                   $(this).addClass("current");           }      });


title: Show items by user_role

text: I have this code, start with                   {foreach $items as $item}      I know that I must connect below code to start code                   $user = new WP_User( $item->post_author );              if ( !empty( $user->roles ) && is_array( $user->roles ) ) {         foreach ( $user->roles as $role )         echo $role;      I need hide items only for one role "directory_4". If post_author item have a role "directory_4" items will be hide and if post_author item have a other role will be showed all items. Very thank you for your help.


title: Getting Custom Field data from a page hierarchy

text: Imagine I have a site set up with pages in this kind of hierarchy..               -Home     -Cars       -Volvo 850        -Volvo 850 tech spec        -Volvo 850 pictures      -Porsche 911        -Porsche 911 tech spec       -Porsche 911 pictures      -other cars etc      Now you can see that I have a bunch of Cars. On each of the car pages (Volvo 850, Porsche 911) I have some Custom Fields where I have entered various data about the Car (by the way, I'm using the Custom Field Template plugin to make entry of this data easy in wp-admin). These fields are displayed on the page. (the fields are not entered on the tech spec and pictures pages) What I would like to do is display a list on the cars on the Home page (below), which gets the data from the Custom Fields. What would be the best way to (a) access this custom field data (which can change when new cars are added or edited), and (b) display the data in a certain order (for instance by top speed)..?               ---------------------------------------     |   Car              |   Top Speed    |     ---------------------------------------     | Porsche 911        |   200          |     | Audi 444           |   180          |     | Volvo 840          |   160          |     ---------------------------------------      I guess the pseudo-code is               * find all pages which are an immediate descendant of the Cars page (not the tech spec and pictures)     * get the custom data from these pages     * display data in Top Speed order


title: A Simple CRM Plugin for WordPress?

text: I want a simple CRM in WordPress.com, any suggestions as how to do? Which plugins to use?? How to start and implement?


title: Dynamic variable for custom taxonomy in loop?

text: I have a custom page template that loops through all custom posts with the post_type of "product_listing" AND the custom taxonomy "product_cat" of "shirts" and returns 4 posts per page (as seen below:)               <?php $loop = new WP_Query( array( 'post_type' => 'product_listing', 'product_cat' => 'shirts', 'posts_per_page' => 4 ) ); ?>      It is the client's responsibility to manage those categories. I'd like to assign a variable to display in place of "shirts" so that I don't have to modify the template each time the client adds a new product category (such as shoes, pants, etc.). I am not a programmer by any means. Does anybody have a snippet of code that would work for this? Or perhaps an article I could read more about assigning dynamic variables in the loop? Thanks!


title: Updating custom fields with data from the database

text: I'm having a real problem with updating advanced custom fields (within a custom post type) with data from the database. I have a table in the database called 'wp_company_profiles' with fields 'address_1' and 'address_2', and have two advanced custom fields set up with the same values. I am trying to put together a hook that will pull data from the database to occupy the custom fields with when a particular post is displayed. Below is the code I am using, but I'm sure there is something I'm missing but can't figure it out. Any help would be appreciated. Thanks.               function get_fields_company_profile($post_ID)  {         global $wpdb;              if ($parent_id = wp_is_post_revision( $post_id )) $post_ID = $parent_id;              $row = $wpdb->get_row( "SELECT * FROM wp_company_profiles WHERE pid => '$post_ID' LIMIT 1" );              $address1 = $row->address_1;         $address2 = $row->address_2;              update_post_meta($post_ID, 'address_1', $address1);         update_post_meta($post_ID, 'address_2', $address2);          }     add_action('init', 'get_fields_company_profile');


title: Save wp_editor() content as option

text: I'm having some troubles with a extra feature i'm writing for my theme. The admin should be able to make some special posts, those posts are stored as an option. The options are atored as an array and WP makes it's own json for arrays. So, the user has a wp_editor(), and the array stored looks something like this:               array(         'title' => 'My title',         'content' => 'Look at my cat! ', //Generated by wp-editor         'signature' => 'My name'     );      The thing is, when an image is added to this content, the image string is quite badly escaped. When i'm trying to get this content i get it as                     instead of                     How can i store content like this in the wp-options table so i can get it right when i try to get the content?


title: Trouble using get_post

text: For Microkids related post plugin He said > "Using the get_post() function you could get any data you need from the > related posts." and he posted this snippet of code.               $related_posts = MRP_get_related_posts( $post_id );      I'm not exactly sure how to use the get_post feature for this situation. I would like to display the titles and thumbnail for each post in that array. Any help would be appreciated.


title: Multi site sub directories 404

text: I've set up my `.htaccess and wp-config` as advised by WP (3.8). The issue is that when I browse to the sub-sites ( i have /testing set up at the moment ) I get 404.Nothing shows in the errors. My host says `AllowOverrides is All and not none` We have other WP installs on the same host, not using multisite, and permalinks work fine. Our site is `Link` and sites are installed as a second level subdirectory. WP seems to have picked this up fine and tells us to add it in the htaccess. Just for clarity, here is our .htaccess:               # BEGIN WordPress     RewriteEngine On     RewriteBase /hosting-subdir/ - this is our site's sub dir but i removed it for privacy     RewriteRule ^index\.php$ - [L]          # uploaded files     RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]          # add a trailing slash to /wp-admin     RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]     RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]     RewriteRule . index.php [L]     # END WordPress


title: Query Wordpress database by registered date and role

text: I would like to get the display name and email address for all users who have registered to my multisite today with the role of subscriber. It needs to be an SQL query as it's used outside of the WP files. I've gathered I need the following: Table: wp_users Columns: user_registered, user_email, display_name Table: wp_usermeta Columns: wp_6_capabilities = a:1:{s:10:"subscriber";b:1;} I'm guessing I need to get the user ID's from wp_users of all users who have subscribed today, then check against wp_usermeta to narrow those results down by the user role. Then I need to go back to wp_users and get the email and display name. I've been trying to write an SQL query to do this for a while and can't seem to come up with anything. Any help is appreciated. Thanks.


title: Configure Php server with ISAP

text: i have hosted my wordpress site in IIS server and its running CGI/FastCGI but I found that CGI/FastCGI is slower than the ISAP.I am working with the performance issue in the site and the site has been live.I tried alot of methods to convert it to ISAP but couldn't.I tried using the windows feature to add the ISAP filter but its not working.Can anyone help how to handle this issue or is there any better tutorials for this ???


title: Display posts containing at least 1 from a list of say 10 tags but not containing other tags

text:
Difficult to explain and maybe totally impossible but I have say 30 tags in total. I would like to output all posts that contain at least one from a list of say 10 tags but do not contain any of the other 20. So for example (assuming I'm targeting posts exclusively containing any number of tags one - ten): Post containing tags: one three eight ten - would be output Post containing tags: one three eight ten twelve - would not be output When I say output it could be a list to include in a post or a unique post / page with its own template. The output method I am flexible with - it's targeting the posts I'm not sure can be done? I am only talking about the tag taxonomy - no other variables. ======================================== Update 16 Jan 2014: I have created a new template, the relevant parts of which are:               $args = array(         'post_type' => 'post',          'posts_per_page' => 12,         'paged' => $paged,         'tag__in' => array (46, 5, 101, 22, 122, 7, 102, 15, 104, 47, 105, 66, 43, 123),         'tag__not_in' => array (10,121,20,36,23,24,21,76,82,17,6,106,8,75,54,38,57,86,56,95,25,62,16,39,40,69,37,9,42,41,87,73,85)          );          $wp_query = null;     $wp_query = new WP_Query();     $wp_query -> query($args);     ?>          <?php if ( $wp_query->have_posts() ) : ?>     <?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>          <?php get_template_part('includes/format', 'archive-update'); ?>          <?php endwhile; ?>     <?php endif; ?>      This works well - the issue is that the `tag__in` array will be static but the `tag__not_in` could be dynamic as new tags are added. I would like to automate this array (if that is the correct phrase). To grab the tag ids quickly for `tag__not_in` I created another template with the following code:               $tags = get_tags('exclude=46,5,101,22,122,7,102,15,104,47,105,66,43,123');          $html = '
';     foreach ( $tags as $tag ) {              $html .= "{$tag->term_id},";     }     $html .= '
';     echo $html;      and then copied and pasted the displayed ids manually into the `tag__not_in` array. Basically how can I adapt the line:               'tag__not_in' => array (10,121,20,36,23,24,21,76,82,17,6,106,8,75,54,38,57,86,56,95,25,62,16,39,40,69,37,9,42,41,87,73,85)      so that the ids are automatically populated by the array created by `get_tags(exclude...)`. I hope that makes sense. The output page is http://skipology.com/iphone-photography- articles-10-essential-apps/


title: How do WordPress veterans deal with the issues of upgrading WordPress?

text: Sometimes upgrading WP is catastrophic: critical plugins don't work any more (and new compatible versions don't exist yet). What do the WP veterans do about it? Do they upgrade WP after the boring work of backing up everything (and the horrible, awful perspective of having to reinstall the previous version after a potential catastrophe) or do they just never upgrade WP?


title: Adding a description to theme customizer controls

text: How could I add a description to `$wp_customize->add_control`? I've found I really need to include a short description on some of the controls but it doesn't look like it's possible. I noticed you can add a description to `$wp_customize->add_section` but that's only a tooltip. This is ideally what I'd like to do, but unsure on how to output it and if this is possible:               $wp_customize->add_control( 'theme_options[some_option_name]', array(         'label'   => 'This Is Some Option',         'section' => 'theme_name_section',         'type'    => 'text',         'description' => 'Wish this existed', // this isn't possible     ));


title: Custom settings disappear during database migration?

text: I've noticed a problem that pops up occasionally when moving a WP install from one place to another (usually the same server.) I copy all the files to their new location, get a mysql dump, update all references to the old paths in the sql file, then import it to the new database. Everything always works just fine apart from custom settings that have been added using register_setting. I can still see them in the database, but WP completely ignores them, and they need to be added again in the backend. Is there something obvious I'm overlooking here? I can post up the code I'm using to build the custom settings panels if necessary... Cheers.


title: Highlight main menu when on specific posts or pages

text: I am using Genesis and have written a custom function which works fine, but is very ugly and includes a css statement. The object is to highlight a menu link in the main header menu when on certain pages or posts. This function does not work if I remove the css from the function or if I remove "#header #nav #menu-item-133 a" from the stylesheet. It has to have both, so something is not right even though it does do the job! Can anyone correct my error(s)? Thanks.               function blog_link_genesis() {         if( is_single() || in_category('investors') || is_page( array(4, 30))) {          $current = '#header #nav #menu-item-133 a';  }              ?>         <style type="text/css">         <?php echo $current; ?> { color: #ff0;}         </style>         <?php }     add_action( 'genesis_header' , 'blog_link_genesis'  );


title: Notify commenters about new replies

text: Is there a plugin to notify commenters of one post to receive emails about new comments made on that post? Only commenters who entered emails will be notified.


title: Split Media Queries in different files!

text: I woke up this morning with a thought. Is it a good idea to split the different media queries in different files, check the width of the page in functions.php and then with an IF call the "correct" using `wp_register_style` and `wp_enqueue_style`?


title: Can't Find a "Most Popular Tags" Hack Anywhere

text: If anybody knows where to find a most popular tags hack, I would be forever grateful. I've searched and searched to no avail.


title: WPMU add custom colum

text: I managed to add the columns that I wanted in all the wpmu sites using:               add_action('manage_users_columns', 'header_column');     add_action('manage_users_custom_column', 'manage_column', 10, 3);     add_filter('manage_users_sortable_columns', 'set_sortable_column');      but i want to add the same functionality to the main network and didn't find any hook for that purpose.Any help where to find those hooks?Thank You.


title: Redirect to user role registration form

text: i am using the modification shown on How to reload the role specific registration form on validation errors? and don't know how to solve this problem. I hope someone out there can help me here. How can i redirect to that specific role registration form after validation errors? Thank you! Linda


Wodpress is linking to unknown site: widgets.amung.us. and whos.amung.us I Tried to find why but could not. :( Does anyone know what is widgets.amung.us or how to remove this link? And why WordPress is linking to this site? Is visible in login page.


title: Why are my wp urls showing page not found?

text: I recently changed a page slug url in the edit area and saved it from flood- maps to floodmaps. There was an issue here so I then deleted the page in trash too and started a new one with the same name Flood maps. I added the content and then saved it. When I went to go to the url it gave me a page error and the url went back to the old slug url floodmaps which is not found. I then queried in the mysql db and got rid of _wp_old_slug in the post meta table. Now when I try to load floodmaps I get the error. I have checked plugins etc and resaved permalinks and still nothing works. Is there anything that can inspect the issue here? Cheers


title: Fatal Error relating to sessions.php

text: here is the error code I have > Warning: Unterminated comment starting line 2079 in > /home/teamspor/public_html/wp-includes/user.php on line 2079 > > Warning: require(/home/teamspor/public_html/wp-includes/session.php) > [function.require]: failed to open stream: No such file or directory in > /home/teamspor/public_html/wp-settings.php on line 122 > > Fatal error: require() [function.require]: Failed opening required > '/home/teamspor/public_html/wp-includes/session.php' > (include_path='.:/opt/php53/lib/php') in /home/teamspor/public_html/wp- > settings.php on line 122 I have tried deleting the theme from the ftp and I have also tried disabling the plug-ins via the same method. The only advice I've found online so far is advising to add/change bits of code but it doesn't say where. As far as I can tell it's some sort of permissions issue but I'm not sure why it has happened. The "settings.php" file is in the correct place but the "sessions.php" file is missing


title: What is the best way to get the first few post from WordPress in different divs using a loop?

text:
I got the first post using the loop but I can't get the second post. I would like every post to be in a different div but the same style as the first post. To do this, I would probably need to create more loops. I want to do this so I can get a slide show with div's using jquery. The first part of the loop selects the first image in a post and the second part of the loop removes the image from the text and shows the text using the WordPress format. You can find an example here: http://www.volunteeringnews.com/index2.php Thanks you very much!

                      <?php                 $attachments = get_children(                     array(                     'post_type' => 'attachment',                     'post_mime_type' => 'image',                     'post_parent' => $post->ID                     ));                 if(count($attachments) > 0) { ?>                     <?php                         $attachments = get_children(array('post_parent' => get_the_ID(), 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order'));                         if ( ! is_array($attachments) ) continue;                         $count = count($attachments);                         $first_attachment = array_shift($attachments);                         ?>                         <?php echo wp_get_attachment_image($first_attachment->ID, 'medium'); ?>                          <?php } else { ?>                                              <?php } ?>

                  <?php                      //Show first post only             add_filter('the_content', 'narga_excerpts');                 query_posts('showposts=1');                 $ids = array();                 while (have_posts()) : the_post();                 $ids[] = get_the_ID();                 //Add remove filter first image                 function remove_first_image ($content) {                 $content = preg_replace("/]+\>/i", "", $content, 1);                 return $content;}                 add_filter('the_content', 'remove_first_image');                 //Get post format                                get_template_part( 'content', get_post_format() );                 //Remove remove filter first image                 remove_filter( 'the_content', 'remove_first_image' );                 remove_filter( 'the_content', 'narga_excerpts' );                           endwhile;             ?>


title: Parent class for menu items don't work

text: I tried it with the function extracted from this page: http://codex.wordpress.org/Function_Reference/wp_nav_menu#How_to_add_a_parent_class_for_menu_item I added the code to my functions.php, but I can't find any element with the class 'parent-menu-item', despite having several pages with sub-items in my WordPress installation. What could I possibly be doing wrong here? Any other functions in my functions.php are working without problems.


title: the_title() shows title of the first post instead of the page title?

text:
I'm occasionally facing this problem and not sure what causes it, any ideas?               <?php get_header(); ?>

<?php the_title(); ?>
                 <?php get_template_part( 'loop', 'index' ); ?>
     <?php get_footer(); ?>      For a normal page the_title returns "Page title". But for a blog (using loop.php as in index file above) it returns "First posts title". Any ideas?


title: Can't access my wp admin

text: I have a wp website.. i love it asit's easy to update. the website is still live and is working fine but i went to use the wp admin lastnight and for some reason it suddenly won't let me access the wp admin, it gives me a http 403 forbidden message and says this website declined to show this wep page. Please help as i really need to update it.


title: Image slider file 'featured.php' is not automatically sliding images (but works in local server)

text:
I edited the Image slider file featured.php to retrieve the image files from some local folder instead of media gallery (and/or posts). It **works perfectly on local server**. But when I upload it to the site it showed up but stopped animating (sliding automatically). However, slides change when the control buttons are clicked. I tried to put back the original featured.php and looked if it works, but it didn't. I went through all the code and related scripts but can't understand the problem. Is it a javascript problem? Any ideas? (Let me add some details) it comes with a theme called "ElegantEstate". The original file looks like this:
              <?php global $ids;         $ids = array();         $arr = array();         $i=1;              $width = 954;         $height = 289;         $width_small = 49;         $height_small = 49;              $featured_cat = get_option('elegantestate_feat_cat');          $featured_num = get_option('elegantestate_featured_num');               query_posts("showposts=$featured_num&cat=".get_catId());                   while (have_posts()) : the_post();             global $post;                $arr[$i]["title"] = truncate_title(20,false);             $arr[$i]["fulltitle"] = truncate_title(250,false);                  $arr[$i]["excerpt"] = truncate_post(320,false);                  $arr[$i]["permalink"] = get_permalink();                  $arr[$i]["thumbnail"] = get_thumbnail($width,$height,'',$arr[$i]["fulltitle"],$arr[$i]["fulltitle"],false,'featured_image');             $arr[$i]["thumb"] = $arr[$i]["thumbnail"]["thumb"];             $arr[$i]["thumbnail_small"] = get_thumbnail($width_small,$height_small,'',$arr[$i]["fulltitle"],$arr[$i]["fulltitle"]);             $arr[$i]["thumb_small"] = $arr[$i]["thumbnail_small"]["thumb"];                  $arr[$i]["use_timthumb"] = $arr[$i]["thumbnail"]["use_timthumb"];                  $custom = get_post_custom($post->ID);             $arr[$i]["price"] = isset($custom["price"][0]) ? $custom["price"][0] : '';                  $i++;             $ids[]= $post->ID;         endwhile; wp_reset_query(); ?>
             <?php for ($i = 1; $i <= $featured_num; $i++) { ?>                 <?php if ($arr[$i]["title"] == '') break; ?>
                     <?php print_thumbnail($arr[$i]["thumb"], $arr[$i]["use_timthumb"], $arr[$i]["fulltitle"] ,$width, $height); ?>

                             <?php }; ?>

             <?php _e('Previous','ElegantEstate');?>                   <?php for ($i = 1; $i <= $featured_num; $i++) { ?>                 <?php if ($arr[$i]["title"] == '') break; ?>                 <a href="#" class="smallthumb<?php if ($i==1) echo(' active'); if ($i == $featured_num) echo(' last'); ?>">                     <?php print_thumbnail($arr[$i]["thumb_small"], $arr[$i]["use_timthumb"], $arr[$i]["fulltitle"] ,$width_small,$height_small); ?>                              <?php }; ?>                  <?php _e('Next','ElegantEstate');?>

            And it is included in the theme's home.php file. You can see it at http://www.addiscityservices.com/. The control buttons work but the auto sliding is off. Don't know why.


title: How can i show categories of custom post

text: I make my `custom post` and the name of that custom post is `FAQ`. so now i want to show the `categories` of that `post`. The code i am using for this is               <?php wp_list_categories('orderby=name&include=3,5'); ?>      But this not showing the post of that `custom post` type. What can i do to get the `categories` of that `custom post` type.


title: Integrate post tags in Post Edit page with qTranslate

text: # Summary In the **tags widget** in the **Post Edit page** , I need to know a way to **filter** through:   1. the **tags suggestions**   2. the **tag terms update** when **saving or updating the post** At least that is what I think I need. ![enter image description here](http://i.stack.imgur.com/FsLX0.jpg) # My Case I'm using **qTranslate** _(v.2.5.32)_ to create a multilingual frontend as well as **backend**. My concern here is **showing the translated taxonomy terms in the backend** , specifically **the post tags in the Post Edit page**. qTranslate handles taxonomy translations by using **custom fields (metaboxes)** in the **taxonomy edit page** , one for each language, which are saved to the **options table** database. The plugin translates taxonomy terms in the frontend very well, but **in the backend they don't translate**. Only terms in the **default language** are displayed despite the current language being viewed. ## My Hack So Far Now I managed to create a **hack** so that the terms in the right language would be displayed by using the code below:               if (is_admin()) {            /**        * Fix translation for:        * - Taxonomy & custom taxonomy names in Post Manage page        * - List of tags already added to the post in Post         *   Edit page (but have issues when saving)        */         function mod_wp_get_object_terms_qtranslate($terms, $obj_id, $taxonomy, $args) {              // $taxonomy output seems to be wrapped         // in single quotes, thus remove them to         // make the output valid         $tax = str_replace("'", "", $taxonomy);              if ( !is_taxonomy_hierarchical($tax) ) {                $meta    = get_option('qtranslate_term_name');           $lang    = qtrans_getLanguage();                if ( !empty( $terms ) ) {             foreach ($terms as $term) {               $term->name = $meta[$term->name][$lang];             };           };              }              return $terms;       }       add_filter( 'wp_get_object_terms', 'mod_wp_get_object_terms_qtranslate', 0, 4 );                 /**        * Fix translation for:        * - Taxonomy names in Taxonomy Manage page        * - 'Popular Tags' in Taxonomy (Tags) Manage page        * - Category filter dropdown menu in Post Manage page        * - Category list in Post Edit page        * - 'Most Used' tags list in Post Edit page        *   (but have issues when saving)        */         function mod_get_terms_qtranslate($terms, $taxonomy) {              $meta    = get_option('qtranslate_term_name');         $lang    = qtrans_getLanguage();              if ( !empty( $terms ) ) {           foreach ($terms as $term) {             if ($meta[$term->name][$lang]) {               $term->name = $meta[$term->name][$lang];             }           };         };              return $terms;       }       add_filter( 'get_terms', 'mod_get_terms_qtranslate', 0, 3 );          }      ## The Problem The problem now is in the **tags widget** in the **Post Edit page**. Though I managed to translate the list of tags that are already **added to the post** and the ones in the **'Most Used' list** , I am encountering the following issues:   1. Unable to get the **tags suggestions** to show the **translated version of the terms**. Currently it only suggests terms if I typed in terms from the default language.   2. When the post is **saved/updated** , translated tags from the **added tags list** (either newly added or the existing ones) and from the **'Most Used' list** are treated as **new tags** by Wordpress. If I added terms in the default language, then they will be saved normally. **How do I fix the above issues?** ## What I Have Tried In the first function from my hack above (ie. `mod_wp_get_object_terms_qtranslate`) I added `wp_update_term` inside the `foreach` loop so that the **term data** itself is updated to reflect the current language being viewed. I would assume this would result in retrieving the correct language in the **tag suggestion** list and in **updating the post**.               foreach ($terms as $term) {       $term->name = $meta[$term->name][$lang];            wp_update_term($term->term_id, $taxonomy, array(         'name' => $meta[$term->name][$lang]       ));          };      This didn't seem to work in that the **term data was not updated**.


title: How to place comments_template(); outside the loop?

text:
I am making a new template and I need to place the comments template outside the wordpress loop and just above the footer in the single.php file. I searched on google and the best answered I could find related to my issue is in this link: http://stackoverflow.com/questions/6384205/displaying-the- wordpress-comments-template-outside-the-loop However, that did not work. The same comments are appearing on all posts. So, how can I display the comments display outsite the wp loop? EDIT: This is the single.php file               <?php     get_header(); ?>

                  <?php while ( have_posts() ) : the_post(); ?>                      <?php get_template_part( 'content-single', get_post_format() ); ?>
<?php _e( 'Post navigation', 'twentytwelve' ); ?>
                     <?php previous_post_link( '%link', '' . _x( '←', 'Previous post link', 'twentytwelve' ) . ' %title' ); ?>                     <?php next_post_link( '%link', '%title ' . _x( '→', 'Next post link', 'twentytwelve' ) . '' ); ?>                                             <?php endwhile; // end of the loop. ?>

         <?php get_sidebar(secondary); ?>         <?php get_sidebar(); ?>
          <?php     comments_template( '', true );     ?>           <?php get_footer(); ?>


title: How to use same theme in different languages?

text: I have a network of wordpress sites For example rara.org (English) rara.org/fr (French) Now I want to use the same theme which is lets say "Mytheme" for both but I also want the in the french site words like "Search" is in french, the dates that are shown are in french and so on. How can I achieve this? Please help me out.


title: Append 'Continue Reading' link if post length is more than 3 lines of text?

text: I'm pretty new to coding for Wordpress, bear with me. I have a section on my home page, that lists the 2 most recent blog posts. If the text goes past three lines, my design gets messed up. So I was wondering if there was a native function that exists for me to append 'Continue Reading' automagically and allow the user to click that link to bring them to the full blog post? For example, this is what I do NOT want: ![Bad](http://i.imgur.com/Vld41Gu.png) This, is what I do want, I did the design in Photoshop and this is what I'd like to happen if the posts are going to be longer than 3 lines of text. ![Good](http://i.imgur.com/jOiMJTC.png) Thanks, I'll try to clarify anything if need be!


title: Problems with moving my Wordpress site to another domain/server

text: I'm having problems moving a wordpress site from one domain to another. I've searched the site but couldn find a useful answer for my situation. Here's what i did: I made a backup of the website. Then i exported the database. Then i installed Wordpress on the other domain. Then i copied all my Wordpress files of the old website on the new server overwriting the new installation. Then i deleted everything from the database on the new server and imported the database of the old server. Then i changed the database name and bpassword in the wp- config file. So i did all this but the new site isn't working, and i don't know where it went wrong? So i'd like to start over, but what should i do different? Thankyou for your help!


title: PHP and video embed code opening in a lightbox

text:
I have a theme that is using PHP to create a link to a specific video page via permalink:               <div class="portfolio_filter_item <?php echo $category_string;?>">

                                                     <a href="<?php the_permalink(); ?>">                                                         <img src="<?php echo $project_thumb;?>">

                                                             **<a href="<?php the_permalink(); ?>"> <?php the_title(); ?>**      Instead of referencing the permalink of the page, I need it to reference the embed code of the video on the page so I can open the link in a lightbox. I've installed a lightbox on the site that should automatically add the lightbox effect to any class "video lightbox.iframe". Any ideas? Thanks!


title: register_theme_directory and broken deploys

text: I use `register_theme_directory()` in a mu-plugin to register a custom theme directory (located at `project_root/app/views/`, with site_root at `project_root/public/` and WordPress in a Git submodule at `project_root/public/wp/`. `WP_CONTENT_DIR` is at `project_root/public/content`). I also use Capistrano to deploy my project. Every time I deploy, the site breaks, and I get this message in my Dashboard: > ERROR: The themes directory is either empty or doesn’t exist. Please check > your installation. When I navigate into the Appearance tab, my theme doesn't appear on the list until I refresh the page. After refreshing, I can see my theme, activate it, and everything works again. Why might this be happening on every deploy? I am confused as to why WordPress would think the theme doesn't exist, when it definitely does.


title: How do i keep my current page menu highlighted on pagination?

text:
I have a navigation menu in a page that highlights the current menu you’re on based on the URL by adding a class. My problem is that my page is paginated, so sometimes the user will end up at: `http://example.com:4001/wordpress/calientes/page/2/` , /page/3/ , /page/4/ and so on... what’s the best way to keep my menu highlighted while the user is browsing the pages? This is my menu:

 Calientes

Tendencias

      This is the Script that use to highlight the current page menu:


title: How to add terms to a post depending on its title?

text: I want to add all posts with keyword "Dog Training" in the post title to a specific category. Reason: If you enter something into WordPress search it's not an exact match. Previous WordPress search was much more accurate but they gimped it now. Note the space between the words.


title: Adding custom taxonomy term on post_save for custom post type

text: I have a custom post type called course and a custom taxonomy called courses. What I am trying to achieve is that when a user creates a Course post, it automatically adds the post title as a Courses term.               function lms_add_course_term( $post_id ) {          if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )            return;          $post_type = get_post_type($post_id);          if ($post_type !== 'course')      return;      $course_title = get_the_title( $post_id);               // See if the post is already associated with the term     if ( has_term($course_title, 'courses') ) {     return;          }           else {           wp_set_object_terms( $post, $course_title, 'courses', true );          };           add_action( 'save_post', 'lms_add_course_term' );          }      Can't figure out what I am doing wrong. The code returns no errors but nothing else happens.


title: Setting comment text as required

text: I want to set also text comment as required... but in the backend only email and author are possible. Without using a javascript validation, how it is possible? Thank you


title: Filter subpages in while loop from WP Query object

text:
I'm looking to optimize a page where I'm using several queries (with WP Query) to retrieve similar data, and I'm considering merging these queries together then filtering for relevant data once inside a loop. In one of the loops I want to not display subpages even though they are fetched with the query. I'm thinking along the lines of this -                   $query = new WP_Query();              $query->query( 'post_type=pages' );              // Menu, need to remove subpages here         while ( $query->have_posts() ) : $query->the_post();         if (!is_page(the_post());             $menu .= '
' . get_the_title() . '
';         endif; endwhile;      Not sure how to accurately use this statement though, any ideas? Edit: Never mind, solved it using "if( $post->post_parent == 0) { }" after initiating the while loop.


title: Getting the action's tag name within the action

text: There's a function attached to a set of actions, like this:               add_action('some_tag', 'the_function');          function the_function($maybe_some_vars){       // ...     }      Is it possible to find out the action name ("some_tag") within the_function? The reason I'm asking, is that I'm attaching the function to multiple actions (some of them custom, some belong to WP like `the_content`). The code that executes within the function depends on knowing the name of the action. I did manage to get it using `debug_backtrace()`, but I'm pretty sure that's not a very reliable way.


title: Wordpress - custom navigation item classes

text:
I am trying to create something that looks roughly like this:

Home

About

Blog

         <button id="menu" class="menu-button" type="button" role="button" aria-label="Menu Toggle">                    </button>           Given that I am placing the button inside the navigation for mobile is controversial, however at the moment it's the least of my worries. I can't work out how to get custom classes on to my nav items. I'm using Bones as a starting point for my project and I've got most things figured out, but this one, after much googling is still to be resolved. The current function that does my nav is:               function bones_main_nav() {         // display the wp3 menu if available         wp_nav_menu(array(             'container' => false,                           // remove nav container             'container_class' => 'menu clearfix',           // class of container (should you choose to use it)             'menu' => __( 'The Main Menu', 'bonestheme' ),  // nav name             'menu_class' => 'nav top-nav clearfix',         // adding custom nav class             'theme_location' => 'main-nav',                 // where it's located in the theme             'before' => '',                                 // before the menu             'after' => '',                                  // after the menu             'link_before' => '',                            // before each link             'link_after' => '',                             // after each link             'depth' => 0,                                   // limit the depth of the nav             'fallback_cb' => 'bones_main_nav_fallback'      // fallback function         ));     } /* end bones main nav */      Any help with this would be VERY much appreciated. Because it's such a custom navigation that very specific, would I be better to just make a static nav?


title: On Plugin Activation, How Do I Check for Proper Transport Mechanism?

text: For a plugin that communicates with somewhere else, I hear we're supposed to use wp_remote_post and wp_remote_get instead of PHP's Curl library. Okay, but is there a fast and proper way on plugin execution to test for a blog's PHP/host OS to have the proper transport mechanism installed? I mean, I could attempt a test POST, but thought WP might have a better, faster mechanism that I can test for? Doing the following is unacceptable:               if (!function_exists('curl_exec')) {         wp_die('The CURL API is not installed with PHP. You cannot use this plugin without that. Ask your web hosting provider to install it.');     }


title: Custom Query Fields - Altering Meta Value

text: I'm giving Custom Query Fields a shot for filtering/sorting posts on the front-end of a site. The instructions seem pretty self-explanatory, but I do have another layer that I'm trying to figure out. For one of my custom fields, it is currently storing a fractional number. I am controlling the input so only values like `3 3/4` or `1/5` are accepted (to not break any type of fraction format). This is done due to how the values need to be displayed on the site and the specificity needed (these are for product dimensions). Then, I am using a data attribute, run through the following function to convert the fraction to a decimal:               function fraction_to_decimal($input) {         $fraction = array('whole' => 0);         preg_match('/^((?P<whole>\d+)(?=\s))?(\s*)?(?P<numerator>\d+)\/(?P<denominator>\d+)$/', $input, $fraction);         if (isset($fraction['denominator']) && isset($fraction['numerator'])) {             $result = $fraction['whole'] + $fraction['numerator']/$fraction['denominator'];             return $result;         }         else {             return $input;         }     }      The reason I am doing this on the front-end display and not in the admin is for two reasons:   1. Simplicity for the user to enter (enter in a fraction as you normally would)   2. Going from fraction to decimal suits my needs for filters using http://isotope.metafizzy.co/ The reason I am introducing `Custom Query Fields` into the mix is for my interest in removing Isotope from the setup and rely more on core WordPress filter/sort capabilities. _So - onto the actual question_ Since my meta_values are stored as a "broken" integer, `3 3/5` until they are run through that function, is there a way to intercept the meta value interpretation of Custom Query Fields to get the decimal value instead? Thanks for any help!


title: How to Query Database for posts with certain Taxonomy Term

text: I want to write a select query to return data on only posts which have are associated with the taxonomy term `food-and-beverage`               SELECT wp_postmeta . * , wp_posts.post_name     FROM wp_posts, wp_postmeta, wp_terms, wp_term_relationships     WHERE wp_posts.post_type =  'projects'     AND wp_posts.post_status =  'publish'     AND wp_posts.ID = wp_postmeta.post_id     AND wp_term_relationships.object_id = wp_posts.ID     AND wp_term_relationships.term_taxonomy_id = wp_terms.term_id     AND wp_terms.slug =  'food-and-beverage'     ORDER BY wp_posts.ID DESC       For some reason unknown to me, this is returning posts which do not have `food-and-beverage` selected As evidenced by the answer below, this is not the ideal approach, yet it is one that I've committed to, as refactoring the code (this is generated SQL, and theres lots more of it) would take me forever. **EDIT** * * * Since everyone seems to be in agreement (myself included) that the way I'm doing this is wrong, I'm going to reluctantly try to refactor. However, I'm going to leave the question open for the time being in case someone can put together a quick fix for me (I'll happily drop you some **bounty points** ). For the bold/crazy, here is a gist with a big chunk of the source: https://gist.github.com/2950395 I pass the ajax it a couple "filters" as POST variables.


title: Custom MySQL query to list post

text: I have the following query:               SELECT       p.*     FROM       orders_items oi       INNER JOIN products pr         ON pr.`post_id` = oi.`product_id`       INNER JOIN posts p         ON p.`ID` = pr.`post_id`         AND p.`post_type` = 'product'     GROUP BY oi.`product_id`     ORDER BY COUNT(oi.id) DESC;      I want to list the post based on the above query. Can anyone please tell me how can change the following code to incorporate above query?                   $args = array(             'posts_per_page' => '10',             'post_type'      => 'product',             'paged'          => '1'         );         global $query_string;         query_posts($args);      Any help guys?


title: How do I pass the template url to javascript in the ADMIN area of my theme?

text: I need to pass the path to a php file (located in a folder in my theme) to a JS file being used in my admin area but I have no idea how to accomplish that. What Im trying to do, is build a page where selecting some options in a form will pass the input's value to a php script via ajax. But because JS is client side, I dont know how to point to the correct location. I tried testing using this:               <?php       wp_enqueue_script( 'some_handle' );         $translation_array = array( 'some_string' => __( 'Some string to translate' ), 'a_value' => '10' );         wp_localize_script( 'some_handle', 'object_name', $translation_array );         wp_enqueue_script("admin", $adminDir."js/admin.js", false, "1.0");        ?>      with this in my admin.js:                console.log(object_name.some_string);       But console just reads:               ReferenceError: object_name is not defined


title: Add function to Simple Twitter Connect to not Tweet pages

text: How would I add the capability in Simple Twitter Connect (in the stc- publish.php file) to not tweet pages, either newly published or edited? I don't need it to be an admin option, just a change for a few of my sites. It looks like this function would be a good place to add the "don't tweet pages" capabilty (while retaining the check to prevent edited posts from being tweeted) as it checks for edited posts. How can one differentiate between posts and pages?               // this new function prevents edits to existing posts from auto-posting     add_action('transition_post_status','stc_publish_auto_check',10,3);     function stc_publish_auto_check($new, $old, $post) {         if ($new == 'publish' && $old != 'publish') {             $post_types = get_post_types( array('public' => true), 'objects' );             foreach ( $post_types as $post_type ) {                 if ( $post->post_type == $post_type->name ) {                     stc_publish_automatic($post->ID, $post);                     break;                 }             }         }     }      **Edit 4/03/11** Answer and better edit below.


title: Set default custom post type for XML-RPC

text: So now that it is possible to work with Custom Post Types over XML-RPC, has anyone figured out a way to set the post type for all items coming in via XLM- RPC to a default post type? IFTTT has a WordPress action that lets you create a photo post via XML-RPC. Both are coming through as default posts, and I would like to make it possible to set all posts coming in over XML-RPC to a custom-post type. Any thoughts?


title: Get Recent Posts by Date in Multisite

text:
Everything in explanation is about **CDTuts** I've created a **WordPress Network** and I want is to get the recent posts from all of the selected subdomain blogs. I need to get the latest **All** organized by date and not organized by _blog ID_. I don't want to use **switch_to_blog** thus, using foreach, because I'm only looping posts within the next blogs I switch. I want to actually combine the posts and have them all organized by date. I'd figure you'd have to do this by querying mysql instead of using WP_Query. But I was hoping for a more native way of doing this. This is for the list of posts to be made at the bottom of the front page as you can see with timestamps that aren't ascended or descended by the number greater or lesser. I even tried doing something like this, but this wouldn't work either. Sorting the post by Unix timestamp, to only realize that the posts are still being organized by **switch_to_blog** instead of a timely manner.               <?php                    switch_to_blog(1);         $main_posts = get_posts();         switch_to_blog(2);         $php_posts = get_posts();         switch_to_blog(3);         $wp_posts = get_posts();         switch_to_blog(4);         $mac_posts = get_posts();         switch_to_blog(4);         $psd_posts = get_posts();         switch_to_blog(1);              $posts = array_merge($main_posts, $php_posts, $wp_posts, $mac_posts, $psd_posts);         usort($post, get_post_time);              foreach($posts as $post){         ?>
<a href="<?php echo the_permalink(); ?>">

                     <?php echo the_title(); ?>
 <?php echo get_post_time(); ?>

         <?php }              ?>      I've also created a function where I can select the ID of the blog using **switch_to_blog**. This will only work on the tiles at the top of the front page. But I'm also trying to do the same for the latest posts at the bottom. I won't be able to create an offset so that I can keep the tile design while maintaining the 6 latest posts. This was based on a previous answer on StackExchange               function global_latest_post($LatestBlogNumber,$LatestPostNumber, $LatestThumbSize, $LatestThumbNumber) {         $original_blog_id = get_current_blog_id();         $bids = array($LatestBlogNumber);                  foreach($bids as $bid) {             switch_to_blog($bid);             $tiles = new WP_Query('posts_per_page=1');             while ($tiles->have_posts()) : $tiles->the_post(); ?>                 <a href="<?php echo the_permalink(); ?>" class="<?php echo $LatestThumbSize; ?> thumb-<?php echo $LatestThumbNumber; ?>">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Read More →

<?php echo $LatestPostNumber; ?>. <?php echo the_title(); ?> in <?php bloginfo('name'); ?>
                              <?php                        endwhile;         }         switch_to_blog( $original_blog_id ); //switched back to current blog     }


title: How to show the homepage on a different url, like site.com/blog instead of site.com?

text: I have Wordpress installed in my root directory, so if you go to site.com you see the list of recent posts. What I want to do is to have the homepage show a static page instead showing recent news etc (I've figured out how to do this), however if someone goes to site.com/blog/, I want to show a list of the recent posts the same way as they show up right now on the homepage. Can I do this - if so, how? P.S the other url doesn't have to be called /blog/, it can be anything, e.g site.com/recent/ or site.com/archive/ would also work. Thanks.


title: Change menu item order

text: My primary navigation menu consists of pages, categories, and custom taxonomy. It appears to be in a random order. How do I adjust the order of the links? (the drag/drop in wp menus panel doesn't seem to have any effect)


title: OOP Plugin: Where should I place the action hooks in the class?

text: Where in my admin class should I place the action hooks for adding css, scripts and the add menu page? In the __construct? Or should they be placed in a method?


title: Hook into admin_notices after sending mail

text: In my (admin) plugin I want to display a message using `admin_notices` action on successful sending of mail. Currently it is not displaying. I know this has something to do with the order of events, but I cannot figure out how to structure it so that the message displays. Currently I'm adding the `admin_notices` action from within an `init` action callback. I'm not sure if this is allowed and therefore this may be the issue. However, if I add it to the `__construct` method, how can I get it to know that the mail has been sent? Currently my `Send_mail` class looks something like:               class Send_mail {         public function __construct() {             add_action('init', array($this, 'send_mail'), 30 );         }              public function send_mail() {             if (!isset($_POST['send-confirmation-true'])) {                 return;             }                  // wp_mail() functionality             // returns true on successful send                  if ($mail_sent == true) {                 add_action('admin_notices', array($this, 'show_admin_notice') );             }         }              public function show_admin_notice() {             // output admin notice html         }     }      === EDIT === After doing some testing, I've found out that actions called after the following if-statement:               if (!isset($_POST['send-confirmation-true'])) {         return;     }      only work if they are hooked to an action that is either `load-(page)` (in my case: `load-post.php`) or before in the action order list. The action I need is `admin_notices` and therefore does not get added. What is causing this behaviour?


title: Easy way to write complex queries in wordpress

text: I want to run one sql query like this in wordpress. Just wanted to know if there is an easy way to do this in wp. Thanks. Is this query possible with the use of query_posts anyhow? ` select p1.meta_value as `avg`,p2.meta_value as total,p1.meta_value*p2.meta_value as product from wp_postmeta as p1, wp_postmeta as p2 where p1.meta_key = 'crfp-average-rating' and p2.meta_key = 'crfp-total-ratings' and p1.post_id = p2.post_id; `


title: Using a private method as an action callback from within a class

text: I have created a class from within which I would like to call a private method (from within the same class) from the `__construct` method as an action callback. When I would like to use a public method I can access it by:               add_action( 'init', array( $this, 'action_callback' ) );      However, this causes an error when the method is private. I have also tried unsuccessfully:               add_action('init', $this->action_callback() );      How do I access a private method? The class looks something like:               class My_class {         public function __construct() {             add_action( 'init', array( $this, 'action_callback' ) );         }              private function action_callback() {             // do something         }     }


title: Is there a way to add another row to the tinyMCE kitchen sink toggle?

text: The tinyMCE "kitchen sink" toggle button shows/hides a row of buttons. I have successfully added my row of shortcode buttons to the tinyMCE editor, but I was wondering if there was a way to make my row only display when the kitchen sink button is clicked. I don't want to add the buttons directly to the kitchen sink row because I have lots of buttons that need their own row. So, can I make the kitchen sink button show two rows instead of one? Or is there some sort of modifier when I add my row to indicate that it should be toggled when the kitchen sink button is clicked? Here is the code I'm using to add my third row of buttons:                   // add shortcode buttons to the tinyMCE editor row 3     function add_button_3() {        if ( current_user_can('edit_posts') &&  current_user_can('edit_pages') )        {          add_filter('mce_external_plugins', 'add_plugin_3');          add_filter('mce_buttons_3', 'register_button_3');        }     }     //setup array of shortcode buttons to add     function register_button_3($buttons) {        array_push($buttons, "dropcap", "divider", "quote", "pullquoteleft", "pullquoteright", "boxdark", "boxlight", "togglesimple", "togglebox", "tabs", "signoff", "columns", "smallbuttons", "largebuttons", "lists");          return $buttons;     }     //setup array for tinyMCE editor interface     function add_plugin_3($plugin_array) {        $plugin_array['lists'] = get_bloginfo('template_url').'/js/customcodes.js';        $plugin_array['signoff'] = get_bloginfo('template_url').'/js/customcodes.js';        $plugin_array['dropcap'] = get_bloginfo('template_url').'/js/customcodes.js';        $plugin_array['divider'] = get_bloginfo('template_url').'/js/customcodes.js';        $plugin_array['quote'] = get_bloginfo('template_url').'/js/customcodes.js';        $plugin_array['pullquoteleft'] = get_bloginfo('template_url').'/js/customcodes.js';        $plugin_array['pullquoteright'] = get_bloginfo('template_url').'/js/customcodes.js';        $plugin_array['boxdark'] = get_bloginfo('template_url').'/js/customcodes.js';        $plugin_array['boxlight'] = get_bloginfo('template_url').'/js/customcodes.js';        $plugin_array['togglesimple'] = get_bloginfo('template_url').'/js/customcodes.js';        $plugin_array['togglebox'] = get_bloginfo('template_url').'/js/customcodes.js';        $plugin_array['tabs'] = get_bloginfo('template_url').'/js/customcodes.js';         $plugin_array['columns'] = get_bloginfo('template_url').'/js/customcodes.js';        $plugin_array['smallbuttons'] = get_bloginfo('template_url').'/js/customcodes.js';        $plugin_array['largebuttons'] = get_bloginfo('template_url').'/js/customcodes.js';        return $plugin_array;     }     add_action('init', 'add_button_3'); // add the add_button function to the page init      However, the row that adds is not toggled by the kitchen sink button.


title: Access the environment of an admin page from another admin page

text: I've been busy thinking about a problem, and so far I didn't find a solution to it. ### The _abstract_ scenario On admin page A, I would like to print the value of a (global) variable--in the context of admin page B, though. ### The _concrete_ scenario On a custom user-options page, I would like to list all metaboxes registered for each post type. Both plugins and the theme can add/remove metaboxes with respect to the current page context (`$pagenow`). Thus, the `$wp_meta_boxes` global is set up in that context. * * * So far, I've read into virtually any hook, read a lot on AJAX (the right and the wrong ways), and tried out numerous different approaches I came up with. Unfortunatly, without luck. ### The question Is it possible to retrieve the value of `$wp_meta_boxes` on admin page `post- new.php?post_type=my_super_duper_post_type`, for instance, from another admin page? If so, how would I go about that? Can this be done via AJAX?   Or can I trick the plugins/theme into thinking that the current page is `post- new.php?post_type=my_super_duper_post_type`, for instance, while we're actually on my options page?


title: Custom taxonomy meta fields

text: I'm trying to make an anime site like myanimelist.net but in spanish with links of the episodes at the bottom. I created a post type called anime, and some custom taxonomies associated with it: series, movies, ovas, specials, live action, producers, themes, genres, and characters. I used advanced custom fields to assign meta fields to the taxonomies with fields like image, synopsis, type, alternative title, episodes, status, aired, producers, genre, themes, duration and rating. Here is what i want to do: Make one template for all the terms from series that displays the fields that i assigned to each one. So people could visit the term and see the information about the series. Example www.example.com/series/one-piece and it shows the information about that specific series. At the bottom they could see the link to each episode(post) assign to that term. I would like someone to help me make that template if its possible or tell me if I'm doing it right using taxonomies with metafields if its not the best way to do what i want to accomplished, point me in the right direction. I been trying to learn how to code php so i know a little, had read about 200 pages of a couple php book while at work but i understand some of the code if a see it. I would really appreciated the help. Thanks a lot in advanced! PD: I can't use Organize Series plugin as that would be only for the series taxonomy and i need it for movies, ovas, specials, etc...


title: Multiple meta_values in the pre_get_posts filter?

text: I have a custom post type with custom fields, the one in particular is "zip". I also have an array that stores like 20 different zip codes. I want to check to see if any of those custom post types have one of those zip codes. If they do, then I want them to appear in the search results. If they don't, I don't want them to appear. How would I go about doing this..? It's driving me insane. Thanks in advance.


title: How to edit the text below "Leave a Reply"

text: I use the Twenty Ten theme, customized. The theme text is: Your email address will not be published. With the email box below, this gives readers the impression that they must enter an email address, yet I set my settings so one is not required. I'd like to edit the text to read: You do not have to leave an email address in order to reply. Can this be done? If so, how? Thank you.


title: Is there any wordpress plugin available to auto share comments?

text: I'm trying to achieve like this. See the image. ![enter image description here](http://i.stack.imgur.com/2jjhC.png) Is there any good free or premium plugin available to add this feature? I know there are some plugins out there like janrain,gigya. But those plugins have limits in free version. Their fee also high. So i don't like their plugin. Any other good plugin available? Thanks


title: Set wp-content folder to Dropbox folder

text: Ideally I would like to do this with both my PC and Mac OSX boxes, but for now I would be thrilled with just the Mac OSX. I am trying to keep my WP Themes & Plugin Local Development synced using Dropbox. I am using XAMPP for both Windows and Mac as my LAMP Stack and am wondering what I have to set in order to get the Mac. Based off the Codex I can do this via setting these two items:               define('WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/somedir');     define('WP_CONTENT_URL', 'http://example.com/somedir');      I am successful in changing `WP_CONTENT_DIR` to _/Users/seth/Dropbox/Xammp- Content/wordpress/wp-content/_ , which allows me to see my available themes and activate them, however any of the resources (styles.css, images, etc.) doesn't resolve and thus I have a bunch of failed GETs on the resources and the theme is unstyled. Upon further inspection this is the URL resolved for styles.css > _http://localhost:8080/wp-content/themes/[theme-name]/styles.css_ Which again is a failed resource to load. I have no idea what to set `WP_CONTENT_URL` to... Any help? Appreciate it.


title: How to configure Wordpress to be a subdirectory of my main site as mymainsite.com/blog?

text: I have developed a site www.mainsite.com based on Ruby on Rails hosted on Heroku. I have also developed a blogging site based on Wordpress at blog.mainsite.com hosted on Dreamhost. I want our users to interact with www.mainsite.com/blog instead of blog.mainsite.com. I have each site function correctly, and the DNS setup correctly. I also set up reverse proxy in Rails to route traffic reverse_proxy /^/blog(/.*)$/, 'http://blog.mainsite.com$1', opts={:preserve_host => true} Most of the time it work. After I messed with the permalinks and restored it, now in Wordpress, whenever I upload a media file (image), it always sends me to www.mainsite.com/wp-admin (404) instead of www.mainsite.com/blog/wp-admin. What is the problem?


title: How to map sub-directory to second wordpress multisite?

text: I have setup a two sites using one wordpress installation. The issue that I have now is that I can only access each site via `/blog/` and `/blog/support/`. I want to access the support section using `/support/`. So I created a symlink to the blog directory using a new directory named support. Although this does take me to my wordpress install. It is having issues loading up site 2 even though I have changed the site 2 home and siteurl to `/support/`. All it does is throw a 404 error. How do I get a multi-site wordpress install to work with sub-directories? There is a lot of documentation for multi-domain mapping but not much for the above.


title: How can I make a custom post type that loops pages in a new dashboard page, each single page is a new dashboard page (all within the back-end)?

text: I've been wanting to make the most out of WordPress, to use it more and more like a CMS as it truly is a wonderful project. Out of all the CMS/Blogging webapps, WordPress wins in my book. I understand how to create a post-type. What I don't understand is how to make pages within the dashboard, and how to add a sidebar menu item with the links. Also, I would like to know how to make the new posts of the custom post-type display only on the dashboard, as a back-end documentation base, or CRM. Of course I could always use a plugin, but then the opportunity for not only myself to learn would be lost, the opportunity to show the many visitors of this site how to achieve the same thing would be lost as well. Let the Answers begin! P.S. I'm so very grateful for all of the help you all give to the community here. I've searched for this topic and couldn't find it, if this topic is already answered here, please comment with the link to the question with the answer. Thanks!


title: Permalink Trouble with custom post types

text: When using custom post types I reach a dilemma where I have to use flush_rewrite_rules(); when using a permalink structure, otherwise it goes to a 404. After using it It works on one CPT but if you have 2 or 3, I still have the same problem and have to back to the basic permalink settting. If you could help me, that would be great.               add_action('init', 'video_register');          function video_register() {          $labels = array(         'name' => _x('Video', 'post type general name'),         'singular_name' => _x('Video', 'post type singular name'),         'add_new' => _x('Add New', 'Video'),         'add_new_item' => __('Add New Video'),         'edit_item' => __('Edit Video'),         'new_item' => __('New Video'),         'view_item' => __('View Video'),         'search_items' => __('Search Video'),         'not_found' =>  __('Nothing found'),         'not_found_in_trash' => __('Nothing found in Trash'),         'parent_item_colon' => ''     );          $args = array(         'labels' => $labels,         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,         'query_var' => true,         'menu_icon' => null,         'rewrite' => true,         'capability_type' => 'post',         'hierarchical' => false,         'menu_position' => null,         'taxonomies' => array('post_tag'),         'supports' => array('title','editor','thumbnail','custom-fields',   'comments',)                 );           register_post_type( 'video' , $args );     flush_rewrite_rules();     }      This is what I'm adding for my custom post type. Thank you.


title: Can't activate Plugin: unexpected T_STRING, expecting T_FUNCTION

text: I'm writing a plugin but have a problem. I wanted to make an upload form for my existing plugin, so I don't need to upload every picture with the Media Uploader and Copy&Paste the URL in the form. I used this tutorial: Tutorial Now, when I wanted to install the updated Plugin I get the following error message: > Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION in > /var/www/intern/wpkkbk/wp-content/plugins/widget-plugin.php_/widget- > plugin.php on line 133 The code I added looks like this (line 133: `add_action(...)`):               function my_admin_script($hook) {         if ($hook != 'widgets.php')             return;                       wp_enqueue_media();             wp_register_script('my-admin-js', plugins_url('widget-plugin.php_/js/upload.js', dirname(__FILE__)), array('jquery'));             wp_enqueue_script('my-admin-js');          }     add_action('admin_enqueue_scripts', 'my_admin_script');      I don't know, where I made a mistake. It didn't even work, when I used the exact same code from the tutorial. Any suggestions!


title: Wordpress admin bar showing pending comments which cannot be selected or modified after deleting parent page

text: My Wordpress admin interface shows there are 4 pending comments, but I've already approved three and deleted one of them via Disqus comment moderation page, but the page they were posted on was later deleted. I then posted two comments myself on a test page, deleted the page, and they are still shown as pending on Wordpress admin. How do I remove them from pending comments list? Page the comments have been posted to is removed, so they do not have anything in "in response to" column, these comments also do not have a checkbox next to them, so I can't select them. There are also no options appearing when hovering above the comment on pending comments moderation page. I just recently installed WordPress to my site and it doesn't have anything custom but Disqus. * * * I am absolutely new to WordPress, so please explain each step of possible solution in detail.


title: How can i do something after head like adding a hook for after head but before post

text:
What i mean is i am trying to add breadcrumbs to my blog and i thought of adding it before content or after title but there's an issue with that - on archive pages or category pages the breadcrumbs appear for every posts. so i figured i have to attach the breadcrumbs to something above the post - like the head. how can i do that ? this is what I've done so far for the content:               add_filter( 'the_content', array($this, 'adding_bread_crumbs') );     function adding_bread_crumbs( $content ) {         /* Getting the current page permalink and site url */         $pageURl = preg_replace('/\/$/','',get_permalink());         $homeURL = preg_replace('/\/$/','',site_url());              if ( function_exists('yoast_breadcrumb')) {             /* Checking if the current page is home page */             if($pageURl != $homeURL && !is_page('Home')){                 $breadcrumbs = '
';                 $breadcrumbs .= yoast_breadcrumb('
','
',false);                 $breadcrumbs .= '
';                 $content = $breadcrumbs.$content;             }         }         return $content;     }      Is there anything that would replace 'the_content' another hook maybe? or is there an action i have to use ? Thanks


title: How can I hook into creating a new post and execute wp_die(), before the post is inserted into the database?

text: Info about wp_die from codex: Kill WordPress execution and display HTML message with error message. A call to this function complements the die() PHP function. The difference is that HTML will be displayed to the user. It is recommended to use this function only when the execution should not continue any further. I have code:               function myHook( $post_ID, $post )     {          wp_die('Error', 'Error',  array( 'response' => 500, 'back_link' => true ));     }     add_action( 'save_post', 'myHook', 0, 2 );      Problem is that error page appears, but post is still inserted. Shouldn't saving be interrupted by this hook? If I misunderstood description, how can I break execution so post will not be saved? EDIT: I just found that save_post is called after instert to database not before. Does there exist any function called before insert that i can hook into? Thanks in advance


title: Get author custom image field URL to display on post page?

text: I'm using advanced custom fields and have setup an image field for my users to add an image in their profile. I'd need to display this image on post pages, so i've tried the following...               <?php     $attachment_id = the_author_meta('author_logo');     ?>     <?php echo the_author_meta('author_logo'); ?>     <?php wp_get_attachment_image_src( $attachment_id )?>      <?php wp_get_attachment_url( $attachment_id ); ?>      The output is always the image attachment ID never the URL. What can I change to output the image path URL? Thanks


title: Show subcategories and hide posts or show posts if not exists subcategories

text: I'm trying to make a WordPress blog where in the index page only Parents Categories appear. In second page need to appear SubCategories and hide posts, if not exists SubCategories show posts for the Parent Category. Here is the structure.


title: Can my "add_action" function know the name of the hook calling it?

text: Lots of hooks:               add_action('thesis_hook_after_comment', 'pj_time');     add_action('thesis_hook_after_comments', 'pj_time');     add_action('thesis_hook_after_comment_box', 'pj_time');     add_action('thesis_hook_after_comment_meta', 'pj_time');     add_action('thesis_hook_after_content', 'pj_time');     add_action('thesis_hook_after_content_area', 'pj_time');     add_action('thesis_hook_after_content_box', 'pj_time');     add_action('thesis_hook_after_footer', 'pj_time');     add_action('thesis_hook_after_header', 'pj_time');     add_action('thesis_hook_after_headline', 'pj_time');     // etc.      How can `function pj_time()` know which hook called it? Is there a global variable or something that tells me which hook we're on? So pj_time() could output something like: "The hook (name of hook here) rocks." I don't know the order the hooks are called either, they're just in alphabetical order here. Otherwise I could use a counter to figure how many hooks we've done so far and determine the name of the hook that way. So I want to know if it's possible to get the name of the hook. Thanks.


title: Custom Posts Types as Custom Fields

text: I have three Custom Post Types: Book, Volume and Chapter where one Book can contain many Volumes and one Volume can contain many Chapters. I want to do something like this:   1. The user access "Books" ![enter image description here](http://i.stack.imgur.com/8HbQL.png)   2. The user select a book for editing and, inside that page, on the meta box, he can add/edit just the volumes relating to that book ![enter image description here](http://i.stack.imgur.com/JArg2.png)   3. The user select a volume for editing and, inside that page, on the meta box, he can add/edit just the chapters relating to that volume ![enter image description here](http://i.stack.imgur.com/wpY5K.png)   4. The user finally select a chapter to edit ![enter image description here](http://i.stack.imgur.com/N8cLt.png) I initially thought of putting an iframe inside the meta box area on the post types using the `src` attribute as `edit.php?post_type=post_type` with some filters on its query string, to list just the post type related to the respective page. What would be best in that situation? Is that a pattern on WordPress to work with situations like that, where Custom Post Types needs to be Custom Fields of another Custom Post Type, i.e. one to many entity relationship?


title: How to get variation by order id on WooCommerce?

text: I am trying to get variation from `wp_woocommerce_order_itemmeta` by order id. My products have detail terms but I can't find them. It looks like this on `wp_woocommerce_order_itemmeta`:               431 52 _variation_id 27978      432 52 _line_subtotal 30000      433 52 _line_total 30000      434 52 _line_tax 0      435 52 _line_subtotal_tax 0      436 52 Duration 7       And I have been trying to get many ways... but I can't really get them. I need to get "Duration" or "veiw_resume" value by order id               function check_quantity($order_id) {              global $wpdb;              $order = new WC_Order( $order_id );         $items = $order->get_items();              foreach ( $items as $item ) {             $product_name = $item['name'];             $product_id = $item['product_id'];             $product_variation_id = $item['variation_id'];             $pa_version = $item['pa_version'];         }                    $versionvalues = get_the_terms( $product_id);              foreach ( $versionvalues as $versionvalue ) {             //echo $versionvalue->name;             $pa_version2=$versionvalue->name;         }              //$result = array_shift(woocommerce_get_product_terms($product_id, 'pa_view-resumes', 'all'));              /*global $wpdb;         $result = $wpdb->get_results('select t1.order_item_id, t2.* FROM          wp_woocommerce_order_items as t1 JOIN wp_woocommerce_order_itemmeta as t2 ON t1.order_item_id = t2.order_item_id         where t1.order_id='.$order_id);         echo '<pre>';         print_r($result);         echo '</pre>';          */              //get item-meta for job/resume         //$wpdb->get_results ( "SELECT * FROM wp_woocommerce_order_items" );              //Resume-27905-27979              $metakey    = "order_info_kcm";         $metavalue  = $product_name."-".$product_id."-".$product_variation_id."-".$pa_version."-".$pa_version2."-".$result;              $wpdb->query( $wpdb->prepare( "INSERT INTO $wpdb->postmeta ( post_id, meta_key, meta_value ) VALUES ( %d, %s, %s )",              $order_id,              $metakey,              $metavalue              ) );


title: How do I pass a post ID to the page URL?

text: I am using a form (gravity form) on my site. The form is inserted in a page (called form_page) on the users dashboard when they are logged in `http://example.com/dashboard/form_page` I am using a plugin (see below) to dynamically populate the form with content from the post the user is author to. However I need to pass the POST ID to the URL for it to work. So the URL would end up looking like this `http://example.com/dashboard/form_page?gform_post_id=476` This works. However, I am manually appending the `?gform_post_id=476` to the end of the URL to test the concept actually works and it does. However I have no idea how to dynamically pass this post ID to the end of the URL of the page for an Author who is logged in. It might help to know that the "Author" will only have 1 post associated with them. So (out loud) I am thinking there might be a way to GET the POST_ID associated with the logged in USER and then pass it to the URL of that particular page. I am just not sure how to connect the missing piece of this puzzle and would appreciate some guidance. Cheers in advance... My effort so far is as follows `<?php foreach(get_posts(array('author' => $author_id)) as $post)?> <a href="http://example.com/dashboard/form_page?gform_post_id=<?php echo $post->ID ?>">Link</a>` But this seems to get first POST ID the site. Not the ID of the Authors POST. Note: It is a custom post. Plugin used: http://wordpress.org/extend/plugins/gravity-forms-update-post/


title: Show widget when not using SSL

text: My wordpress site supports http and https. What I want to do is to add a widget when surfing over http that says something like "Surf this site secure" to show the visitor that I also have a secured version. I don't want to force them to surf over SSL because I'm using a type of certificate that's not supported on Windows XP. Now how can I do this?


title: How do I copy a wordpress database?

text: I'm trying to migrate my wordpress site from an old host to a new host. The Wordpress Codex says "you can move by just copying your files and database." Copying the files is easy enough, but how do I copy my database? I'm sure I'm just not looking in the right places, but I can't find any documentation on this anywhere.


title: Get author and excerpt from URL

text: Trying to be tricky here, I want to show a list of articles with their author and excerpt. I'm using a custom field and want the user to just be able to list the URLs on their own line and that's it. Is there a way to look up the non-rewritten url based on the friendly one? Then just pull the article ID from there via regex? To further clarify: Say this is the URL http://www.site.com/2013/10/wearable-tech-trends- element14.html Can I take it back (decode) to? http://www.site.com/?p=123 So I can grab the 123 and use that to find the author and excerpt.


title: How to remove message output for the WP-PostRatings Plugin?

text: When the user clicks on the _vote_ image, the image changes to the _voted_ state. If the user clicks the image in the _voted_ state again, a message pops up saying: > You Had Already Rated This Post. Post ID #X I want it so that this message does not pop up and the 'voted' image stays as is. Below is what I believe to be the relevant code needed to make this change. It is from lines 558-633 of _wp-postratings.php_. If someone can take a look and let me know what I need to change, I'd be very grateful.               ### Function: Process Ratings     process_ratings();     function process_ratings() {         global $wpdb, $user_identity, $user_ID;         $rate = intval($_GET['rate']);         $post_id = intval($_GET['pid']);         if($rate > 0 && $post_id > 0 && check_allowtorate()) {                   // Check For Bot             $bots_useragent = array('googlebot', 'google', 'msnbot', 'ia_archiver', 'lycos', 'jeeves', 'scooter', 'fast-webcrawler', 'slurp@inktomi', 'turnitinbot', 'technorati', 'yahoo', 'findexa', 'findlinks', 'gaisbo', 'zyborg', 'surveybot', 'bloglines', 'blogsearch', 'ubsub', 'syndic8', 'userland', 'gigabot', 'become.com');             $useragent = $_SERVER['HTTP_USER_AGENT'];             foreach ($bots_useragent as $bot) {                  if (stristr($useragent, $bot) !== false) {                     return;                 }              }             header('Content-Type: text/html; charset='.get_option('blog_charset').'');             postratings_textdomain();             $rated = check_rated($post_id);             // Check Whether Post Has Been Rated By User             if(!$rated) {                 // Check Whether Is There A Valid Post                 $post = get_post($post_id);                 // If Valid Post Then We Rate It                 if($post && !wp_is_post_revision($post)) {                     $ratings_max = intval(get_option('postratings_max'));                     $ratings_custom = intval(get_option('postratings_customrating'));                     $ratings_value = get_option('postratings_ratingsvalue');                     $post_title = addslashes($post->post_title);                     $post_ratings = get_post_custom($post_id);                     $post_ratings_users = intval($post_ratings['ratings_users'][0]);                     $post_ratings_score = intval($post_ratings['ratings_score'][0]);                         // Check For Ratings Lesser Than 1 And Greater Than $ratings_max                     if($rate < 1 || $rate > $ratings_max) {                         $rate = 0;                     }                     $post_ratings_users = ($post_ratings_users+1);                     $post_ratings_score = ($post_ratings_score+intval($ratings_value[$rate-1]));                     $post_ratings_average = round($post_ratings_score/$post_ratings_users, 2);                     if (!update_post_meta($post_id, 'ratings_users', $post_ratings_users)) {                         add_post_meta($post_id, 'ratings_users', $post_ratings_users, true);                     }                     if(!update_post_meta($post_id, 'ratings_score', $post_ratings_score)) {                         add_post_meta($post_id, 'ratings_score', $post_ratings_score, true);                     }                     if(!update_post_meta($post_id, 'ratings_average', $post_ratings_average)) {                         add_post_meta($post_id, 'ratings_average', $post_ratings_average, true);                         }                     // Add Log                     if(!empty($user_identity)) {                         $rate_user = addslashes($user_identity);                     } elseif(!empty($_COOKIE['comment_author_'.COOKIEHASH])) {                         $rate_user = addslashes($_COOKIE['comment_author_'.COOKIEHASH]);                     } else {                         $rate_user = __('Guest', 'wp-postratings');                     }                     $rate_userid = intval($user_ID);                     // Only Create Cookie If User Choose Logging Method 1 Or 3                     $postratings_logging_method = intval(get_option('postratings_logging_method'));                     if($postratings_logging_method == 1 || $postratings_logging_method == 3) {                         $rate_cookie = setcookie("rated_".$post_id, $ratings_value[$rate-1], time() + 30000000, COOKIEPATH);                     }                     // Log Ratings No Matter What                     $rate_log = $wpdb->query("INSERT INTO $wpdb->ratings VALUES (0, $post_id, '$post_title', ".$ratings_value[$rate-1].",'".current_time('timestamp')."', '".get_ipaddress()."', '".@gethostbyaddr(get_ipaddress())."' ,'$rate_user', $rate_userid)");                     // Output AJAX Result                     echo the_ratings_results($post_id, $post_ratings_users, $post_ratings_score, $post_ratings_average);                     exit();                 } else {                     printf(__('Invalid Post ID. Post ID #%s.', 'wp-postratings'), $post_id);                     exit();                 } // End if($post)             } else {                 printf(__('You Had Already Rated This Post. Post ID #%s.', 'wp-postratings'), $post_id);                 exit();              }// End if(!$rated)         } // End if($rate && $post_id && check_allowtorate())     }      * * * _EDIT: You can find the Pluginhere_


title: Looking for Plugin that displays Facebook group's photos

text: There are several plugins that handle the auto retrieval/display of photos from my personal facebook profile, but i'm looking for one that will work w/ my facebook group. the group is way more active than the actual website and it'd be a bonus for the website to pull more content from FB. have already looked at: Facebook Photo Fetcher Fotobook neither would allow me to grant access to the group's photos even though i am an admin. i'm sure there were a few more but it was a while back and i must have deleted them out of my plugins directory.


title: How do I check if a menu exists?

text: I'm currently retrieving a nav menu based on the parent page's title, and if the page doesn't have a parent then it's own title.               global $post;     $page_title;          if ($post->post_parent) {         $page_title = get_the_title($post->post_parent);     }  else {         $page_title = get_the_title($post);     }          $sidebar_title = 'Sidebar - '.$page_title;     wp_nav_menu(array( 'menu' => $sidebar_title));      Instead of first checking for a parent, I'd like to first check if a page has it's own unique menu. This is what I wrote but it doesn't work:               global $post;     $page_title = get_the_title($post);     $sidebar_title = 'Sidebar - '.$page_title;          if ( !wp_nav_menu(array( 'menu' => $sidebar_title, 'echo' => false )) ) {              $page_title = get_the_title($post->post_parent);         $sidebar_title = 'Sidebar - '.$page_title;     }          wp_nav_menu(array( 'menu' => $sidebar_title ));      TLDR: How do I check if a menu exists?


title: Order get_terms() By Custom Field

text:
I want to order my categories like I order my pages. I've added an extra field called _Order_ to my taxonomy, but how do I order my terms by this value? Adding and Saving my Order Value:               /** Add New Field To Category **/     function extra_category_fields( $tag ) {         $t_id = $tag->term_id;         $cat_meta = get_option( "category_$t_id" );     ?>
         <?php _e('Category Order'); ?>
                 <input type="text" name="cat_meta[order]" size="3" style="width:5%;" value="<?php echo (isset($cat_meta['order'])) ? $cat_meta['order'] : '0'; ?>" />
             <?php _e('Categories are ordered Smallest to Largest'); ?>
     <?php     }     add_action('protax_edit_form_fields','extra_category_fields');            /** Save Category Meta **/     function save_extra_category_fileds( $term_id ) {         if ( isset( $_POST['cat_meta'] ) ) {             $t_id = $term_id;             $cat_meta = get_option( "category_$t_id");             $cat_keys = array_keys($_POST['cat_meta']);                 foreach ($cat_keys as $key){                 if (isset($_POST['cat_meta'][$key])){                     $cat_meta[$key] = $_POST['cat_meta'][$key];                 }             }             //save the option array             update_option( "category_$t_id", strip_tags($cat_meta) );         }     }     add_action ( 'edited_protax', 'save_extra_category_fileds');      Normally I could retrieve this value such as:               $categories = get_categories(array('taxonomy' => 'protax'));     foreach($categories as $cat){         $tmp = get_option('category_'.$cat->cat_ID);         echo $tmp['order'];     }      Is it possible to order by this custom value? Is there a better way to manually order my categories?