Multiple loops are not reset

My lovely colleagues have once again designed something that gives me a hard time getting it in Wordpress. Surprisingly it's something that I have done multiple times before; having recent posts and page content on one page. The homepage is a page. Just above the page's content there are three recent posts. For the posts I need to display the first part of the content before the `<!--more-->` tag. That loop seems to work fine. Later in the template I loop through the actual page content. No matter what I do, it always gives me dodgy results. Here's a trimmed version of my index.php/page.php template (they happen to be identical):
         <?php get_template_part('news'); ?>              <?php         $args = array(             'hierarchical'  => false,             'sort_column'   => 'menu_order'         );              $pages = get_pages($args);         ?>              <?php while(have_posts()): the_post(); ?>             <?php $id = get_the_ID(); ?>

                     <?php foreach($pages as $page): ?>                         <li<?php echo (($page->ID !== $id) ? '': ' class="active"'); ?>>                             <a href="<?php echo get_page_link($page->ID); ?>"><?php echo $page->post_title; ?>
                     <?php endforeach; ?>

jaarrekeningen

administraties

salarisverwerking

fiscaal advies

overig advies

<?php the_content(); ?>

         <?php endwhile; ?>              <?php get_template_part('social'); ?>
      As you can see, I'm including the `news` template. Here it is:               <?php     $args = array('numberposts' => 3);          $posts = get_posts($args);          global $more;     ?>
         <?php foreach($posts as $key => $post): setup_postdata($post); ?>             <?php if($key > 0): ?>

<?php endif; ?>             <?php $more = 0; ?>

<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
                      <?php the_content('Lees meer'); ?>
         <?php endforeach; wp_reset_postdata(); ?>

      What am I doing wrong? Thanks in advance.


Membership subscription, change user role when subscription runs out

There are heaps and heaps of membership plugins out there, all of them focusing on restricting site content based on the users chosen subscription. I would however only want the user role to change from "have paid" to "haven't paid" when the subscription time runs out, still allowing them to view all the site content but only limited to the role capabilities I've set previously. **EDIT** (for clarification): My users have a public profile page on which they present themselves and their services. They pay annually to stay public, but if they haven't payed they should be hidden from the site, i.e change role to "invisible" instead of "public". Today I do this manually by keeping dates on each user and change their role when needed to, which is quite tedious.


Layer post title on top of image Wordpress featured thumbnail image

