save_post action not firing due to old page_template meta data

I have some functionality hooked to the save_post action that wasn't working for a user on a particular WordPress Page. After some digging I found that wp_insert_post() was returning before getting to do_action( 'save_post'.... because of the following logic: (wp-includes/post.php line 3187...)               if ( !empty($page_template) && 'page' == $data['post_type'] ) {         $post->page_template = $page_template;         $page_templates = wp_get_theme()->get_page_templates( $post );         if ( 'default' != $page_template && ! isset( $page_templates[ $page_template ] ) ) {             if ( $wp_error )                 return new WP_Error('invalid_page_template', __('The page template is invalid.'));             else                 return 0;         }         update_post_meta($post_ID, '_wp_page_template',  $page_template);     }      Turns out the user had assigned a page template to the page when using a previous theme, but my theme doesn't support page templates. In this case, the $page_template variable above is set to 'template-grid-gallery.php', which is not a template file in the current theme. Consequently, the function returns zero and never reaches the save_post action (several lines below). Is there some way to explicitly turn off page template support in a theme so that WordPress doesn't ever check for a page template. Otherwise it seems like the save_post action would never fire if the page has a page template assigned, but is using a theme without page template support. Obviously I could just delete the _wp_page_template meta data for that page, but I'd like to protect against this kind of problem for other users in the future.


Menu Items Disappearing

I'm running WP 3.5.1 and I've a menu with about 100 items. When I add new items to the menu older ones disappear. I'm not running Suhosin or similar stuff. What can be the cause? Note: I'm on a dedicated server.


Sorting a list of users by a user taxonomy with Pods

I’m trying to use user taxonomies to sort my userbase into categories and then show a list of taxonomies in the sidebar that on click expands to show the users within each taxonomy. I’m struggling a bit with this as get_users() doesn’t allow you to query by taxonomy as they aren’t stored in the usermeta table. So I thought a relational field with pods might allow me to do this, but I’m having a hard time wrapping my head around pods and pulling data out. So here is the original code: https://gist.github.com/mrpritchett/ee86154f32aac7a31b36 And here is my attempt to echo any data from my pods attempt (it fails with the error Fatal error: Call to a member function find() on a non-object in…): https://gist.github.com/mrpritchett/16687da67735c01b02ed An explanation on what I’m doing wrong with pods would be greatly appreciated and any ideas/help with the greater problem would be icing on the cake! :)


Plugin dont Work Inside AJAX Call

I'm doing a Progress Bar Shopping Experience (in my WooCommerce site). First the user select the plan (demo, home, business, premium), then select the products he wants, and finally I've to show them the cart table. I use the following code to send the items using AJAX (In the same template):               <?php         if(isset($_POST['action']))          {           global $woocommerce;           $woocommerce->cart->empty_cart(true);                            $woocommerce->cart->add_to_cart( 2932, 30 );                echo do_shortcode('[woocommerce_cart]');           die();         }     ?>     <?php get_header(); ?>

     <?php echo do_shortcode('[woocommerce_cart]');?>          <?php get_footer(); ?>     <?php get_sidebar(); ?>      My problem is that the table (the first one) that return the AJAX is WITHOUT the price discounts of the plugin "woocommerce dynamic pricing discounts". But if inside any template i use:                 <? echo do_shortcode('[woocommerce_cart]'); ?>      Its return the table (second table) WITH the price discounts... You can see the example here: http://cl.galyleo.net/prueba-carro/ of the code with the 2 cases. Any ideas?


Can't update multiple rows with $wpdb query

it seems that I cannot update multiple rows to change the post_type of posts having a specific tag. I follow different method, even if it seems the good one is this one :               global $wpdb;     $result = $wpdb->query("UPDATE $wpdb->posts SET $wpdb->posts.post_type = 'editorial_post' WHERE $wpdb->posts.post_type = post AND $wpdb->postmeta.meta_key = 'tag'      AND $wpdb->postmeta.meta_value = 'editorial'");     var_dump($result);      `Var_dump()` always returns a null result. Can someone tell me where I'm wrong ? Thank you very much.


Displaying custom filed content instead of post content

