Get Unique Categories - Group By?

I have 2 separate groups of Categories that a post can be classified in: Client & Medium. I'm trying to display all the Clients (if they have posts), and any Mediums that those posts may belong to. The problem I'm running into is this: Lets say a 3 posts are associated with Client A. When I'm in the loop, and gathering all the Categories for each post, I get 'Client A' 3 times, instead of just once (as I want it). The same is true with the Medium category as well. I want to display only: a) the unique / distinct Clients (that have posts) b) the mediums that those posts are categorized by, per client. What's the best way of going about this? If I'm in the Loop, is there a way to only pull unique Categories? Or do I have to gradually put them all in an array, and check that they don't exist before adding a new one? How about using some sort of Group By clause? Here's some of the code I'm using:               <?php $args = array('cat' => 4 );      $clients_query = new WP_Query( $args );     ?>          <?php while ( $clients_query->have_posts() ) : $clients_query->the_post(); ?>                  <?php $categories = get_the_category(); ?>                  <?php foreach($categories as $category) : ?>                      <?php if (cat_is_ancestor_of(4, $category)) : ?>                     /* 4 is the Client Cat -- so stick this in an array */                      <?php elseif (cat_is_ancestor_of(5, $category))                                    /* 5 is the Medium Cat -- so stick this in a seperate array maybe?                           <?php endif; ?>                  <?php endforeach; ?>              <?php endwhile; ?>


How is it possible to list custom post types by "category" like with simple posts?

I created a custom taxonomy, "partners". I would like to categorize these items, so I created a custom post type with a taxonomy.               register_taxonomy("partners-category", array("partners"), array("hierarchical" => true, "label" => "Partners", "singular_label" => "Partner", "rewrite" => true, "slug" => 'partners-category'));      I would like to list these posts by categories for example: categoryname- category.php. I know it's working only with posts, so what's the best way? Thank you very much and sorry, I'm newbie.


Custom Post Type Archive in Sub Folder

I have a sub-directory in my Wordpress theme (there are a lot of pages and I want a more logical structure). I have a custom post type called "entry" but if I place the archive-entry.php template in my sub-directory it is no longer picked up by the theme. Is there a way I can put my custom post type archive templates in a sub- directory?


Woocommerce - Free Shipping after coupon

Here is the situation:   1. Website offers free shipping on orders above $50.   2. Price total cost after coupon is less than $50   3. Free shipping is still applied. It looks like free shipping is calculated on the original price, and not on the final price. Is there a way to change that around? i have checked all woocommerce settings, and played around switching coupon settings and site wide settings to no success.


How to get author's name by author's id

I want to show recent posts like this.
       <?php foreach( wp_get_recent_posts() as $recent ){ ?>
           <a href="<?php echo get_permalink($recent['ID']); ?>">         <?php echo $recent["post_title"]; ?> by         <?php echo $recent["post_author"]; ?>
       <?php } ?>
      But `$recent["post_author"]` returns only id of author. And this is outside `The Loop`, so I can't use `the_author()` function. How can I get author's name from ID? Or maybe there is a better way to do it?


List all posts of certain category which share some tags

My problem is quite simple: I've got a couple of posts in different categories that have several tags, some of them in common. When I load a post, in my sidebar (using PHP Code) I want to show a list of all the posts of another category that share the same tags as the one displayed. I've tried related posts and it doesn't do the trick, because I found no way of adding the 'only this category' condition. UPDATE. I have tried this               <?php     global $post;     $tagargs = $catargs= '';     $catnames ='';     $tagnames = '';     $tags = get_the_tags($id);              if ($tags) {             foreach ($tags as $tag) {                 $tagnames .= $tag->name . ',';             }             $tagargs = array(                 'ignore_sticky_posts' => 1,                 'tag' => $tagnames,                 'post__not_in' => array($id),                 'showposts' => $number,                 'orderby' => 'name',                 'order' => 'asc',                 'cat' => '152'             );         }          $posts = get_posts($tagargs);       foreach($posts as $post) :         ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
      <?php endforeach; ?>      And I get all the posts in category 152 (the one I want) but that have only in common the first tag. I have figured out how to do the opposite, I mean, first, get the tags of all the posts inside this category (152) and then compare them with those in the current post (because sometimes, the current post have more than two or three), and get those posts that have all the tags in both sides. What do you think?


Basic function call on init failing

I've been banging my head against this for a while. I have this very straight- forward code in my plugin:               add_action('init', 'register_shortcodes');          $shortcodeRegistrationRan = False;          function register_shortcodes() {         global $shortcodeRegistrationRan;         $shortcodeRegistrationRan = True;         echo "Ran = True";              add_shortcode( 'accountability', array($hfMain, 'processAccountabilityShortcode') );     }      The problem is `$shortcodeRegistrationRan` never gets set to `True`, nor does "Ran = True" appear anywhere on the page. What am I missing? I'm using SimpleTest for Wordpress to check the status of my run flag. I have plenty of other passing tests, so the test suite is running fine. My test checks this way:               public function testShortcodeRegistrationRan() {         global $shortcodeRegistrationRan;         $this->assertEqual($shortcodeRegistrationRan, True);     }      At the beginning of the test suite:               require_once(dirname(__FILE__) . '/../[PLUGIN NAME].php');      **EDIT:** Per @s_ha_dum's advice, I added a new test using the `shortcode_exists` function:               public function testShortcodeRegistration() {         $this->assertEqual(shortcode_exists('accountability'), True);     }      Unfortunately, it, too, does not pass. **EDIT:** Here is the full context:               <?php     /*     Plugin Name: Nathan's Awesome Widget     Plugin URI: http://NathanArthur.com/     Description: This plugin does awesome things     Author: Nathan Arthur     Version: 1.0     Author URI: http://NathanArthur.com/     */          /*global $wp_version;          if ( !version_compare($wp_version,"3.0",">=") ) {         die("You need at least version 3.0 of Wordpress to use the copyright plugin");     }*/          function my_plugin_activate() {         error_log("my plugin activated");     }          register_activation_hook(__FILE__,"my_plugin_activate");                    if (!class_exists("HfAccountability")) {         class HfAccountability {             private $currentUser;             function HfAccountability() { //constructor                 $this->currentUser = wp_get_current_user();             }             function getCurrentUserLogin() {                 return $this->currentUser->user_login;             }             function processAccountabilityShortcode( $atts ) {                 #$to = '[MY EMAIL ADDRESS]';                 #$subject = 'Testing Mandrill integration';                 #$message = "Yup, that's all we're doing";                 #wp_mail( $to, $subject, $message, $headers, $attachments );                 return 'We tried.';             }         }     }          if (class_exists("HfAccountability")) {         $hfMain = new HfAccountability();     }          //Actions and Filters     /* if (isset($hfMain)) {         //Actions         add_action('init', 'register_shortcodes'); //PROBLEMATIC LINE              //Filters              $actionsRan = True;     } */          add_action('init', 'register_shortcodes');          $shortcodeRegistrationRan = False;          function register_shortcodes() {         global $shortcodeRegistrationRan;         $shortcodeRegistrationRan = True;         echo "Ran = True";              add_shortcode( 'accountability', array($hfMain, 'processAccountabilityShortcode') );     }


WordPress deployment strategy: Dealing with dependencies

The main question is: **How do you deploy your WordPress sites, taking into account dependency management and database migrations?** ## Details I've been reading around this issue both on Stack Exchange and from trawling Google and I'm yet to find a solid explanation of how to do this. I'm really interested in how other developers tackle deploying their WordPress sites and in particular how they deal with plugin dependencies. Let's say I'm developing a WordPress site. Assume I will need a local, staging and a live environment and they should all be virtually identical to each other. I need some solution to manage deploying to these remote servers and updating them periodically with the latest changes. Typically in this situation I use Vagrant locally, with a box that will match the live environment as closely as possible. Typically I'll use some WordPress specific flavour of Vagrant just to get up and running quickly (e.g. Varying Vagrant Vagrants). Now the first challenge: **How to handle versioning?** My current workflow involves versioning any custom code, i.e. the theme and any custom plugins. Third party code (i.e. plugins and WordPress itself) are defined as git submodules and so can be pulled in automatically by git and as they are submodules, I avoid having a ton of third-party code in my project repo. At a basic level this works just fine. I can ssh into the remote servers and do a simple `git pull my-stable-branch` and I'm all done. Except what happens when a particular plugin or other dependency isn't available as a git repo? Many plugins are only available via subversion. Additionally, any commercial plugins used in the project won't be available _at all_. How should these dependencies be handled? Yes, they could be added to the project repo and versioned, but this feels wrong as it's third-party code that won't be changed. **Handling databases changes:** How do you handle updating the database when moving from local to staging, to live? There are two main problems I encounter here:   * URLs stored in the database   * Ensuring the DB is up to date with the live environment. The first is currently the bane of my life when it comes to working with WordPress. There numerous entries in the database that use the full URL of the site. Naturally, this will change between environments and so the database needs to be edited whenever it's migrated to a different environment. Currently, I've just using a basic shell script + PHP script to get an SQL dump of the DB, find and replace all instances of the 'old' URL with the 'new' one and then import the result back into MySQL. This is messy, tedious and can't be the optimal solution, can it?! Secondly, let's say I do some work locally to update a site. Whatever this work is, let's assume it involves some changes to the database. Now I'm ready to push this to staging for client perusal, and eventually to live. In the time between me getting a copy of the live DB, completing my work and pushing the updates to staging, the live site DB may have changed significantly. So, not only are the DBs out of sync and will need merging, there could also potentially be conflicts that need to be managed. **Deployment tools: Chef, Ansible, Puppet, Composer... something else?** Whilst researching this topic, I've come across these names, though admittedly I haven't read into too much details about any of them. At a brief glance though they all seem to offer something useful in terms of automated deployment and dependency management, but as far as I can see none of them seem to solve any of the problems I'm having (recap: Commercial plugin dependencies and DB migration). This is all getting a little wordy now, so thank you if you're still reading. :)


pass html code to worpdress

I'm starting with wordpress and I have some doubts. I created a proprietary design from requirements that had. This design is made with html and bootstrap. Now I want to start using wordpress step then as the pages that I have the layout I made to wordpress? When I paste the html code when I create a new page, my code has things like this ...                <img src = "<? php echo get_template_directory_uri ();?> / images/clean/32x32/facebook.png" alt = "Facebook">       or php code which is not interpreted. How should I? I tried to give the image add text box but would have to upload the images, but if you and I have in the theme!!


How can assign posting to Subscriber to specific category?

I'd like to permit posting(writing) to "Subscriber"group to a specific category. How can I do it?


Comparing permalink to url

I'm trying to compare the permalink with a url and then output stuff depending if they match. At the moment I have the code below. On the page it's visibly showing that the permalink and the url (i.e $company) match yet it's outputting "don't show news articles". Where am I going wrong?
permalink of current page: <?php $link = get_permalink(); echo $link; ?>
     <?php $portfolioloop = new WP_Query( array( 'post_type' => 'news' ) ); ?>         <?php while ( $portfolioloop->have_posts() ) : $portfolioloop->the_post(); ?>                                        <?php while(the_repeater_field('featured_companies')): ?>
url of linked page: <?php $company = the_sub_field('featured_company'); ?>
                 <?php  if ($link == $company) { ?>                     show news articles                 <?php } else { ?>                     don't show news articles                 <?php } ?>             <?php endwhile; ?>         <?php endwhile; // end of the loop. ?>


Get content or excerpt of top rated votes @GD-Star Rating?

I am using the GD-star Rating plugin and I have a function which outputs the top rated posts. The problem: it won't show the content or the excerpt of those posts. How can I do this? This is the function I am using:               <?php     global $wpdb; // include the $wpdb     $query= "SELECT p.ID, p.post_title as title, visitor_votes + user_votes as total_votes, visitor_votes, user_votes  FROM  `".$wpdb->prefix."gdsr_data_article` da INNER JOIN $wpdb->posts p ON da.post_id = p.ID order by total_votes desc limit 20";     $results=$wpdb->get_results($query); // run the query on the database     if ($results) { // if we have any results         ?>

Position	Post	Points

         <?php             $position=0; // we set the position as 0, as we start every loop with increasing it by one             foreach ($results as $toppost) {                 $position++; // see, I told you, we increase by one, so the first post will get position #1                 echo "
#".$plads."	ID)."'>".$toppost->title."	".round($toppost->total_votes)."
";             }         ?>
         <?php            }     ?>      I already tried: `get_the_excerpt($toppost->title)` and `get_the_excerpt($toppost->ID)`, but none of them showed it.


Howto accurately position images with maximum flexibility?

I got a request to develop the following design with Wordpress: http://imm.io/DLrl (design is pixelated by me for the purpose of privacy). As you can see there is a pretty random structure of image placement and the webmaster should have maximum flexibility in deciding how to place images, how many and in which size. So the design as seen now will change each time the webmaster decides so. When a new collection of pictures is added to the website, the webmaster should be able to choose a couple of them which will be highlighted on the main page. In this design one image stands for an album or collection of pictures. So when clicking on one of these images a lightbox will popup whereby the visitor can browse all the containing images. I have no clue how to implement such a design within wordpress. Any tips/ideas on possibilities? Any plugins worthwhile looking at? (ps: to me the design is a bit confusing and not very clear in terms of usability and structure, but that's another matter)


using get_option to add a different js

I'm trying to us `get_option` in my plugin to choose to load 1 of 3 js files. I started with this (and it works) ...               add_action('wp_footer','isotope_vpl_set_style');          function isotope_vpl_set_style() {             include("inc/myfile.js");             }      then I changed it to ...               add_action('wp_footer','isotope_vpl_set_style');            function isotope_vpl_set_style() {        $style = (get_option('damien_style');         if  $style = ("isotope"){             include("inc/myfile.js");             }     }      And it's not working ... I checked the SQL table and the option name and value are set. My PHP error log tells me I have an unexpected ; on this line `$style = (get_option('damien_style');` Where have I gone wrong please :)


Get featured image on Blog Index

I've been trying to use the "featured image" from the home (the blog index) with no luck. It's working for every single page, but it's not working for the home. The code looks something like this:               // Don't use on single posts         if (!is_single()) {             if (is_home()) {                 if (function_exists('wp_get_attachment_thumb_url')) {                     $img = wp_get_attachment_image_src(get_post_thumbnail_id(),'full');                     $featured_image = $img[0];                 }             } else {                 if (function_exists('wp_get_attachment_thumb_url') && has_post_thumbnail()) {                     $img = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID),'full');                     $featured_image = $img[0];                 }             }             if ($featured_image) { ?>                 // A lot of code...             <?php }         }      I already tried to obtain the thumbnail using the **_thumbnail_id** meta. Same result. This code is placed on the functions file, I believe that the issue is that it's trying to get the loop/posts featured image. Thanks a lot in advance.


the_excerpt() not showing manual excerpt for Pages

I have enabled the excerpt feature for pages in my wordpress theme -               add_action( 'init', 'my_add_excerpts_to_pages' );         function my_add_excerpts_to_pages() {              add_post_type_support( 'page', 'excerpt' );         }      This has enabled the excerpt box when adding or updating pages through the admin area, which is what I expected. I am then trying to display each excerpt on the homepage of my site like so -               $child_pages = $wpdb->get_results("SELECT *    FROM $wpdb->posts WHERE post_parent  = 64    AND post_type = 'page' ORDER BY post_title", 'OBJECT');    ?>                 <?php if ( $child_pages ) : foreach ( $child_pages as $pageChild ) : setup_postdata( $pageChild ); ?>                 <div class="memberHover" id="member-<?php echo $pageChild->ID; ?>">

<?php echo $pageChild->post_title; ?>

<?php the_excerpt(); ?>

<?php echo get_the_post_thumbnail($pageChild->ID, '312,156'); ?>
             <?php endforeach; endif; ?>      The issue is that even if I have a manual excerpt populated through the admin area, it still creates the auto excerpt when displaying on the homepage. It seems that it is not picking up the fact that there is a custom excerpt in the database for each item. Any and all help is greatly appreciated! Thanks, Tristan


How to handle shortcodes through plugin

I learned that I can only put in the code for handling my shortcode through the theme's `functions.php` But I was thinking of making it a plugin rather than a theme. How can I achieve that?


Bug: Post needs to be updated twice when adding action for save_post hook

My function does exactly what I want it to do: I'm trying to add/update meta fields in another post type when an "events" post is saved. Except the post needs to be updated _twice_ for the information to update on the front end. What am I doing wrong?                 function bam_create_next_show_meta($post_id) {             if(get_post_type() == 'tribe_events') {                 $meta = get_post_meta($post_id, $_artistMeta->$post_id, TRUE);                 $artists = unserialize($meta['_artistMeta'][0]);                      if($meta) {                     $event_link = get_permalink();                     $eventVenue = tribe_get_venue();                     if($eventVenue) {                         $eventVenueSplit = explode (' ', $eventVenue, 3);                         if($eventVenueSplit[0] == 'Centro' && $eventVenueSplit[1] == 'Cultural') {                             $eventVenue = ' en C.C. '.$eventVenueSplit[2];                         } elseif($eventVenueSplit[0] == 'Biblioteca') {                             $eventVenue = ' en Bibl. '.$eventVenueSplit[1].' '.$eventVenueSplit[2];                         } else {                             $eventVenue = ' en '.$eventVenue;                         }                     } else {                         $eventVenue = '';                     }                          $eventStartDate = tribe_get_start_date($postID,false,'j');                     $eventStartMonth = tribe_get_start_date($postID,false,'M');                          $event_sort = tribe_get_start_date($postID,false,'Y-m-d');                          $es_eventStartMonth = strftime('%b', strtotime($eventStartMonth));                          $event_title = 'Proxima fecha: '.$eventStartDate.' de '.$es_eventStartMonth.$eventVenue.'';                          foreach ($artists['artistName'] as $artist) {                         if($myid == $artist)                             continue;                         $output[] = $artist;                         $myid = $artist;                     }                          global $post;                          $artistas = get_posts(array('post_type'=> 'artistas','post__in' => $output, 'posts_per_page' => -1));                          foreach($artistas as $artista) {                         setup_postdata($post);                              $artistID = $artista->ID;                              $artist_event_id = get_post_meta($artistID, 'artistEventId', true);                         $artist_event_link = get_post_meta($artistID, 'artistEventLink', true);                         $artist_event_title = get_post_meta($artistID, 'artistEventTitle', true);                         $artist_event_sort = get_post_meta($artistID, 'artistEventSort', true);                              if(strtotime($artist_event_sort) >= $date_sort || $post_id == $artist_event_id) {                             update_post_meta($artistID, 'artistEventId', $post_id, $artist_event_id);                             update_post_meta($artistID, 'artistEventLink', $event_link, $artist_event_link);                             update_post_meta($artistID, 'artistEventTitle', $event_title, $artist_event_title);                             update_post_meta($artistID, 'artistEventSort', $event_sort, $artist_event_sort);                                             }                     }                 }             }         }              add_action( 'save_post', 'bam_create_next_show_meta');


Simple rich text editor in Text widget?

I've seen a few plugins that add rich text editing to the default "Text" Widget. However, all of the ones I've tested are either too complicated (or try to do too much) or don't work properly with the latest WP versions. I'm just looking for a simple rich text toolbar with a minimal feature set (basic formatting and lists), image upload and hyperlink tool. Ideally, I'd like to find one that does not require a separate window to handle rich text. Just a simple tab to switch between html and wysiwyg. Any suggestions or recommendations?


WP_Query with 2 genres

I'm working with a custom post type and trying to get a query working that includes 2 genres (a custom taxonomy). I have this, which works for a single genre (I don't want to display the widget currently being viewed in the list, the 'post__not_in' takes care of that).               $myposts = new WP_Query(          array(              'post_type' => 'widgets',              'post__not_in' => array($wp_query->post->ID),               'genre' => 'styleA'          )      );      But I'm having trouble when I try to make a list that includes 2 genres. I've tried various versions of this:               $myposts = new WP_Query(          array(              'post_type' => 'widgets',              'post__not_in' => array($wp_query->post->ID),               'genre' => array('styleB', 'styleC')          )      );      Everything I've read in the Codex seems to use a syntax like this, anyone know where I'm going wrong? Much appreciated.


Adding a function-based search to the Users admin page

On the Users admin page, I want to add a function-based search criterion. By default, there are filters to search by user role and there is a search box that searches the user data. I would like to add another text box and use that box's input to restrict which users are shown according to a function. The function will see whether that inputted text is present in a the usermeta table, and will return a boolean based on that. So, the generic version is that: Text box gets input: "search_data" When the admin user clicks on search (or a separate button), the users list should redisplay with only users who satisfy search_function( "search_data" ). What is the best way to implement this functionality in a plugin?


Use conditionals with wp_enqueue_style to attach stylesheet according to post type displayed

I have many custom post types, including some introduced by plugin such as bbPress or WooCommerce. My standard stylesheet is growing large, so I thought to split it into multiple stylesheets according to post types being viewed in the browser. In this way, when the users is viewing bbpress fourms, he will also load a forum.css; when viewing wordpress pages, he would load a page.css. And so on. I tried with the following code added in my functions.php:               function sg_frontend_enqueue_styles(){              $templateuri = get_template_directory_uri();              // some of my custom post types         if( get_post_type() == ( 'activity' OR 'dining' OR 'heritage' OR 'hiking' OR 'nightlife' ) ) :               wp_enqueue_style( 'locations', $templateuri.'/css/locations.css', '', false, 'all' );              // bbPress forums         elseif ( get_post_type() == ( 'forum' OR 'topic' OR 'reply' ) ) :             wp_enqueue_style( 'forum', $templateuri.'/css/forum.css', '', false, 'all' );              // Pages         elseif ( get_post_type() == 'page' ) :             wp_enqueue_style( 'page', $templateuri.'/css/page.css', '', false, 'all' );              // WooCommerce         elseif ( get_post_type() == 'product' ) :             wp_enqueue_style( 'product', $templateuri.'/css/product.css', '', false, 'all' );              endif;          add_action('wp_print_styles', 'sg_frontend_enqueue_styles');      However this is **not** working. Problem: all CSS styles are loaded altogether, regardless of whether the user is displaying a post belonging to that specific post type. Furthermore, ' **page.css** ' is not being included at all. I've then tried with a different approach, replacing conditionals with a switch:                   $templatename = get_post_type();         switch ( $templatename ) :             case 'activity' :                 wp_enqueue_style( 'locations', $templateuri.'/css/locations.css', '', false, 'all' );             case 'dining' :                 wp_enqueue_style( 'locations', $templateuri.'/css/locations.css', '', false, 'all' );             case 'forum' :                 wp_enqueue_style( 'forum', $templateuri.'/css/forum.css', '', false, 'all' );             case 'heritage' :                 wp_enqueue_style( 'locations', $templateuri.'/css/locations.css', '', false, 'all' );             case 'hiking' :                 wp_enqueue_style( 'locations', $templateuri.'/css/locations.css', '', false, 'all' );             case 'nightlife' :                 wp_enqueue_style( 'locations', $templateuri.'/css/locations.css', '', false, 'all' );             case 'page' :                 wp_enqueue_style( 'page', $templateuri.'/css/page.css', '', false, 'all' );             case 'product' :                 wp_enqueue_style( 'product', $templateuri.'/css/product.css', '', false, 'all' );             case 'reply' :                 wp_enqueue_style( 'forum', $templateuri.'/css/forum.css', '', false, 'all' );             case 'topic' :                 wp_enqueue_style( 'forum', $templateuri.'/css/forum.css', '', false, 'all' );             break;             default : '';         endswitch;      this one sometimes work sometimes not... On bbpress forums works fine, but on pages for example, it enqueues ALL the stylesheets...


W3 Total Cache, CDN and theme files

I updated the style.css file of my WordPress installation recently. The change were effective: when logged in as an administrator (my blog is set so that the administrator is never served a cached version of the site, but a “live” one), I can see them. But my blog is being served through a CDN (using W3 Total Cache). Through the CDN, the changes are not effective: the CDN does not serve the modified files from my theme. Even though I’ve uploaded them after modification (Dashboard>Performance>CDN>Upload theme files. My CDN runs on AmazonCloud Front. And Minify is disabled on W3 Total Cache. The theme file being served through my CDN is a compressed version: style.css.gzip Should I “purge” objects from my CDN or wait a little more (it’s been more than a week). And yes, I empty the cache of the browser I’m using to see in the changes are taking effect. Or is there something else I’m missing? Thanks, P.


Help Combine These Two PHP Codes

I have my WordPress post format codes:               <?php     if ( has_post_format( 'image' )) {       echo 'This is a image post';     } ?>      And my code to grab the first image from a post...               <a href="<?php the_permalink() ?>">     <?php $image = catch_that_image();     if( $image ) { ?>     <img src="<?php echo get_template_directory_uri(); ?>/scripts/timthumb.php?src=<?php echo $image; ?>&h=240&w=280" class="index" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" />     <?php } ?>           So how do I put the image which is grabbed into the first code? Thanks for all the help guys and gals, I really do appreciate it.


Database Tables in Wordpress Theme

I am creating some sliders type functionality for my wordpress theme and I thought that creating two seperate db tables like 'sliders' and 'slider_images' is a good idea. My problem is that i don't know what is the best way to handle the creation of those tables. If it was a plugin, I would just do it on activation, but it is just some functionality as part of my theme and i haven't really found a hook that is executed once when the theme is activated. If possible, i would like to not have to check the database for the existence of tables in every page refresh and create if not. Is there a way to do that ?


Files placed in directory with wordpress 404

I changed my WordPress permalinks settings from the default to displaying the name of the post. When I did this, all the files that I had been storing in the directory with WordPress (www.example.com/notpartofwp.html) suddenly displayed wordpress style 404 errors.   1. Is this normal WordPress behavior?   2. If so, what can I do about it?


create taxonomy

I am new to word press, I want to display results on a page which belong to some group from database(I have group column). I think this can be done by taxonomy so I have taxonomy table but I don't know what to write in taxonomy.php file, any idea what is the minimum information that I have to write in taxonomy.php to make it work.


How to pass post title (which could include &) to Gravity Form

I have created a form (Gravity Form) which I want to be able to complete dynamically from several of my other websites. In such a case, one of the fields that I am trying to send to the form is the post title, which can - and does - includes ampersands from time to time (e.g. The Ins & Outs of Gravity Forms). The trouble I'm having is figuring out how to encode the post title so that ampersands within the post title are not treated as separators for the next query var. For example, the URL `mydomain.com/page-with-my-form-on-it/?title=The Ins & Outs of Gravity Forms&type=new` should complete the 'title' field with 'The Ins & Outs of Gravity Forms' and the 'type' field with 'new', but instead it puts 'The Ins ' in the 'title' field and leaves the 'type' field (and any other subsequent fields) empty. To create that URL, my current code is simply as follows, though I have tried using urlencode(), htmlentities(), and str_replace() with the_title() to try and overcome this issue:               <a href="http://www.mydomain.com/page-with-my-form-on-it/?title=<?php the_title(); ?>&type=new">Link      Any suggestions?


Tag page that displays specific posts

How would I go about coding a generic tag.php page that displays all the posts with a specific tag? For example, if I navigate to example.com/tag/your-tag, it should display all posts with the tag "your tag".


Is anyone familiar with this error? It is causing TinyMCE to break in my Wordpress theme. In console it gives me these two errors both seem to originate from wp- admin/post-new.php > Uncaught ReferenceError:switchEditors is not defined > > Uncaught TypeError: undefined is not a function /wp-admin/load- > scripts.php?c=0&load%5B%5D=hoverIntent,…editor,quickt&load%5B%5D=ags,wplink,wp- > fullscreen,media-upload&ver=3.9.1:2 ![enter image description here](http://i.stack.imgur.com/p3rLM.png) Both the Visual and Smart tabs break, becoming unclickable, and the TinyMCE toolbar disappears.


Close modal window after form submit

I have this in a php file from Contact Form 7, which **I load into a modal window** (FancyBox) and **I would like to close it after the user will press the Submit button**. I was thinking of adding onSubmit="action" to the form but I don't know how or which one is the function I am supposed to use to close the modal window?               $form .= '<form action="' . esc_url_raw( $url ) . '" method="post"' . ' class="' . esc_attr( $class ) . '"' . $enctype . '>' . "\n";      Is this the right approach? Also, if I can make it to click on a PayPal button right after that, it will be brilliant.


Custom field php

Hi I put this php code on my single post php               <?php     $custom_fields = get_post_meta($post_id);      $my_custom_field = $custom_fields['_source_link']; //key name     foreach ( $my_custom_field as $key => $value )         echo $key . " => Click Here
";     ?>      however I've got error > Warning: Invalid argument supplied for foreach() How to fix this error?


How Do I Use A Custom Mobile Theme?

I have a self hosted blog and I want it to be mobile compliant. I know there is a free plugin the serves this purpose. However, I want to use a simple mobile theme I like (say from Theme Forest). How do i go about it? Is it as straight forward as uploading a normal theme?


how do I get the title in the post

I have a custom grid loop to show a specific post type on a page. This shows the excertp for each post but it does not link include the post title, and I would like each post to have a title that links to the full post. Can anyone help? thanks,               <?php     /**       * @author Jonathan Perez      */          /*     Template Name: Grid Loop for Press Releases     */          // Do the Custom Loop     remove_action('genesis_loop', 'genesis_do_loop');     add_action( 'genesis_loop', 'sf_custom_loop' );          function sf_custom_loop() {                       echo '
' . get_the_title() . '
';             the_content();                  //WP Query Start                  $per_page = 9;                  $product_args = array(                 'post_type' => 'pressreleases',                 'posts_per_page' => $per_page,                                 'paged' => get_query_var( 'paged' )             );             $products = genesis_custom_loop( $product_args );     }          //Add Post Class Filter     add_filter('post_class', 'sf_post_class');     function sf_post_class($classes) {         global $loop_counter;         if ($loop_counter % 3 == 0) {             $classes[] .= 'first ';         }         return $classes;     }                    /** Move Post Info */     remove_action('genesis_before_post_content','genesis_post_info');     remove_action('genesis_after_post_content','genesis_post_meta');          genesis();


how to invoke wordpress API from other existing PHP system

We have our own php system, now we want to have a blog function. Because wordpress are widely used, so we decided to use it. And now I want to invoke wordpress's function , for example `wp_insert_user` , how can I can do that ? Suppose my system is `A` and installed on `/var/www/A`, and wordpress is `WP` and installed on `/var/www/WP`. I can put them together like this `/var/www/A/WP`, but I don't think that's a good idea. If we use `/var/www/A` and `/var/www/WP`, how can I invoke wordpress's function from a php file that in project `A`? Using curl? Edit:======================================================= Now I put WP below A (/var/www/A/wordpress) Here, in my project A , I have a logon.php, what I want to do is invoke 'wp_insert_user' function to create a new wordpress user when user logon our system (just a test purpose). I put the following code at the beginning of my logon.php               define('WP_USE_THEMES', false);     require('/var/www/A/wordpress/wp-blog-header.php');      Before I add the two line, when I visit my site, the url is :               http://localhost/myproject/www/logon.php      After I add it, the url become this:               http://localhost/myproject/www/logon.php/wp-admin/install.php      what worse, all the style of my logon.php are completely gone. My requirement is simple:               when user logon our system, invoke wordpress function 'wp_insert_user'      to create a user for wordpress. Just to create a new user, no more action.


Embeding YouTube video via a template function throws iframe cross-domain policy error

I'm using Wordpress 3.5 which natively supports embeds into posts and pages from many sites, YouTube included. When I embed a Youtube video directly onto a post or a page (by simply copying and pasting the video url), it works fine and no cross-domain policy errors are thrown in Chrome or Firefox. However, when I add the URL from a function inside a custom page template (outside the main loop), that I built for a custom post type, it throws an error. **Here is what my function looks like:**               function my_tour_video()     {         global $post,                $wp_embed;               $my_tour_video = get_post_meta($post->ID, "_my_tour_video", true);           echo $wp_embed->run_shortcode('[embed]' . $my_tour_video . '[/embed]');     }      In my custom field I have tried the "embed" youtube url and also just the "watch" url copied and pasted from the browser. You can try this sample url: http://www.youtube.com/embed/Y7AvqD2loX4 **Error in Chrome looks something like:** > Unsafe JavaScript attempt to access frame with URL http://www.mydomain.com > from frame with URL http://www.youtube.com/embed/Y7AvqD2loX4. Domains, > protocols and ports must match. Any suggestions on how to do this the right way would be very helpful at this point.


Avoiding page loop

I'm doing a custom page that has multiple wp query calls, the thing is that I don't need the main query that is I don't need anything from the page contents, so in order to save load time I was wondering how to tell wordpress not to fetch anything from the db ?


How to use WP_Query() on single.php?

I'm using `WP_Query()` to pull out a few posts under a specific category "Featured" to display at the bottom of any post. So I added `<?php if (function_exists('getEditorPicks')) getEditorPicks();?>` in single.php. In functions.php, I have               wp_reset_postdata();         $args = array('cat' => 4176, 'posts_per_page' => 5);         $query = new WP_Query($args);         //return $query->query_vars;         if ($query->post_count>2) {             while ($query->have_posts()) {                 $query->the_post;                 echo the_title();             }         }         wp_reset_postdata();      However, it takes forever for the page to load now and it simply exhausts memory in the end. What am I missing here?


Different sql queries count indicator on the main page

I use w3_total_cache plugin. But i can`t understand what is going on sometimes. I have enabled database caching and debug info at the bottom. Sometimes on the main page 90-96 db queries, sometimes 495-501. How can be so different results for the same page with the same parameters? Or how can be so much queries sometimes ? What is this meaning? Please explain me:)


Override plugin functions in functions.php

I´d like to override `$title = get_bloginfo();` with --> `$title = get_bloginfo('siteurl');` Some code from the plugin "Really simple Facebook Twitter share buttons":               function really_simple_share ($content, $filter, $link='', $title='', $author='') {         static $last_execution = '';              ...              $custom_field_disable = get_post_custom_values('really_simple_share_disable');         if ($custom_field_disable[0]=='yes' and $filter!='shortcode') {             return $content;         }              //GET ARRAY OF STORED VALUES         global $really_simple_share_option;         $option = $really_simple_share_option;              ...              $first_shown = false; // NO PADDING FOR THE FIRST BUTTON              // IF LINK AND TITLE ARE NOT SET, USE DEFAULT FUNCTIONS         if ($link=='' and $title=='') {             $link = ($option['use_shortlink']) ? wp_get_shortlink() : get_permalink();                  $title = get_bloginfo(); // OVERRIDE                  $author = get_the_author_meta('nickname');         }      Can I do this in my functions.php because I´ll updating this plugin without changing this lines after every update. Thanks


Why am I able to add a "formats" dropdown, but the style isn't applied?

I've created style called "smalltext" so the user can specify a paragraph with smaller text to match the theme where needed:               add_filter( 'mce_buttons_2', 'my_mce_buttons_2' );          function my_mce_buttons_2( $buttons ) {         array_unshift( $buttons, 'styleselect' );         return $buttons;     }          // Callback function to filter the MCE settings     function my_mce_before_init_insert_formats( $init_array ) {           // Define the style_formats array         $style_formats = array(               // Each array child is a format with it's own settings             array(                   'title' => 'Smalltext',                   'block' => 'p',                   'classes' => 'smalltext',                 'wrapper' => true                  )         );           // Insert the array, JSON ENCODED, into 'style_formats'         $init_array['style_formats'] = json_encode( $style_formats );                return $init_array;            }      // Attach callback to 'tiny_mce_before_init'      add_filter( 'tiny_mce_before_init', 'my_mce_before_init_insert_formats' );          add_action( 'admin_init', 'add_my_editor_style' );          function add_my_editor_style() {         add_editor_style();     }        I've attached the `editor-style.css` file in my theme. I know it's connected since I can see the css for it applied in the `formats` dropdown. When I highlight some text and choose the format the text is not wrapped in a `paragraph tag` and the "smalltext" class isn't applied. The `formats` dropdown just reset back to the default option. Is there something I'm missing to ensure this piece works?


How to show featured image in custom post type dashboard post page

I have added this code to my theme to add a new colmum for showing the featured image in the dashboard post page colmum. It's working in wordpress default post page, but not in custom post type (my custom post name is photo_gallery).               add_filter('manage_posts_columns', 'posts_columns', 5);     add_action('manage_posts_custom_column', 'posts_custom_columns', 5, 3);     function posts_columns($defaults){         $defaults['riv_post_thumbs'] = __('Thumbnail');         return $defaults;     }     function posts_custom_columns($column_name, $id){        if($column_name === 'riv_post_thumbs'){             echo the_post_thumbnail( array('292, 292') );         }     }      How can I show this custom column as first in my custom post type overview?


Wordpress forces HTTPS to HTTP in template

I have a form in a specific page templates with a hidden field and a value of "HTTPS://www.mydomain.com/innerpage". When I view the source code of the page with the form the value changes to HTTP. When I strip the inner page, the HTTPS stays. I need to have this value as HTTPS, so a redirect is not optional. Any help would be appreciated. Thanks!


Is it possible to apply a meta_query to one specific post type in a query with multilple post types?

I have two post types, _news_ and _events_ :   * A _news_ has no custom fields.    * An _event_ has two custom fields : _start-date_ and _end-date_. I want to display _news_ and _events_ on the same page, ideally with one single query. One important fact is that _events_ have to be ordered by _end-date_ and that only future or current _events_ have to be displayed. Here's the query args I am trying :               $args = array(         'post_type' => array( 'news', 'events' ),         'meta_key' => 'end-date',         'orderby' => 'meta_value',         'order' => 'ASC',         'meta_query' => array(             array(                  'key' => 'end-date',                 'value' => date ( 'Ymd' ),                 'type' => 'NUMERIC',                 'compare' => '>='             )         )     );      That works fine for _events_ alone, but doesn't when I add _news_ to the post types. The problem seems to be that I specified 'meta_key' and 'meta_query' parameters which are only present on _events_ , as a result all the _news_ are left out in the results. So my question is, is there a way to target a _meta_query_ to one specific _post_type_ in one same query ?


How can I add a Custom Button to Add or Edit post / page next to Add Media?

I'm trying to add a custom button nearby the Add media on the wordpress Add and Edit Post/Page. How can I do that? Thank you very much for your help! ![Here's where I want it to be](http://i.stack.imgur.com/BqZpQ.jpg)


Logout redirect to home page

I'm using custom menu for login/logout here below is my code:
           <?php     if (is_user_logged_in()) {       $user = wp_get_current_user();       echo 'Welcome '.$user->user_firstname.'       | Logout';     } else { ?>       <?php wp_loginout(); ?>       or <a href="<?php bloginfo('url') ?>/wp-login.php?action=register"> Register     <?php }?>
      but problem is : redirect to login page not current page... I want it should go to home page after logout. Please help me...


Pulling Advanced Custom Fields from other pages

Basically I am using Advanced Custom Fields and have an ajax tabbing system that works with the ACF. The current set up is below:

General

Courses

In the area

Sports & facilities

      At the moment, I am loading external php documents through AJAX, only problem is, the php is not loading as when echo'ing that field, it cannot be found as it is held elsewhere. How can I use the custom fields to display what's in that page template, that is held elsewhere? I current am using:               <?php echo the_field('current_students'); ?>      To display the field, but where it's an external PHP document, it doesn't work.


After moving a site to another domain, all images are lost

I moved from www.domain1.com to www.domain2.com Trouble is the image paths left looking at www.domain1.com/wp- content/uploads... So when www.domain1.com went down all my images are now lost. I updated wp_posts table where all attachments now point to www.domain2.com/wp-content/uploads... The images exist in www.domain2.com but still I cannot see any image. Caching is off. Help!!!


Edit the output of wp_widget_rss_output()

I want to show rss feed in my dashboard widget, i use this code:               wp_widget_rss_output(array(         'url'           => 'http://www.example.com/',         'title'         => __( 'Some Title' ),         'items'         => 1,         'show_summary'  => 1,         'show_author'   => 0,         'show_date'     => 0     ));      but after the 'show_summary' wordpress addes '[...]'. How do i remove it?


handling login/logout redirects

I have a couple issues with the way Wordpress handles redirects on login and logout. Standard behaviour is:               login: /wp-login.php (with no redirect_to url) -> /wp-admin.php      logout: /wp-admin.php -> /wp-login.php      What want is:               login: /wp-login.php (with no redirect_to url) -> homepage     logout: /wp-admin.php -> homepage      Would prefer a coded solution please. It helps me to learn and understand how Wordpress works. Thank you


How to show Disqus comments and pingbacks?

I use disqus to handle comments on my blog. I also like to have pingbacks from various posts back and forth to each other (and from outside sources. However, I noticed today that while the comment count at the bottom of a post will show the total number of "comments" (including pingbacks), _only_ the Disqus comments are actually displayed. How can I get pingbacks to appear _as well as_ Disqus comments?


how to dynamically access file upload fileds

in my custom plugin i wrote a php file for displaying a table in front end. and the datas used to display in that are taken from db and i added a input file upload field also but the file uploading is not performing. the part of code is:                 <form name="form_subscriber" method="post" action="<?php echo the_permalink(); ?>" enctype="multipart/form-data" >       foreach ( $testdatea as $data ) {       <?php echo(stripslashes($data->eemail_name_sub)); ?>	        <?php echo(stripslashes($data->eemail_email_sub)); ?>	        <?php echo(stripslashes($data->eemail_mobile_sub)); ?>	        <a href="javascript:void(0);" onclick="show_addreports('<?php echo $i;?>');">Add Report                 <div id="<?php echo 'Addreport'.$i;?>" style="display:none;">              <input type="file" name="report_uploadadd" id="<?php echo 'report_uploadadd'.$data->eemail_mobile_sub;?>" size="20"/>                           <input type="submit" name="Submit" class="button-primary" value="add" onclick="return addreportlab('<?php echo(stripslashes($data->eemail_mobile_sub)); ?>')"/>
              <a title="Delete" onClick="javascript:_subscriberdealdeletebylabs('<?php echo($data->eemail_patient_id); ?>')" href="javascript:void(0);">Delete
         <?php $i = $i+1;  } ?>        <input type="hidden" value="" name="reportsaddlab" id="reportsaddlab" >        <input type="hidden" value="" name="additional" id="additional" ></form>      The code for file uploading used is:                    if (!function_exists('wp_handle_upload'))         require_once( ABSPATH . 'wp-admin/includes/file.php' );         $floc='report_uploadadd'.$_POST['additional'];     $uploadedfile = $_FILES[$floc];          $upload_overrides = array('test_form' => false);     $movefile = wp_handle_upload($uploadedfile, $upload_overrides);     @$url = $movefile['url'];     @$type = $movefile['type'];     @$file = $movefile['file'];     @$filename = basename($url);     $rrfilename = $_FILES[$floc]['name'];          if ($movefile) {         echo "
File is valid, and was successfully uploaded.
\n";         var_dump($movefile);     } else {         echo "
Invalid file upload !
\n";     }     exit();      The javascript function used in this process is:               function addreportlab(ptmb){      if(document.form_subscriber.report_uploadadd.value=="")     {         alert("Please add a file.")         return false;     }      document.form_subscriber.reportsaddlab.value = "true";     document.form_subscriber.additional.value = ptmb;      document.form_subscriber.submit();      } The var_dump output is :               array(1) { ["error"]=> string(212) "File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini or by post_max_size being defined as smaller than upload_max_filesize in php.ini." }


Rewriting WordPress core functionallity: Changing the private posts

I'm trying to rewrite a bit of core WordPress functionality. I'm using WordPress 3.9.2 and I consider myself an intermediate in WordPress programming. This is an image that will explain what I am trying to do: ![Explanatory image](https://cloud.githubusercontent.com/assets/1983593/3995444/04c8c072-2928-11e4-9a7f-b0bc7a598339.png) Currently, when one sets a post to "Private", it will hide the post from view, only to be accessed directly through it's link and by specially privileged users. This is not what my customer want, they want a "Member" (Norwegian: Medlemmer) functionality instead, where that option will make the posts exclusively visible for that specific access role. So for an anonymous user you would see some posts, but when logged in as a member, you would see all of those posts. I am also trying to remove the "Password protected" option, as this does not apply to my customer's website, but this is not a priority. So my question is: **Any ideas on what I will have to do to change this from a plugin?** My current thoughts are in the lines of filter hooks. Any help appreciated.


Exclude custom taxonomy term posts from custom post loop

I have a custom post type set up called `projects` with a custom taxonomy called `categories` that has a number of terms. For one of them called `archive` I would like to remove its associated posts from the custom post loop. I'm attempting with the code below, but doesn't seem to be excluding.               <?php $loop = new WP_Query( array( 'post_type' => 'projects', 'orderby'=>'rand', 'posts_per_page' => -1 ) );           query_posts( array(     'post_type' =>'projets',     'tax_query' => array(      array( 'taxonomy' => 'categories', 'field' => 'slug', 'terms' => array( 'archive', ), 'operator' => 'NOT IN',),)     ) );     ?>          <?php while ( $loop->have_posts() ) : $loop->the_post(); ?> POST CONTENT <?php endwhile; ?>


How to remove Biography from user profile admin page

I would like to remove or hide the Biography input field from the profile page. How do you do this? I already removed some contact methods from this page, but I'm not sure how to get rid of the biography.


Display 1 Post per taxonomy with polylang

I am trying to make a loop where I display all my taxonomies with the first post of every taxonomy. It's the taxonomy `"customers"` and I want to display every first portfolio-CPT of the customer. I have **polylang** with english and german language installed, all working, instead of this loop. The Loop is working, but the project always get me the english posts. No matter what language it's set. Here is a pastebin, just to be clear the customer tax is `"kunden"` and the custom post type is `"portfolio"`. The `"kunden"`-tax is not translated, both language use the same one. The `"portfolio"`-cpt is translated.               <?php get_header() ?>

                     <?php                          $lang = pll_current_language();                          $terms = get_terms( 'kunden' );                          foreach( $terms as $term ) :                                  $args = array(                                     'post_type' => 'portfolio',                                     'kunden' => $term->slug,                                     'posts_per_page' => 1,                                     'lang' => $lang,                             );                             $single = new WP_Query( $args ); ?>                             <?php if ($single->have_posts()) { ?>                                  <?php while ($single->have_posts()) : $single->the_post(); ?>                                  <?php get_template_part('project-thumb'); ?>                                  <?php endwhile; ?>                                  <?php } ?>                     <?php endforeach; ?>

               <?php get_footer() ?>      If I change `post_per_page => 2` the german post is the second one after the english one. So both Languages are displayed one after another.


Metabox Populated with a Custom Post Type - How to Output CPT based on Select?

I have a dropdown metabox populated with a custom post type, now in my template, I can get the value of the metabox output but what I really need is all the information stored from that selected CPT to be displayed in certain areas of the post. **My metabox**               $meta_boxes[] = array(     'id' => 'actordetails',     'title' => 'Select an Actor',     'pages' => array( 'films' ),     'context' => 'normal',     'priority' => 'high',          // List of meta fields     'fields' => array(              array(     'name' => '',     'id' => $prefix . 'getactors',     'type' => 'select',     'clone' => false,     'options' => get_actors_options(),         ),               )      );      **My function**               function get_actors_options( $query_args ) {          $args = wp_parse_args( $query_args, array(         'post_type' => 'actors',     ) );          $posts = get_posts( $args );          $post_options = array();     if ( $posts ) {         foreach ( $posts as $post ) {             $post_options [ $post->post_title ] = $post->post_title;         }     }          return $post_options;     }      This is what I get with:                   <?php echo get_post_meta($post->ID, 'nt_getactors', true); ?>      ![enter image description here](http://i.stack.imgur.com/QPM7d.png) **This is what I need:** ![enter image description here](http://i.stack.imgur.com/3oRmt.png) So what code would I use to get the rest of the custom post type that I selected.


post parameter 'name' 404 error

I am integrating the WorldPay hosted payment pages gateway to my WordPress installation and I am setting a notification URL in WorldPay to a route within WordPress. The problem I am having is that WordPress automatically responds with a 404 error if you pass it a parameter called 'name', or any other reserved term as defined here: WordPress reserved Terms as WorldPay does. I was wondering whether it is possible to change this default 404 response, I have tried using `unset($_POST['name'])` within my plugin code, but I assume that this is too late within the request lifecycle as it didn't alter the response. I would also prefer not to set my callback url to another script, which would then alter the $_POST array and pass it on to my plugin, if anyone can suggest a way I can achieve a 200 response without doing this? **edit: My question in a much easier to read format** Remote service X is sending a callback to my WordPress site of example.com/?name=nameofaccount how do you handle that when WordPress uses name as a reserved term and the remote service wont change?


Disable plugin only for one post

It's possible to disable a plugin just for a post? I'm displaying a post in my footer but I've installed **Simple Facebook Share Button** and I don't know how to remove that button. Unfortunately I can't use css to hide the button :( How can I do this? Thanks


Is it possible to setup a gallery in the backend without including it in the content?

I want to setup a gallery without including it in the content to be able to access it in the theme files. Currently I use a dummy page that only contains the gallery and isn't reachable from the front end. I would prefer to skip this step and keep the gallery setup on the page where it is displayed. If the gallery has to be include in the content could I modify the handling of the shortcode in a template specific way and include the gallery before calling `the_content();`?


Unexpanded shortcodes in search engine results

I have some shortcodes on pages e.g. [fb_like] [twg_gpo_button] [ratings]. If I visit page they expand correctly but on search engine results page, they do not expand on some pages. I have installed W3 Total Cache plugin. Is this due to it? What should I do to prevent this in future? I want to remove such pages from search engines results too.


Theme editor menu item refuses to go away

I've got an action set up on `admin_menu` to modify it as needed. I successfully removed the themes menu with the following:               remove_submenu_page('themes.php', 'themes.php');      Now I want to get rid of the useless yet dangerous theme editor.               remove_submenu_page('themes.php', 'theme-editor.php');      This refuses to work for whatever reason. I can remove any of the other appearance menu items but the theme editor refuses to listen to my demands. That particular menu item is indeed added via `add_submenu_page` on line 163 of `wp-admin/menu.php` so I fail to see why I can't get rid of it. Is this a bug or am I missing something?


Disable media upload in rich text editor

I wonder if there any way to disable/remove the Upload/Insert button on the text editor that created on the custom field? I already has a field that handling the file upload, so I just want the text editor to handle text with basic formatting and lists features. Thanks


Remove Ability for Other Users to View Administrator in User List?

_( **Moderator's note:** Original title was "Remove Admin from User Menu")_ I have created a client administrator role which is essentially an Editor with ability to add/remove users. The article _"Editor can create any new user except administrator"_ was excellent in helping keep my new client admin role from editing or creating a True admin user. However what would be ideal is to hide administrators from client admins when they are viewing users. I want them to _"believe"_ that they are the admin of their site but I do not want them to be able to even view my role/user-- essentially hiding the _"administrator"_ role from them when they are in the _"Users"_ panel.


restore a db after bad backup

i haven't got any experience in wordpress so please sorry me if answers seems too trivial. one upon a time i had a blog. then the hosting service expired and i get a backup in a hurry way: the bad way.   * i copied all the root directory   * i dumped the mysql database now i've just paid for reactivate the host and i want to restore the blog project ( **BUT** the directory is changed now, the file are no more in _/htdocs/public/www_ but in _/public/www/blog_ ), but i am experiencing some troubles.   1. first of all i've fixed wp-config.php with the new database name, and new user, it seems to be OK.   2. then i've done a copy of all files back in the server and redone a wordpress installations via wp-admin/install.php . updated wordpress and plugins.   3. imported the database back with phpmyadmin. now if i go to visit index.php i get this error after the title:               Error 404 - Not Found          Apologies, but we were unable to find what you were looking for. Perhaps searching will help.      and no css is loaded. i've tried the queries founded in this link but they have produced no changes in sql tables. some advice?


Displaying Posts Attached to Custom Taxonomy Terms

The following displays a parent term in a custom taxonomy, then displays the child terms and finally is intended to display the post links (custom posts) for the posts attached to each term. Thus:   Parent     * Child 1      * Post 1.1     * Post 1.2    * Child 2      * Post 2.1   etc.   etc.   However, the query is returning no posts. I'd appreciate any pointers as to the source of the problem. For the sake of brevity I've omitted the set up list of variables that precedes this code.                 echo("
". $chapter_info->name . "
");     echo("
"); // Start sections Div.         foreach ($sections as $section){                     echo("
". $section->name."
");// Display Section Name         $pagequery=NULL;         $postqueryargs = array(                 'post_type'=>'book',                 'taxonomy'=> $taxonomy,                  'terms'=> $section->slug                                                                 );         $pagequery = new WP_Query($postqueryargs);         echo("
");// Start pages div         echo("
");             if($pagequery->have_posts()){                 while ($pagequery->have_posts()):$pagequery->the_post();                     echo('
' .get_the_title() . '
');                  endwhile;}         else{             echo("No Pages Yet In This Chapter");             }                echo("
");           echo("
");/* End pages */               }// End foreach - Sections     echo("
");/* End section */


How to find an option in the database?

As far as I can tell, the plugin that I'm using is saving options to the wp_options file:               ### New global settings container, will eventually be the only one!     $cformsSettings = get_option('cforms_settings');      When I go into phpmyadmin, however, I can't find the cforms_settings option_name? Can anyone help me trouble-shoot this? I have a backup of my old data but I can't add it. I've also tried creating a completely new form and then searching the database and I've been unable to find it. Very puzzled!!


How to get rid of shortcodes in post content once and for all

I changed theme/plugin now the post content still display shortcodes. There are some tips around on hiding them, but everytime I use some content functions, the shortcodes shows up again. Also, my shortcodes are the "extended type" such `[theshortcode id="34877"]`, `[theshort size="large" "tiny"]` etc so the tips on removing them from database doesn't work at all.


Calling multiple scripts using wp_enqueue_script

I'm trying to call multiple JQuery scripts using wp_enqueue_script. The call to JQuery works perfectly but the second call to cufon doesn't. I'm not a php or javascript expert - could anyone lend a hand, is there a best practice method for this?               function my_init_method() {         if (!is_admin()) {             wp_deregister_script( 'jquery' );             wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js');             wp_enqueue_script( 'jquery' );         }     }              add_action('init', 'my_init_method');          function my_init_method2() {         if (!is_admin()) {             wp_deregister_script( 'cufon' );             wp_register_script( 'cufon', 'http://mydomain.com/wp-content/themes/simplefolio/js/cufon-yui.js');             wp_enqueue_script( 'cufon' );         }     }              add_action('init', 'my_init_method2');


restricted rss feed

One of my wordpress blog is protected by the wordpress password plugin. however, I would like provide rss features. I found how to configure wordpress plugin to make rss work. But, by default, it seems that all the content of a post is sent by the feed. I would like to limit the information available by rss. Ideally, I would like to provide only the title of a post by rss. I have pictures and video (by vimeo) that have not to be available by rss ! Any help ? Thanks


Why Does the WordPress Twitter Tools Plugin give a 500 Internal Server Error?

When submitting API key information and clicking "Connect to Twitter" in the WordPress "Twitter Tools" plugin, I get a 500 internal server error. Nothing is logged by apache or php. I'm using WP 3.3.2, Ubuntu Meerkat, apache2, PHP 5.3.3-1ubuntu9.10. Although I am not sure what their wp/web/php/wordpress server settings are, others seem to be experiencing the same issue, as can be seen on this thread (which is in what is supposedly the official support forum, but no luck with a response there yet): http://wordpress.org/support/topic/plugin-twitter-tools-error-when-clicking- on-connect-to-twitter. Any ideas on possible causes or fixes? Does anyone know if this plugin is still being supported?


Questions about Robots.txt

I need some help with robots.txt. Under Privacy Settings, I selected "I would like my blog to be visible to everyone, including search engines..." As I understand it, WordPress automatically creates a robots.txt file. But, I need to exclude one page from the automatically generated robots.txt file. Let's say the page is called, "myPage". How do I keep myPage from being indexed? If I make my own static robots.txt will it be overwritten by WordPress' dynamic one? Also, does WordPress' auto-generated robots.txt exclude files like wp-admin, that shouldn't be indexed? Thank you! -Laxmidi


Access code/password only restricts page access, no user registration..?

Does anyone know of a plugin that will allow for a simple access/invite code to be given out, and when entered, will allow access to a certain page? I'm looking to only have one input field and no user registration needed to access a certain page of the site, and to just be able to give out unique codes that will grant access. I can't find anything like this that isn't a full user membership plugin. Any help or point in the right direction is much appreciated.


List top 5 authors with most posts

How are you? I have a blog which have 20 authors. I want to write code to show the 5 author who have more posts. like this: Adam (10 Posts) Khal (8 Posts) Yous (5 Posts) Moha (3 Posts) Yousef (1 Post) but I don't know how can do it that


How to query / DB requests?

what is the correct way to query the a Wordpress database, meaning to pull row and column info, and then place it into a corresponding table in the Wordpress admin? I'm wanting to do a query similar to that of the "links" section in the Wordpress admin, being able to both "edit" and "delete" the rows/columns individually. I've already found plenty of articles on setting up tables, and have the edit/delete front end in place, but just need a solid example of how to make a database query pull the info to edit/delete/add the info to the table.


Possible?! A contextually titled back link

The dilema:   1. I have a category menu in sidebar.php that highlights the category one is in.   2. I need to keep that highlight ON when one dives into a post of that category.   3. The blogs posts are usually associated with more than one category. So we can't rely on getting the posts category to achieve this as it'll return multiple categories.   4. Furthermore, the user is able to navigate to the next or previous post from within the post, so when the user navigates with this method, how will that communicate to the category menu that it's still in the originally specified cat? You can see it partially working here. When you are in catagory.php, i have it so that it highlights the current category in the category menu, but it's not working once you go to a post. I think this one is surely for the pros. I dont even think Mullenweg could figure this out!


post_content getting cut off on blank space on $wpdb->update

I am publishing the following post via xmlrpc               <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">     <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><meta name="Generator" content="Microsoft Word 14 (filtered)">

This is a new document

Test Test Test

                 With **define('SAVEQUERIES', true);** option in wp-config, the following MySQL query is produced:               (         [0] => UPDATE `s_6_posts` SET `post_author` = 9, `post_date` = '2012-04-11 20:40:05', `post_date_gmt` = '2012-04-11 20:40:05', `post_content` = '\n\n\n
\n\n
This is a new document
\n\n

\n\n
Test Test Test
\n\n
\n\n\n', `post_content_filtered` = '', `post_title` = '', `post_excerpt` = '', `post_status` = 'draft', `post_type` = 'post', `comment_status` = 'open', `ping_status` = 'open', `post_password` = '', `post_name` = '', `to_ping` = '', `pinged` = '', `post_modified` = '2012-04-11 20:40:05', `post_modified_gmt` = '2012-04-11 20:40:05', `post_parent` = 0, `menu_order` = 0, `guid` = 'https://qa.citivelocity.com/cvauthor/equitywire/?p=230' WHERE `ID` = 230         [1] => 0.12744808197021         [2] => wp_xmlrpc_server->serve_request, IXR_Server->IXR_Server, IXR_Server->serve, IXR_Server->call, wp_xmlrpc_server->mw_newPost, wp_insert_post     )      When I look at the database after the insert, the post_content column only contains

This is a new document

      What is happening here is in                      block, everything after the space between `<span>` tag is cut off. I manually ran the MySQL update statement from console and it inserts the data properly. The collation for mysql is **utf8_general_ci** and the data does not contain any special characters. I am at a lost as to why this is happening.


Having two different versions of the same post?

I'm currently working on a site that's targeted for beginners in a new language. Now I'm looking for something that can ease my work with having two different versions of the same post. One "easy to read" and one with more adept language. In the front end there should be some sort of option that let the user tab to which ever version he or she would want to read. Would be good if the user could set a default value in the user profile aswell. Anything ring a bell? I figure WPML would be worth a shot, but I haven't used it before, and I would like to try and find something else, since WPML also seems a little bit to advance for this purpose.


Show metabox in custom-post-template depending on taxonomy term?

I'm not sure if there is a solution for that but I'll ask it anyway :) I've built a custom-post-template and a related custom-taxonomy. The taxonomy works as kind of "categories" for the custom-post-template. The taxonomy has terms like "car, house, wood". I use `metaboxes` to add custom meta-data to my custom-post-template. I wonder if it's possible to have different metaboxes visible for different tax-terms? e.g. When I create a new post (with my custom-post-template) and check the "car"-category I want an additional `metabox` to input additional data. This metabox should just appear if the post is associated with the car-term inside that taxonomy! Is that somehow possible? Thank you!


Comment author url link is wrong? How to change from authors/ to author/

I’m maintaining a rather simple blog where a small number of people are registered as administrators to write posts. When making a link to the authors URL in a posts meta data, I use the function               get_author_posts_url(authorid).      This links to e.g. `mydomain.com/author/bill` This is the correct URL for the author Bill. Now I’ve just discovered that when one of the admins create a comment to a post, the author comment URL link reference to the wrong URL. If same author, Bill, makes a comment to a post, the link is:   `Mydomain.com/authors/bill` (with an **s** behind author). This is wrong and when following this URL it gives me a 404 error. I’ve tried different methods to overcome this, trying to create my own callback comment function, tried to create a custom rewrite function and such but nothing has worked. Initially I don’t understand why the comment author URL is different but that’s another question. Any help or suggestions to solve this small, but very much annoying problem would be appreciated. Thanks   \- Mestika


Remove on behalf of in wordpress emails?

//email to members             $Memberdata_all ="select * from lwy_users where ID = $GuestID[$h]";              $Memberdata_array = $wpdb->get_results($Memberdata_all, OBJECT);             $to = $Memberdata_array[0]->user_email;              $from=$Sender_data_array[0]->user_email;                  // Email subject and body text             $link='abc';             $subject = 'A Golfing Executives member is offering to host golf';             $headers = "From: "membership@executives.com"\r\n";             $message = "Hi $fromname,

             This is to inform you that a  member wishes to host a round of golf.

             The following are the member details:

                       MemberID:       $user_id
               MemberName:     $fromname $fromnamelastname
             Golf Club Name: $clubname
                 Golf Club Location  $ClubCity
             Golf Club Website:  $ClubWebsite

                    Here are the hosting details:

             $noticetext

             Please visit the link to accept the request

             If you have any questions, please contact the member directly at  $from

             Regards

            ";            add_filter('wp_mail_content_type',create_function('', 'return "text/html"; '));       $hostemail=wp_mail($to, $subject, $message, $headers );       in Received email im getting...               golfinge@fs05.freshsites.co.uk; on behalf of; WordPress <membership@executives.com>      please help me ,how can i removegolfinge@fs05.freshsites.co.uk; on behalf of; WordPress .i need only from membership@executives.com


Style category link depending on category ID

I want to style a link depending on its ID, for instance, if the category ID is 2, then I want the link to be pink. My theme calls the category like this:               <?php if (in_array('categories', get_option('theme_postinfo2'))) { ?> <?php the_category(', ') ?>      I found a way to style specific categories in **lists** by adding:               li.cat-item-7 { ... }  /* category ID #7, etc */      to my stylesheet, however, I cannot find a way to do the same thing to links. What type of solutions are available? Please be detailed in your reply as my coding knowledge is limited.


Custom post type posts don't show in archive widget

I have a custom post type called 'Podcasts' but none of the posts are showing in the archive widget. Only the main query (blog posts) are being shown. I've tried adding this code below to include the Podcasts posts, but this only allowed them to show up in the archive template, which is great but not quite there yet.               /* Show Podcasts posts in archive */     add_filter('pre_get_posts', 'query_post_type');     function query_post_type($query) {       if(is_category() || is_tag()) {         $post_type = get_query_var('post_type');         if($post_type)             $post_type = $post_type;         else             $post_type = array('nav_menu_item','post','podcasts');         $query->set('post_type',$post_type);         return $query;         }     }      How can I get the Podcasts posts to show up in the archive widget? Edit: For clarity, I'm talking about when I click the dropdown in the native archives widget. The days/months that should have podcast posts don't even show up. Only the day/months for the blog posts show. Edit 2: I tried dropping this into `functions.php` and now the months containing the podcasts posts show up, but when I click on those months, it just leads me to the 404 WordPress template. However, when I click on a month containing a post from the main query, it takes me to the `archive` template listing those posts.               add_filter( 'getarchives_where', 'custom_getarchives_where' );     function custom_getarchives_where( $where ){         $where = str_replace( "post_type = 'post'", "post_type IN ( 'post', 'podcasts' )", $where );         return $clauses;     }


Multiple sub directories for theme template pages

I apologize if this questions has already been answered, I have a feeling I'm just not using the right terminology for my search. I'm in the process of building a base theme for my employer. One of the things we want to do with this new theme is have the option to switch from a standard template to one that's been Zurbified. The way I'd prefer to handle this is by having an admin panel checkbox. Within the theme itself we want to have 2 separate folders that contain the actual theme template files (Ex: `theme_folder/normal/page.php || theme_folder/zurb/page.php`). How would I go about properly processing this? Is there a hook/filter that allows you to specify which sub folder to use in the specific situation? From what I read its possible to have the sub directories house the template page files,   http://nacin.com/2012/03/29/page-templates-in-subdirectories-new-in- wordpress-3-4/   , but I'm not finding the call I need to tell Wordpress to use the specific subs.


Displaying year, month and day archives differently

I'd like to display daily archives differently than monthly/yearly archives. How do I check to see if the archive template is being pulled for a daily archive vs. a monthly/yearly archive?


Wordpress error on log out 'Not Permitted' and can't log out

I've got a weird situation whereby I sometimes can't log in as clicking on a link (or going directly) to /wp-login.php shows me a blank page with the words 'Not Permitted'. If I go to the /wp-login.php page directly from that 'Not Permitted' page, then I can log in using my details. If I try and log out again though, I reach that 'Not Permitted' page again and can't log out. That's a bit long-winded, so I've created a video so you can see what I mean: http://www.youtube.com/watch?v=BI3NTiGNgoE Has anyone come across this before? This is the first time I've seen this type of error, I've seen the 'are you sure you want to log out' error message before, but not this one... Thanks Osu


Changing order in which custom fields appear in dashboard

I have several custom fields for my CPT. In dashboard page of my CPT, when editing a CPT, I see my custom fields in "custom fields" box. But I want to change the order in which they are displayed. Is it possible?


How to specify widget order or css name via script?

I've got a routine (see below) that creates and inserts several widgets into the active theme's sidebars. However, I need more control over either the order/index the are assigned (ie, one of my widgets need to be at the top of any other widgets in the sidebar) OR, I need to be able to specify a custom css name for the widget. I've inserted a comment to catch the widget titled "my important widget" and apply the index or custom css I'll need to assign to that widget. Are either of these possible?               $file_name_widget = $files_widgets->getPathname();     $widget_text = file_get_contents($file_name_widget);     $widget_text_label = 'text';     $widget_ops = get_option('widget_text', array());     $widget_id = count($widget_ops) + 1;     if($file_name_widget == 'my important widget') {         //place code here to make this widget move to the top of any others in the sidebar its assigned to         }     $widget_ops[$widget_id] = array('title' => $files_widgets->getBasename('.txt'),'text' => $widget_text,);     update_option('widget_text', $widget_ops);                       $sidebar_id = basename($files_widgets->getPath());     $sidebars_widgets = get_option('sidebars_widgets', array());     $sidebars_widgets[$sidebar_id][] = $widget_text_label."-".$widget_id;     update_option('sidebars_widgets', $sideb


Plus sign in query string to custom page gets 324 server error

OK, so I've created a page (http://justinhealth.com/testsite/error-signing- up). It's a custom error page for iContact. Now, when there's an error in iContact's signup, it actually goes here: http://justinhealth.com/testsite/error-signing-up/?[error+message+here] The problem is that the plus signs in the URL cause a 324 server error. If there are no plus signs (like http://justinhealth.com/testsite/error-signing- up/?error-message-here) it works fine, but since I can't rewrite how iContact generates the address, I need to work with the plus signs. Any ideas on why I get an error? On the page itself, I capture the error using `$_server['QUERY_STRING']`, but I get the error regardless of whether that's on the page or not.


Problem with Line spacing in wysiwyg editor in WP 3.5.1

Since updating to 3.5.1, I can no longer get single line breaks in the WYSIWYG editor. I used to be able to shift-return for a line break and return for a paragraph break. But now all lines have double spacing. Hitting "delete" at the beginning of the line does not help. I can of course fix this by switching out of WYSWYG mode, but this makes no sense to me. I tried replacing the WP-ADMIN folder with a fresh copy, no change. Any ideas? ![enter image description here](http://i.stack.imgur.com/OPUpm.png)


qTranslate get content by language using wp_query

I've similar problem to the issue described here. On my bilingual website here http://redscouseworld.com/ I'd like to display posts only in Polish language. And here http://redscouseworld.com/en/ I want to show posts written in English only. I added following code to my homepage:
     <?php $the_query = new WP_Query( 'showposts=10' ); ?>     <?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>
<a href="<?php the_permalink() ?>"><?php the_title(); ?>

<?php the_excerpt(__('(more…)')); ?>
     <?php endwhile;?>
      And you can see that on English version both post types are being displayed (Polish and English) - half of them as untranslated ones. How can I display only proper ones on each site? I tried to hide them using qTranslate function "Hide untranslated content" but the result was empty page. I'd be grateful for your help! Thanks in advance!


What are the parameters are used in add_action and filters?

add_action( $hook, $function_to_add, $priority, $accepted_args );      I am unenable to understand what the code is used for? What are the inbuilt parameters and functions are mostly used in add_action?


Wordpress admin for a custom post, hide/collapse the main "title" and "description" boxes

Is there a way to hide the main "title" and "description" boxes for a custom post? I have a custom post with a large meta box. I won't be using the regular title and description so I would like to either hide it or collapse it so the user won't have to scroll to get down to my meta box.


Display All Non-Used Plugins

My company currently has a multisite of about 20 sites, and growing every day. We're trying to go through the plugins and set standards. IE, forms use plugin X. However, we have not found a single way to go through and systematically show which plugins aren't even used. Is there a function that can show us the used, or unused plugins? I have tried searching everything I can think of and cannot for the life of me find an answer.


How do I restore my site?

I accidentally deleted all my pages and posts from my wordpress admin. I was trying to delete some dummy data that one of my plugins installed on the website and wham!, all my posts and pages were gone. In the wordpress dashboard, my uploads are not showing but when I looked in the folder on my server, they were all there. Why is is showing on the server but not in the wordpress admin? I never backed up too. Now, what should I do to get everything back?


TinyMCE Anchor Button not showing

I'm using this filter and function to display a custom, stripped-down version of the TinyMCE editor. Everything works as it should...except the 'Anchor' button will not show ('anchor')? According to the TinyMCE website (http://www.tinymce.com/wiki.php/Controls), that is the control to use. **Does anyone know why the anchor button will not show?** ![enter image description here](http://i.stack.imgur.com/LfZ9C.png) **EDIT:** the code example comes from here (this shows the full code I am using, not just the snippet below): https://gist.github.com/mrwweb/9937127               add_filter( 'mce_buttons', 'wpse_mce_buttons_1' );     function wpse_mce_buttons_1( $buttons ) {         $buttons = array( 'styleselect', 'bold', 'italic', 'link', 'unlink', 'bullist', 'numlist', 'table', 'anchor');              return $buttons;     }     add_filter( 'mce_buttons_2', 'wpse_mce_buttons_2' );     function wpse_mce_buttons_2( $buttons ) {         $buttons = array();         return $buttons;     }


Hide custom menu when when no menu selected

The title might not a 100%, feel free to correct... I'm building a custom theme that has a couple of costume theme locations for menus (1 main menu, 1 footer menu, 1 "Follow Live" button). These are specified as a Theme Location in the Menu's panel. I'm having an issue with the footer menu: when that theme location does not have a menu selected, it falls back to displaying all pages. I'd like it to not display anything when it's not linked to a menu. The menu is defined in functions.php like this:               function add_footer() {     register_nav_menus(         array('footer-menu' => __('Footer Navigation'),));}      add_action('init', 'add_footer');      And it's displayed on the page like this:                   <?php              wp_nav_menu( array(             'theme_location' => 'footer-menu',              'menu_class' => 'false',              'container' => 'false',              'fallback_cb' => 'wp_page_menu',              ));?>      I've tried removing the `fallback_cf`option but that doesn't help.


Wordpress admin stylesheet

Is there a way to override the styles in the admin in my theme? I don't want to touch the admin style sheet if I don't have to. I just want to make a column bigger in my admin, but also, to do it in a way that doesn't get overridden in a future wordpress update.


How to add multiple the_content or something like that?

ok... let me explain: i have an example post in wp admin and i want to add :   * some text (already added via the posts editor)   * some custom stuff (some taxonomy that i have already added)   * some videos   * and some images How can i do this? I don't know how to add the videos and images after the content (the text )


add_filter 'single_template' and use of wp_nav_menu in template

I'm using `add_filter('single_template',...)` to call a unique template file under a certain condition. The problem we're running into is that no matter what I do I can't use `wp_nav_menu()` successfully in the template file we are calling. Does anyone have any experience with this situation?


get_footer can't find any variables set in functions.php

footer.php can't find any variables I set in functions.php, I've tried a global (urggh) and object array like so:               $foo = (object)array("bar" => "test text");      It works within page template, just not in the header or footer, does anyone know why this is happening? Thanks for reading.


where to set the PO file for a plugin?

I have a Cimy user plugin and I want to make translations and then force the Cimy user to read from my translation. Should I define the language in `wp- config.php` in the root folder?   I do not know where to change it? I have `define('WPLANG', 'fa_IR');` in `wp-config.php` and it is reading from path > \wp-content\languages Should I change the fa_IR PO edit and just add the ones from Cimy user in the bottom of the WordPress fa_IR PO? or I should use separate file?


List Posts For Terms Of A Custom Taxonomy For Any Post Type

The function is great and i am using this function with these filter to just display selected taxonomy term posts by id, but what result i am getting is like this Child Taxonomy 1   \- Child Taxonomy 1 Post 1   \- Child Taxonomy 1 Post 2   \- Child Taxonomy 1 Post 3   Child Taxonomy 2   \- Child Taxonomy 2 Post 1   \- Child Taxonomy 2 Post 2   \- Child Taxonomy 2 Post 3   Parent Taxonomy   \- Child Taxonomy 1 Post 1   \- Child Taxonomy 1 Post 2   \- Child Taxonomy 1 Post 3   \- Child Taxonomy 2 Post 1   \- Child Taxonomy 2 Post 2   \- Child Taxonomy 2 Post 3   Means at the last after listing the Child Taxonomy Term Name and Its posts the function is also displaying the parent Taxonomy Name and All the posts from its Child taxonomies in parent Taxonomy as its posts. I need help to get rid of that parent taxonomy at the last and all posts from child taxonomies in it too, so it will just display the result like this: "List All Child Taxonomies and Its Posts Only like below" Child Taxonomy 1   \- Child Taxonomy Post 1   \- Child Taxonomy Post 2   \- Child Taxonomy Post 3   Child Taxonomy 2   \- Child Taxonomy 2 Post 1   \- Child Taxonomy 2 Post 2   \- Child Taxonomy 2 Post 3   What should i do in this function to get the result working code below: Post Type = events Post Type Custom Taxonomy Term = events_cat Parent Taxonomy Term = announcments i need this function to only list child taxonomies of announcments and their posts not the announcments too at the end with all posts from its child taxonomies. Please help me how.                   // List posts by the terms for a custom taxonomy of any post type     $post_type = 'events';     $tax = 'events_cat';     $tax_terms = get_terms( $tax );     if ($tax_terms) {         foreach ($tax_terms  as $tax_term) {         $args = array(             'post_type' => $post_type,             "$tax" => $tax_term->slug,             'post_status' => 'publish',             'posts_per_page' => 4,             'caller_get_posts'=> 1         );               $args = array(     'tax_query' => array(     'relation' => 'AND',     array(     'taxonomy' => 'events_cat',     'field' => 'slug',     'terms' => $tax_term->slug,     ),     array(     'taxonomy' => 'events_cat',     'field' => 'id',     'terms' => array( 3, 37 ),     'operator' => 'NOT IN',     )     ),     'post_type' => $post_type,     'post_status' => 'publish',     'posts_per_page' => -1,     'caller_get_posts'=> 1     );             $my_query = null;             $my_query = new WP_Query($args);                  if( $my_query->have_posts() ) : ?>
All <?php echo $tax; ?> Posts For <?php echo             $tax_term->name; ?>

                 <?php while ( $my_query->have_posts() ) : $my_query->the_post(); ?>                          <li id="post-<?php the_ID(); ?>">                         <a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
                      <?php endwhile; // end of loop ?>
                  <?php else : ?>             <?php endif; // if have_posts()             wp_reset_query();              } // end foreach #tax_terms     }


category pagination got broken suddenly

i need some help here please! The pagination just stopped working suddenly with the default post type and default wp query, with plugin "wp-paginate" or even with next/prev arrows! It echo 404 error when navigate to any sub page. Any clues what may cause this ? thanks


post_class output in wrong area?

Trying this in my functions file. There is actually a lot more to this function than I am showing, but this is the important part that is messed up.               function xyz_loop() {             $defaults = array (                 'before' => 'article id="post-' .get_the_ID(). '"' .post_class('clearfix'). 'role="main">',                 'after' => '/article>',             );                        $args = wp_parse_args( $args, $defaults );         extract( $args, EXTR_SKIP );              echo $before;              echo 'doing stuff here';              echo $after;}      the problem is the post_class is outputting the post classes before the article container instead of inside it. Can I not use post_class like this?


Querying posts with meta value that begins with a certain pattern

I am trying to create a search filter using meta_query. The only problem I'm having now is that I can't compare with wildcards. I think that's how you word it?               $keyword = 'sos';     $tlds = array('com','net','org');          query_posts( array(         'post_type' => 'domains',         'meta_query' => array(                 array('key' => 'domain_name',                       'value' => $keyword,                        'compare' => 'LIKE'                 ),                 array('key' => 'domain_tld',                       'value' => $tlds,                        'compare' => 'IN'                 )         )      ));      This code will work fine, but right now it just checks whether the domain_name contains the keyword anywhere in the string. I want to check whether the domain_name begins, contains or ends with the keyword. I tried adding the '%' sign to define the wildcard so that it would search for the pattern, but I don't think meta_query allows wildcards.               $keyword = 'sos%';     function where_keyword( $where = '' ){         $where .= " LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id)          WHERE $wpdb->postmeta.meta_key = 'domain_name'          AND $wpdb->postmeta.meta_value LIKE '$keyword'";         return $where;     }     add_filter( 'posts_where' , 'where_keyword');      This was my second attempt, but I am not sure if my approach is correct? I'm a novice when it comes to sql. I've been get this working for days so I thought I'd see if anyone else has attempted this.


Does WordPress have an Browser Agent?

I want to block a directory to everyone but WordPress's internal upgrade feature (I am trying to get WordPress to do auto-updates of my premium plugin). I have it updating, but I really would like to block the directory for everyone but WordPress. Anyone know what WP's internal User Agent is?


How to obtain a reference to the_excerpt() from custom loop

I have a script in archive.php, which is outside the loop, that calls on the function get_blog_links() to list all posts that belong the the current category (my "blog" category). I'm trying to do some trace testing inside the "get_blog_excerpt() function in order to write out either the post excerpt or (if no excerpt appears) the first 55 words of content (the_excerpt) for each post. However, I'm unable to obtain a reference to the_excerpt in my function. Any help much appreciated.               //Blog Listing     function get_blog_links(){         $myposts = get_posts();         echo '
';          echo '
'; foreach($myposts as $idx=>$post){ ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>       // THE FUNCTION CALL IM WORKING ON...                 <?php echo get_blog_excerpt();?>
         <?php }          echo '

';     }               function get_blog_excerpt(){         // return get_the_excerpt(); WORKS         // return the_permalink();  WORKS         // return the_excerpt(); DOES NOT WORK?         // return get_the_content(); DOES NOT WORK?     }