I'm currently trying to layer a post title on top of the posts featured image but all I see at the moment is " **);">** " instead of the image. The code I'm using is as follows:               <div style="width:609px;height:364px;background-image:url(<?php the_post_thumbnail(); ?>);">
<a href="<?php the_permalink() ?>"><?php the_title(); ?>

      And here is the CSS for the H2 style               article h2 a{     background-color:#bf0c08;     color:#fff;     width:auto;     font-size:30px;     text-decoration:none;     padding:8px;     max-width:479px;     line-height:60px;}      Any idea where I'm going wrong? Also a solution would be awesome :) You can see this on www.ridermagazine.co.uk


Custom field not showing

I am trying to get 3 images and their links which I have defined as custom fields. The custom field aren't displayed and when I `var_dump()` my `get_post_meta()` it returns `string(0)""`, what am i doing wrong?
     <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
 <?php echo "
".the_meta()."
"; ?>     <a href="<?php $show = get_post_meta(get_the_ID(), 'promotional_link', true); ?>">     <?php //var_dump($show); ?>     <img src="<?php echo get_post_meta(get_the_ID(), 'promotional_image', true); ?>" height="200" width="260">

     <?php endwhile; endif; ?>


Get post ID in post/page edit area

How can i get "post id" in post edit area for add_filter in functions.php? I want to change file name automatically during upload. so i need to obtain post id. the code is as follows:               add_filter( 'wp_handle_upload_prefilter', 'custom_upload_name' );        function custom_upload_name($file)     {              list($name, $ext) = explode('.', $file['name']);       $file['name'] = $post_ID.'.'.$ext;         return $file;     }      Edited: the final and working code:               add_filter( 'wp_handle_upload_prefilter', 'custom_upload_name' );        function custom_upload_name($file)     {              $post_ID = $_POST['post_id'];          list($name, $ext) = explode('.', $file['name']);       $file['name'] = $post_ID.'.'.$ext;         return $file;     }


Problem with update_user_meta() meta_value

I am trying to insert a large number of user in to the wordpress db using wp_insert_user(). After inserting each user, I am trying to add an user meta for each user. I am doing like this:               $meta_value = //data from an API (e.g.: 19, 34, 1290 etc)     $user_id = wp_insert_user( $new_user_data );// it works fine     update_user_meta( $user_id, 'my_meta_key', $meta_value ); //does not work      When I run it, user get inserted, but not the meta. When I try like below, it works:               $user_id = wp_insert_user( $new_user_data );// it works fine     update_user_meta( $user_id, 'my_meta_key', '1290' ); //it works      I have over 1000 users, I need to insert, so I need to insert the meta dynamically as well. Any idea how can I overcome this? Thanks.


Content between shortcodes

I am wondering if there is a way to take content between shortcodes and input it into a string, for example, I want to be able to have [shortcode]Hello World![/shortcode] input to a string called $ShortCodeText, how do I do this?


Having a series of pages created based on records in a table with fields populating the pages

I just did a redesign of my site, AlpineZone.com. I worked with a WP developer on the completion of the site. One thing that was done that I'm not entirely happy with is the way the Resorts section is handled. Here is an example resort: http://www.alpinezone.com/resorts/sugarbush/ I'm 100% happy with the way it _looks_. The site used to be in standard PHP and all the data was stored in a tab delimeted file that was read by a PHP script. The tab file was updated in Filemarker Pro and updated. This means that it was in a tabular format so I could easily search for records; find resorts that had X number of lifts or between X and Y vertical feet, etc. basically I had a lot more flexibility in parsing the information. However, the "data" in the new format comes from the Postmeta table. I believe the fields are done using a plugin called Advanced Custom Fields. As far as I can tell, it's not easily queryable or searchable. I have other areas of the site, like the Map (http://www.alpinezone.com/skiing/ski-resort-map/), that I would like to pull information from the same source, so I don't need to maintain two sets of records for each resort. Right now the Map is still pulling from the same Tab file it did before. But this means I have the risk of resorts in the Resorts section falling out of sync with the resorts on the Map since the data sources are disparate. basically: is there a way to create a series of pages based on a table of data with each record becoming a new page and the fields being populated into a page structure? Then, I could update the records by just updating the table and it gives me the other benefits of having a table structure (querying, sorting, advanced searching, and ultimately easier expansion (e.g. if I want to add a new field I don't have to add to 140+ resorts manually I can add a field, update the page template to include that field, and then just populate the fields in the table.). Edit: i found this; http://www.myreviewplugin.com/importman.html, which kind of sounds like what i want except it is part of this larger package I don't need. Thanks! -Nick


issues with wp_enqueue_script in my plugin

So I am working on a plugin and am trying to trigger a js file whenever a post is saved. I have been reading up on this all morning and cannot seem to find why this is not working. Any advice? If I were to paste the js code directly into the plugin it seems to work... I have double checked the path to the js and still no response.               add_action( 'admin_init', 'plugin_admin_init' );     function plugin_admin_init() {           wp_register_script( 'qtool-insert-v2', plugins_url() . '/buildStatus2/' . 'qtool-insert-v2.js' );     }          add_action( 'save_post', 'add_my_script' );     function add_my_script() {         wp_enqueue_script( 'qtool-insert-v2' );     }      Here is the qtool-insert-v2.js - very simple redirect.               <script type="text/javascript">     <!--     window.location = "http://www.google.com/"     //-->     alert("HELLO");     </script>


Redirect members to custom page upon logging in through WP admin

When a members logs in through WP admin, I would like to redirect them instantly to a custom URL. What will I need to change to make this possible? Respond with step-by-step details would be ideal.


Custom fields attached to a page template only show on edit screen when page is saved

When I create a custom field and associate it to a custom page template, it doesn't show in the post editor screen until I click save (draft / publish). Ideally, the custom field should show when I select the page template from the dropdown, without having to save anything. Can anyone suggest how I would achieve this desired behavior? Regards Bob


Making audio playlist with external audio files?

In WordPress 3.9 there is a new feature that can make a playlist with uploaded audio files. I'd like to use external audio files. I use two web hosts. One for my website and one for my audio files.


A-Z Plugin takes the root of the page and not my site?

Already tried the maker of the plugin but dont get any respons meby some smart men know the answer also. I use a A-Z plugin on this page: http://www.spreuken-wijsheden.nl/wijsheden- a-z/ The plugin links to my categories but doesnt take the root of my site but the page wijsheden-a-z. tried everything quitte desperate. The plugin can be found here. http://www.tipsandtricks-hq.com/wp-alphabet- listing-plugin-list-all-wordpress-posts-or-pages-alphabetically-4873 Many thanx already if someone knows the answer


Where to set individual blog quotas?

I am administering a self-hosted, multi-site Wordpress 3.1.x site with a few hundred sites. 10 users have requested to have their quotas increased to 1GB. I can't do it for everyone, but I would like to do it for these 10 sites. How can I set blog media quota on a site-by-site basis ? Thanks


Theme Loading Into Dashboard

I'm having this really weird, never seen before, issue ... whenever I visit the Dashboard, after about 3-5 seconds, my theme loads into the Dashboard layout. It's like the theme's stylesheet is being enqueued somehow ... ![enter image description here](http://i.stack.imgur.com/Elyd5.png) Here is my enqueue hook within `functions.php`:               function myyogawebsite_scripts() {              wp_enqueue_style( 'foundation-normalize', get_template_directory_uri() . '/css/normalize.css' );         wp_enqueue_style( 'foundation-min-css', get_template_directory_uri() . '/css/foundation.min.css' );              // WordPress Core         wp_enqueue_style( 'wordpress-core-css', get_template_directory_uri() . '/css/wp-core.css' );              // Load our main stylesheet.         wp_enqueue_style( 'myyogawebsite-style', get_template_directory_uri() . '/style.css' );              wp_enqueue_script( 'foundation-jquery', get_template_directory_uri() . '/js/jquery.js', null, null, false);              wp_enqueue_script( 'foundation-modernizr', get_template_directory_uri() . '/js/modernizr.js', null, null, true);         wp_enqueue_script( 'foundation-min-js', get_template_directory_uri() . '/js/foundation.min.js', array('foundation-jquery'), null, true);          }     add_action( 'wp_enqueue_scripts', 'myyogawebsite_scripts' );


Pages throwing 404 error on server load

I have a really strange problem. I have to fix a strange bug in a wordpress installation that is related to the server load. When the site receive more than 5 parallel request some pages starts to throw 404 errors. The pages throwing the errors are never the same and seems to be totally random. I can recreate the problem on my local machine using curl in the terminal :               $ curl -I http://site.local.com/path/to/page & curl -I http://site.local.com/path/to/page/ & curl -I http://site.local.com/path/to/page/ & curl -I http://site.local.com/path/to/page/ & curl -I          HTTP/1.1 200 OK     Date: Fri, 13 Jun 2014 14:31:09 GMT     Server: Apache/2.2.26 (Unix) DAV/2 PHP/5.5.11 mod_ssl/2.2.26 OpenSSL/0.9.8y     X-Powered-By: PHP/5.5.11     X-Pingback: http://site.local.com/xmlrpc.php     Content-Type: text/html; charset=UTF-8          HTTP/1.1 404 Not Found     Date: Fri, 13 Jun 2014 14:31:09 GMT     Server: Apache/2.2.26 (Unix) DAV/2 PHP/5.5.11 mod_ssl/2.2.26 OpenSSL/0.9.8y     X-Powered-By: PHP/5.5.11     X-Pingback: http://site.local.com/xmlrpc.php     Expires: Wed, 11 Jan 1984 05:00:00 GMT     Cache-Control: no-cache, must-revalidate, max-age=0     Pragma: no-cache     Content-Type: text/html; charset=UTF-8          HTTP/1.1 200 OK     Date: Fri, 13 Jun 2014 14:31:09 GMT     Server: Apache/2.2.26 (Unix) DAV/2 PHP/5.5.11 mod_ssl/2.2.26 OpenSSL/0.9.8y     X-Powered-By: PHP/5.5.11     X-Pingback: http://site.local.com/xmlrpc.php     Content-Type: text/html; charset=UTF-8          HTTP/1.1 200 OK     Date: Fri, 13 Jun 2014 14:31:09 GMT     Server: Apache/2.2.26 (Unix) DAV/2 PHP/5.5.11 mod_ssl/2.2.26 OpenSSL/0.9.8y     X-Powered-By: PHP/5.5.11     X-Pingback: http://site.local.com/xmlrpc.php     Content-Type: text/html; charset=UTF-8      The second curl call return a 404 errors. I have disabled all the plugins and this behavior is still happening. Anyone have any ideas?


Conditional within a public function within a loop

I am using a plugin to build widgets that includes images. Unfortunately it doesn't allow me to resize the images. I tried by adding a conditional but since it's in a public function and within a loop it wasn't working. This is the code:               public function get_widget_data() {             $widget_params = $this->get_widget_data_cache();                  if ( $widget_params ) {                 return $widget_params;             }                  $available_custom_widgets = $this->get_widget_posts();             if( !empty($available_custom_widgets) ) {                 foreach($available_custom_widgets as $widget) {                         $widget_params[] = array(                         'ID' => $widget->ID,                         'title' => $widget->post_title,                         'content' => $widget->post_content,                         'size' => $size,                         'image' => (has_post_thumbnail( $widget->ID ) ) ? wp_get_attachment_image_src( get_post_thumbnail_id( $widget->ID ), $size ) : null, //aangepast                         'link_url' => get_post_meta($widget->ID, '_' . Tribe_Widget_Builder::TOKEN . '_link_url', true),                         'link_text' => get_post_meta($widget->ID, '_' . Tribe_Widget_Builder::TOKEN . '_link_text', true),                         'link_target' => get_post_meta($widget->ID, '_' . Tribe_Widget_Builder::TOKEN . '_link_target', true),                         'widget_description' => get_post_meta($widget->ID, '_' . Tribe_Widget_Builder::TOKEN . '_widget_description', true),                         'dashboard' => get_post_meta($widget->ID, '_' . Tribe_Widget_Builder::TOKEN . '_dashboard', true),                         'disable_sidebar' => get_post_meta($widget->ID, '_' . Tribe_Widget_Builder::TOKEN . '_disable_sidebar', true),                         'token' => Tribe_Widget_Builder::TOKEN,                     );                                   }             }             $this->set_widget_data_cache($widget_params);             return $widget_params;         }      I need to assign a conditional thumbnail size to `$size` on the line that starts with `image- =>` depending within which sidebar the widget is located. I tried adding the following to the function, but is_dynamic_sidebar is not working within:               if (is_dynamic_sidebar('buildings-right')) {         $size = 'test';     }else {         $size ="banner";     }      It just takes the 'else'. What are alternatives for `is_dynamic_sidebar` that will work within this function and within a loop?


Get First Image Or youtube Thumbnail with link to youtube video

Looking for a single function to grab the first image or video thumnail (with link to the video location i.e. youtube) Havent quite found one that will work. My youtube file starts with there new sharing format http://youtu.be. Not the best with functions yet so ive been stumped for awhile on this havent got any help on wordpresses fourm either


Check if values exists DB

I am getting nutts with this one. I want to check if the email introduced in the form already exists in the database before creating a new record. But for some reason the email is empty at search time but when gets into the database gets it correct value from the form. The PHP @ 'functions.php':               function qsmp_register($name, $mail, $password, $terms, $newsletter) {         global $wpdb;         $table_name = $wpdb->prefix . 'qsmp_mails';              $query = $wpdb->prepare( 'SELECT COUNT(*) FROM %s WHERE email = %s ', $table_name, $mail );              $cEMAIL = $wpdb->get_var( $query );              if ($cEMAIL < 1)         {      The HTML:               <form class="reg-page" name="register" action="<?php qsmp_register( $_POST['qsmp_name'],                                                                                $_POST['qsmp_email3'],                                                                                $_POST['qsmp_password3'],                                                                                $_POST['qsmp_terms'],                                                                                $_POST['qsmp_newsletter']) ?>" method="post">

Register a new account


Track skip button on built-in WP audio playlist?

I feel like I'm missing something here. How do I add a skip track button to the WordPress built-in audio playlist player? Do I lose the ability to move around the playlist if I hide that gigantic track list? I'm looking to embed a slim playlist player on a page.


Ajax Call in page theme not working?

Ok, i am VERY new to wordpress (2 Hours new). I am creating a page template, which works fine, but this is the issue i am having: In the template.php file, i have this code:               <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>     <script type="text/javascript">         function loadTweets() {$.getJSON("http://mysite.com/wp-content/themes/truemag/page-templates/includes/twitter.php", function (json) {alert(json);});} setInterval(loadTweets(), 60000);     </script>      For some reason when i go to the URL in my browser, I get an Error 500. Same with my ajax call? How would i fix this? I was told maybe a .htaccess file, but i dont think that would be an issue. For some reason this page is blocked.


child_of not working in wp_dropdown_categories

I have `wp_dropdown_categories` working without setting `child_of`. Once I set `child_of`, all categories disappear. Here's my code, what should I do to enable `child_of`?               function dropdown(){         $book_term=term_exists('book','category');         $book_term_id = $book_term['term_id'];          $dropdown = array(         'child_of'   => $book_term_id,         'hide_empty' => 0         )     ?>         wp_dropdown_categories( $dropdown );     <?php     }


Edit default action for profile_personal_options

Is there a way to edit the pre-existing action attached to the `profile_personal_options` hook that is built-in to WordPress?


How to access global variable $menu inside a class function

am puzzling why can't i access the global variable `$menu` inside a php class function               class adminMenus {        public function getWPdefaultmenus(){           global $menu;           return $menu;        }     }      using this code in a plugin file and this function still return `NULL`. **Edited** what i am doing after @Will the Web Mechanic's answer               class adminMenus {          private $getWPdefaultmenus;          public function __construct(){             add_action( 'admin_menu', array( $this, 'getWPdefaultmenus' ) );           }           public function getWPdefaultmenus(){               global $menu;               $this->getWPdefaultmenus = $menu;           }         }      but this returns error:Fatal error: Cannot access empty property


WPDB - How to search a column in a table

I have a custom table called wpgrating I have a column there called "ip" Now what I want to do is search for "ip" column and see if there is an entry already there? How can I achieve this?


Terms not appearing in wp_dropdown_categories

I am trying to use wp_dropdown_categories at front end. I got the dropdown box with default "uncategorized", the rest of the category is not there.               function cats_dropdown(){         require_once(ABSPATH . '/wp-admin/includes/template.php');         $args = array('taxonomy' => 'category');     ?>       <div>          <?php wp_dropdown_categories($args); ?>       </div>     <?php     }      In the same function, if I try to output wp_terms_checklist, it works. This is confusing. Anything I missed in the dropdown?


Custom metabox value not saving

I have a custom meta box on a custom post-type. I've followed this tutorial but can't get the value I enter to save, I'm guessing I've referenced to something incorrectly. I've looked at the other answers here but no one seems to be using the same save method as I am, and I'm unsure of how to use those answers. This is how I'm creating the fields in the meta box:               // Album Information Metabox Content     function meta_album_info() {         global $post;         // Noncename needed to verify where the data originated         echo '<input type="hidden" name="albummeta_noncename" id="albummeta_noncename" value="' .         wp_create_nonce( plugin_basename(__FILE__) ) . '" />';         $year_released = get_post_meta($post->ID, '_year_released', true);         $record_label = get_post_meta($post->ID, '_record_label', true);         echo '
Year Released
<input type="text" name="_year_released" value="' . $year_released  . '" class="widefat" placeholder="1980" />

Label
<input type="text" name="_record_label" value="' . $record_label  . '" class="widefat" placeholder="2Tone" />
';     }      And here's how I'm attempting to save the data (well for now just the year_released field):               // save album info     function wpt_save_album_meta($post_id, $post) {         if ( !wp_verify_nonce( $_POST['albummeta_noncename'], plugin_basename(__FILE__) )) {         return $post->ID;         }         if ( !current_user_can( 'edit_post', $post->ID ))             return $post->ID;         $album_meta['_year_released'] = $_POST['_year_released'];         foreach ($album_meta as $key => $value) {             if( $post->post_type == 'revision' ) return;             $value = implode(',', (array)$value);             if(get_post_meta($post->ID, $key, FALSE)) {                 update_post_meta($post->ID, $key, $value);             } else {                 add_post_meta($post->ID, $key, $value);             }             if(!$value) delete_post_meta($post->ID, $key);         }     }     add_action('save_post', 'wpt_save_album_meta', 1, 1);      much appreciated!


Adding line breaks to nav menu items

I need to add line breaks to the nav menu item titles. I didn't realize this was a problem as when I am logged in as a Super Admin, I can add `<br/>` just fine, but apparently regular-level admins cannot. I've read over this post Custom Menus Description Stripping HTML Tags but I'm fairly convinced the tags are being stripped on on save/update, so I am not immediately seeing how a Custom Walker is the solution, but my brain is pretty well shot today, so it might be obvious. There also doesn't seem to be any sanitation happening in `wp_save_nav_menu_items()` or `wp_update_nav_menu_item()`.


Filter post query to only show direct children of category

Google seems all purple on this subject, if you know what I mean. I've searched for this topic forever to find a solution. I want to build a finder/explorer feel to my categories, so when browsing to a category, I only want to display the direct children of the category - not posts in sub categories of this category. I would like to alter the current query if possible, and not do any SQL quries. **I tried:**               $posts = query_posts('cat='.$cat.'&child_of='.$cat.'&parent='.$cat);      And a whole bunch of other stuff.. But I'm running out of ideas...


ajax, right way to do it and make it works?

I'm new to wordpress but have knowledge in php and javascript. I read a lot of blogs about ajax call in wordpress. I also read some posts on this forum. However, I still have some difficulties making an ajax call with wordpress. It's a little confusing in my mind where `add_action` and hook must be written (inside my custom php function file or inside function.php file? or in an other way). When my jquery script is called, `wp_ajax` is not defined... I don't understand how my jquery script can get `wp_ajax` url or other variable from php before it is ran. Here my different scripts: In my function.php (I really don't know if I need to put this here or in my custom php file):               wp_enqueue_script('load_post', get_template_directory_uri().'/js/load_post.js', array('jquery'), '1.0', 1 );     wp_localize_script( 'load_post', 'wp_ajax',             array( 'url' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce('ajax_nonce') ));       In load_post.php               <?php          add_action('wp_ajax_load_post', 'load_post_callback');     add_action('wp_ajax_nopriv_load_post', 'load_post_callback');          function load_post_callback() {          if (isset($_POST['post_ids'])) {              $nonce = $_POST['nonce'];          if ( ! wp_verify_nonce( $nonce, 'ajax-nonce' ) ) {             die ( 'Interdit !');         }              $ids = array();          $ids[] = $_POST['post_ids'];              $posts_per_page = 8;         global $wp_query;         query_posts(array('post_type' => array('post', 'portfolio'), 'post__not_in' => $ids, 'posts_per_page' => $posts_per_page));         while (have_posts()) : the_post();              $post_type = get_post_type( $post->ID );         if ($post_type == 'post') {             $post_type = 'blog';         }     ?>          //I do some stuff echo...          <?php         endwhile;         wp_reset_query();         }     }     ?>      And load_post.js               jQuery(document).ready(function($) {               jQuery('#next-container').click(function() {                   var IDs = [];             $(".element").each(function(){ IDs.push(this.id); });                  $('#next-container').html('loading');                  $.ajax({                 type: 'POST',                 url: wp_ajax.url,                 data: {  action: 'load_post',                            ajax_nonce: wp_ajax.nonce,                         'post_ids': IDs,                         },  //{'post_ids[]': IDs },//'post_ids='+IDs,                 success: function(data) {                         $('#next-container').html('');                           $container.isotope( 'insert', $(data));                              }                     })             })     })


How can I create an RSS feed that includes "Private" posts?

I'm currently publishing articles to wordpress as "Private", as I don't want them to be viewable on the website. However I do need an RSS feed of these posts. Any suggestions on how to go about creating an RSS feed of posts that aren't viewable on my site?


How can I list custom post by custom category?

From some references I wrote a code for create custom post type ( **journal** ) and taxonomy using following code. It works fine. Next I am add a new category from admin side for my custom post type ( **journal** ) called **featured**. I can sort this post type by category on admin side ![Admin part](http://i.stack.imgur.com/nwOAO.png). But on user side I can't list them when I am list my category which shows only **post categories** Like below image. Below image show list of my custom post type( **journal** ) . How can I show this journal list by category name on user side?![enter image description here](http://i.stack.imgur.com/vb9kH.png)               function post_type_journal()         {                  $labels = array(             'name' => _x('Journals', 'post type general name'),             'singular_name' => _x('Journal', 'post type singular name'),             'add_new' => _x('Add New', 'journal'),             'add_new_item' => __('Add New Journal'),             'edit_item' => __('Edit Journal'),             'new_item' => __('New Journal'),             'view_item' => __('View Journal'),             'search_items' => __('Search Journal'),             'not_found' =>  __('Nothing found'),             'not_found_in_trash' => __('Nothing found in Trash'),             'parent_item_colon' => ''         );              $args = array(             'labels' => $labels,             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,             'query_var' => true,             'menu_icon' => null,             'rewrite' => true,             'capability_type' => 'post',             'hierarchical' => false,             'menu_position' => null,             'supports' => array('title','editor','thumbnail'),                );              register_post_type('journal', $args);         }         add_action('init','post_type_journal');     function themes_taxonomy() {                  register_taxonomy('article', 'journal', array(             // Hierarchical taxonomy (like categories)             'hierarchical' => true,             'query_var' => true,                     // This array of options controls the labels displayed in the WordPress Admin UI             'labels' => array(                 'name' => _x( 'Journal Category', 'taxonomy general name' ),                 'singular_name' => _x( 'Journal-Category', 'taxonomy singular name' ),                 'search_items' =>  __( 'Search Journal-Categories' ),                 'all_items' => __( 'All Journal-Categories' ),                 'parent_item' => __( 'Parent Journal-Category' ),                 'parent_item_colon' => __( 'Parent Journal-Category:' ),                 'edit_item' => __( 'Edit Journal-Category' ),                 'update_item' => __( 'Update Journal-Category' ),                 'add_new_item' => __( 'Add New Journal-Category' ),                 'new_item_name' => __( 'New Journal-Category Name' ),                 'menu_name' => __( 'Journal Categories' ),             ),                  'rewrite' => array(                 'slug' => 'article', // This controls the base slug that will display before each term                 'with_front' => false, // Don't display the category base before "/locations/"                             'hierarchical' => true // This will allow URL's like "/locations/boston/cambridge/"             ),         ));     }     add_action( 'init', 'themes_taxonomy',0);        The following is code of user side that outputs is shown in second image               $categories = get_categories($args);       foreach($categories as $category) {          echo '
Category: term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'
 ';         echo '
 Description:'. $category->description . '
';         echo '
 Post Count: '. $category->count . '
';  }                        $type = 'journal';                     echo  $cat_id=get_cat_ID('featured');             $args=array(                      'cat'=>$cat_id,              'post_type' => $type,              'post_status' => 'publish',              'posts_per_page' => -1,              'caller_get_posts'=> 1);                  $my_query = null;             $my_query = new WP_Query($args);             if( $my_query->have_posts() ) {              while ($my_query->have_posts()) : $my_query->the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
             <?php               endwhile;             }             wp_reset_query();  // Restore global post data stomped by the_post().             ?>


Where to put a migration script to switch post information?

I just changed a crucial aspect of my theme, and posts tagged with a particular taxonomy called `position` are now handled by a custom meta field called `cmb_position_name`.   * Posts that have the taxonomy `position` with the term `event_highlights` should now have a `cmb_position_event_highlights` meta value of `on`.   * Posts that have the taxonomy `position` with the term `featured_news` should now have a `cmb_position_featured_news` meta value of `on`.   * Posts that have the taxonomy `position` with the term `slider` should now have a `cmb_position_slider` meta value of `on`. I need to make a script that migrates existing posts, adding these meta values accordingly. What is a good place to put this script so that it is executed once, and ensures all the posts are migrated properly?


What does that mean: cannot use a scalar value as an array

I've got a theme and when I host it locally on my MAMP server I have no issues, after moving it to a web server get the following issue: > Warning: Cannot use a scalar value as an array in /home/XXX/public_html/wp- > content/themes/XXX/lib/inc/shortcodes.php on line 752 Firstly, I have no idea what a scalar value is, but here is the code in question. When commenting out the code, the site works fine again, but, it obviously does something, so any help would be appreciated. Lines 752 - 756               $param = WPBMap::getParam('vc_row', 'el_class');          $param ['description'] = 'If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.
Predefined Classes:
          no-margin-sides  no-margin-top  no-margin-bottom  margin-top-75  margin-bottom-75
          padding-top-50  padding-bottom-50
';          WPBMap::mutateParam('vc_row', $param);


Pretty Permalinks

I've created my own search functionality which basically finds the nearest store closest to the entered postal code. My URL for the search currently looks like this `http://www.example.com/stores?searchTerm=London`, which is not really that SEO friendly. I would like my URL to be in the following format - `http://www.example.com/stores/London`, however due to my lack of knowledge in how the WordPress URL Rewrites work I'm struggling with this and would like some help in resolving this issue. Stores is a page that loops through the results. If anybody has any ideas on how to do this or can point me in the right direction then it would be greatly appreciated.


rewriting for custom taxonomy rewrite

I want to rewrite my custom taxonomy in form of http://mywebsite.com/cars/my-tax All examples i found makes use rewrites and use a new function to get the new permalink... problem is normally to get a term url, get_term_link is used but I cannot use this as I have rewritten the permalink.. so i need to replace this function everywhere it is called? does not seem to be a good solution for me.


Thumbnail for categories / taxonomies plugin?

I'm looking for a nice way to attach an image as a thumbnail to a category. No plugin that I found does this. I have a category loop and it would nice to display a category thumbnail, not just the name and description.


Wordpress localization - gettext and git

We're about to start working on localization of a highly customized wordpress theme with over 200 php files. We're using git for version control. Are there any particular hints or warnings we should know about? Do we just stick the po/mo files in there with the theme? We're probably going to try to use a tool like WPML or Codestyling Localization. Do they store everything in files or to they mess about with wpdb?


Trigger Customizer saving process with Javascript only

I'm working on a custom theme that uses WordPress Customization API to let the user play with parts of the content of his website, basically the front-page which he can modify by adding/removing custom blocks such as latest posts, page children, etc. Blacks structure is collected and filled in an custom input. Everything works fine except for saving, the Customizer seems to have some safety that blocks me from saving the input value: in order to save it, I need to manually trigger a Javascript 'keypress' event by selecting the input and pressing a key. If I don't, the submit button stays disabled. By browsing through /wp-admin/js/customize-controls.js I manage to activate the submit button:               wp.customize.trigger('change')      But even though the saving thing is unlocked, it doesn't have any effect: the input value is not sent to admin_ajax.php and my data is not saved. Any idea of how I could force the trigger on the Javascript API to save my data? I couldn't find detailed doc on the WP JS API, that could helped too if I missed it somewhere.


3 different ways to check the number of pages on site gives 3 different answers

I entered this command into Google:               site:g33ktalk.com      And it returned 659 pages. But when I created a sitemap with this service: http://www.xml-sitemaps.com/ it showed me 498 pages crawled. And when I made the sitemap with the Wordpress default sitemap generator, it showed under 400 pages. Would anyone know why this happens and what is the correct count? Is it a crawling problem? If so, how would I begin debugging it so that all 600+ pages can be crawled? Thank you!


localization of theme and plugins to English (originally in another language)

We're about to start localizing a wordpress installation with a highly customized theme and several custom plugins. Unfortunately it is not gettext- ready, and also the original theme is not in English. How would you do this? I'm thinking the best way to do it would be to go through the theme and plugin files, change all static text (currently in Swedish) to gettext-wrapped English, and then do a translation back to Swedish. It sound pretty tedious. Can we just wrap the Swedish in gettext calls and provide an en_US translation? Also, any thoughts on tools? WPML, Codestyling Localization, raw poedit, something else?


My website is slow on the initial load

I am creating my first website in wordpress, and I have noticed some strange behavior. The website is really slow on the initial load. When I open the website after some time of inactivity, let's say an hour, the site loads extremely slow, over 5 sec. After that the website is just fast. Even when I close the browser and open again the website stays fast. When I switch to another browser, I have the same problem. Initial load is slow, after that the page works as usual. Anyone know something I could do. I have disabled all plugins and still the same problem, any know what I can do. Profiling with firebug and Yslow is not really an option, because I can not get good results. I can only test this once every hour.


How do I filter a custom post type loop by a field?

OK, very simple task, I'm just not good at PHP. I have a page where I want to list some staff using a styled list. Here is the page all working fine, I just need to divide the results - http://www.themontessoripeople.co.uk/montesori/?post_type=people I downloaded a "custom content type" plugin and added the content type of "people" and added the appropriate fields. Now I want to filter the posts I have added by the custom field called "hierarchy". Here is how I want the page to display - http://i47.tinypic.com/oqymwh.jpg Notice in the image I have headings for each group of posts filtered by the room. The custom field "hierarchy" contains the room variables of either "management", "babies_room" and "toddlers_room". How do I amend the code below to filter the posts by the value held within `<?php print_custom_field('hierarchy'); ?>` ?               <?php $col = 1; ?>               <?php if (have_posts()) : ?>                     <?php while (have_posts()) : the_post(); ?>                          <?php if ($col == 1) echo "
"; ?>                          <div class="post col<?php echo $col;?>" id="post-<?php the_ID(); ?>">

<?php the_title(); ?>
                                      <?php print_custom_field('job'); ?>

                                     <img src="<?php print_custom_field('staff_image:to_image_src'); ?>" width="160" height="160" alt="<?php the_title(); ?>-image" />

<?php edit_post_link('Edit Post', ''); ?>

                      <?php if ($col == 1) echo "
"; (($col==1) ? $col=2 : $col=2); ?>                <?php endwhile; ?>      Thanks, Ben.


Redirect Domain to a Specific Category

My current blog site hosts the Category-- http://www.soulintentarts.com/the- weekly-rune/ I would like the domain theweeklyrune.com to redirect to the above URL, which is the WP Category The Weekly Rune. Is that possible? Thank you!


Upload iPhone video clips to blog via native WP app

I'm using the WordPress iPhone app, and when I upload video clips to a blog they show up in some browsers and in others not. I'm using a HTML5 video markup as a container for the clips. While mpeg-4 doesn't work in Firefox and Opera I would really expect the clips to work in Apple's own browser Safari, which they don't. The only browser I can currently view these clips in is Chrome. Here's my markup for the uploaded clips:               <video width="960" height="540" src="http://path/to/clip/1.mov" type="video/quicktime" controls>Your browser can't play this video.</video>      It seems that .mov files are harder to interpret for Safari than it's mp4 counterpart. Could it be that Safari needs the clips to be in the latter format? If it does, what approach would you recommend converting these files when uploading a video clip?      Any directions regarding this issue are much appreciated.


How to randomise my menu items?

So I thought I could do it like this (also I want to only get 3) -               $menu_items = wp_get_nav_menu_items(26);     $menu_items = array_rand($menu_items, 3);          foreach ( (array) $menu_items as $key => $menu_item ) {         $title = $menu_item->title;         echo $title;     }


Hide H1 Title using the_title filter

I am trying to hide the pages H1 header IF a custom field specifies this. On a page back end I have added a custom field: Name = hide_title Value = true I then want to hide only the H1 using a filter. The following code does not work but is the result of my noodling around. Can anyone suggest a fix for this code or an alternate way of approaching this. I do not want to amend the core template files. Thanks                   // Hide H1 Title              add_filter('the_title', 'hide_title', 10, 2);              function hide_title($title, $id) {                  global $post;             $key = 'hide_title';             $meta = get_post_meta($post->ID, $key, true);                  if ($meta = 'true') $title['post_title'] = '';             return $title;              }


automatically adding submenu items

Here's the solution that @bainternet has posted here: Add child pages automatically to nav menu               /**     * auto_child_page_menu     *      * class to add top level page menu items all child pages on the fly     * @author Ohad Raz <admin@bainternet.info>     */     class auto_child_page_menu     {         /**          * class constructor          * @author Ohad Raz <admin@bainternet.info>          * @param   array $args           * @return  void          */         function __construct($args = array()){             add_filter('wp_nav_menu_objects',array($this,'on_the_fly'));         }         /**          * the magic function that adds the child pages          * @author Ohad Raz <admin@bainternet.info>          * @param  array $items           * @return array           */         function on_the_fly($items) {             global $post;             $tmp = array();             foreach ($items as $key => $i) {                 $tmp[] = $i;                 //if not page move on                 if ($i->object != 'page'){                     continue;                 }                 $page = get_post($i->object_id);                 //if not parent page move on                 if (!isset($page->post_parent) || $page->post_parent != 0) {                     continue;                 }                 $children = get_pages( array('child_of' => $i->object_id) );                 foreach ((array)$children as $c) {                     //set parent menu                     $c->menu_item_parent      = $i->ID;                     $c->object_id             = $c->ID;                     $c->object                = 'page';                     $c->type                  = 'post_type';                     $c->type_label            = 'Page';                     $c->url                   = get_permalink( $c->ID);                     $c->title                 = $c->post_title;                     $c->target                = '';                     $c->attr_title            = '';                     $c->description           = '';                     $c->classes               = array('','menu-item','menu-item-type-post_type','menu-item-object-page');                     $c->xfn                   = '';                     $c->current               = ($post->ID == $c->ID)? true: false;                     $c->current_item_ancestor = ($post->ID == $c->post_parent)? true: false; //probbably not right                     $c->current_item_parent   = ($post->ID == $c->post_parent)? true: false;                     $tmp[] = $c;                 }             }             return $tmp;         }     }     new auto_child_page_menu();      How to use it? I have to implement it on a published website so I'm not in a position to experiment much... c/p code to functions.php? call the function from inside the header?


List all posts in custom post type by taxonomy

Is there a way I can list all posts in a specific custom post type and arrange them by the custom taxonomy term attached to them? For example; **Taxonmy Term #1**   Post Type   Post Type   Post Type   **Taxonomy Term #2**   Post Type   Posty Type Any help would be most appreciated. Thanks.


How to extend WP_Query to include custom table in query?

I have been days over this issue now. Initially it was, how to store a user's follower data in database, for which I got couple of nice recommendations here at WordPress Answers. After, following the recommendations I have added a new table like this:               id  leader_id   follower_id     1   2           4     2   3           10     3   2           10      In the table above, the first row has a user with an ID of 2 who is being followed by a user with an ID of 4. In the second row, a user with an ID of 3 is being followed by an user with an ID of 10. The same logic applies for the third row. Now, essentially I want to extend WP_Query so that I can limit posts fetched to that of, only by the leader(s) of a user. So, taking the above table into consideration, if I were to pass the user ID 10 to WP_Query the results should only contain posts by user ID 2 and user ID 3. I have searched a lot trying to find an answer. Nor, I have seen any tutorial to help me understand how to extend the WP_Query class. I have seen Mike Schinkel's answers (extending WP_Query) to similar questions, but I have really not understood how to apply it to my needs. It would be great if someone could help me out with this. Links to Mike's answer's as requested: Link 1, Link 2


Change post category via MySQL

I'm currently building a management program that works separately from Wordpress but interacts directly with the Wordpress MySQL database. I have it working updating, adding and deleting posts and postmeta but I am now stumped on adding categories to posts and changing categories. I have posts setup with custom taxonomies "what" and "from" and I would like to change these using a select box in a form via MySQL. Is this possible? I know it involves a lot of LEFT JOINS to display the taxonomies for each post but I'm not sure how to update them. Heres what I have for displaying the custom taxonomies on the site:               SELECT t.*, tt.* FROM wp_terms AS t      INNER JOIN wp_term_taxonomy AS tt ON (tt.term_id = t.term_id)      INNER JOIN wp_term_relationships AS tr ON (tr.term_taxonomy_id = tt.term_taxonomy_id)      WHERE tt.taxonomy IN ('what') AND tr.object_id IN (79088)      ORDER BY t.name ASC;      Where 'what' is the custom taxonomy and 79088 is the post ID how would I go about changing this what from term_ID 1500 to 1501 for example?


Loading Custom Post Type Events into jQuery-based FullCalendar?

Here is a question I have spent over 3 hours attempting to solve but each approach I take ends up not working out for me. All I am attempting to do is utilize this opensource ajax calendar script:   * **FullCalendar** and have the entries display all posts within a specific post type. For each of the posts within this event post type I have a custom metabox with the following custom fields:   * event category   * event start date   * event start time   * event end date   * event end time At the most basic level I just need each post to show up within the applicable calendar box based on the "event start date" and "event start time" and link to the applicable event post details page. In an ideal situation I was looking to have each event category with its own color and have each event span multiple days if the applicable event has an `"event_end_date"` that is different than the start date. Has anyone done this before and can past the applicable code to get either of these in place. I feel this would be highly valuable to the WordPress community as well.


How do I add CSS options to my plugin without using inline styles?

I recently released a plugin, WP Coda Slider, that uses shortcodes to add a jQuery slider to any post or page. I am adding an options page in the next version and I would like to include some CSS options but I don't want the plugin to add the style choices as inline CSS. I want the choices to be dynamically added to the CSS file when it's called. I would also like to avoid using fopen or writing to a file for security issues. Is something like this easy to accomplish or would I be better off just adding the style choices directly to the page?


What Is The Difference Between suppress_errors() And hide_errors() in $wpdb?

What is the difference between the suppress_errors() function and the hide_errors() functionin wpdb class? What is the use of each function?


Order by multiple meta keys on wordpress

After multiple research I didn't find the correct answer to my question. I just need to order my custom post type by date and then by time (format: 18:00). Here's what I tried: http://pastebin.com/BRR6h08j It orders well by the date but not by the time. And I don't need to hide events that occured. If someone can help me getting my correct meta_keys I know the problem is here:               'meta_query' => array(          'relation' => 'AND',           array(             'key' => 'heure_de_lartiste',             'value' => $todaysDate,             'compare' => '>='            )       ),      I don't know what to put in "value" and "compare" Thanks a lot, Jhon


Having Trouble With get_category_by_slug In a Custom Function

Here's my custom function to list child categories by the parent slug.               function ribbon_list_cats($parent_cat_slug)     {         $parent_category = get_category_by_slug($parent_cat_slug);         if ($parent_category->count != 0) {             echo "
";             echo wp_list_categories('title_li=&child_of='.$parent_category->term_id.'&hide_empty=0&show_option_none=&echo=0');             echo "
";         }     }      I'm having trouble getting it to return and output. It doesn't throw an error. I'm using it multiple times so I created this but when I do it like so:               $parent_category = get_category_by_slug('lifestyle');     if ($parent_category->count != 0) {         echo "
";         echo wp_list_categories('title_li=&child_of='.$parent_category->term_id.'&hide_empty=0&show_option_none=&echo=0');         echo "
";     }      right in the template it works fine. But that's a lot of code to repeat over and over again. Hope that makes sense. Thanks!


Disable the link on certain pages

I currently have a site with two levels of navigation. I am styling the wp_list_pages() list to act as my navigation. I would like to disable the link on some pages which have children (not exclude) so that I can hover over them to display the drop down navigation but I can't click on them. Does anyone know of such a method or parameter I could add?


How do I view registered syles and scripts for enqueue

I know that `wp_register_style()`, `wp_deregister_style()` and `wp_enqueue_style()` are used for css style registration and enqueue management. However, I am interested in viewing ALL registered styles (whether custom or by default). Does `wp_register_style()` add the script names/locations to a table in the WordPress database? If so, which? And how can I view them? Is there a function for that or do I have to create my own? Thanks.


remove "edit your profile" from admin menu bar

How can I remove "edit your profile" submenu under "my-account-with-avatar" admin menu bar, while still keeping the avatar and logout?


Custom taxonomy from custom post type

Trying to have a set of categories for every custom post type. > Book (custom post type) -> category (custom taxonomy) -> Adult / Teenage / > Kids > > Movie (custom post type) -> category2 (custom taxonomy) -> Thriller / Comedy > / Action So far I manage to display the custom taxonomy as a list:               $terms = get_terms( 'category' );     echo '
';     foreach ( $terms as $term ) {         $term_link = get_term_link( $term );         if ( is_wp_error( $term_link ) ) {             continue;         }         echo '
' . $term->name . '
';     }     echo '
';       and in functions.php               add_filter('pre_get_posts', 'query_post_type');     function query_post_type($query) {         if (is_category() || is_tag()) {             $post_type = get_query_var('post_type');             $post_type = array('Book');             $query->set('post_type',$post_type);             return $query;         }     }      When I click on Adult/Teenage/Kids it works as I want it, it calls category.php, but when I click on any of Thriller/Comedy/Action it doesn't work. Any suggestions?


How can I make a website with dynamic features with wordpress?

As I am a novice in web development field, I wanted to clarify some questions running in my head.   1. I want to make a multilingual website with dynamic features. Dynamic features can be like anything under the sun. Is it possible that I can make a website using WordPress (which is mostly considered as blogging platform). Well I know that there are some limitations while making a customized website with wordpress.   2. Should I learn any of the frameworks like Django or rails, if yes why (its obvious I would have to learn CSS, Ajax, Javascript, PHP)?   3. Suppose I want to add dynamic features in my wordpress site real time features like that of twitter (should I learn ruby on rails then?), or building API's, support digg like features ,people submitting blogs and reblogging again, aggregaton features, editing features, some facebook features like notification features on the top of your profile page, colloborative blogging, submitting links, photos, videos, social platform for people to know each other and follow them, microblogging (realtime) like tumblr. Will it be fully customizable after I get my hands perfectly on learning some languages and/or frameworks like rails or django.   4. I don't want to learn drupal as it learning curve is very high and meant for technically good programmers, while I don't have much knowledge of Joomla (and am ready for it to learn if wordpress fails).   5. I also want to make a rich platform for advertisement which will be commercial. Is it possible that I make a model of advertisement which is in my mind which can link to any other websites, blogs, people (users). The most interesting,challenging and important question is:   1. If I am not able to make a website with such dynamic features with Wordpress, will I have to make pluggins, widgets,themes on my own which can be fully customized for my website. Is it possible to make such pluggins and themes which can be fulfill above said points.


Custom Metabox with Taxonomy Dropdown - Saving Issue

My goal was simple --- to create a custom post type with a custom metabox with a simple drop down list of taxonomy terms instead of utilizing the tags or checkboxes. The reason was to ensure that the editor can only select a single term from the taxonomy list. After trial and error I finally managed to figure out a way to utilize the excellent metabox creation tools I am using from WP-Alchemy (http://farinspace.com/wpalchemy-metabox/) to create my metabox and have it display the applicable terms in a dropdown list. The problem I am having is that I can't seem to get a new selection from the dropdown menu to save the selected value. To be clear... its important that only a single term be associated with each post in this custom post type meaning that whenever a different value is select from the dropdown menu and the post is saved it needs to ensure the previous selection is unregistered. As mentioned I currently have it displaying the list of terms in a dropdown and I also have it correctly displaying whatever term might be associated. Just the saving of the new values is where i am having issues. From extensive research it "seems" like the solution involves using the wordpress "wp_set_post_terms" functions which is further explained here: http://codex.wordpress.org/Function_Reference/wp_set_post_terms However I am unsure how to utilize it correctly to achieve my desired result. Below I have include the code I am utilizing. It's very possible there is a better way of doing this and I would appreciate whatever suggestions you guys might have might also ensure that the applicable "checks" are being done to ensure data can't be inserted by users that are not authorized. FUNCTIONS.PHP FILE (SHOWS THE CREATION OF THE CUSTOM POST TYPE AND TAXONOMY BELOW.               //////////////////////////////////////////////////////////////////////////////     // CUSTOM POSTTYPE FOR -- SERVICES       //////////////////////////////////////////////////////////////////////////////          add_action('init', 'services');     function services() {      register_post_type('services', array(       'labels' => array(        'name'   => __('Services'),        'singular_label'  => __('Service'),        'new_item'   => __('Add a Service'),        'add_new'   => __('Add a Service'),        'add_new_item'  => __('Add a Service'),        'edit'   => __('Edit Service'),        'edit_item'   => __('Edit Service'),        'view'   => __('View Service'),        'view_item'   => __('View Service'),        'search_items'  => __('Search Services'),        'not_found'   => __('No Services Found'),        'not_found_in_trash' => __('No Services Found in Trash'),            'parent_item'  => __('Parent Service'),        'parent_item_colon' => __('Parent Service:')        ),       'can_export'    => true,       'menu_position'   => 7,       'public'    => false,       'show_ui'    => true,       'publicly_queryable'  => true,       'hierarchical'   => true,       'query_var'    => true,       'capability_type'   => 'post',       'exclude_from_search'  => false,       'supports' => array(        'title',        'editor',        'revisions',        'page-attributes'        ),       'rewrite' => array(         'slug'   => 'disability-services',         'with_front'   => false        )      ));     }      HERE IS WHERE I AM REGISTERING THE TAXONOMY I AM TRYING TO WORK WITH               // CUSTOM TAXONOMY METABOX POSTTYPE - AGE GROUPS        register_taxonomy('theme', array('services'), array(         'hierarchical'          => false,          'singular_label'            => 'Age Group',          'query_var'                 => 'theme',         'public'                => true,         'show_ui'               => true,         'show_tagcloud'             => false,         'show_in_nav_menus'             => true,             'rewrite'               => array( 'slug' => 'age-groups', 'with_front' => false ),         'labels' => array(             'name'          => __( 'Age Groups' ),             'singular_name'         => __( 'Age Groups' ),             'search_items'      => __( 'Search Age Groups' ),             'all_items'             => __( 'All Age Groups' ),             'parent_item'       => __( 'Parent Age Group' ),             'parent_item_colon'         => __( 'Parent Age Group:' ),             'edit_item'             => __( 'Edit Age Group' ),              'update_item'       => __( 'Update Age Group' ),             'add_new_item'      => __( 'Add Age Group' ),             'new_item_name'         => __( 'New Name of Age Group' ),             'popular_items'         => __( 'Popular Age Groups' ),             'separate_items_with_commas'=> __( 'Separate Age Groups with commas' ),             'add_or_remove_items'   => __( 'Add or remove Age Groups' ),             'choose_from_most_used' => __( 'Select Popular Age Groups' ),              ),        ));        wp_insert_term('Kids', 'theme');        wp_insert_term('Teens', 'theme');        wp_insert_term('Adults', 'theme');      THIS IS THE REMAINDER OF THE CODE I AM USING IN THE FUNCTIONS FILE AND THE CODE TO CREATE THE METABOX BASED OFF WPALECHEMY. In this attempt I tried to include 'save_filter' => "wp_set_post_terms( $post->ID, 'theme' )", with the hope this would save the applicable data but it did not.               // CUSTOM METABOX POSTTYPE - SERVICE DETAILS        $custom_metabox_service_details = new WPAlchemy_MetaBox(array (         'id'        => '_service_details-metaboxes',        // underscore prefix hides fields from the custom fields area         'title'     => 'Age Groups',            // title added automatically to the custom metabox         'types'     => array('services'),           // added only for custom post type "name-of-post-type" can also be "page" or "post"         'context'   => 'normal',                    // same as above, defaults to "normal" but can use "advanced" or "side"         'priority'  => 'high',                  // same as above, defaults to "high" but can use "low" as well         'mode'  => WPALCHEMY_MODE_EXTRACT,         'save_filter' => "wp_set_post_terms( $post->ID, 'theme' )",         'template'  => TEMPLATEPATH . '/admin-metabox/service_details-metaboxes.php'  // contents for the meta box         ));      I SHOULD ALSO NOTE THAT DIMAS OVER AT WPALECHMEY JUST ADDED SOME NEW CODE INTO HIS 1.3.2 VERSION OF GITHUB WHICH ALLOWS THE ABOVE CODE TO INCLUDE A               'save_filter' => "custom-function",       This code allows you to create a custom function or I guess call a custom function which gets executed upon hitting the publish button so maybe that is the best way to save the data? In any case, I am utilizing the following code for the custom metabox to display the actual dropdown list displaying the taxonomy terms.               <?php      // This function gets called in edit-form-advanced.php     echo '<input type="hidden" name="taxonomy_noncename" id="taxonomy_noncename" value="' . wp_create_nonce( 'taxonomy_theme' ) . '" />';          // Get all theme taxonomy terms     $themes = get_terms('theme', 'hide_empty=0');      ?>          <select name='post_theme' id='post_theme'>     // DISPLAY TERMS AS DROP DOWN OPTIONS     <?php $names = wp_get_object_terms($post->ID, 'theme'); ?>     <option class='theme-option' value='' <?php if (!count($names)) echo "selected";?>>None</option>     <?php foreach ($themes as $theme) {      if (!is_wp_error($names) && !empty($names) && !strcmp($theme->slug, $names[0]->slug))       echo "<option class='theme-option' value='" . $theme->slug . "' selected>" . $theme->name . "</option>\n";       else      echo "<option class='theme-option' value='" . $theme->slug . "'>" . $theme->name . "</option>\n";      }     ?>     </select>      I am assuming saving the data should be simple as pie but I guess I am confusing myself on how to accomplish this. As mentioned I would appreciate if you could also provide suggestions on the code to ensure any necessary checks are done to ensure data is saved correctly and only be the correctly authorized people. Must thanks in advance!


Post & edit a post from front end along with upload, dropdown, and other inputs

I am following this tutorial to post from front end. I am able to post the title, content, category, tags, I would like to know is it possible to add more fields like in the image below. How to increment field-set? and how to add edit the post from the front end itself? basically this what I want to do. ![front end post with advanced fields](http://i.stack.imgur.com/vqY6E.jpg)


I can't set meta_key in my custom post type query

I've created a custom post, `events`, and saved the meta data `event_year` to each event. I'm trying to get a year's event archive. When I go the the following URL, the `meta_key` and `meta_value` are not set for some reason, and thus the event archive is unfiltered.               /?post_type=events&meta_key=event_year&meta_value=2011      Debugging the values:               echo $wp_query->query_vars['post_type']; // 'events'     echo $wp_query->query_vars['meta_key']; // -blank-     echo $wp_query->query_vars['meta_value']; // -blank-      **Why can't I set the meta_key and meta_value?** The meta_values are saved to the events. I've successfully displayed them:               get_post_meta($post->ID, 'event_year', true); // '2011'


using get_the_category to get all post categories except one

foreach((get_the_category()) as $cat) {     if (!($cat->cat_name=='Featured')) echo $cat->cat_name . ' ';     }      this is what has been recommended in the forums but its not working for me. I need to split off the echo piece like the following to show an image.
<img src="<?php bloginfo('template_url'); ?>/images/cats/<?php echo $category->slug ?>-icon.png"/>  <?php  echo $category->cat_name ?>
      any ideas?


Multiple Comment Moderators and Notifications

I am looking for a way to make it so multiple authors/moderators within wordpress get notified when there is a new comment waiting approval. I'm thinking of switching over to Disqus for this type of thing, but was wondering if it's possible without swapping out the commenting interface.


Template files missing after moving site

I just moved a site (by exporting & importing all posts & pages, and copying theme files over), and on the new site the various page and post templates are unavailable for selection on post and page edit screens. The files did have Windows line endings, which I fixed, but that did not eliminate the problem. Any other things to try?


How do I fix the url when clicking on portfolio item?

Right now I'm working on the portfolio section of this website, and I noticed that whenever I click on a work, it adds a # followed by the whole URL of what I want. For example, it goes from               http://ligature23.ufdesigners.com/work/      to               http://ligature23.ufdesigners.com/work/#http://ligature23.ufdesigners.com/work/soft-money/      The only plug-ins I have activated are the ones that came with the theme, and I have my permalinks set to Post Name. Any guesses as to what it could be that's causing this?


Geting error in post and category

Hallo, I have in my blog now add a Plugin [Custom Post Type UI] and have great a Post type movies and taxonomies like genre,actors,directer..... like this all ok now i have great a test post min add Movie and add info now come my big problem it show noting in post just a error > Catchable fatal error: Object of class WP_Error could not be converted to > string in /home/user* **/public_html/ _*_ ** _*_** / _*_ */wp- > content/themes/telegraph/functions/wpzoom-functions.php on line 783 Lines 780-786               } elseif ( is_single() ) {       $cat = get_the_category();        $cat = $cat[0];       echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');       echo $currentBefore;     //      the_title();       echo $currentAfter;      can some on help me by this problem. PS: do i have to add any code to my theme wen i great a Post type or Taxonomies in [Custom Post Type UI]


passing markup thought a shortcode attribute

Happy holidays everyone. Hope someone can help me in thinking about a problem I've run into. I have a plugin Im building that allows the user to pull address data from the maps API - ie it validates an address and if it is a business, pulls the marker icon, address details, web link etc. and builds a shortcode to render the map on the front end. At the moment the shortcode is being built and result previewed via a tinyMCE modal window. Creating the map marker content (marker info bubble) is what is causing me greif. I wanted the user to be able to add or manipulate the content of this block, but the net result is a fair amount of markup. So far I've tried to pass the generated markup though one of the shortcode attributes like so:               [my_gmaps id="map" z="11" w="100%" h="300" scrollwheel="false" maptype="ROADMAP" address="Southampton, United Kingdom" marker="true" markerimage="http://anachronistic.local:9102/wp-content/plugins/_TomRush/inc/js/TinyMCE_additions/modal/../img/icons/music_folk_map.png" infowindow="
Southampton
Southampton, UK
Some User Note
external map" ]      What I've found (probably no surprise to you all) is that the visual editor wreaks havoc on the shortcode, especially the infowindow atribute, adding line breaks and stripping the `<br>` tags for starters. I want the user to be able manipulate the marker content but this isn't a tenable solution. How can I pass this information without the editor mangling it? Is this where I need to learn the transients API or should I consider another approach? Many thanks in advance for your experience.


Ways of dealing with nested arrays within option

I stumbled upon one problem regarding too complicated(at least in my point of view) data structures stored in option field. Right now I have an array of collections and within each other there is another sub-collection (as depicted below). In my opinion it looks too complicated, especially when one wants to store some value inside. More or less it would look like:               $collection = get_option('collection_setting');     $collection[1][elements][0][name] = "ChangedExample";      And this can get much worse when we would like to introduce another array inside of collection. Plus I think it can get quite sloppy if one uses like 100 entries per array. My question is how could this be improved? Storing it into two different option fields - one for collection, second for sub-collections and then somehow trying to connect this within code? Or maybe this is perfectly OK? Of course I assume that creating another table in DB is not the most elegant way.               Array     (       [0] => Array           (             [name] => collection_name             [speed] => 200             [id] => collection_name_1             [max_elements_per_page] => 13             [elements] => Array                 (                     [0] => Array                         (                             [id] => 1                             [url] => http://www.example1.org                             [name] => Example1                         )                          [1] => Array                         (                             [id] => 2                             [url] => http://www.example2.org                             [name] => Example2                         )                          [2] => Array                         (                             [id] => 3                             [url] => http://www.example3.org                             [name] => Example4                         )                      )              )          [1] => Array         (             [name] => collection_name_2             [speed] => 200             [id] => collection_name_2             [max_elements_per_page] => 13             [elements] => Array                 (                     [0] => Array                         (                             [id] => 1                             [url] => http://www.example1.org                             [name] => Example1                         )                          [1] => Array                         (                             [id] => 2                             [url] => http://www.example2.org                             [name] => Example2                         )                          [2] => Array                         (                             [id] => 3                             [url] => http://www.example3.org                             [name] => Example4                         )                      )              )          )      For example when I have setting page on which I want to edit only the first element of collection then with the moment I'm saving it, Wordpress overwrites whole option with only values submitted with form, erasing second element from collection (here $collection[1] is erased). What is the way out? I'm thinking of using validate_options function( which is receiving data from setting page). I could retrieve collection_setting, modify it accordingly and returning modified collection_setting.               register_setting('collection-settings-group', 'collection_setting', 'validate_options');      But I think it's too much work and I'm sure there is some better solution for this.


A-Z Index Taxonomy

Hi to all I just got working the code below to display an alphabetical pagination on index.               //Register the AZ Index shortcode [azindex]     $azindex = '';          add_shortcode('azindex','azindex_get_filter');     function azindex_get_filter($attr){              echo '
';         azindex_get_alphabetical_index();          echo '
';     }          /********************************************************************/     /* ACTIONS                                                          */     /********************************************************************/     add_action('init', 'set_index_var');     function set_index_var()     {         global $azindex;         $tmp = get_query_var('azindex');              if($tmp != "")             $azindex = $tmp;     }          //Add WHERE addition to query      add_filter( 'posts_where' , 'azindex_posts_where',10,2 );          function azindex_posts_where( $where, &$wp_query) {         global $wpdb;         global $azindex;         //global $azindextype;              //var_dump($wpdb);              if(isset($azindex)  )             $where .= " AND {$wpdb->posts}.post_title LIKE '{$azindex}%' ";              return $where;     }     /********************************************************************/     /* FILTERS                                                          */     /********************************************************************/     // Add the query var azindex so WP won't drop it     add_filter( 'query_vars', 'azindex_add_query_vars');          function azindex_add_query_vars($vars){         $vars[] = "azindex";         return $vars;     }     /********************************************************************/     /* MAIN CODE                                                        */     /********************************************************************/     function azindex_get_alphabetical_index(  )     {         $azindex = get_query_var('azindex');              if($azindex == '')             $azindex = -1;              $base_url = get_site_url();              for($i=0;$i<26;$i++)         {             $letter[$i] = chr($i + 65);                  $href = $base_url.'/index.php?azindex='.$letter[$i];             $base_add = '';                  if($azindex == "")  //Not selected -> link                 echo '
'.$letter[$i].'
';             else if($azindex == $letter[$i])                 echo '
'.$letter[$i].'
';             else                 echo '
'.$letter[$i].'
';         }              if($azindex == -1)             echo '
All
';         else             echo '
All
';     }      Than added in my index template:
<a href="<?php echo esc_url( home_url( '/' ) ); ?>">ALL
     <?php echo '
';         azindex_get_alphabetical_index();          echo '
'; ?>      For now its working good but I need to add the numeric pagination too something as 0-9 or a button # wich will display all posts with numeric titles. Anyone wich has more experience please a small help will finish this small job. I tried this function here but didnt work.


Show list of custom posts with respective attachments?

I would like to construct a query to show a list of custom posts ("podcasts") with the urls to their respective attachments. Each custom post_type ("podcast") has 1 attachment (the mp3 file belonging to it's post_parent). I would like an unordered list showing podcast's title, and it's attachment url (guid of the attachment) like this:

Podcast Title - http://..../podcast.mp3
      I achieved this with wp queries:               <?php query_posts('showposts=1&post_type=podcasts'); ?>
     <?php while (have_posts()): the_post(); ?>
<?php the_title(); ?>
     <?php     $args = array( 'post_type' => 'attachment', 'post_parent' => $post->ID );     $attachments = get_posts($args);     if ($attachments) {       foreach ( $attachments as $attachment ) {       echo $attachment->guid;       }     } ?>
     <?php endwhile; ?>
      But I would like to know how I solve with raw SQL query. I've tried so many queries it's made me dizzy - any help would be amazing! _*_ EDIT: Decided to go with John's suggestion of WordPress' queries. Thank you and I trust someone else will also find this useful in future.


Add delete/edit button to each row in an SQL table (Wordpress Backend)

I have a form that is submitting entries to a table in the backend of my Wordpress installation. I would like to add edit/delete buttons to each row so that an administrator can delete submissions or edit them directly through the backend tool. So far I have the submissions submitting and displaying correctly in the backend but I am not sure how to achieve the edit/delete functionality. Here is what I have so far:               add_action( 'admin_menu', 'form_menu' );          function form_menu() {       add_menu_page( 'Form Submits', 'Form Submits', 'manage_options', 'form-submissions', 'form_options', 'dashicons-list-view', '24' );     }          function form_options() {       if ( !current_user_can( 'manage_options' ) )  {         wp_die( __( 'You do not have sufficient permissions to access this page.' ) );       }            global $wpdb;             $submission = $wpdb->get_results( "SELECT * FROM form_submissions");            echo "
";       echo "
               First Name	               Last Name	                E-mail	               Address
";       foreach($submission as $row) {         echo "
";         echo "".$row->first_name."	";         echo "".$row->last_name."	";         echo "email.">".$row->email."	";         echo "".$row->address."	";         echo "
";       }       echo "
";     }      Can someone point me in the right direction? Thanks!


Hard Code Pages into a Theme for a Network (multisite) Installation

I'm creating a multisite network and I am looking for a way to have it so new blogs that are created have a couple of standard pages set up automatically. The purpose of these pages will be to display universal membership options and other info that I want each site to display. So, for example, I want each new site to have a "Join" page and an "About this Network" page, and I don't want to have to manually set up the pages and their custom templates. I'm using Twentyeleven as my child theme base and customizing a specific theme to be used by each of the newly created sub blogs users. I guess a part of this question is: is it possible to hardcode pages into a Wordpress theme? Thanks very much. JW


Insert content into <title> head tag with function

Is there a hook available that lets you append or prepend text to the `<title>` tag in the head? I've seen lots of posts about customizing the `<title>` tag, but they all involve manually adding a function inside the `<title>` tag. I'm looking to modify it with a hook if possible so it can be easily turned on/off in a functions.php file.


xmlrpc how to check for errors

I am trying to post to wordpress with XMLRPC using this tutorial:http://wp.tutsplus.com/tutorials/creative-coding/xml-rpc-in- wordpress/ the problem is that tutorial does not have any kind of check for errors while post and I am wondering how to check if the post was posted without any problem based on that tutorial. Maybe someone could help. Thank you.


Restrict query to last day with posts

I am using the Delicacy theme. I want to show n my homepage the posts of the current day.   But if there are no post for that day it shows _"No found"_. I want to show posts from the last day with posts instead. How can I do that? I am using this query:               $current_year = date('Y');     $current_month = date('m');     $current_day=date('d');          query_posts(          "cat=5&year=$current_year&monthnum=$current_month&day=$current_day&order=ASC"      );


Upload video in custom folder

I am trying to find a system to upload some kind of media in a custom folder. I want to keep all uploads in default wordpress folder and create a custom folder just for videos. So i would have the following folder structure:               - wp-content       - uploads         - year         - month       - videos         - category-one         - category two      In addition i would like that the files stored in this new folder should be listed in media library.


The work of Wordpress Function update_post

I use wp_update_post() in a Frontend Page. The first part of the function works as expected. post_content and/or post_title will be changed in wp_posts. But the function does not create a revision copy from the old table item as described in the WP Function Reference. Here is my code               $upd_post = array();     $upd_post['ID'] = $post->ID;     $upd_post['post_title'] = $wp_query->query_vars['4tn_title'];     $upd_post['post_content'] = $wp_query->query_vars['4tn_content'];     $update_result = wp_update_post( $upd_post );      Perhaps it doesn't work because the post_type is a cutom-type 'portfolio' instead 'post'. If this is the reason what is to do for getting a 'revisioncopy' for portfolio-items


Create a live demo gallery for themes

I want to create a live demo site like http://www.elegantthemes.com/gallery/ that show themes so when I click on the theme screenshot it takes me to the live theme preview. I tried two plugins themebrowser and wordpress-theme-showcase they are showing the themes in a list and I can click the theme to view, but when I'm trying to go to any page inside the preview theme it takes me to the original theme that already installed, so also I want to be able to browse the demo theme pages and posts like if it is activated. Thanks Edit: From the source code of wordpress-theme-showcase plugin the Theme Preview URI: php?preview_theme=WordPress%20Default and that's ok for he home page of the new theme, but if I want to go to some page it redirects me to the home page of the installed theme. So I tried to add &p=1 (post url) to the end of the Theme Preview URI above and it works. The question now is how I can append this url to all the links in the preview page


javaScript in <head> section of WP API

How do I place the following javaScript in the `<head>` section of the Wordpress _Widgets_ API menu screen?               <script type="text/javascript">         jQuery(window).load(function() {             jQuery("#logocheckbox").change(function() {                 jQuery("#logocheckboxdiv").fadeToggle("slow");             });         });     </script>


Display the Content of a Post with qTip2

How would/should I use qTip2 to display the `the_content();` of a WordPress post? I've been trying to accomplish this for a month now. I got it working once, but it wouldn't display the content that was placed after a `<br>`. I no longer have the code, unfortunately. I found the code, which worked before, but sadly, couldn't handle line breaks, `<br>`: http://jsfiddle.net/jv8WN/7/


use Wordpress theme / plugin editor in my plugin

Is there a way to use the wordpress theme / plugin editor inside my plugin to give the user the ability to edit the css file of my plugin ? Im building a plugin that gives the user an option to add some CSS. First i was going to use just a textarea but then i thought it would be pretty could if i can use the Wordpress editor that will open my style.css file. I could put just a link to http://www.xxxxxx.com/wp-admin/plugin-editor.php but it would be great if i can integrate it into my plugin. Regards


Repeatable WordPress custom fields in a metabox

I would like to create a meta box where the user can add or remove a simple input field that holds an image url on posts.


Customizing the 3.5 "Add Media" popup (Backbone.js)

Here's yet another question in regard to the new(ish) 3.5 "Add Media" popup and how to customize it! **What I'm trying to do** I'm attempting to do four main things: 1) Create a custom tab titled "Flickr Uploads"; 2) Customize the text that is displayed in the upload `button`; 3) Populate the `select` dropdown with external `API` sorting options (in other words `unset` the default options and `set` my own... only for the custom tab); 4) change the photos that are displayed to ones from an external `API` and still be able to add tags, descriptions, etc... in the right-side-bar. **What I've managed to do** With the use of the gist by @Fabien Quatravaux I have completed steps `1) and 2)` in the list above ... but, I'm having some trouble figuring this stuff out. This is what is being displayed: ![Good start but not done!](http://i.stack.imgur.com/RCp4S.png) **Where I need help to finish** As you can see I still need to figure out how to customize the `select` dropdown options, display the `meta-data` inputs in the right-side-bar, as well as make the images select the right way and get the button to interact the same as on the "Insert Media" tab. I have barely messed with `jQuery` let-alone `Backbone` ... so, needless to say I am quite lost in what to do. I don't know where to start. Thank you for any help!


$current_screen if condition for a specific page in admin

Right now I have this code to add some changes in my WYSIWYG editor in admin:               add_filter( 'default_content', 'custom_editor_content' );     function custom_editor_content( $content ) {              global $current_screen;              if ( $current_screen->post_type == 'page') {            $content = '                 // TEMPLATE FOR MY PAGE                 ';         }              return $content;     }      But it's for all pages. I want it only for a page with id = 28. How to do that? I guess I need to change my if condition to something like:               if ( $current_screen->post_type == 'page' && ??? post_id == '28' ??? )      However, I need to figure out the code between the question marks.


How to show 3 most recent/viewed posts in a special tiles on home page using wordpress?

I have these tile elements on the top of my homepage:

Just Some Title

2013/2/25

Title 1

2013/5/15

Title 2

2013/6/17

Title 3

Another Title

       and I want to show 3 most recent/viewed posts in tile 2, 3 and 4; just the title, date and an image of that post that it gets the url from custom fields that I defined, I tried using :               .     .     .         <?php query_posts("post_per_page=3"); the_post(); ?>
                 <img class="post-image" src="<?php echo get_post_meta($post->ID, 'post_image', true) ?>"/>
                     <img src="<?php echo get_post_meta($post->ID, 'post_icon', true) ?>" >
<?php the_time('F jS, Y') ?>

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

                 <img class="post-image" src="<?php echo get_post_meta($post->ID, 'post_image', true) ?>"/>
                     <img src="<?php echo get_post_meta($post->ID, 'post_icon', true) ?>" >
<?php the_time('F jS, Y') ?>

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

                 <img class="post-image" src="<?php echo get_post_meta($post->ID, 'post_image', true) ?>"/>
                     <img src="<?php echo get_post_meta($post->ID, 'post_icon', true) ?>" >
<?php the_time('F jS, Y') ?>

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

     <?php wp_reset_query(); ?>      .     .     .      Actually these are just some place to show 3 most recent/viewed post with an image, I mean there will be a list of recent posts beneath them with an excerpt (just for the record). the problem is that it just gets one post and shows it there, what's wrong? what did I missed? please help, I'm new in the world of wordpress!


Server Path Information

I have a plugin that uses server paths to define the location of an Image Folder, however, I have decided to have a CDM or a new separate server to host my images. Currently all the paths look like this: `$upload_dir = '/home/www/original_domain.com/media/downloads/encrypted';` I have tried to search the web for answers but I do not know that search queries to type in to get the answers. The new server has a different domain and I have tried doing this: `$upload_dir = 'http://new_domain.com/media/downloads/encrypted';` But that does not work, is there a way to define the folder location? I believe this script can only read server paths.


Change language by clicking a button

The goal is to offer a button/select drop-down or similar to switch the _public interface 1)_ language on the fly. What I'm searching for   * Plugin _or_ Theme Code...   * ... _or_ Ideas   * Using a work-around with `load_textdomain()` would be appreciated to leave translation to .po/.mo files   * Ideas on how to parse the strings into the interface (ex. ajax/plain php/ini, json, xml files) when not relying on some textdomain function * * * Note: **1)** It's not about publishing in different languages. **2)** I don't need code to make the actual drop-down/button/whatever. It's only about the code/system delivering the strings for the UI. Thanks!


get_the_post_thumbnail ignores my default thumbnail size

My default thumbnail size is 150x150. Therefore, if I use a custom thumbnail size, such as 75x75 it should use the thumbnail of 150x150 and shrink to fit to my size:               get_the_post_thumbnail( $item->ID, array(75,75))      However, it is basing the image off of a thumbnail size of 149x100. The 150x150 image exists, but it refuses to use it. I figured heck with that, I'll just create a custom 75x75 thumbnail and that will solve the problem:               functions.php     add_image_size( 'listp-thumb', 75, 75, true ); // thumbnails located in list posts      Now to call the new thumbnail:               get_the_post_thumbnail( $item->ID, 'listp-thumb')      The same thing happens. :( Do I need to clear a custom query that may be interfering with this?


Migrate DB Plugin: Error "The directory needs to be writable"

I'm using the migrate db plugin to do some find and replaces to the database after it's been exported. It continues to pester me with the directory isn't writeable error. I've went and chmod'd the whole /wp-content folder with the following command: `chmod -R 777` which i know you're not suppoose to do; but it's driving me nuts. it still has the same silly error. Does anyone know which folder it's asking to give the correct permissions?


Do you know a video plugin that allows embedding in the home.php file?

I've been looking for a video plugin in the plugin depository but couldn't find one that I'm looking for. Basically, I want visitors to be able to play the video in the home page but the issue here is that the home page is displaying post excerpts. So if I would just post the video as normal, it would be cut in the home page. So I think I would need to hard code the video code of the plugin inside the loop in the home template file, like where $video is the the video file in the post. Does anybody know a video plugin like this? Or is there a work around here, like how to show video in the home page having post excepts. Thanks.


Using global $post; with custom post types

I'm working on creating a notification that will indicate when a post is less than a few days old. This is specifically for a custom post type called "news". Is there a way to use `global $post;` with custom post types? This is my original code.               <?php global $post;         $postdate = str_replace("-", " ",substr($post->post_date, 0,10));         $postd = explode(" ", $postdate);         $ageunix = get_the_time('U');         $days_old_in_seconds = ((time() - $ageunix));         $days_old = (($days_old_in_seconds/86400));         if ($days_old < 3) { ?>         <script type="text/javascript">             jQuery(document).ready(function($){                 $("#notification").addClass("notification-highlight");              });         </script>     <?php } ?>      I tried               <?php      $post_type = get_post_type();     if (($days_old < 3) && ($post_type == "news")) { ?>         <script type="text/javascript">             jQuery(document).ready(function($){                 $("#notification").addClass("notification-highlight");              });         </script>     <?php } ?>


Removing Image and Caption Dimension Attributes

This question is an offshoot from the this discussion on removing dimension attributes from images. The solution code provided on that thread works very well except that it has the unfortunate side effect that any `[caption]` shortcodes are striped from the image. After several hours of digging through the core code, I found the cause of this. The wpeditimage TinyMCE plugin that's responsible for adding the `[caption]` shortcode checks for width attributes in the shortcode and the `img` tag. If it doesn't find them, it simply remove the caption. Since, this is done 'on the fly' with javascript in the TinyMCE editor, I can't think of any type of WordPress filter that would address this issue. I would be very happy to be proven wrong however. :) As a final note, my temporary solution has been to use the following jQuery to strip all of the offending tags client side. This, in conjunction with a filter on `img_caption_shortcode` to prevent a width style from being used there, seems to do the job. It's not pretty, but it's a band-aid for now. Anyone have a better idea?               // Strip width and height attributes from img, video, and object in the main article so we can have fluid images     var $fluid_items = $('.main-article-wrapper').find('img,video,object');     $fluid_items.removeAttr('width');     $fluid_items.removeAttr('height');


How can I increase the post count for custom post types only?

I have the page count set to the default 10 in my reading settings menu. ![screenshot-with- shadow.jpg](http://img257.imageshack.us/img257/5788/screenshotwithshadow.jpg) However, I use my template `archive.php` file for all post types, including `posts` and `books` How can I change the loop so that when searching `books` it will show 30 books in the archive page instead of showing the default 10?


wp_list_categories, Add class to all list items with children

I'm using `wp_list_categories();` to show a list of all the terms within a custom taxonomy but I need to style list items that have children differently to those that don't. Is there a way, PHP or jQuery, that I can give all parent elements a special class?


Serving Cookies From A Different Domain or Sub-Domain

The WordPress Codex clearly states that if your website is served from `example.com`, for the sake of performance, you can have the cookies served from `www.example.com` by adding this to your wp-config.php:               define('COOKIE_DOMAIN', 'www.example.com');      **Problem:**   * The cookies are still being served from `example.com` and not `www.example.com`. What's wrong? or does this no longer work? _**PS:** Edited to be precise._


Error establishing a database connection when migrating site to localhost

I'm wanting to make a version of my blog on my home computer that I can work on offline. I set up LAMP on my computer (running Ubuntu) and copied all of my files from my server (000 Webhost) with FileZilla. But when I try to access my site on my localhost, I get "Error establishing a database connection." I think I've figured out that it has something to do with MySQL, but I'm really new to all this and could be way off. Any help would be greatly appreciated. Thanks in advance.


Geolocate Custom Post Type on Save

I was wondering what hook i would use to geo-locate a custom post type when it is saved? I have a Custom post type of Restaurant and I want to geolocate the address using googles api and then save it into another field(s)