Plugin allow to add a custom field in post/page. In post/page, i create a custom field, so user can input content on this field. And i want if user input to this field, the post/page will display this content on screen, instead the main content that input via post/page editor. Anybody can let me know how to do this ? It is a plugin, so i can not edit template. I have tried with add_filter -> the_content , but it seems only apply for post type, how to make it works with both post/page type ?               add_meta_box(                 'st-page-builder',          // Unique ID                 esc_html__( 'Page Builder', 'page-builder' ),       // Title                 'pageBuilderCallBack',      // Callback function                 'post',                 // Admin page (or post type)                 'advanced',                 // Context                 'default'                   // Priority             );          function pageBuilderCallBack($object, $box) {         wp_nonce_field( basename( __FILE__ ), 'page-builder-nonce' );         $page = get_post_meta($object->ID, 'page_builder', true);         require_once 'form-input.php';     }          function displayCustomContent() {         // how to replace main post content with custom content ?         if (is_page() || is_single())          {               global $post;                    $pageBuilderContent = trim(get_post_meta($post->ID, 'page_builder', TRUE));                    if ($pageBuilderContent) {                    return $pageBuilderContent;               }          }               return $content;     }           add_filter('the_content', 'displayCustomContent');


jQuery .load and WP function

I am attempting to get the Quick Chat WordPress plugin to load only if you click on a button. I'm currently using this code:               $('#chat').load('path to my wp template/quick-chat.php');      ... where the file 'quick-chat.php' has a WordPress function that calls Quick Chat. When the file loads, however, it's not recognizing the function. It's acting like it was outside of WordPress. Any ideas?


Display check marked taxonomies as drop down menu

I've built a hierarchical taxonomy that displays a master list of available fragrances in the admin. When you create a page, you checkmark the fragrances that are available for that particular post. I used this code to functions.php and it seems to work in the admin:               add_action( 'init', 'build_taxonomies', 0 );          function build_taxonomies() {     register_taxonomy(     'scents',     'page',     array( 'hierarchical' => true,     'label' => 'Scents',     'query_var' => true,     'rewrite' => true ) );     }      Now I need to output the checkmarked items so they display on the post in the form of a drop down menu. The problem is that it outputs ALL scents that have been check marked across ALL pages. I just need it to output the ones that have been check marked on the page you're on. Here's the code I used:               <?php wp_dropdown_categories('taxonomy=scents'); ?>      How to edit this so that it only shows the fragrances for the page I'm on? Thanks.


How to check if a shortcode exists?

I'm using `do_shortcode` function to add shortcode in my template. But i would like to check if that shortcode exists before display them. I mean like this               If (shortcode_gallery_exists) {       echo do_shortcode('[gallery]');     }      Can anyone help me? Thanks


Multi language site

I found that two most popular plugins for multi language sites are WMPL and qTranslate. First one is commercial, so this is not option, and second doesn't have ability to translate widgets in sidebars, or I don't know how to do it. Can you suggest me which plugin to use or what trick to do to have multi language widgets?


Followers for WordPress

I'm seeking a system for following (like used on Twitter.com) with the following parameters, or close to them, and I'm curious if anybody has a solution. I would like to avoid BuddyPress. **Basic PHP Code for Follow/Unfollow Links in WordPress Templates** A PHP code which generates a link that can be inserted on author pages to Follow/Unfollow a user. If the logged-in user is already following the author they are viewing, then the link will say "Unfollow". If the logged-in user is not following the author they are viewing, then the link will say "Follow" and allow them to follow the user. **A PHP Code Which Produces a List of All Authors Being Followed by Logged-in User** This would be useful to create a "Following" list so users have an easy place to view their author pages and un-follow them. Must be able to insert it on a page. **A PHP Code Which Produces a List of Users Following Logged-in User** This would be useful to create a list of "followers." Must be able to insert it on a page. **The Followed Authors Being Incorporated Into The Loop** I bet this would be the most practical way to incorporate posts from those being followed into a "stream," or loop of posts. I assume some function which pulled posts from followed authors may need to be created. Then posts could be grabbed in the normal fashion and the posts from authors being followed would be mixed in via the same method as all the other posts (for example, by date published). **Capacity/Scalability Concerns** I do not just want a comma separated list of user_id fields in a wp_usermetavalue to be created as this would only work up to a certain number of followers - think scalability.


Admin ajax request return 0 with die()

So i'm using this configuration for an AJAX call in the administrative area (like this):               add_action( 'admin_head', 'ajaxPerNgg' );          function ajaxPerNgg(){ ?>     <script type="text/javascript" >     jQuery(document).ready(function() {         jQuery("#message").remove();         jQuery("#errore a#attivo").click(             function(){                 var data = {                     action: 'my_action'                 };                 jQuery.post(ajaxurl, data, function(response) {                     if(response == "attivato")                         jQuery("#errore a#inattivo").attr("id","completato").html("Attivato");                     else                         jQuery("#errore a#inattivo").attr("id","attivo").html("Attivalo ora");                 });             }         );     });     </script>     <?php }          add_action('wp_ajax_my_action', 'my_action_callback');          function my_action_callback() {         echo 'attivato';         die();     }      It's just a test code, but it always return 0 instead of the string "attivato". It also find the ajax url correctly, without a 404 error.   What is the problem?


Custom Permalink with Dynamic Taxonomy for Custom Post Type - Works, but breaks other permalinks

My custom permalink with dynamic taxonomy is working for my custom post type. However, it breaks all my other permalinks. They display a 404 error in the content area (header and sidebar still display). I used the following code to create the dynamic permalinks for the custom post type:               /*Adds Custom Permalinks for Course Segments*/     function custom_post_link($post_link, $id = 0)     {       $post = get_post($id);            if(!is_object($post) || $post->post_type != 'course-segment')       {         return $post_link;       }       $course = 'course-segment';            if($terms = wp_get_object_terms($post->ID, 'course'))       {         $course = $terms[0]->slug;       }       return str_replace('%course%', $course, $post_link);            return $post_link;     }          add_filter('post_type_link', 'custom_post_link', 1, 3);      I also added the following to my `create_post_type()` function:               'rewrite' => array('slug' => '%course%')      I got the code to do this from: http://stackoverflow.com/questions/7723457/wordpress-custom-type-permalink- containing-taxonomy-slug. By simply commenting out the following two lines of code my old permalinks work, but of course my dynamic permalinks don't:               //add_filter('post_type_link', 'custom_post_link', 1, 3);               //'rewrite' => array('slug' => '%course%')      In `Settings` my permalinks are set to `%postname%`. Any thoughts or insights on how I can get both my normal permalinks and my dynamic custom post type permalinks working would be most appreciated! -Mark


Change meta box when the page's template is changed

For my WordPress theme I have a custom portfolio post type and a portfolio page template to display them. What I want to do is add a meta box to the edit page area, but only when the page has the portfolio template. Thanks.


W3 Total Cache can't create files

I want to use W3 Total Cache plugin. Installed plugin succesfully but i'm trying to enable Page Caching and i'm getting this error : > Page caching is not available: advanced-cache.php is not installed. Either > the /home/content/92/7450992/html/wp-content directory is not write-able or > you have another caching plugin installed. This error message will > automatically disappear once the change is successfully made. Plugin can't create advanced-cache.php to wp-content. wp-content's CHMOD is 777 but still same error. Do you have any idea ?


How can I make my posts on my home page just show summaries?

My home page lists all my recent posts, however it displays each post in its entirety. Is there any way I can force it to just show a preview, such as the first 10 lines? This would enable views to quickly scroll through and see the topics recently blogged, rather than having to scroll through a recent post which is incredibly large. (this also helps with more Ad impressions I believe) Under Settings > Reading, there is the following option `For each article in a feed, show ...Full Text / Summary` but I think this is only for feeds (RSS). Thanks * * *


Grouping posts by a custom meta value

I'm trying to output a list of dates that are held in a meta key called event_dates without duplicates. I've also tried a `wp_query` with a `meta_compare` but I'm not able to make that work either. Any help would be greatly appreciated. Thanks!               <?php          $args1 = array(             'post_type'=>'cw_events',             'showposts'=>-1,             'order'=>'ASC',                         );               $archive = get_posts( $args1 );               foreach( $archive as $post ) :              setup_postdata($post);             global $wpdb;                  $metatable = $wpdb->prefix."postmeta";                $post_id = $post->ID;                 $cal_dates = $wpdb->get_results(                 $wpdb->prepare(                     "SELECT meta_value                      FROM $metatable                      WHERE post_id=%d                      AND meta_key='event_date'",$post_id             ) );                  //output posts -- trying to use array_unique(), but it's not working                 $cal_dates = array_unique($cal_dates);               foreach ($cal_dates as $cal_date) {                       echo var_dump($cal_date);                 echo $cal_date->meta_value.'<br />';                      }          endforeach;      ?>      I saw this post, but the method does not seem to work. There's no such function as `get()` in wp.... Group posts by meta_key PS sorry for the messy code, SE seems to be having some trouble dealing with returns...


What is the most comprehensive backup plugin for WordPress (it does not have to be free)?

Related to this question I am currently using Automatic WP backup. It works ok. Now I am looking for something more comprehensive and granular. A plugin that let's me choose the sites to backup inside my network, the type of content, the granularity on restores. ETC. Examples of things that I will like to do:   * Schedule a backup, with notification to owners (site owners)   * Verification of the backup (that it will work once I need it).   * That I can change variables important to restore in different webhost


Transferring standalone wordpress blog to the one under **.wordpress.com

I have a blog that is working on wordpress installation and now I want to transfer it to the my new blog under WordPress.com domain name. Is it possible to carry all the content to new WordPress blog?


Contact information footer

I am new to Wordpress but forced to create a website as a Wordpress template for my current employee (I am a front end developer, mostly build new systems/apps etc from scratch). Creating the template is no issue, but how do I go about making everything fully editable? For example the footer: it contains contact information and I would like information to be fully editable from within the Wordpress admin. Everything however seems to resolve around posts and articles... so, my first idea was to simply make posts and categorize those as "Footer" and then filter the displayed posts on the loop in footer.php by that category but that doesn't seem very logical. What is a more common approach? Widgets? If widgets is the answer, how exactly do those present themselves in the admin section? Sorry for the long question :)


Finding the category id's on category intersection pages

I'm using category intersection pages for users to be able to filter posts by categories. E.g. http://freemapsalgarve.com/category/destinations/alvor+bars-pubs/ Here the user is filtering on the "alvor" AND "bars-pubs" child categories of "destinations". I want to be able to get the id's of the categories that are being filtered on the page so I can display them to the user but I am only able to get the first category. `$this_cat = get_category(get_query_var('cat'));` ...returns the first category "alvor" in this example. Does anyone know how I could find the both categories being filtered on here?


Theme URLs problem

I programmed a theme post (edit: probably that's the `single.php` template) which uses the function `get_userdata( $_GET['p'] )`. But the main admin reformatted urls to this: `~/author/gamelaster` (default is `?author=1`) and now this is not working correctly. > How do I get the id of Author in this URL format? Or > how do I get user slug + get id from database? But, I cannot use the standard author functions/post functions(get_ID etc).


How to link to a alternative page in CSS

I have a wordpress site and I want to be able to completely change a page that is displayed based on the browser size in my Custom CSS, so that if it is over 1500 pixels it loads a completely different page. Don't ask why it has to be this way, CSS syling does not do what I need as it's a complicated gallery that required a whole new template and new page, so now I want to be able to swtch between the 2 pages based on the browser size. I know I need to use this code - @media only screen and (min-width: 1500px) { but then I have not found what the code is to replace the page is that follows it. the Page id in wordpress is 164 and I want to replace it with 3902. If this is not possible what about changing the nav link in CSS instead so depending on the browser size it links to a different page? Thanks Jason


Limited excerpt with readmore

I wanted limited excerpt (40 words) with readmore link...I used this code below:               <?php echo apply_filters('the_excerpt',get_the_excerpt().'<a href="'.get_permalink().'"> read more </a>'); ?>      any help appreciated.


how can i add an array of post types to this query?

`$pp = new WP_Query('orderby=comment_count&posts_per_page=4'); ?>`


Comment moderation with disqus comments

Comment moderation on custom post types this answer shows moderation on custom posts. Is this possible with disqus?


How to set default metaboxes on user creation?

Just for repetition's sake, I want to do the following: I need to set custom fields and the excerpt metaboxes for WP default Posts post type when a new user is created. I know that by default WP doesn't show them but would like it to. I will be removing the Screen Options tab so the user won't be able to disable them. I know this question has been asked for different scenarios and I have tried using and changing the code that I found here and on the web that help manipulate this but without much luck (eg: How to set default screen options?). Obviously I've tried on different installs but it doesn't work. Is there another way of doing this?


How can I develop a plugin that generates a page dynamically

I want to develop a plugin that generates a page and embeds the page link in pages menu in the client part at the time of plugin activation. Please help me with this.


Filter query_posts by tag slug on "Tag Archive" page (when tag is 2 or more words)

I'm using the following to bring up a tag archive page:               <?php query_posts( "tag=". '' . single_tag_title( '', false ) . '' ); ?>      This works perfectly for all tags of one word only, but any tags of more than one word (eg: "tag one", slug: "tag-one") do not display. Is it possible to query_posts by tag slug, rather than single_tag_title? Thanks!


How do I define post titles as images using Custom Fields?

I've tried to follow a guide that explain how to do so but failed and I don't know why it doesn't work. The guide: http://wordpress.org/support/topic/unique-header-image-for-each- post   1. In my posts (WP GUI), I've added a custom field named 'PostTitle'. The value of these Posts are 153 & 156 as the post IDs numbers. Furthermore, I've uploaded two title pictures to my theme images directory:     * http://letthemstare.com/wp-content/themes/manifest_v1.1/images/153.jpg     * http://letthemstare.com/wp-content/themes/manifest_v1.1/images/156.jpg   2. Under header.php , I've added the following: ID, $myfield, true); ?>              .entry-title {         border:none;         color:black;       <?php       if($postimage) {        ?>         background-image: url('http://letthemstare.com/wp-content/themes/manifest_v1.1/images/<?php echo $postimage; ?>.jpg');       <?php       } elseif(!$postimage) {        ?>         background-image: none;       <?php       }       ?>     }        3. Post titles images load to each post title individually but: a. Images doesn't replace original text title b. Images are shown only within posts and not on the main page c. I'm not sure that the images will function as a link on the main page I choose entry-title according to the following code in index.php:               <?php while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?>
      When I mask this line, the post titles on the main page disappear. Furthermore, on style.css h3 represents the post titles:               h3 {       margin-bottom: 5px;       font-size: 2.3em;       font-weight: bold;       text-align: left;     }      I'm afraid that I have a mistake in the title class but I don't know what it is and how to fix it. Kindly assist me in fixing the issues above. Your support would be most appreciated. Thanks in advance!


All in One Calendar Plugin Custom Post Type Query

Hi I'm trying to write a query which will pull the events out from the All in One Calendar Plugin. This is what I have so far:               <?php  query_posts('post_type=ai1ec_event');?>     <?php while ( have_posts() ) : the_post(); ?>     <?php echo '
'.get_the_title().'
'; ?>     <?php endwhile; ?>      This works well to get the event titles and their respective content, but I need to get the event details out as well. eg. event dates, venue, location. Thanks


Wp Remote get with manual redirect

I set                add_filter( 'http_request_redirection_count', array($instance,'SetDirectionCount'));      to 0 I try to get 'http://boards.ign.com/The_Vestibule/b5296/' or 'http://www.informationweek.com/story/' but that gives me:                WP_Error Object ( [errors] => Array ( [http_request_failed]       => Array ( [0] => Maximum (0) redirects followed ) ) [error_data] => Array ( ) )      The head does not show me a redirection:               Array ( [headers] => Array ( [connection] => close [date] =>      Mon, 14 Mar 2011 01:40:19 GMT [server] => Microsoft-IIS/6.0 [p3p] => Array ( [0] =>       CP='NOI ADMa OUR STP' [1] => CP="TST" ) [x-powered-by] => ASP.NET [cluster-server] => \      ignprdappw64212 [x-aspnet-version] => 2.0.50727 [pragma] => no-cache [x-aspnetmvc-version]      => 1.0 [set-cookie] => BoardCookieV3%5Fboards%2Eign%2Ecom=dc=no&ra=False; expires=Wed,     14-Mar-2012 01:40:19 GMT; path=/; HttpOnly [cache-control] => private [expires] => Wed, 14          Mar 2001 01:40:19 GMT [content-type] => text/html; charset=utf-8 ) [body] => [response]   =>        Array ( [code] => 200 [message] => OK ) [cookies] => Array ( [0] => WP_Http_Cookie      Object ( [name] => BoardCookieV3%5Fboards%2Eign%2Ecom [value] => dc=no&ra=False        [expires] => 1331689219 [path] => / [domain] => [httponly] => ) ) )      Now... what I would have liked is information back from the head request that a 301 or 302 would be happening or even a 404, so that I could wp_remote_get that one instead. Am I doing something wrong? FYI: I need to manually redirect because I need to determine the base_href of an image if none is given in the HTML source (code: http://plugins.trac.wordpress.org/browser/wp-favicons/trunk/includes/class- http.php ) or some more background: http://wp.leau.co/2011/03/18/handling- redirects-for-wp-favicons-with-redirects-set-to-0-with-wordpress- wp_remote_get/


Running hundreds of WP in multisite

We are starting to rack up the number of WP websites and we're looking to have a bit more control over all of them, would multi site be the correct way to go? All the sites are running on different domains, different versions of WP and different plugins (with different versions of those). I don't want to blanket update all of the versions because I don't want to risk things breaking. So with that in mind would the only benefit be that I would have a super admin access and be able to switch between the sites quickly?


Is there a need to do apply_filter('widget_title', $instance['title']) or any other 'widget_xxx' filters?

I am reading the book Professional Wordpress, and have code like               $title = apply_filters('widget_title', $instance['title']);     $name = apply_filters('widget_name', $instance['name']);     ...      I wonder if there really are filters like `widget_xxx`? What do they do?


Sorting Posts Based On Meta Value Using AJAX

I am trying to short posts on frontpage/archive pages using AJAX. The AJAX call seems okay but nothing displaying. Here is the JS:               jQuery( document ).ready(function() {         jQuery( ".sbyp" ).click(function() {             jQuery("#list-items-review").empty();             jQuery(".ajaxloader").show();                  jQuery.ajax({                 type: 'POST',                 url: SHTR.ajaxurl,                 data: {"action": "priceshortaction" },                 success: function(response) {                     jQuery("#list-items-review").html(response);                     jQuery(".ajaxloader").hide();                     return false;                 }             });         });     });      And, here is the function:               function price_shorter_callback() {         $query = new WP_Query( array ( 'post_type' => 'smr_product', 'meta_key' => '_productprice' ) );         ob_start ();                 if ( $query->have_posts() ):                          while( $query->have_posts() ): $query->the_post();                          smr_product_the_frontend_item();                     endwhile;                      endif;             wp_reset_postdata();             $response = ob_get_contents();            ob_end_clean();            echo $response;            die(1);     }     add_action( 'wp_ajax_priceshortaction', 'price_shorter_callback' );     add_action( 'wp_ajax_nopriv_priceshortaction', 'price_shorter_callback' );      The function `smr_product_the_frontend_item();` is just a callback to display the posts. Here it is at pastebin. Where I am doing wrong?


How do i make this Taxonomy term code work?

Hi i have this code below in my header file               <?php     if ( ! is_home() ) {          if ( get_post_type() == 'pretty-little-liars' ) {         echo '

';     }     if ( get_post_type() == 'revenge' ) {         echo '

';     }     if ( is_tax( 'series', 'pretty-little-liars' ) ) $stylesheet_uri = $stylesheet_dir_uri . 'http://www.tv-cafe.com/wp-content/themes/tvcafe/posttypecss/style-pll.css';     }     ?>      The first three "if" lines calls for a different header image which works properly, but the fourth "if" line i was trying to call for a different stylesheet for a Taxonomy term. I have a post type entitled gallery, and under the gallery post type i have the Taxonomy "Series" and one of the terms happens to be "pretty-little- liars". Here is what i want. Whenever a user click on a gallery post and it's under the Taxonomy Term "pretty-little-liars" I want it to have a different background image. The above code doesn't work for the taxonomy so what am i doing wrong or how do i fix this, suggestions anyone? I would really appreciate the help :)


Create template for taxonomy results limited by Custom Post Type

I've got a Custom Post Type with a Custom Taxonomy set up. So how do I create an archive template to display posts from that CPT, limited by taxonomy? Here's the deal: The CPT is called Shows. Each post represents an upcoming concert. Its archive page lives at mysite.com/shows. The taxonomy is called Bands. Each Show post is tagged with the Band performing the concert. What I want is to create an archive page to display all Show posts tagged with a certain band. For example, I want the visitor to be able to open mysite.com/shows/radiohead, and see all of the Shows posts tagged with "Radiohead" in the Bands taxonomy. How do I publish a template that will support that URL structure? Thanks for any help you can provide.


How to detect shortcode usage, submit a form from widget to that page?

I've created a plugin and now want to create a widget containing a form that will submit to the page where my plugin shortcode is embedded from any wordpress page on the front end. I assume that within my widget code I need to detect the page/post or permalink containing the shortcode and make that the action="" of my form. Does anyone know how to do this? I found this code for conditionally loading js/css based on found shortcode but not sure how to adapt to be used in my widget.               add_filter('the_posts', 'conditionally_add_scripts_and_styles'); // the_posts gets triggered before wp_head     function conditionally_add_scripts_and_styles($posts){     if (empty($posts)) return $posts;          $shortcode_found = false; // use this flag to see if styles and scripts need to be enqueued     foreach ($posts as $post) {         if (stripos($post->post_content, '[code]') !== false) {             $shortcode_found = true; // bingo!         break;     }     }          if ($shortcode_found) {     // enqueue here     wp_enqueue_style('my-style', '/style.css');     wp_enqueue_script('my-script', '/script.js');     }          return $posts;     }      Original post found here: http://beerpla.net/2010/01/13/wordpress-plugin- development-how-to-include-css-and-javascript-conditionally-and-only-when- needed-by-the-posts/ Any help is greatly appreciated. Thanks, Russ


Using Wordpress Redirection plugin to strip URL parameters via regex

I'm using WooCommerce on Wordpress to run a small online shop and Google is crawling loads of page variations such as:               http://domain/brand/brandname?orderby=rating&view=grid     http://domain/brand/brandname?orderby=price&view=list     http://domain/brand/brandname?orderby=date      As it stands there are more pages like this than products and it's likely that Google will consider some of them to be duplicate content. I'm planning on using the Wordpress Redirection plugin to create some regexp rules so that I can redirect each of these variations to the main product page. In other words, redirect:               http://domain/brand/brandname?orderby=rating&view=grid     http://domain/brand/brandname?orderby=rating&view=list               to:          http://domain/brand/brandname      To do this I just need to split the URL at the whilst keeping the page part - I think ?. How do I do this ? I've searched around on the web but haven't found a specific example and I'm hopeless with regular expressions !


Could not add 'LoginLogout' link using BAW login logout plugin

I installed and activated the 'BAW login/logout' plugin to bring login or logout link in my screen. but this is not working for me. can some one help me steps I followed: 1) Installed and activated'BAW Login/logout'plugin 2) In Menu panel I selected the value 'Login/Logout' and clicked on 'Add to Menu' 3) The 'Login/Logout' option is added to Menu structure 4) I saved the menu 5) I refreshed the website. But could not find the link 'Login' or 'Logout'


Most recent post from every category/taxonomy but sorted by date

I am trying to get a list of the most recent post from every category/taxonomy. I have found a solution for this, but I want the overall list to be **sorted by post date**. At the moment it is sorted by category/taxonomy name. So if I post in cat A, then in Cat B and last in cat C: the post would be ordered: C, B, A (latest first). If I then post in cat B the order should change to: B, C, A Really would like it to work with custom taxonomy but default categories could work for me too. The code I have so far is from this site: http://wptheming.com/2012/08/display-the-most-recent-post-in-each-category/               //Retrieves all the terms from the taxonomy portfolio_category     //http://codex.wordpress.org/Function_Reference/get_categories     $cat_args = array(         'type' => 'post',         'orderby' => 'name',         'order' => 'ASC',         'taxonomy' => 'tax_name');     $categories = get_categories( $cat_args );              // Pulls the first post from each of the individual portfolio categories         foreach( $categories as $category ) {             $args = array(                 'posts_per_page' => 1,                 'post_type' => 'post',                 'tax_name' => $category->slug,                 'no_found_rows' => true,                 'update_post_meta_cache' => false,                 'update_post_term_cache' => false             );             $the_query = new WP_Query( $args );                  // The Loop             while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
                     <?php the_title(); ?>                     <?php the_content(); ?>
             <?php endwhile;             }         // Reset Post Data         wp_reset_postdata();         ?>      EDIT: I tried editing the first part of the code to:               $cat_args = array(         'type' => 'post',         'orderby' => 'date',         'order' => 'DESC',         'taxonomy' => 'tax_name');     $categories = get_categories( $cat_args );      But it still shows the posts in order of taxonomy name?


after logout, get_current_user_id still holds value

I added a login, logout menu item to a menu with the following code in `functions.php`. After logout it redirects to the current page. But surprisingly enough, the `get_current_user_id` method still holds the value of the previously logged in user.               add_filter( 'wp_nav_menu_items', 'asv_add_usermenu_student', 10, 2 );               function asv_add_usermenu_student( $items, $args ) {                        if (is_user_logged_in() && $args->theme_location == 'top_student_menu') {                          $items .= "
Log Out
";                      } elseif (!is_user_logged_in() && $args->theme_location == 'top_student_menu') {                         $items .= '
 LOG IN
';                   }                   return $items;                 }      How to grt rid of it ?


How to install wpengine hosted multisite locally

Does anyone have any insight into how to install a copy of a wpengine hosted site locally? You can assume Wordpress migration knowledge i.e. I have a copy of the files and have imported the DB locally. I am getting 'Error establishing a database connection' even though I am 100% sure that I have edited the wp-config DB connection details correctly. This is a **multisite** install. **UPDATE** From wpengine : "You will need to remove our platform specific files found in the mu-plugins folder and the object-cache.php found in the wp-content folder...Outside of changing all of the subsite urls and the primary domain, there shouldn't be anything specific to our platform."


XML-RPC detailed author info for wp.getPosts

I'm working with XML-RCP since a few days. I recognized that the posts only contain the ID of the author of a post. I tried to get the specified user using `wp.getUser` but the XML-RPC user does not have the necessary rights to read the user list. I don't want to use an admin account for my iOS app just to display some posts… Now I found that I can pass a `fields` parameter with a list of fields I want to have in the response. Is there a possibility that I can use these parameters to display detailed informations on the author of a post?


Switched from query_posts to wp_query, pagination no longer working

Switching a loop on a static front page from query_posts to wp_query. All is working other than the pagination link (which used to work). Example can be seen live here in "work" section. Here is my loop:                   <?php          $paged = (get_query_var('page')) ? get_query_var('page') : 1;          $args = array('category_name'=>'portfolio','posts_per_page'=>4,'paged'=>$paged);          $work_posts = new WP_Query($args);               if($work_posts->have_posts()) :              while($work_posts->have_posts()) :                 $work_posts->the_post();         ?>

                 <a href="<?php the_permalink(); ?>">                 <?php                     if ( has_post_thumbnail() ) {                     the_post_thumbnail();                     }                    ?>

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

              <?php endwhile; ?>

           <?php next_posts_link('load more'); ?>

            <?php wp_reset_postdata(); ?>              <?php else : ?>
Sorry, there are no posts to display
         <?php endif; ?>


Is it necessary to reset the query after using get_posts()?

Is it necessary to reset the query after using `get_posts()` ? I have been looking at this page and I don't see any reference to `get_posts()` ... I can't make it out for sure from this page either. I can't see why it wouldn't be necessary ( though on my test page it doesnt cause any problems without `wp_reset_postsdata()` `wp_reset_query()' or ''rewind_posts()' ) but if it is which is the right function(s) to use.


How to Loop within a Loop (Display Children and then Grandchildren)

I am trying to develop a query for WordPress that will allow me to display a list of child pages with titles only, and then under each child page title, a list of grandchilden (children of the child) page titles AND their content. So for example, the output should be something like this:

Page 1

Child Page 1

Child Page 2

Grandchild

Hello, welcome to this grandchild page

Grandchild #2

Hello, welcome to this grandchild page

Child Page 3

Page 2

      It needs to be done dynamically, meaning I do not want to specify the post ID number as part of the query. I have tried using a standard WordPress Query and then nesting a second query within the first one - this failed. In addition, I also tried modifying the code seen here: http://wordpress.org/support/topic/query-child-pages-of-a-current-page-and- loop-through-each-child-page Finally, I also tried to modify this code:               <?php if ( have_posts() ) {  while ( have_posts() ) { the_post(); $thispage=$post->ID; }} ?>     <?php $childpages = query_posts('post_per_page=3&orderby=menu_order&order=asc&post_type=' . get_post_type( $post->ID ) . '&post_parent='.$thispage);         if($childpages){ /* display the children content  */                 foreach ($childpages as $post) :                 setup_postdata($post); ?>
<a class="" href="#<?php echo($post->post_name) ?>">                 <?php the_title(); ?>
               <?php           endforeach;          } ?>      I've been trying to get this working for more than a day now and i'm just going around in circles really. Would very much appreciate help in getting this working.


custom post type breadcrumb error when has_archive = false

I have a custom post type (team) and I do not use archive page (has_archive => false), when I visit single team post the breadcrumb contains inactive text "TeamSingleTitle". I would like to know how I can modify the breadcrumb function to remove this "Team" custom post name from the breadcrumb. I can't hide it using CSS as it's appended directly in front of the SingleTitle without even a space. If I change has_archive to true then it all works correctly and Team is created as a link and spaced accordingly.


WordPress save thumbnail but don't show it

WordPress don't show image thumbnail but save them. I have all version of image (eg. image.jpg, image-300x250.jpg) but WordPress don't detect them. Anybody got same problem as here?


Default PHP document / names needed for a Wordpress theme?

I am hosting my own version of Wordpress, and I'd like to do a custom theme for it to suit my website. However, with so many bits and pieces of examples on the Internet, I'm not really sure how many PHP documents I should have, and what names are they given inside a theme. So far, i only understand that there are the following PHP documents inside a Wordpress Theme itself :               404.php     comments.php     footer.php     functions.php     header.php     index.php     page.php     sidebar.php     single.php     style.php      Are there anymore? Is there a full list that I can refer to (like a cheat sheet)?


Is there any way to dynamically alter widget titles?

I have a case where that are a lot of widgets in several custom sidebars. I am wondering if there is a simple way to alter the titles of each widget dynamically. Typically a widget has a title field you can set manually or on the plugin itself. I wish to add something like a meta field value per post to each widget title. The logic would be something like:               $dynamic_title = get_the_title();     // add a filter to change the widget titles per post value     //     // The widget title would be something like "Recent Posts for $dynamic_title"      I know there is a `widget_title` filter but how do you target specific widgets? ps. I cannot use the regular `register_sidebar` parameters due to having many widgets needing specific titles.


Set Featured Image programmatically (in admin) with JavaScript?

I'm trying to set the post thumbnail (featured image) with javascript from an existing image in the media gallery. I would consider a php-based option too I suppose (one that would require clicking update before the images show up). **Some Background** I'm building a site for a music venue with a custom "event" post-type. Most of the time these events are unique, but there are some recurring ideas (for example, open mic night most tuesdays). I was thinking I'd like to put in a dropdown with some "presets" to populate the `add new event` form fields in the backend. It's a cinch (I think) to do this with the the tinymce, and my custom meta fields. The tough part is how to to put an (already uploaded to media library) image into the featured image box programmaticly. I know I can do make something work on the template end of things, but it would be nice to see that thumbnail pop up in the `add new/edit` view. Thanks!


Walker to add Bootstrap markup for wp_list_pages

I'm using `wp_list_pages()` to create a nav of the pages in my site. Some pages have children so I need a dropdown menu in the nav to show the child pages and the Bootstrap markup for dropdown menus. To use Bootstrap I need to add class names to the corresponding `<ul>`, `<li>`, and `<a>` elements. I think the best way to add these classes is using a custom walker. How do I write this custom class to add the classes I need? The current html:

Home

Profile

         Products & Services

Buying

Selling

Managing

      The HTML I need:

Home

Profile

         Products & Services

Buying

Selling

Managing

      I've tried extending the walker class but I can't figure out how to determine whether the page has children and apply a class if needed. Here is my walker:               class My_Walker extends Walker_page     {       function start_el(&$output, $page, $depth, $args, $current_page) {         if($depth) {           $indent = str_repeat("\t", $depth);         } else {           $indent = '';         }              extract($args, EXTR_SKIP);         $css_class = array('page_item', 'page-item-'.$page->ID);         $attributes = [];         $children = get_pages('child_of='.$post->ID);              if(!empty($current_page)) {           $_current_page = get_page($current_page);           _get_post_ancestors($_current_page);                if(isset($_current_page->ancestors) && in_array($page->ID, (array) $_current_page->ancestors)) {             $css_class[] = 'current_page_ancestor';           }           if($page->ID == $current_page) {             $css_class[] = 'current_page_item';           } elseif($_current_page && $page->ID == $_current_page->post_parent) {             $css_class[] = 'current_page_parent';           }         } elseif($page->ID == get_option('page_for_posts')) {           $css_class[] = 'current_page_parent';         }              $css_class = implode(' ', apply_filters('page_css_class', $css_class, $page, $depth, $args, $current_page));              $output .= $indent . '
ID) . '">' . $page->post_title  .'';              if(!empty($show_date)) {           if('modified' == $show_date) {             $time = $page->post_modified;           } else {             $time = $page->post_date;           }           $output .= " " . mysql2date($date_format, $time);         }       }     }


Rewwrite rule for mapping plugin static file

I am thinking to move my static data to Amazon cloudefront and i am able to map all static data with the URL from the cloudefront except Plugins i have installed. I do not want to use any plugin to do this mapping as was thinking of writing some kind of rewrite rule to handle this. for e.g all the URL related to plugin static data (js/css etc) have this URL:               http://mysite.com/wp-content/plugins/rest_of_the_url      I want to replace this URL with                http://cdn.mysite.com/wp-content/plugins/rest_of_the_url


How to display Parent categories and Child Categories?

I struggleing to find the best way to develop the below. Basically my website will have a landing page on the site ( **Sports Landing Page** ) and when the user clicks on a category on that page eg "Football" they will view another page with sub categories of the item they have just clicked on eg) Football clubs. Then once the user clicks on that football club they will be taken to a **Blog article page** about the subject. **Sports landing page**   * Football   * Rugby   * Swimming   * Running **Football**   * Manchester United   * Liverpool   * Blackburn Rovers   * Chelsea **Manchester United Blog Article** I've had a play around with categories but can't seem to figure out the best way to achieve this. Would you display all parent categories on page on the first landing page, then all child categories on the 2nd landing page and then have a specially designed post page for the blog article? I've tried to only show the parent blog categories but can seem to get the code to work:               <?php query_posts('cat=11&depth=0'); if (have_posts()) : while (have_posts()) : the_post(); ?>                <?php endwhile; ?>               <?php else : ?>
Not Found
          <?php endif; ?>      and then here is the code I have been using for the sub categories:                   <?php query_posts('cat=11&depth=1'); if (have_posts()) : while (have_posts()) : the_post(); ?>                <?php endwhile; ?>               <?php else : ?>
Not Found
          <?php endif; ?>      If anyone can help, it would be greatly appreciated. Thanks Paul


sort post types by amount of views

I have a custom post type that I want to do a type of news feed for, but I only want to show the ones with the most views. I know I can do a query for an "archive" of my post types, but my question is "how to sort the query by views"?


Twenty Eleven child theme anchor top menu not clickable

I am working on child twentyeleven theme. I have to do three things to my child theme. 1-Using page.php coping in my child theme.I added the code in page.php at top of the code                <?php if (is_front_page()){             get_header( 'home' );         }           else {             get_header();     }?>      2-header-home.php created in child theme using header.php. 3-In header-home.php i did one replacement that nave section from bottom of header.php and put at top but inside as               <body <?php body_class(); ?>>

<?php _e( 'Main menu', 'twentyeleven' ); ?>
                     <?php /* Allow screen readers / text browsers to skip the navigation menu and get right to the good stuff. */ ?>
<a class="assistive-text" href="#content" title="<?php esc_attr_e( 'Skip to primary content', 'twentyeleven' ); ?>"><?php _e( 'Skip to primary content', 'twentyeleven' ); ?>

<a class="assistive-text" href="#secondary" title="<?php esc_attr_e( 'Skip to secondary content', 'twentyeleven' ); ?>"><?php _e( 'Skip to secondary content', 'twentyeleven' ); ?>
                     <?php /* Our navigation menu. If one isn't filled out, wp_nav_menu falls back to wp_page_menu. The menu assigned to the primary location is the one used. If one isn't assigned, the menu with the lowest ID is used. */ ?>                          <?php wp_nav_menu( array( 'theme_location' => 'home-menu','fallback_cb' => '') );?>                       4-At my home page,menu appeared but not clicking. 5-Then I created my child functions.php.register home-menu and iteme taken from my catogry section. Any one there have answer. muneeb


How to show only the date, the title and a little “summary” of my WordPress post in my custom theme?

I am pretty new in WordPress theme development and I have the following doubt about how show posts into a page. I have this page belonging to an old custom legacy blog that I am build again using WordPress: http://www.asper-eritrea.com/comunicati.asp As you can see in this page are presented some posts using the following structure: **date** followed by the **post title** followed by a **short summary** What I want to do in WordPress is something like it. So I have create this page that show the posts lists: http://lnx.asper- eritrea.com/category/legacyposts/ As you can see in this page are shown the posts (the formattation is horrible because I imported the post from the old website but I will work on it in a second time). The main problem is that if the post is very long it is shows all of its contents. This is the code of this page ( **category.php** ) is:               <?php get_header(); ?>

Associazione per la Tutela dei Diritti Umani del Popolo Eritreo

Association in Defense of the Human Rights of the Eritrean People

Ultimi Articoli
                       <?         // get the term using the slug and the tag taxonomy         $term = get_term_by( 'slug', 'featured', 'post_tag' );         // pass the term_id to tag__not_in         query_posts( array( 'tag__not_in' => array ( $term->term_id )));         ?>              <?php             if (have_posts()) :                 // Start the Loop.                 while (have_posts()) : the_post();                          /*                      * Include the post format-specific template for the content. If you want to                      * use this in a child theme, then include a file called called content-___.php                      * (where ___ is the post format) and that will be used instead.                      */                     get_template_part('content', get_post_format());                      endwhile;             else :                 // If no content, include the "No posts found" template.                 get_template_part('content', 'none');                  endif;             ?>

          <?php get_footer(); ?>      So what I want to do is that, for each post, the loop show only the date, the title and the beginning of my post (for example a specific number of character). What can I do to obtain this result? Tnx


Is it acceptable to build functionality into a theme built for a client?

I know it's now the common wisdom to not build functionality into themes, as advised by WordPress, Envato, and others. This includes the likes of content types, taxonomies, sliders, shortcodes etc, to make themes as flexible as possible when used for different applications. I know I don't like downloading themes which have more functionality built-in than I need. Suppose that a theme has been purpose-built for a client with specific needs. As much functionality as possible has been delegated to plugins, however this does create a dependency on plugins when such functionality can be part of the theme itself. For example, I've used Pods to establish custom content types and custom taxonomies; it's been great for quickly building up these content types and their fields, but creates a dependency on Pods where it is not really needed. These ends can readily be achieved through the theme itself. It's normally advised to not include custom types or taxonomies in themes as the themes will be less useful to other users, and would not be accepted by the WordPress theme repository. However, in my case, this theme is custom built for this client and the client's needs, and it is not intended to be used elsewhere. I also have an ongoing relationship with the client to support the site and make revisions to the theme. In such a scenario, would it be acceptable to include the custom types, taxonomies, and fields into the theme? Is the no-functionality-in-themes more a guideline than a rule, applied more heavily on distributable rather than custom work?


photo gallery implementation like tmz

** REVISED POST ** I have a **custom post type** called `photo_group` that allows you to input an _array_ of photos. I also have a single post called "photos" which is **re- written** to be my-website.com/photos When a user goes to the photos page I want the _first_ (and only **one** ) `photo_group` to display it's content in a **photo gallery** (I'll take recommendations here, but I can simply drop in a JS photo gallery as needed). I was going to build something _custom_ for this, but I don't know that that is _necessary_. I don't want to build this with custom code and then find out I could have used nextgen or something like it. The goal is to have something similar to TMZ's photo page. Thanks. ** ORIGNAL POST ** I'm thinking I'm probably going to have to do this by finagling my php to output some javascript, but I don't want to be in the middle of doing that and find out there was an easier way. I have a custom post type called `photo_group` and I'm trying to use it to accomplish something like TMZ's photo page. Thanks. PS- I don't do celebrity gossip so rest assure this isn't for me! ** ANSWER ** I ended up doing a custom php implementation with using a jQuery slideViewer for the front end.


How to display product categories and number of sales on WooCommerce

I am currently working on a WooCommerce site.I managed to set it up,do some configuration according to my plan.Now i want to display product categories alongside each products in product catalog,and also want to display how many time the product has been sold too. I have done some searching and found this code,which displays product categories,but i want to display category with link to it.                <?php      $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );      $parents = get_the_terms($term->parent, get_query_var('taxonomy') );           echo "<div class='product-cat'>";      echo "In"." "." ";      foreach( $parents as $parent ) {      echo $parent->name;      }     ?>       Please help out on this.Thanks in advance.


I need to create a page or post hierarchy

I am currently stuck and I need some advice ASAP. I am making a site for a client on which they need to have a sort of hierarchy like this               Carriers (Main Category or page)     -Level 1        -Level 2           -Level 3 (sometimes needed)        -Level 2        -Level 2     -Level 1        -Level 2        -Level 2     -Level 1        -Level 2     -Level 1      I was thinking about doing it through parent and child apges but that would create a ton on empty pages which purpose would only be to hold the children. I also though about doing it through post categories but I am not sure how to do that since the hierarchy isnt always consistent, some have 3 levels and others only one. Can you please help? Thanks!


Attach time/date stamp on add_post_meta

we have an image viewer on our website where admins can tag images thought ajax (new feature on Wordpress 3.0). We are tagging just fine, but we need to filter when they were tagged. We are using normal add_post_meta to update the tagging for the images but I would like to know what's best way to attach time/date on it. this is our ajax format               $imgID = (!empty($_POST['imgID'])) ? (int) $_POST['imgID'] : '';                 $value = (!empty($_POST['value'])) ? trim(stripslashes($_POST['value'])) : '';                 $action = (!empty($_POST['act']) && in_array($_POST['act'], array('add', 'remove'))) ? $_POST['act'] : 'add';                 if (!empty($imgID) && !empty($value))                 {                     if ('remove' == $action)                         delete_post_meta($imgID, 'image_tag', $value);                     else if ('add' == $action)                     {                         $ctags = get_post_meta($imgID, 'image_tag');                         if ((is_array($ctags) && !in_array($value, $ctags)) || !is_array($ctags) || !$ctags)                             add_post_meta($imgID, 'image_tag', $value);                     }                 }                      exit;      My first thought is to create new db table. but if there is something easier that I am missing on WP it would be awesome to know. thanks in advance


meta_box or custom_field as a second tinymce post-instance?

probably a rather weird question but I have no idea if this is possible or not!? I created a `custom-post-type` to handle events. An event always has a future date but once this date is over I want to be able to write a review of the event and add this to the post itself. So imagine an event as a kind of group of two posts. The first post is the one when it get's published. With a description of the event, a date of the event, etc. Once the event is over I somehow would like to write a "recap" of the event - how it was, some photos, etc. Do you generally have any idea how I could solve this? So that the same event- post suddenly has a kind of "subpost" with a review in it? I was wondering if I could solve this via a `custom-field` that adds a completely new instance of the TinyMCE editor underneath the already existing one. So that I could write two posts inside of one post? Sounds silly I know. But then I would have one event-link that (if the date of the event is over) would have a somehow differently formatted second post-item with the review of the event in it! Any ideas on that? How could I solve such a thing? Thank you!


How do I authenticate/turn off a plugin remotely for plugin SaaS like functionality?

I have a client whom we created a custom plugin for. We are charging monthly for access to this plugin but the only way we have to disable it is manually in the Wordpress admin. How would I go about authenticating access remotely like WPMU does? I would like to be able to disable the plugin functionality via an Amazon database or similar.


Wordpress error on saving administration settings with IDN domains

I have created a new wordpress site on Azure Web Sites, this time using IDN Domain. I configured the domain in the administrator page using its punycode representation: Wordpress URL: http://xn--sandraeiaki-8db.com Site URL: http://xn-- sandraeiaki-8db.com Everything works fine, except saving settings from the worpress settings page inside the administration. After successfully saving settings wordpress tries to redirect back to the settings page, however somehow that redirect changes the domain, instead of redirecting back to http://xn--sandraeiaki-8db.com it redirects to http://xn--sandraeiaki-bra36d.com/ The only clue I got is that, http://xn--sandraeiaki-bra36d.com/ is the punycode representation of http://sandraeiã±aki.com/, so it seems like wordpress is using an invalid encoding here instead of UTF-8 for redirecting back to the settings page. Update I can see in wordpress options.php file that it tries to redirect using, after succesfully saving changes:               /**     * Redirect back to the settings page that was submitted     */     $goback = add_query_arg( 'settings-updated', 'true',  wp_get_referer() );     wp_redirect( $goback );     exit;      **Update 2** After a chat session with **soulseekah** we have traced back the issue to be in the location value set by IIS on Azure, creating a simple php page, that changes the location header, the redirection fails: `<?php header( 'Location: /' ); exit; ?>` Examining the location header value, shows that it is encoded in ASCII instead of UTF-8: > Location: sandraeiÃ±aki.com **Update 3** After some testing it only happens when the header() php function is passed a relative location url value, setting the location value to an absolute uri resolves without problems , either by using the punycode domain encoding or utf-8 encoding. I made a temporaly fix by changing wordpress redirect function, now it sets only absolute uris, and seems to be working. However, how I can fix that behaviour permanently?


Formatting Multiple add_theme_support Arguments

In my `functions.php` I have the following: `add_theme_support( 'post-thumbnails', 'html5', array( 'comment-list', 'comment-form', 'search-form' ) );` …which in WP 3.8.1 disables e.g. featured image (i.e. `post-thumbnails`). My question is how to properly format all these support items in the `add_theme_support` function; is adding two separate function calls right or 'wrong'? `add_theme_support( 'post-thumbnails' ); add_theme_support( 'html5', array( 'comment-list', 'comment-form', 'search-form' ) );`


Displaying $_FILES data (simlar to $_POST)

I'm trying to display $_FILES in wp-admin, and I've been using add_filter and apply_filter, but it does not seem to show the $_FILES array values. My goal is to show the values in $_FILES so I can upload it to a specified directory (But this is going to be in the future). **Upload Screen Meta Box**               function upload_screen() {        print_r(apply_filters('demo_fileupload',$_FILES));       echo "
";       echo 'Upload Files<input type="file" name="" />
';     }      The next function should return the file array (this is where the problem lies). So I tried using `add_filter`, but does not seem to work. **File Upload Function** but return `$file array` for now.               function demo_fileupload($file) {       return $file;     }      **Add Filter**               add_filter('save_post','demo_fileupload',10,1);


Generated URLs don't reflect accurate URLs.

Evening, I'm getting some incorrect links generated by my theme. `WordPress Address (URL): http://localhost/newgameplus/wordpress` `Site Address (URL): http://localhost/newgameplus` Clicking on something like `preview post` Generates a URL like this: `http://localhost/newgameplus/?p=34` The correct URL is: `http://localhost/newgameplus/wordpress/?p=34` How can I make it reflect this? (Also, I cannot change site Address because my site is in a different subdomain)


How to use custom database tables for custom post types?

I need to use an existing database table as a Custom Post Type (CPT) to integrate it with wordpress. I've considered @boone-gorges thoughts here (should I?) and have decided, Yes, I need to use a custom table (mostly for indexing of the 20+ "custom meta" fields that would get bogged in wordpress' native handling of custom meta.) Aside from home-grown display and usage of data, I need tight integration with Wordpress (acts and behaves like CPT) so that I can:   * Call the CPT via the loop   * Utilize custom taxonomies   * Integrate with Posts to Posts   * Use various other plugins (bbPress Topics for Posts, Popularity plugins, etc... ) on that CPT Editing / Updating through WP would be a bonus - though not necessary (the table will be edited mostly via external programs, which is another reason it needs to be separate). Is there a slick way to make this happen? Perhaps implementing hooks that hijacks calls to that CPT and directs them to the other table? I'm looking at Pods \- but this seems like overkill.


Show only preview of posts on the homepage?

Is it possible to only have a couple lines shown per post (or even 0 lines) on the homepage? Instead of dumping the whole article on the page?


Getting selected (highlighted) html from the Visual Editor on Edit Post page?

So I understand that the visual editor uses something called TinyMCE. How do I retrieve the html that the user selects from the visual editor? I am basically trying to create a button that gets the selected html and replaces it.


How to customize the gallery shortcode in WordPress?

I want to change WordPress's main gallery shortcode style to something like the picture below! ![sample slide show](http://i.stack.imgur.com/FkmQM.png) Any idea ?


How to return value from sql and display it

In ordinary php I don't have that kind of problem I think but in WP this is a different story. I have query and I want return one value from "liczba_wodo" column.               global $wpdb;     if (isset($_POST['submit'])){             $spr_liczbe_wodo = $wpdb->get_row ("select liczba_wodo from wp_ow_adres where adres='Street 12/6'");             foreach ( $spr_liczbe_wodo as $print )   {             echo $print->liczba_wodo;             echo 'Echo test';             }              }     }      Of course 'echo test' works fine. I think that "$spr_liczbe_wodo" is null or something. Thanks for help.


tax_query does not work with pagination with custom query (both wp_query and query_posts())

I am using custom query for advance search with custom taxonomy .My pagination work well when does not use 'tax_query' .When I use 'tax_query' it does not show any post to next page and just show my "not found " notification. My code is here               /*     Template Name: search result     */      ?>                 <?php                // create array of all category list with empty      $all_cat=array();            $args = array(         'hide_empty'    => true,         );          $custom_terms = get_terms('ad_category',$args);              foreach($custom_terms as $key) {             $all_cat[]=$key->slug;         }          // end of foreach loop       // end of taking all the arry of category list          // create array of all location list with empty      $all_location=array();            $args = array(         'hide_empty'    => true,         );          $custom_terms = get_terms('locations',$args);              foreach($custom_terms as $key) {             $all_location[]=$key->slug;         }          // end of foreach loop       // end of taking all the arry of category list                                    $get_location= $_POST['loc'];     // get the selected value for location       $v1=array();      $get_category=$_POST['cat'];       // get the selected value for category                // code for checking where any category select or not         if($get_category=="C")             // if no category selected then it return "C" as defauolt value             {             // if defalut value then we need all the category in our search result         }          else         {              $all_cat=array( $get_category);   // if any category selected then just use this as search          }          // code for checking where any location select or not         if($get_location=="L")             // if no location selected then it return "L" as defauolt value             {                 // default value means all location         }          else         {             $all_location=array( $get_location);   // if any category selected then just use this as search               }                     wp_reset_query();  // reset wprdpress query      ?>                          <?php get_header(); ?>
                  <?php                    $sidebar_data = array(                         'umenu' => 1,                         'heading'=> 'Tack',                         'updata'=> 'för att du bidrar till en bättre värld!',                         'downdata'=> 'Läs mer om Busenkelt.nu Klicka här',                     );         include ('sidebar.php');         ?>

Testing Pagination

                         <img src="<?php echo get_template_directory_uri(); ?>/images/icon-info.png">
                     <img class="rimg" src="<?php echo get_template_directory_uri(); ?>/images/icon/icon-heart.png">

                       <?php                  if ( is_user_logged_in() ){                       ?>
                          <?php                     global $current_user;                     get_currentuserinfo();                 ?>                 <?php  $p = (get_query_var('paged')) ? get_query_var('paged') : 1;  ?>                     <?php                      global $query_string;                     $args = wp_parse_args($query_string);                     $post_pre_page=5;                     $offset = ( $p - 1 ) * $post_pre_page;                          $args = array(  'post_type' => 'advertise',                                      'post_status' => 'publish',                                     'posts_per_page'    => $post_pre_page,                                               // 'tax_query' => array(                                             //         array(                                     //                 'taxonomy' => 'ad_category',                                                     //                 'field' => 'slug',                                      //                 'terms' => $all_cat,                                     //                 'operator' => 'IN'                                       //             )                                          // ),                                     'offset'=> $offset,                                     'orderby'=>'date',                                     'order'=>'DESC',                                     'paged'=>$p,                                  );                     $loop = new WP_Query($args);                      query_posts($args);                     global $wp_query;                     // Store it for safekeeping                     $temp_wp_query = $wp_query;                     // Now blank it out                     $wp_query = null;                     // Now populate it with your custom query                     $wp_query = $loop;                               ?>

                                                              <?php echo 'Page '. $p . ' of ' .$loop-> max_num_pages; ?>

                      <?php   if ( have_posts() ) {?>                         <?php while ( have_posts() ) : the_post(); ?>                     <div class="ind-ad" id="<?php echo 'ad-'.get_the_ID();?>">

                               <?php if ( get_post_meta( get_the_ID(), 'add_image1', true ) ) { ?>                                     <?php  $imager = get_post_meta( get_the_ID(), 'add_image1', true ) ;?>                                     <img class="thumb" src="<?php echo wp_get_attachment_url($imager); ?>" alt="<?php the_title(); ?>" />                               <?php  }                                       else {                                             echo "no image 1";                                      }                                ?>

                                <?php if ( get_post_meta( get_the_ID(), 'add_image2', true ) ) { ?>                                     <?php  $imager = get_post_meta( get_the_ID(), 'add_image2', true ) ;?>                                     <img class="thumb" src="<?php echo wp_get_attachment_url($imager); ?>" alt="<?php the_title(); ?>" />                               <?php  }                                       else {                                             echo "no image 2";                                      }                                ?>

                               <?php if ( get_post_meta( get_the_ID(), 'add_image3', true ) ) { ?>                                     <?php  $imager = get_post_meta( get_the_ID(), 'add_image3', true ) ;?>                                     <img class="thumb" src="<?php echo wp_get_attachment_url($imager); ?>" alt="<?php the_title(); ?>" />                               <?php  }                                       else {                                             echo "no image 3";                                      }                                ?>

                               <?php if ( get_post_meta( get_the_ID(), 'add_image4', true ) ) { ?>                                     <?php  $imager = get_post_meta( get_the_ID(), 'add_image4', true ) ;?>                                     <img class="thumb" src="<?php echo wp_get_attachment_url($imager); ?>" alt="<?php the_title(); ?>" />                               <?php  }                                       else {                                             echo "no image 4";                                      }                                ?>

 Post id :  <?php the_ID(); ?>

 Title :  <?php the_title() ?>

 Author Name :   <?php the_author(); ?>

 Author Id :   <?php the_author_meta('ID')?>

 Gilltig till:

                                                                      <select>                                        <option>                                             <?php if ( get_post_meta( get_the_ID(), 'val-year', true ) ) { ?>                                             <?php echo get_post_meta( get_the_ID(), 'val-year', true ) ;  ?>                                               <?php }                                                    else {                                                     echo "no data";                                                   }                                              ?>                                        </option>                                     </select>                                                                                <select>                                        <option>                                             <?php if ( get_post_meta( get_the_ID(), 'val-month', true ) ) { ?>                                             <?php echo get_post_meta( get_the_ID(), 'val-month', true ) ;  ?>                                               <?php }                                                    else {                                                     echo "no data";                                                   }                                              ?>                                        </option>                                     </select>                                                                                <select>                                        <option>                                             <?php if ( get_post_meta( get_the_ID(), 'val-day', true ) ) { ?>                                             <?php echo get_post_meta( get_the_ID(), 'val-day', true ) ;  ?>                                               <?php }                                                    else {                                                     echo "no data";                                                   }                                              ?>                                        </option>                                     </select>

 Status:

 Ta bort

                         <?php endwhile; ?>
                             <?php                             // $big = 999999999; // need an unlikely integer                             // echo paginate_links( array(                             //     'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),                             //     'format' => '?paged=%#%',                             //     'current' => max( 1, get_query_var('paged') ),                             //     'total' => $loop->max_num_pages,                             //     'prev_text'    => __('« Previous'),                             //     'next_text'    => __('Next »')                             //     ));                             ?>

              <?php previous_posts_link( '<< Previous Posts', $loop->max_num_pages ); ?>

              <?php next_posts_link( 'Next Posts >>', $loop->max_num_pages ); ?>

                         <?php                             }                              else {                                 echo '
 no sparade ad found for this author.
';                                 echo '
';                             }                             wp_reset_postdata();                             $wp_query = $temp_wp_query;                         ?>
                <?php                 }                  else {                     echo '
 If registered User? go to  Home page   and Log in Or Register as a User.
';                     echo '
';                 }                ?>
         <a href="<?php echo  home_url(); ?>">             <input class="gostep1" type="button" value="Next Stage">

     <?php require_once('check.php');?>     <?php get_footer(); ?>


Seeting Active Nav for Bootstrap in WordPress

OK , I have a Custom Theme generated by Bootstrap. Currently I just added a Navbar (navigation to the theme and I am having trouble on setting ACTIVE navbar in each active page.(by adding `active` class to the li) For example if I am in Contact us page how I can force the navbar to make the contact us nav active! I alreadt tried               <li <?php is_page( 'Home' ){echo 'class="active"'}> Home
     <li <?php is_page( 'About us' ){echo 'class="active"'}> About us
      can you please let me know how I can do this?


How do I change the fonts in the Twenty Thirteen theme?

The Twenty Thirteen theme uses Bitter for headings and Source Sans Pro for body text. I would like to change these. The fonts are included by the line:               <link rel='stylesheet' id='twentythirteen-fonts-css'  href='//fonts.googleapis.com/css?family=Source+Sans+Pro%3A300%2C400%2C700%2C300italic%2C400italic%2C700italic%7CBitter%3A400%2C700&subset=latin%2Clatin-ext' type='text/css' media='all' />      in the rendered page, but I can't find out how to edit this line. The template calls `wp_head` in `header.php` to insert the line, and the line that embeds the font is included in `custom-header.php`:               wp_enqueue_style( 'twentythirteen-fonts', twentythirteen_fonts_url(), array(), null );      But this is where I get stuck. I cannot find how to edit `twentythirteen- fonts` or the associated `twentythirteen_fonts_url()`. Any suggestions? The fonts I want to include in place of Bitter and Source Sans Pro are also Google Fonts, if that makes things easier.


Get uploaded image path in wordpress by filename

Can we get uploaded image path in wordpress by filename? Actually I know the way in PHP that will parse all files in the **uploads** folder, and matches the each file. But that way will produce high load on server, whenever I will run this script. Is there any other possible way? Thanks. Note: I do not have any posts linked with it. I just have image file name. By that only I need to find the full image uploaded path e.g. http://www.abc.com/wp-content/uploads/2013/02/test.png


Working local with one database

We are working with GIT while development but keep sending each other database exports. I would like to use one database on a development server (as suggested to be the easiest solution on Keeping WP database synced across multiple developers using git) But WP saves saves the domainname and while working local, for example localhost/project. All urls still point to dev.domain.com/ Can we overcome this problem or should we try another approach?


Possible to limit custom meta boxes depending on what page template is used?

Ive searched around and havent been able to find anything regarding using a specific "template" as a target to trigger when to show custom meta boxes...Is this possible, and if so how would you script this out? If post/page ID's are the only real feasible option then would it be possible to target a parent page ID rather than individual page IDs? ## EDIT #1 To help further explain the particulars of project Im going to briefly outline why Id like to instantiate custom meta boxes for only particular page templates... The way my site is currently setup is have a bunch of custom static pages for artists on a record label. Originally this was perfectly fine since they did not need and/or request a more dynamic solution - however now they are currently needing to frequently update their own bio/pics/etc for each artist profile page making my current setup not very useful. Currently, there is a Recording Artists page that acts as an archive, and then all artist pages are children of that page. **Additionally, I also need to allow personalized widgets to each artists sidebar which is a key part of deciding which direction to go.** _The only other alternative Ive considered but Im not sure if it would work is to convert the recording artist archive into a CPT archive instead, and then make each artist page a custom single page..._


How do you make the email field on the profile page read only for subscribers?

I would like to make the email field on the profile page for subscribers read only. They can see their email but not change it. I want only admins to to be able to change users email address.


when the incoming url is a query, in which function does WP begin to work with it?

I need to debug a problem with filters I have in place. they're affecting any url that includes a query; eg, `http://my.domain.hk/?attachment=1`. does anyone know in which function WP begins to work with this kind of url, one that includes a query? cheers,   Gregory


the_author() not working outside the loop

I have the following code on index.php and I want to include this line of code (bellow) to display author info on top of the loop.                <?php include 'author-top.php'; ?>      I want it to display right after the header as shows here               <?php get_header(); ?>          <?php include 'author-top.php'; ?>

                             <?php if ( is_home() && ! is_paged() ) : ?>
<?php bloginfo( 'description' ); ?>
             <?php endif; ?>             <?php if ( have_posts() ) : ?>                            <?php /* Start the Loop */ ?>                            <?php while ( have_posts() ) : the_post(); ?>                          <?php get_template_part( 'content', 'home' );                     ?>                      <?php endwhile; ?>                      <?php spun_content_nav( 'nav-below' ); ?>                  <?php elseif ( current_user_can( 'edit_posts' ) ) : ?>                      <?php get_template_part( 'no-results', 'index' ); ?>                  <?php endif; ?>

      This is what I get: http://gyazo.com/4154248fa37c84f9cb8f52871f186723.png When I try to use the same 'php include' somewhere else at the bottom of the index.php code everything seems to work well. The problem is I need it on the top so it shows on the top on the small screens. Is it anything I'm doing wrong? or it is that wordpress doesnt allow to do use 'php includes' in there and if so why not. This is the content inside author-top.php

<?php echo get_avatar( get_the_author_email(), '80' ); ?>

<?php the_author(); ?>

<?php the_author_description(); ?>


Wordpress EduPress and businessbite Theme Installation Failed

I have downloaded and installed wordpress EduPress.zip, businessbite.zip themes. Unfortunately, i found an error. ERROR: The package could not be installed. The theme is missing the style.css stylesheet. Theme install failed. Can any one help me?


display comment form for specific post id

I have three pages, and I want them all to display the comments form from a post with id=343. What code would I use within the pages to make that happen? Here is what I've tried:               <?php     $id=343; // sample, I get the latest post id of a particular category     comments_template();     ?>      But that doesn't work, it just shows the blank comment form from the page. Any thoughts / suggestions?


Why do some hooks not work inside class context?

I'm pretty stumped on this one. I'm using add_action inside my plugin class to do certain things- add scripts & styles to the head, wp_ajax, etc. Here's the actions, in the __construct:               function __construct(){         add_action('admin_menu', array($this, 'sph_admin_menu'));         add_action('sph_header', array($this, 'sph_callback'));         add_action('sph_header_items', array($this, 'sph_default_menu'), 1);         add_action('sph_header_items', array($this, 'sph_searchform'), 2);         add_action('sph_header_items', array($this, 'sph_social'), 3);              //Below here they don't work. I have to call these outside of the class (but I need class variables within the functions)         add_action('wp_print_styles', array(&$this, 'sph_stylesheets'));         add_action('wp_print_scripts', array(&$this, 'sph_scripts'));         add_action( 'wp_ajax_nopriv_add_to_list', array(&$this, 'le_add_to_list'));         add_action( 'wp_ajax_add_to_list', array(&$this, 'le_add_to_list'));         add_action('init', array(&$this, 'register_menu'));     }      Anybody ever come across something like this? I'd really like to know how to use said hooks from within a class- it's so messy having actions outside the class!


wp_dropdown_pages with tax_query clause

I'm display a dropdown list of custom post types in wordpress. This first block of code uses WP_Query               $houseQuery = new WP_Query(         array(             'post_type' => 'house',             'order'     => 'ASC',             'post_status' => 'publish',             'orderby'   => 'title',             'nopaging' => true,             'tax_query' => array(             array(                 'taxonomy'  => 'teamtype',                 'field'     => 'slug',                 'terms'     => 'sectorteam', // exclude house posts in the sectorteam custom teamtype taxonomy                 'operator'  => 'NOT IN')             ))     );     if( $houseQuery ->have_posts() ) :         while ($houseQuery ->have_posts()) : $houseQuery->the_post();             if(get_the_ID()==$c)                 $name=$post->post_title;             echo '{ value:'.get_the_ID().', label: "'.get_the_title(get_the_ID()).'"},';         endwhile;     endif;      This is the second cut of the code which uses 'wp_dropdown_page()' method and is a bit more concise               $args = array (         'id' => 'house',         'name' => 'house',         'echo' => 1,         'post_type' => 'house'     );     wp_dropdown_pages($args);      I need to exclude the posts defined by the 'tax_query' in the first example but am ensure how this can be done with the arguments that 'wp_dropdown_pages' uses. I would like to only invoke one Query as part of the solution.


Where can I create a normal php file?

I have a wordpress site and I want to create a normal php file. If I put it anywhere in my wp-content folder, I always get a page not found error when I try to access it. For example, I create a file: json.php, and I put it in the wp-content folder and try to acess it like that: www.example.com/json.php, but I get the error. If I put it outside my wp-content folder, it works, but then I can not use the Wordpress functions like The Loop. How can I create a php file in wordpress and acess it normally?


Plugin Customization Lost During Plugin Upgates

I asked this on the WordPress Plugins/Hacks Forum because SE was in read-only mode yesterday. I did get an answer, but the "relative noobie" is kicking in, as I need an example in order to see how to use the methods the answer provided. Original Post and Answer Reposted below so example will fit... * * * I'm relatively new to WordPress, but I'm a programmer for a living. Because of that, I don't like reinventing the wheel. Recently, I downloaded a plugin. I can modify this post to say what the plugin was if needed, but this is more generalized. This plugin tracks items, and creates newsletters based on those tracked items. One of those items is Gender. Since the visitors I get are sometimes couples, they share email addresses(email is a required field), therefore I cant demand of them to each have an email, so in the Gender Field, I added Couple, tested it, and it works great. It now adds an m for male, f for female, and a c for couple to the plugin's customized table in the WordPress Database. Recently, the plugin had an update, and I updated it. Because I modified pieces in the plugin's core files, the update overwrote the custom field I added, causing me to have to re-add the custom work I did. Can someone tell me what the best approach is to customizing the plugin, while keeping it up to date? Is there a hook I can use/add that will accomplish what I'm asking etc.? * * * I did find this: How to edit a wordpress plugin without break its update process, the answer by Tom, is the one I need to know if I can implement, and how... **UPDATE**   Plugin Name: Newsletter Example Edit: ## wp-content/plugins/newsletter/users/edit.php
     Gender	                   <?php $controls->select('sex', array('n' => 'Not specified', 'f' => 'Female', 'm' => 'Male', 'c' => 'Couple')); ?>
                                 This can also be a couple, if our members are sharing e-mail addresses.


How can I get an array/list of all current WordPress Admin Menu items?

I would like to somehow retrieve a list of all current admin menu items, even the ones created by themes/plugins. Is it possible?


Links redirecting to localhost after migration to server

I developed a website on my localhost and migrated it to my web server. The site displays mostly everything on the home page (I lost some font settings as far as I can tell) and all the content seems to be intact as well as the menu items. But all links, images and nav items redirect to my localhost site. Even when I try to log into my wp-admin it accepts the credentials but redirects me to the admin for my localhost site. Is this my permalinks all messed up or something else? I have tried:   * searching for an .htaccess file but there is none   * defining a home & siteURL in the wp-config file (this just breaks the layout of the site although it still is active)   * edited wp-options table to be new URL for 'siteURL' but couldn't see a row for 'home' **RESOLVED** I found the 'home' field. And that proved to be the clincher. So if anyone comes across this same issue, I resolved it by editing both the 'home' and 'siteURL' fields in the wp-options table of the database on the server (not the localhost one) to replace the 'localhost/sitename' with 'http://www.sitename'. Both 'home' and 'siteurl' should be the same. That did the trick and all my links now work.


How can I fix this, i get an error 404 when i acess the second page of post-type

How can I fix this, i get an error 404 when i acess the second page of post- type www.site.com/clipuri/2012/ www.site.com/clipuri/2012/page/2/               register_post_type('clip', array(   'label' => 'Clip','description' => '','public' => true,'show_ui' => true,'show_in_menu' => true,'capability_type' => 'post','hierarchical' => true,     'rewrite' => array('slug' => ''),     'query_var' => true,'has_archive' => true,     'menu_position' => 5,'supports' => array('title','editor','custom-fields','category', 'post_tag',),     'labels' => array (     'name' => 'Clip',       'singular_name' => 'Clip',       'menu_name' => 'Clip',       'add_new' => 'Add Clip',       'add_new_item' => 'Add New Clip',       'edit' => 'Edit',       'edit_item' => 'Edit Clip',       'new_item' => 'New Clip',       'view' => 'View Clip',       'view_item' => 'View Clip',       'search_items' => 'Search Clipuri',       'not_found' => 'No Clip Found',       'not_found_in_trash' => 'No Clip Found in Trash',       'parent' => 'Parent Clip',     ),) );          register_taxonomy("clipuri","clip", array("hierarchical" => true, "label" => "Cat Clip", 'show_ui' => true, 'query_var' => true, "singular_label" => "clipuri", "rewrite" => true, 'with_front' => true));      in theme i use               <?php global $wp_query;     $args = array_merge( $wp_query->query, array( 'post_type' => 'clip')  );     query_posts( $args ); ?>          <div class="nav">     <?php if(function_exists('wp_paginate')) {wp_paginate();} ?>     </div>          <?php if (have_posts()) : ?>     <?php while (have_posts()) : the_post(); ?>


Using customised language file for Event Organiser plugin?

I'm using WP 3.4.1 with German language files and started using the Event Organiser plugin. This plugins already comes with some German language files, but I'm not 100% happy with it due to following reasons:   * Some typos   * Mixture of informal (Du) and formal (Sie) usage   * Some unusual sentence structure (translated one by one from English - not a real mistake, but it sounds weird)   * The term 'Event' is not translated at all. Depending on the audience that might be okay, since 'Event' is also used in German language (the more 'modern' style), but for my designated audiance the translation of Event (Veranstaltung) would fit better. So I created a customer version of the German .po and .mo files and uploaded it back to the `wp-content/plugins/event-organiser/languages` directory. Unfortunately those will be overwritten every time the plugin gets updated. Is there a way to place the custom language files to anywhere else so they don't get overwritten by an update but pulled before the ones in the plugin's language folder? I tried to put the `eventorganiser-de_DE.mo` and `eventorganiser-de_DE.po` to the `wp-content/languages` and the `wp- content/themes/<theme>/languages` folder, but it looks like that the language files won't be pulled from there. So any ideas how to 'resolve' this issue? I could also do the translation and provide the language files to be part of the main plugin, but I could imagine that then other people would complain that it is 'Veranstaltung' and not 'Event' anymore ;-) Thanks a lot in advance! P.S.: For Stephen, the author of the plugin (if you see this here ;-)), it's me, Mathias, who posted in the bugs forum of your page yesterday. But I didn't know where to ask this question on your site, so I ask it here and hope that anybody responds ;-)


add_blog_option blog ID

In multisite I run add_blog_option and look at the row in mysql wp_options. The record is there but I do not see a field for the blogID. How does the wp_options relate to the specific blog?


count how many approved comments made by a moderator

I need to know how my comment moderators are performing by counting how many each of them have deleted, approved or spammed. Is there a way to do this?


Customize wordpress search query

Would this method parse_query of the WP_Query class allow a custom search query to a custom table? WP_Query I ask because the Codex says " To customize the query append additional arguments to (array) `$search_query`. Execute the $search_query through a new $wp_query object".               <?php     global $query_string;          $query_args = explode("&", $query_string);     $search_query = array();          foreach($query_args as $key => $string) {         $query_split = explode("=", $string);         $search_query[$query_split[0]] = urldecode($query_split[1]);     } // foreach          $search = new WP_Query($search_query);     ?>      So I would think to do something like this: $search_query = parse_query('SELECT * FROM custom_talble'); If this applies here From Codex: parse_query( $query ) Takes a query string defining the request, parses it and populates all properties apart from $posts, $post_count, $post and $current_post.


How can I include custom category and tag base in template files?

How can I include custom category and tag base names in the category and tag template files? Specifically, I'd like to include in the page title of category and tag pages the custom category and tag names. For example, if a site admin goes to Settings > Permalink and specifies: category base = location tag base = software I would like the category page title to be: Location > single_cat_title I would like the tag page title to be: Software > single_tag_title I couldn't find a template tag that display this.


list category posts under its item in menu

When adding category to Menu, I need it to list all the item that belong to that category in separate `UL` automatically. like this   http://i.stack.imgur.com/ulOOS.jpg   Of course I can do that manually, but I'm look for a way to add a filter, maybe, to the `wp page menu` function, but Im not sure how its can be done. I'm using `thematic` child theme Thank you.