Help alphabetically sorting $terms from get terms('wpsc_product_category'

I'm trying to get a list of wpsc_product_category terms, for a given category, and have them display in alphabetical order (by name) with links to their pages. This gives me the right list, but the sort() doesn't work. The terms aren't in alphabetical order. Any help would be greatly appreciated!               <?php      //display sorted list of wpsc product categories     $category_id = 10;     $terms = get_terms('wpsc_product_category','hide_empty=0&parent='.$category_id);     sort($terms);     if ($terms) {         foreach($terms as $term) {             ?>

                         <a href="<?php get_term_link( $term->slug, 'wpsc_product_category'); ?>" class="wpsc_category_link"><?php echo $term->name; ?>                         <?php if(get_option('wpsc_category_description')) :?>                         <?php echo '
'.$term->description.'
'; ?>                         <?php endif;?>

             <?php         }     }     ?>


Custom Search Result Page displaying only 1 result.

I'm trying to build a custom search results page. The problem I'm running into is that when I enter a search term ; say 'gaming', it will only return one result, being the latest result. I have my blog setup to display only one article at a time. However, I found a way to circumvent the search results page by logging into wp-admin -> settings -> reading -> and changing the blog page displays one post to say for example 10. Then when I try searching for gaming it returns more than one result (it'll give me 10). However, I don't want this. I want my sites blog page to only show one article, and the results page to display more than one result. How can I go about fixing this? This is what my `search.php` looks like. I created a `searchpage.php` and am including it using PHP to grab the `search.php` Thanks! :)

 Search Results

         <?php         /* Search Count */         $allsearch = &new WP_Query("s=$s&showposts=-1");          $key = wp_specialchars($s, 1);         $count = $allsearch->post_count;          _e('');         _e('"');         echo $key;         _e('"');          _e(' — found ');         echo $count . ' ';          _e('articles');         wp_reset_query(); ?>
               <?php if (have_posts()) : ?>     <?php while (have_posts()) : the_post(); ?>

             <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to              <?php the_title_attribute(); ?>"><?php the_title(); ?> -              <?php the_time('F, j, Y') ?>

               <?php endwhile; else: ?>
     <?php _e("Oops... We couldn't find what you were searching for. Please try again"); ?>
               <?php endif; ?>


WordPress.com-registered domains

I got the client who paid for WordPress hosting with wordpress.com. They also purchase domain with wordpress.com but we did completely new WordPress installation on another server and would like to now re-point that domain to another IP address is that possible? I have a option inside that WordPress installation to Edit DNS Record but when i try to put my IP address like they suggest: A 1.2.3.4 its coming up with an error: We can't save these records because they don't look right to us. Check the errors below. Please contact support if you are unable to resolve the problem. Can any one help or advice. Many thanks,


Designing a custom post type with a minimum number of meta fields

I am new to PHP, mySQL and scripting in general. I'm trying to design a WP custom post type which would be like a point on a timeline or an item on a resume. I'm having trouble designing the structure of the data in a nice, neat way. Each post or 'item' can be either dated or undated. If it's dated, it can either be an event, in which case it has one date attribute, or it can be a time span, in which case it has a start and end date. If it occurs over a span, that span may be 'ongoing', that it will end in the future and then the editor will come back and update the record to reflect that end date (e.g. the most recent position on a resume can be from a start date until the 'present'). The post can have content and other meta-information like a custom taxonomy, but I'm really concerned with boiling down these subcategories to the fewest number of meta fields in the WP postmeta table. The subcategories as I understand them are   * Undated Events (!Start !End !Present)    * Dated Events (Start !End !Present)    * Ongoing Time Span (Start !End Present)    * Completed Time Spans (Start End !Present) Is this the best way to model these events/span/CV items? Thanks!


check if a file in a plugin folder exists from a locale installation

I need to check if a file exist in my plugin dir:               if (fileexists) {     ...     }     else     {     ...     }      However, if in place of fileexists I use `file_exists(WP_PLUGIN_DIR . "/myplugin/myfile.ext")` it returns always true, whereas if I use `file_exists(plugins_url( "myfile.ext", __FILE__ ))` it returns always false, irrespective of the argument I use is a file that exists or not. I do not know if it is relevant to specify that I'm working in a locale environment. WP_PLUGIN_DIR returns `C:\Users\MyName\Documents\webserver\www\wordpress/wp- content/plugins/myplugin/myfile.ext` (and I see some slashes and some backslashes).


How to show content of metaboxes in preview mode

I have custom template that I apply to pages. This template has number of metaboxes where user can add values. This works fine when post is published, I cannot figure out however the way on how to make content of these metaboxes to show in preview when I click "Preview" button from page editing view in wordpress admin. If someone could point me to right direction that would be much appreciated


Embed YouTube, login to buy & payment methods

As you can probably tell, I'm new to WooCommerce and WordPress in general. Before I start building a site and buying plugins and extension I would like to know:   * Can you easily embed YouTube videos onto product pages with WooCommerce?   * Does the customer have to log in or create an account to buy an item through WooCommerce?   * Can a customer pay via credit or debit card through PayPal and not have a paypal account when using WooCommerce?


Unable to create directory

i have been noticing of late, after i upload my sites to a different server, i seem to have some sort of upload problem   1. once i have copied and moved site using ftp to a new host i then can not upload new plugins through wp-admin because i get (Could not create directory.),    2. i cant upload media on posts or pages because i get (Unable to create directory wp-content/uploads/2014/08. Is its parent directory writable by the server?)   3. and i also noticed that at the bottom of wp-admin/theme-editor.php there is a message that says "You need to make this file writable before you can save your changes. See the Codex for more information."  and i dont have this message on the version of the site on my development hosting server and i dont get any of these error messages either, which is odd because i just copied the sites as is from one server and moved them to another, and used the searchand replace script to change paths. this has happened to me recently with 3 different sites using 3 different hosts, and whats odd in all cases the folder permissions on the uploads and wp content folders are set to 755 Please help? what am i missing and how do i fix this problem. thanks


get_post_meta is always empty when I use wp_mail

I made this action hook which will send an email to the users every time a new post in the custom post type "events" is made.               function email_members($post_id) {     global $wpdb;          $usersarray = $wpdb->get_col("SELECT user_email FROM wp_users");     $users = implode(",", $usersarray);          if( ( $_POST['post_status'] == 'publish' ) && ( $_POST['original_post_status'] != 'publish' ) ) {         $subject = 'Event Reminder';              $post_url = get_permalink($post_id);         $post_title = get_the_title($post_id);         $event_date = get_post_meta( $post_id, 'ch_event_date', true );              $message = "APAC Ministries Event Reminder for: ".$post_title."\n\n";         $message .= "Date: ".$event_date;              wp_mail($users, $subject, $message );       }     }          add_action('publish_th_events', 'email_members');      However, the `$event_date` is always empty. I tried running this code in a different file and it works:               global $post;     $test = get_post_meta($post->ID, 'ch_event_date', true);     echo $test;      I can't seem to use get_post_meta in wp_mail. Any alternative solutions are welcome. Thanks!


Inserting another menu from inside an existing menu

I ran into the dreaded php input limit but for some reason my host doesn't respect the php.ini or other settings. My only alternative is adding another custom menu from within a menu. Don't ask why I have this much menus. I'm a dev, not the designer. And revising the contents is out of the question.               ---CURRENT MENU----     HOME     PRODUCTS      |->Listings of over 80 items     SERVICES      |->Listings of over 30 services     LOCATIONS      |->Listings of over 10 items     ABOUT US     CONTACT US     -------------------      This setup has choked the menu and caused subsequent menus to display nothing. Now here's how I want it to turn out.               ---ENVISIONED MENU---     HOME     PRODUCTS      |-> [initialized menu, has its own display options]     SERVICES      |-> [initialized menu, has its own display options]     LOCATIONS      |-> [initialized menu, has its own display options]     ABOUT US     CONTACT US      The initialized menu is the same thing as you would define in functions.php In the envisioned setup, I can define what goes in PRODUCTS in its own menu options page, and the same would be true for the others. NOTE: I want to define my own entries in these initialized menus, no page childs, structured categories or whichever. Before I try to type out my own codes, is there any code that does pretty much this thing?


Reset Wordpress website

I have a website to demo plugins, and I want to allow users to login, but I am not sure how to reset the website once they log out. Is there a way to create a separate instance of Wordpress for each new user and then delete itself once that user logs out? Or is there a way to reset a Wordpress site once a day (not reset database and completely reset site), but keep the plugin activated and setup?


How do you return a menu with the menu name?

in functions.php, I've defined the following:               register_nav_menu( 'home_blocks', __( 'Home Page Posts', 'my_Theme' ) );      In `/wp-admin/nav-menus.php`, I've added a menu called Home Page Posts and assigned 3 posts to it and set it to be the item associated with Home Page Posts as the menu location. In `index.php`, I've added the following:               if ( has_nav_menu( 'primary' ) ) {         echo 'has primary
';     } else {         echo 'no primary
';     }     if ( has_nav_menu( 'home_blocks' ) ) {         echo 'has home blocks
';     } else {         echo 'no home_blocks
';     }      Both of the successful conditions are echoed. When I try to return the menu contents so I can run some inline custom output based on post_id, I attempted the following code and got NULL or string(0) "", depending on what values I put for the location and menu name. What way are these values associated and how would I get the menu back?               $defaults = array(         'theme_location'  => 'home_blocks',         'menu'            => '',         'container'       => '',         'container_class' => '',         'container_id'    => '',         'menu_class'      => '',         'menu_id'         => '',         'echo'            => 1,         'fallback_cb'     => '',         'before'          => '',         'after'           => '',         'link_before'     => '',         'link_after'      => '',         'items_wrap'      => '',         'depth'           => 0,         'walker'          => ''     );          $menu = wp_nav_menu( $defaults );          var_dump( $menu );


I would like to import two columns into Wordpress

Very easy- I would like to import two columns, `list-id` and `slider` in a CSV into my Wordpress database. `list-id` must match with Wordpress post. That's it I have used many Wordpress plugins, but they are slow. TurboCSV seems the best. How can this be done in phpMyAdmin?


Plugin for changing a post's category based on it's post date?

Is there a plugin for Wordpress that will change a post's category based on how long that post has existed? I have seen other Wordpress plugins that use a library called "simple pie" to manage a wp-blog's timed tasks, is there one that does something like this?


How to make orderby 'meta_value_num' OPTIONAL?

$args = array(               'cat' => 5,               'posts_per_page' => 8,               'meta_key' => 'custom_sort_order',               'order' => 'ASC',               'orderby' => 'meta_value_num'             );          $custom_query = new WP_Query( $args );      With the code above I can sort my posts with my custom field's value order, ascending. But if I forgot to assign the Custom Field key and value with the post, the query doesn't find the whole post because of the `custom_sort_order` meta_key -- because it doesn't exist with that certain post. But I need to put the `'meta_key' => 'custom_sort_order'` there because the Codex says: > `'meta_value_num'` - Order by numeric meta value (available with Version > 2.8). Also note that a `'meta_key=keyname'` **must** also be present in the > query. Is there a way, I can by-pass it, and set a default sort order with the query but can manipulate them with my `custom_sort_order` meta_key with ascending numbers? So that, even if I forget to mention the `custom_sort_order` post_meta, the post will be queried as normal. ## EDIT After @heathenJesus's answer and @engelen's comment, it seems we are dealing the topic in a hard way. Can we think about a filter, by which we can modify a custom WP_Query() with our custom custom_sort_order meta_key? Suppose our WP_Query arguments were:                $args = array(               'cat' => 5,               'posts_per_page' => 8,               'meta_key' => 'other_post_meta',               'meta_value' => 'yes',               'order' => 'ASC'             );          $custom_query = new WP_Query( $args );      We excluded the `'orderby' => 'meta_value_num'` and filtered our query with other meta_key and respective value. But `custom_sort_order` meta_key is not there. We're gonna implement some sort of filter and externally modify the order using our custom value `custom_sort_order`. Can we think like that way? Actually can we question: "How the Post Type Re-Order plugin did it that way?"


How to change the link of the wordpress logo in the admin bar?

I have found solutions to change the logo itself and to remove that "about.php" link in the dropdown, but this does not affect the "about.php" link in the wordpress logo. How can I change this?


Multisite Registration Redirect

I've got a multisite using sub-directories with s2member, and i'm trying to find out how to redirect all registrations onto a single site. Currently, clicking on registration takes you to the login/register page for that particular blog. I have one site with buddypress, and i would like to redirect all users to that site when registering, to encourage users to create a profile etc. The other option would be to re-direct users to the buddypress site after registration to complete their profile. Is there a function i can add? The domain is hatcherycentral.com Many thanks


Filter user who used to login to my wordpress site

I want to display one more column into the "All User" panel to show "X" if the user used to login to my website at least 1 time. And then add the ability to sort the user list, which user used to login are on the top list. Sorry for my poor English.


Custom Filter using meta_value in wordpress admin list not working

Hello I was trying to filter the pages using a custom filter in admin post listing of wordpress, but after selecting in the dropdown it returns nothing like its just showing all the posts and the dropdown text returns to its default text "Show all Templates". Please help, I just cant figure it out why its not really working. after I click the Filter button, the url is:               wp-admin/edit.php?s&post_status=all&post_type=page&action=-1&m=0&template=default&paged=1&action2=-1      heres the screenshot: ![page-template](http://i.stack.imgur.com/NIGBP.png) heres my code:               function pagetemplates_request_admin($request) {     if( isset($_GET['_wp_page_template']) && !empty($_GET['_wp_page_template']) ) {         $request['meta_key'] = '_wp_page_template';         $request['meta_value'] = $_GET['template'];     }     return $request;}      ..               function pagetemplates_restrict_manage_posts() {     global $wpdb;     $optemplate ='';     $templates = $wpdb->get_col("         SELECT DISTINCT meta_value         FROM ". $wpdb->postmeta ."         WHERE meta_key = '_wp_page_template'         ORDER BY meta_value     ");     ?>      <select name="template" id="template">          <option value="">Show all Templates</option>          <?php foreach ($templates as $template) { ?>          <option value="<?php echo esc_attr( $template ); ?>" <?php if(isset($_GET['_wp_page_template']) && !empty($_GET['_wp_page_template']) ) selected($_GET['_wp_page_template'], $template); ?>>                  <?php                  $optemplate = esc_attr($template);                  switch ($optemplate)                     {                         case 'template1.php';                             echo 'Blog Page Template 1';                             break;                         case 'template2.php';                             echo 'Blog Page Template 2';                             break;                         default:                             echo 'Default Template';                             break;                     }              ?>          </option>          <?php } ?>      </select>            <?php}      ...               if( is_admin() && isset($_GET['post_type']) && $_GET['post_type'] == 'page' ) {     add_filter('request', 'pagetemplates_request_admin');     add_filter('restrict_manage_posts', 'pagetemplates_restrict_manage_posts');}


Enable TinyMCE Rich Text editor for excerpt

I need my excerpt to have tinymce activated. I have tried the plugins (TinyMCE Excerpt) etc. but that one is outdated and showed only a rudimentary TinyMCE from the one in main edit window. I need the same editor options for the excerpt as I have for main editor. And then I found this piece of code and put it in my functions.php http://notes.pandaweb.de/wordpress/tinymce-editor-fuer-excerpt/ It worked fine until I updated the site to WP 3.9 ( I know the rich text editor has changed in the new version). So what can I do to make this work again? Thank you so much! Anja


how to redirect to a custom post template

I'm building a website in which there is a page where I collect a list of works/projects; I created a file called `work.php` where I made the template of this page, but when I try to view a single custom post (when I press on a single item), it says that the page doesn't exist. Then, my question is: do I have to create a custom template like `work- post.php` for the custom post or do I have to use `single.php`? P.S. I'm using a custom post called `work` type I made.


Wordpress JSON API plugin return multiple categories' post

I am currently using the JSON API to get the data from wordpress http://wordpress.org/plugins/json-api/other_notes/ The plugin helps to retrieve the wordpress post data in JSON format I notice that I can get the post within some category http://www.test.com/?json=get_category_posts&id=9 but what if I would like to search in some cat? eg. id = 9 , id = 10? are there anyway to implement search within serveal category? Thanks


Adding Media Upload to Custom Options Panel breaks "Insert into Post"

I've created a custom site options page as a top-level admin page in my theme. The options are pretty basic but include a couple of images. I initially found a lot of examples for using Media Uploader to upload or select an image on the options page. It was easy enough to implement and worked like a charm but had severely undesirable results. Even though I could invoke the media uploader modal and add images back into my custom options page, "Insert into Post" broke on every other facet of WP. All posts, custom posts and pages could no longer have any string returned from Media Uploader when I clicked "Insert into Post". I think this has to be related to the `window.send_to_editor` function, here's the javascript I used to call Media Uploader (I found it on many websites):               jQuery(document).ready(function($) {          $('#upload_header_img_button').click(function() {         formfield = $('#header_image');         tb_show('', 'media-upload.php?type=image&TB_iframe=true');         return false;     });          $('#upload_branding_img_button').click(function() {         formfield = $('#branding_image');         tb_show('', 'media-upload.php?type=image&TB_iframe=true');         return false;     });          window.send_to_editor = function(html) {         imgurl = $(html).attr('href');         $(formfield).val(imgurl);         tb_remove();         var img_preview = $(formfield).parent().find('img');         console.log(img_preview);         img_preview.attr('src',imgurl);     }     });      After a lot of digging (read: comment searching) I found this function a fellow reader had provided as a possible fix: https://dpaste.de/T8ji and added it after my `window.send_to_editor` function. It worked, as in all my posts and pages had regained "Insert into Post" functionality, but now the Media Uploader is broken on my custom options page. Has anyone run into this?


Remove posts from two categories in Archive Page

From Archive Page I want to remove posts from couple of categories, as they have different style formats which will not look good with other category style formats.


Show all posts using the template page and the loop?

I am trying to make a template page that would display all posts from all categories, in short - every post added to my website. I was googling around and found out that it can be done by using The Loop. The examples were mainly based on Twenty Eleven which is pretty straight-forward. Unfortunately I am using a complex theme and my understanding of PHP is very little... This the website I am developing: http://www.pomorzekultury.pl/ and this is the template page I would like to "adjust" to display everything: http://pastebin.com/5a8fZ3u6 . I hope some of you will make something of this, because as I said eariler I fail understand what is going on here...;) Edit: The whole code of this PHP file I would like to work on:               <?php /* Blog Style B */                  $i = 1;                  if (have_posts()) : while (have_posts()) : the_post();                  $format = get_post_format();             $cb_meta_onoff = ot_get_option('cb_meta_onoff', 'on');                  $category_data = NULL;                  foreach( ( get_the_category() ) as $category )  {                             $category_name = $category->cat_name;                             $category_url = get_category_link($category);                             $category_data .= ''.$category_name.'';                             }             $cat_com_url = get_comments_link();                  $cb_custom_fields = get_post_custom();             if (isset($cb_custom_fields['cb_review_checkbox'][0])) { $cb_review_checkbox = 'on'; } else { $cb_review_checkbox = 'off'; }             if ($cb_review_checkbox == 'on') { $format = 'review'; }             $j = $i / 3;     ?>                                                     <article id="post-<?php the_ID(); ?>" class="cb-blog-style-b <?php  if (is_int($j)) {echo 'right-half '; } ?>clearfix<?php if (is_sticky()) echo ' sticky'; ?>" role="article">
                     <?php cb_review_thumbnail($post); ?>                                         <a href="<?php the_permalink(); ?>">                     <?php                     if ( has_post_thumbnail() ) {                           the_post_thumbnail('cb-thumb-350-crop');                       } else {                           echo '';                     }                     ?>                    <?php if (false !== $format) {echo ''; } ?>
                  <?php echo $category_data; ?>                  <?php if (get_comments_number() > 0) { ?>                     <a href="<?php echo $cat_com_url; ?>">
<?php echo get_comments_number(); ?>
                                          <?php } ?>
                     <a href="<?php the_permalink(); ?>">                       <?php the_title(); ?>
                   <?php  if ($cb_meta_onoff == 'on') { ?>
<?php printf(__('z dnia <time class="updated" datetime="%2$s" pubdate>%3$s</time>', 'cubell'), cb_get_the_author_posts_link(), get_the_time('Y-m-j'), get_the_time(get_option('date_format')) );  ?>
<?php } ?>
                 <?php echo cb_clean_excerpt(150, true); ?>

           <?php         $i++;             endwhile;       ?>

         <?php           cb_page_navi();                             endif;     ?>      EDIT No.2: Maybe listing using archives template would be easier? The archive template loads a view template and the code goes like this:               <?php get_header();      $cb_sidebar_position = ot_get_option('cb_sidebar_position', 'cb_sidebar_right');       ?>
              <div id="main" class="<?php if ($cb_sidebar_position == 'cb_sidebar_left'){echo 'left-sidebar';} ?>  clearfix" role="main">                  <?php if (is_day()) { ?>
                     <?php _e("Daily Archives:", "cubell"); ?> <?php the_time('l, F j, Y'); ?>
                  <?php } elseif (is_month()) { ?>
                     <?php _e("Monthly Archives:", "cubell"); ?> <?php the_time('F Y'); ?>
                  <?php } elseif (is_year()) { ?>
                     <?php _e("Yearly Archives:", "cubell"); ?> <?php the_time('Y'); ?>
             <?php } ?>                  <?php if (have_posts()) {                                       get_template_part('cat', 'style-b');                  } ?>
               <?php get_sidebar(); ?>
           <?php get_footer(); ?>      so `get_template_part('cat', 'style-b');` is taking care of layout but function/reference to all posts needs to be added... Any ideas? :)


How do I add a Wordpress role that can only see scheduled and pending posts?

I run a WordPress installation. I'd like to let other people log in to view (and possibly edit), the scheduled and pending posts to check them over for spellings and the like, but not be able to view the draft posts (because they are very definitely a mess). Google is unfortunately not helping. What's my best method for achieving this? A plugin, making all my drafts part of a particular private setting? EDIT - I'll happily let them edit published posts as well, just not drafts...


Is there os native application for wordpress?

Is there os native application that makes possible to write and edit wordpress on a server? I'm thinking about something like a `Evernote`.


Post 2 Post Site Search

I'm trying to filter search terms bases on categorisation created by posts 2 posts. I'm using the generic site search and then I've created a search filter               function my_filter_the_search($query){              $site_category = filter_input(INPUT_GET, 'site_category', FILTER_SANITIZE_STRING);                  $args = array(                 'connected_type'        => 'sitecat_to_product',                 'connected_items'       => $query             );                  $query->set( 'query', $args );                       return $query;          }      to run before the results are displayed. Does anyone know how I extend the search to then filter for all posts that contain the search term but are then attached to the specific post 2 posts


Custom form in admin area, redirect in wrong page

I'm writing a custom form on my plugin settings area.               <form action="<?php echo admin_url('options-general.php?page=yasr_settings_page') ?>" id="form_add_multi_set">                 Name                  <input type="text" name="multi-set-name" id="new-multi-set-name" class="input-text-multi-set">                 <?php wp_nonce_field( 'add-multi-set', 'add-nonce-new-multi-set' ) ?>                 <input name="action" type="hidden" id="add-nonce-new-multi-set" value="new-multi-set" />                      <?php submit_button(__('Create New Set', 'yasr'), 'primary'); ?>      </form>      When I try to click on submit I got redirect on options-general.php but I need to get redirect on options-general.php?page=yasr_settings_page. How to do that?


get the_title_attribute by id

I'm creating a list with a few permalinks which I call to with `<a href="<?php echo get_permalink($id); ?>" title="...`. And for the title I want to call `the_title_attribute()`. But it seems it can only be called within a loop, and not by id. How do I correctly get a title attribute? _Note: The reason I want to use`the_title_attributes();` is because I use html tags within some of my titles._


Sort posts by activity date

I have a list of posts posted on different dates I can order the posts by date               $loop_args = array(         'post_type' => 'post',         'order_by' => 'date',         'order' => 'ASC'          )      How can I order the post by comment date if the post have a comment. So sort the posts by activity


How to show featured image CAPTION only if it exist

I'm using this function in my functions.php to display image caption for faetured images:               function the_post_thumbnail_caption() {     global $post;          $thumbnail_id    = get_post_thumbnail_id($post->ID);     $thumbnail_image = get_posts(array('p' => $thumbnail_id, 'post_type' => 'attachment'));          if ($thumbnail_image && isset($thumbnail_image[0])) {     echo '
'.$thumbnail_image[0]->post_excerpt.'
';     }     }       And using this in the template file to display the caption:               <?php      if (the_post_thumbnail_caption()) {       the_post_thumbnail_caption();      }     ?>      In the functions file I have the caption displaying in a div class="front- caption" which I am styling with borders. If the caption does not exist then it still displays the empty bordered div. If no caption exists I do not want to display the bordered div. I just want it to display nothing. How can I properly code this to work? Thanks in advance.


Show thumbnail for category?

I currently have a code where, in my category.php, it checks if the specific category has subcategories, and if it does, show them using wp_list_categories. I'd love to have these wp_list_categories to show thumbnails, so I created a new walker, but I cannot figure out how to show thumbnails. I'd be fine with having it show the featured image of my latest custom post type in this category, or using a plugin. I currently have the following walker in my functions.php:                class Walker_Category_Parents extends Walker_Category {                    function start_el(&$output, $category, $depth, $args) {         global $wpdb;         extract($args);                   $link2 = ''.$category->slug.'';         $cat_name = esc_attr( $category->name );         $cat_name = apply_filters( 'list_cats', $cat_name, $category );         $link = 'description, $category ) ) ) . '"';         $link .= 'rel="'.$category->slug.'" ';         $link .= '>';         $link .= $cat_name . '';         if ( 'list' == $args['style'] ) {             $output .= "\t
get_results( "SELECT term_id FROM $wpdb->term_taxonomy WHERE parent=".$category->term_id );                  $children_count = count($children);                  $has_children = ($children_count != 0) ? ' parent-category' : '';                  $class = 'cat-item cat-item-' . $category->term_id . $has_children;             if ( !empty($current_category) ) {                 $_current_category = get_term( $current_category, $category->taxonomy );                 if ( $category->term_id == $current_category )                     $class .=  ' current-cat';                 elseif ( $category->term_id == $_current_category->parent )                     $class .=  ' current-cat-parent';             }             $output .=  ' class="' . $class . '"';             $output .= ">$link\n";             $output .= "\n";         } else {             $output .= "\t$link
\n";         }     }                         }      As you can see, it currently looks for the image in a folder, but this is absolutely not ideal, because I'm not the only one adding categories, but I don't want to give everybody FTP access. Any solutions? Thanks!


tax query between operator like

I have a custom post called person and a taxonomy(like tags) called age. As far I have search tax query doesn't seem to support the between operator like meta query does. Is there a way to accomplish the between, like etc operators with tax query or do I have to make my own sql question ? Also would be better to create a custom field called age rather have a taxonomy and query with meta query that supports the compare operators ? One disadvantage I can think with using custom fields is that you can't query inside the admin panel how many people have that age or query only the people that have a certain age etc. Also if I want to find the min and max age of all people I have to get all posts and compare them one by one. One solution I found to emulate the between operator :               $min_age = 18;     $max_age = 100;     $ages = array();     for($i=$min_age; $i<=max_age; $i++){             array_push($ages , $i);          }     $args = array(         'post_type' => 'post',         'tax_query' => array(             array(                 'taxonomy' => 'age',                 'field' => 'slug',                 'terms' => $ages             )         )     );     $query = new WP_Query( $args );      So what do you think is better to do ? I know my question is a bit vague and sorry for that but I would like to know what is the best solution to this kind of situations.


Is there a way to stop WP editor deleting <gcse:searchbox-only></gcse:searchbox-only>

I would like to paste my Google Custom Site Search code into the editor to appear on one of my pages. It works when pasting into the "text" side, but get's turned into a NBSP if I flick to "visual" Is there a way I can keep `<gcse:searchbox-only></gcse:searchbox-only>` in tact in the editor?


Up/Down voting system for Wordpress

Looking in all posts with keywords "voting system, upvote, downvote", I can't find a satisfying solution for this issue, except accepting one of the available plugins, spend a lot of time undersanding it and try to modify its functionnalies so that they fit with the requirements. So, I am convinced in writing my own code to create a stack-exchange-like voting system for Wordpress. Without your suggestions I cannot find the starting point for the main part of the skeleton of my code. My actual approach :   * Create two custom fields: the first stores the number of post upvotes, and the second, the number of downvotes. It is possible to display votes state using `get_post_meta` function, and change vote state from front end using `update_post_meta`.   * Find a way to store in the database the voted posts by a specific user and the state of vote(up, down or nothing). So that logged in users see if they already voted. > >     If (user is logged in ) >     { >     Show the upvote or downvote state already done by this user; >     Allow voting ; >     } >     else >     { >     don't allow voting; >     } >   **My question is:** How to resolve the second issue. Is there a way to achieve it using the customizing features offered by Wordpress PHP functions (without using SQL queries, since I don't know how to use SQL). I observe that all the Up/Down voting plugins use SQL queries in their code which make me really scared. Should I learn SQL to achieve my goal? I thank you very much for your usual help.


How to Add WYSIWYG Editor (tinyMCE) to plugin options page compatible with Wordpress 3.0 and up?

I'm trying to add tinyMCE instead of textarea for one of my options in my plugin with no luck so far. I tried this : http://www.dbuggr.com/smallwei/add-wysiwyg-editor-tinymce-wordpress-plugin/ and this: http://blog.imwd8solutions.com/wordpress/wordpress-plugin-development-add- editor-to-plugin-admin-page/ There seems to be some problem with styles as styles for tabs (HTML style/Visual style) dont work. Anybody knows about implementation that works 100% with WP 3.0 and up ?


Update user meta array using foreach

I have two arrays consisting of keys and values: Array consisting meta keys:               $user_meta_fields = array ( 'first_name', 'last_name', 'job_title', 'college', 'street_address','address_line2','city','state','country', 'zip',  'phone', 'email' );      Array consisting values:               $post_data['fname']             = $_POST['fname'];     $post_data['lname']             = $_POST['lname'];     $post_data['job_title']         = $_POST['job_title'];     $post_data['college']           = $_POST['college'];     $post_data['street_address']    = $_POST['street_address'];     $post_data['address_line2']     = $_POST['address_line2'];      $post_data['city']              = $_POST['city'];     $post_data['state']             = $_POST['state'];     $post_data['country']           = $_POST['country'];     $post_data['zip']               = $_POST['zip'];     $post_data['phone']             = $_POST['phone'];        $post_data['email']             = $_POST['email'];         Here is my loop:               foreach($user_meta_fields as $user_meta_field){           update_user_meta($current_user->ID, $user_meta_field, $post_data);         }      But it doesn't work for me. Why?


Wordpress gallery shortag

I'm creating a simple slideshow on the side where i want to show 4 images from a post, i searched around i found this code that simply uses the build in gallery function
<?php echo do_shortcode('[gallery id="'.$post->ID.'"]'); ?>
      the problem is that it spits out the entire gallery... is there noway to limit this to 2,3 ? i tried to use http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail but for some reason, i didnt work... I guess it because all my posts are made of is a gallery of images all help is appreciated regards


Unsetting post_tag taxonomy breaks term description for other taxonomies

Here's something I can't figure out. I don't need the default `post_tag` taxonomy, so I'm removing it with this piece of code :               function mwm_unregister_taxonomy(){              global $wp_taxonomies;              $taxonomy = 'post_tag';              if ( taxonomy_exists( $taxonomy ) ) unset( $wp_taxonomies[$taxonomy] );     }          add_action( 'init', 'mwm_unregister_taxonomy');      But then, whenever I try to add a description to a term of any other (custom) taxonomy, via the terms edit page in WP admin, once I submit the changes it brings up the blank page with the "Cheatin, uh?" message. Is this a bug or am I doing something wrong?


.htaccess regex for redirect subdomain to root domain & redirect old permalinks

ok, i have at site a blog.mysite.com, and recently migrated all content to a new wp install at mysite.com. i want to redirect all of the posts from blog.mysite.com to mysite.com and also account for permalink structure. blog.mysite.com is /%year%/%monthnum%/%day%/%postname%/ mysite.com is /%category%/%postname%/ the goal is if anyone goes to blog.mysite.com /%year%/%monthnum%/%day%/%postname%/ they will be redirected to mysite.com is /%category%/%postname%/ i want to ultimately delete all content at blog.mysite.com as well, so i wound want to make this work via .htaccess after it's deleted. i can't seem to work out exactly how to do this in .htaccess. also, both sites live in their own directories on the server. /blog.mysite.com and /mysite.com thanks so much for your help!


Renaming CPT slug when the user access a page from one specific taxonomy

How do I rename a registered CPT slug when the user access a page from one specific taxonomy? I have a custom post type called `/package/` and it taxonomies `/america/ /europe/ /asia/ /hotel/` An package from a Europe tour for example is showed like `domain.com/package/rome-milan-madrid/` What I would like is to have the have the `hotel` tax showing up instead `package` when a user is on the hotel pages. Now is: `domain.com/package/four-seasons/` I need: `domain.com/hotel/four-seasons/`


Only display custom field if it there is a value inside

Quite a simple question really, but unsure how to do it. I have this little bit of code:
                 <?php if ( function_exists('get_custom_field_value') ){                         get_custom_field_value('Essential info 5', true);                 } ?>
      ...and I want to find out how I can adjust it so that if that particular field is empty, it does not display the list item at all. Thanks!


Getting a WordPress tag to print inside of a traditional php echo

I want to get the template path to print in this echo of a form in the admin. Here is what I got:               < ?php echo of_get_option('splash_img_transition', 'bloginfo('template_url')+/images/large/chalk.jpg' ); ?>      The second parameter there is a placeholder if nothing is input into the field that I am echoing. Normally the echo works like this: `< ?php echo of_get_option('splash_img_transition', 'no entry' ); ?>` And of course the WP tag `< ?php bloginfo('template_url'); ?>` I'm just trying to combine the two so that the default (if the user does not input anything) will be a path to a placeholder image. Thanks for any help!


Help with if else statement for separating content from image attachment

![enter image description here](http://i.stack.imgur.com/5QfUW.jpg)I am currently having some trouble executing the following. I would like to separate the image (wp_get_attachment_image) from the content (get_the_content) by using a conditional statement to display the div styled content area. So if the image is displayed without any content in the editor to not display the styled content div at all.
       <?php           $args = array(           'post_type' => 'attachment',           'numberposts' => -1,           'post_status' => null,           'post_parent' => $post->ID         );                $attachments = get_posts( $args );               if ( $attachments ) {               foreach ( $attachments as $attachment ) {               echo wp_get_attachment_image( $attachment->ID, 'full' );             }         }     ?>

          <?php echo preg_replace('/]+./','',get_the_content()); ?>


How to find which plugin is outputting Open Graph tags to <head>

After getting an error the Facebook debugger about duplicate og:url tags, I'm trying to find which plugin is outputting the second set of Open Graph tags to my `head` section. I've tried deactivating each plugin, then viewing the source page using incognito mode in Chrome but that hasn't helped find the source of the issue. Any other ideas or should I be looking somewhere else? The site in question is http://marchforkids.org. The code I want to remove is on lines 91-95 in the source of the front page.


List of Body Classes Generated by body_class()

Does anyone know where I can get a _list of all the **body classes_** generated by `body_class()` for **every sections** and **every conditions** , including _custom post-types_ , etc.? For example, for a _search result_ page with certain conditions (eg. _logged- in_ ), the function produces this:               <body class="search search-results logged-in admin-bar single-author two-column right-sidebar">      I need the full list for **reference** in creating a theme. Cheers!


wp-cli 0.14.1 MySQL error

I just updated to wp-cli 0.14.1 today and once again having a MySQL issue. I'm on Windows, Wampserver, and Cygwin. When I first updated to the last rev (0.14.0) I had a similar problem and wound up finding and using the info from a github discussion that it most likely was due to the "variables_order" in php.ini. I commented that out in my ini file in order to force the default of EGPCS instead of GPCS. That took care of it. There was mention of fixing this in the next release. Now I've updated to 0.14.1 and when trying to run "wp core config ...." to create the wp-config.php file I"m getting the command line error               MYSQL_PWD is not recognized as an internal or external command.      I went back to the github thread and see that scribu did make the change discussed. I followed the link to it to see if it would shed some light. I see the change on line 328 but don't know what I should try now since that change seems to be what's producing my problem. Just FYI: I have no problem using mysql from the DOS or Cygwin command line, they both reference the same executable and work correctly; flawlessly. Any help would be appreciated. UPDATED 03/08/2014 NOTES: (1) I'm not concerned with exposing the username or password as they are temporary and this is on one of my local machines. (2) You'll see I"m using the phar file in this debug session. The exact same thing happens using the "installed" version "wp" in the bin folder. Here's a debug session in PHPStorm in which I started with this wp-cli command:               Boss@Bonkers /cygdrive/c/wamp/www/wpsandbox     $ ../wp-cli-0.14.1.phar core config --dbhost=127.0.0.1 --dbname=wpsandbox --dbuser=root --dbpass=Bonkers --dbprefix=sndbx_      Breakpoints in utils.php were set for line 331:               $final_cmd = $cmd . assoc_args_to_str( $assoc_args );      which creates the final command handed to line 333 for execution:               $proc = proc_open( $final_cmd, $descriptors, $pipes );      Here's the debugging image with the status of the variables just before processing lines 334-339 to exit wp-cli and producing the failure message on the bash command line:               Boss@Bonkers /cygdrive/c/wamp/www/wpsandbox     $ ../wp-cli-0.14.1.phar core config --dbhost=127.0.0.1 --dbname=wpsandbox --dbuser=root --dbpass=Bonkers --dbprefix=sndbx_     'MYSQL_PWD' is not recognized as an internal or external command,     operable program or batch file.          Boss@Bonkers /cygdrive/c/wamp/www/wpsandbox     $       I know wp-cli is well constructed software so it's most likely me missing something along the way. (Getting the command line and PHPStorm working together was time consuming since it's a new tool for me.) I'll keep at it as time allows, but if someone has any clues it would help. UPDATE: 03/29/14 Thanks for the ticket and merge scribu, but unfortunately it doesn't fix the problem. I'm getting the same error. At first I was confused after re-downloading the phar file because I found the exact same code as before your ticket and merge. A WTF moment. So I looked at the builds directory on GitHub and see that file is dated 2 days prior to your merge so it would not have included the changes. I grabbed the nightly, reloaded the project and there were the changes with putenv() but Bash is throwing the same error as before. It seems since this change wp-cli has been incompatible with Cygwin. UPDATE: 04/19/2014 Version 0.15.0 was released on 4/15 so I installed it and ran all the commands above. wp-cli worked as it did in versions < 0.14.1. I compared 0.14.1 to 0.15.0 and found the following. Lines 326-339 of v0.14.1 read:               if ( isset( $assoc_args['pass'] ) ) {         $cmd = esc_cmd( 'MYSQL_PWD=%s ', $assoc_args['pass'] ) . $cmd;         unset( $assoc_args['pass'] );     }          $final_cmd = $cmd . assoc_args_to_str( $assoc_args );          $proc = proc_open( $final_cmd, $descriptors, $pipes );     if ( !$proc )         exit(1);          $r = proc_close( $proc );          if ( $r ) exit( $r );      Lines 326-342 in v0.15.0 now read:               $pass = $assoc_args['pass'];     unset( $assoc_args['pass'] );          $old_pass = getenv( 'MYSQL_PWD' );     putenv( 'MYSQL_PWD=' . $pass );          $final_cmd = $cmd . assoc_args_to_str( $assoc_args );          $proc = proc_open( $final_cmd, $descriptors, $pipes );     if ( !$proc )         exit(1);          $r = proc_close( $proc );          putenv( 'MYSQL_PWD=' . $old_pass );          if ( $r ) exit( $r );      This has fixed the problem. wp-cli is now working again with Cygwin, at least the commands I've used here as well as a few more that relied on getting past this point - the install.


customize tiny MCE blockqute

Hi we all know by default tiny MCE's blockquote generates this               <blockquote> content here </blockquote>      I am styling this via CSS : ![enter image description here](http://i.stack.imgur.com/e3zza.jpg) the css im using :               blockquote { border: none; font-family: 'Georgia', serif; color: #444; font-size: 1.2em;                font-weight: bold; font-style: italic; font-weight: normal;                padding: 0; text-indent: 1.2em; color: #222;                border-bottom: 1px solid #888;                 position: relative; bottom: 12px;  }          .no-js blockquote { position: static; bottom: auto; border: none; }          blockquote span { position: relative; top: 12px; background-color: white; padding: 0 15px; }      for the trailing line to appear without adding unneccesary unsemantic markup i need to generate a span inside the blockquote :               <blockquote>          <span>             content here         </span>     </blockquote>      preferably without making a separate shortcode for this and just use the native blockquote button. can anybody help?


How To Create User Specific Admin User Pages?

The aim is for a proposed site to have customers be able to login and be able to view a private and customer specific ADMIN page NOT frontend page (although this would be much easier to achieve). Said page would display user meta and content that the site Admin could add ad hoc. I am confident in being able to create the menu item, page and populate with user meta, my understanding seems to fail when it comes to actually making said ADMIN page private on a customer by customer basis, and the bet way to add content to these pages by the admin. Any pointers so I can get a better understanding, or indeed plugins that in part have these capabilities would be greatly appreciated. Thanks John


How do I create a single Wordpress page that will use PHP to include different HTML files based on a vaule in the URL?

I have used PHP on a page to include HTML files on a page such as: `<?php require("http://www.mysite.edu/_sports/static/season_box.html"); ?>` This works well for including a single file that gets updated frequently. I am hoping to find a way to use PHP code in a single Wordpress Page that would included one of several HTML files depending on the URL. The idea would be to be able to create a URL to a Wordpress page that would have the name of the HTML file as a variable that the PHP script would use to identify the desired HTML file to include.


WordPress custom post type category pagination 404 Error

This problem is giving me a headache and I was wondering if anyone knew how to fix it. I have a custom post type called Review. Here is how it is defined:               function codex_custom_init() {         $args = array( 'rewrite' => array('slug' => 'review'),                          'public' => true,                          'has_archive' => true,                          'show_ui' => true,                         'label' => 'Review',                          'publicly_queryable' => true,                         'taxonomies' => array('category', 'post_tag'),                          'supports' => array( 'title', 'editor', 'comments', 'excerpt', 'custom-fields', 'thumbnail', 'author')                       );         register_post_type( 'review', $args );     }          add_action( 'init', 'codex_custom_init' );      My archive page, handled by archive-review.php, works fine for pages like this               http://www.acme.com/review/page/3/      However, when categories are involved, wordpress does not display the "next" page. Instead, it goes to a 404. For example, when I try to access this:               http://www.acme.com/category/random/page/2/      Why does that give a 404? Also, it no longer is powered by archive-review.php, but archive.php (which makes sense I guess) archive.php query stuff:               $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;             $cat = get_category(get_query_var('cat'));             $catID = $cat->term_id;             $args = (array('post_type' => array('post', 'review'), 'cat' => $catID, 'paged' => $paged));             query_posts($args);      Please help!! I am very frustrated!


How to set base url for php widget

SO, I have some php that I'm inserting into a widget that generates a list of pdfs within a directory on the root level of my wordpress install (see "Meeting Summaries" to the right here: http://mt- spacehosting.com/fisheries/plans/northeast-multispecies/ ). The list is populating as it should, but when one of the options is clicked, the url adds the current page structure of the current url. To see the code below working correctly, you can visit: http://mt- spacehosting.com/fisheries/past-events.php a simple php page I uploaded to the root directory of the install. Here's my code:                   <select name="s1" onchange="MM_jumpMenu('pdfwin',this,0)">               <option value="Select Date" selected="selected">Select Date</option>              <?php          $sub = ($_GET['dir']);          $path = 'groundfish-meetings/';         $path = $path . "$sub";          $dh = opendir($path);          $i=1;               while (($file = readdir($dh)) !==   false) {              if($file != "." && $file != "..") {                  if (substr($file, -4, -3) =="."){                  echo "$i. <option value='$path/$file'>$file</option>";                  } $i++;                  }               } closedir($dh);          ?>         </select>      I tried $path = "'.bloginfo('url').'/groundfish-meetings"; to set a base url, but it broke the list and none of the files showed. Any help / thoughts would be appreciated! Thanks, Matt


Does a Google + RSS Plugin Exist?

There are post to Facebook/Twitter plugins but I can't find one for Google Plus. Does anybody know if such a plugin exists or if there is a better solution? It would be nice to have content automatically post to a Google Plus page!


List all posts in Custom Post Type but group dynamically by Custom Taxonomies

I have a custom post type named "Resources" which has a Taxonomy named "Types." I have it manually pulling each term which isn't the most elegant solution and every time there is a new term added, I have to add it in manually. I need a way for the Terms to populate with the posts associated listed below. I have a custom loop for displaying each post (pulling in custom fields) so I need to have control over what is displayed for each post. Is there an easy way to go about this? Thanks.


A proper gallery in wordpress?

The dad from a friend of mine photographs bird feathers for hobby. He has about 6000 of them. I've been asked to find him an easy to use gallery, which should allow some kind of batch processing as it's a lot of photos. I've started off on Gallery2, but we're not on speaking terms anymore; what a piece of shit. Any suggestion of building a gallery in Wordpress? Key features: folders, batch processing. Thanks!


There is no featured image in my post in wordpress multisite theme

I have a multi-site word press theme and it has front page as post pages and i have inserted also the featured images in particular post , but it didnt appear the images still. After all there is no error message also. I can found it works in localhost but not in server. Plz help me.


Can I add a Category Metabox to attachment?

I am using `register_taxonomy_for_object_type()` to add the Category taxonomy field to Media uploads (attachments). I'm using this code to do so:               add_action('init', 'reg_tax');     function reg_tax() {        register_taxonomy_for_object_type('category', 'attachment');     }      This works and adds a simple text field for Category to the Media page when viewing an image. What I really want is to make it display the actual Categories Metabox so that I can choose the Categories I want to use rather than just type them into the plain field. I've also found that putting the slug for a category into this text field such as `my-category-name` ends up displaying as the actual category name like `My Category Name` when it's saved, which makes the simple text field even less of a useful option. I've been looking at the `add_post_type_support()` function for adding Metaboxes and have seen it used for Custom Post Types, I just can't see if it's possible to add the same for attachments.


How to output the content of a Custom Post Type from a drop down form?

I have a Custom Post Type called office and I output a list of names of these Offices using a dropdown menu from a thread here on WPSE: Dropdown list of a custom post type. What I would like to do next is not sending the visitor to the single-office, but instead show a line of text underneath the selected office that outputs a sentence with some info of this office, let's say the excerpt. I basically want to get something similar as on this website: http://www.healthysanfrancisco.org/visitors/How_To_Apply.aspx What should I do to accomplish this?


Inserting a DIV Block Into a Listing of Excerpts?

I'm sure there has to be a tutorial for this, I just can't find it. I'm also pretty confident there's numerous ways to do this and I'm looking for the best. I've never had to do this before, so I've never asked... I want to insert a DIV into a list of excerpts. For example, take a look at: http://www.premiumpixels.com/wordpress-themes/ where Orman added a div asking users to subscribe into his excerpts.


List child pages of a specific page

I'm looking for a snippit/function that will list the child pages of a specific page (I guess by page ID) but not necessarily when you are on that page or a child of that page. The parent page (Parents Area) and its child pages are listed below:               Parents Area     - Term Dates     - Calendar     - School Blog     - Letters to Parents     - Attendance      I want to be able to be on any page of the website, specifically within single posts and post archives but be able to list out just the children of the parent page "Parents Area".


Error installing Contact Form 7

What is the procedure to use this plug-in correctly? I have made a form using contact form 7, but when I test the form it fails to send an email with an error message "Failed to send your message. Please try later or contact administrator by other way." How can I fix this issue?


Add number in increment of one to DIV ID

I'm using a shortcode to display a custom post type. The shortcode contains an attribute to display only posts of a specific category within the custom post type e.g. [faq category="travel"] For each shortcode wordpress outputs a specific set of html, including a div with id of "faq-accordion". For each shortcode I need to output the div with ID "faq-accordion+1" e.g "faq-accordion1", "faq-accordion2", "faq-accordion3", etc. I have managed to append a number to each div but for some reason it only goes as far as 6 and then repeats the numbers. Here is my code                   add_shortcode( 'faq', 'wpse105856_shortcode_callback' );              function wpse105856_shortcode_callback( $atts ) {         extract( shortcode_atts( array(             'category' => ''         ), $atts ) );              $args = array(             'numberposts' => -1,             'orderby' => 'menu_order',             'order' => 'ASC',             'post_type' => 'faq'         );                if ( ! empty( $category ) ) {             $args['category_name'] = $category;         };              $posts = get_posts( $args );              //Here is where I am trying to dynamically add a new number to the faq-accordion div         $num = 0;                  foreach ( $posts as $post ) {            $faq  = '
'; //Open the container             };              foreach ( $posts as $post ) { // Generate the markup for each Question             $faq .= sprintf(('
%1$s

%2$s
'),                 $post->post_title,                 wpautop($post->post_content)             );         };         $faq .= '
'; //Close the container              return $faq; //Return the HTML.     };


How do you use Wordpress for a website that's not in a blog format?

I'm developing a company website which has to accomodate easy changes by non technical people. I've been asked to use Wordpress as the CMS, but the website I've created is not in a blog format. This is what it looks like: ![Website frontpage](http://i.stack.imgur.com/vLZWd.png) I just don't see how it's possible for somebody to edit all of the text on this page using that single WYSIWYG editor on the edit posts page. Here we have a banner with text and images, 3 content boxes laid out horizontally, and some text in the lower part of the page. What's the solution to using WP for these layouts?


Remove 'wp-content/themes/themename/' from Image path

I'm currently moving an old website based on some other CMS towards a new server, with WordPress. However, the site ranks good on Google, and I'm have to keep all the link structure, including the ones from images. So, in the old CMS, the links to images were like this:               http://www.domain-name.de/images/image1.jpg      Right now, they are like this:               http://www.domain-name.de/wp-content/themes/theme-name/images/image1.jpg      But they have to look like in the first example. I'm using a lot the /images/... code, so changing that in all .php files and widgets, pages and so on would take hours. Is there anyway to achieve that with some way to do it, maybe with htaccess? **PS:** After searching, I tried a few "Relative image paths" which I found on google... but none of them worked. e.g. i tried this:               function relativePathForUploads($fileInfos)     {         global $blog_id;         $path = get_blog_option($blog_id,'siteurl');              $fileInfos['url'] = str_replace($path,'',$fileInfos['url']);              return $fileInfos;     }     add_filter('wp_handle_upload', 'relativePathForUploads');      and copied it into the functions.php, but it does not do anything. **PPS:** I am searching for a way that the printed out path is without the "wp-content/themes/.....".


Infinite Scroll plugin scrolling truly "infinitely" (i.e. does not recognize end of posts)

I'm using the infinite scroll plugin and on some pages it just scrolls forever and is not showing the _"No more posts to load"_ message. Happens with newest WordPress version and also with the twentyeleven theme. Anybody knows this problem?   How can I make this work?


Facebook and WordPress

Is there a way to create a login/register with facebook and facebook comments on my wordpress site without using plugins? Some sort of a guide would be appreciated.


Wordpress Ajax not working

I have updated wordpress 3.5.2 and using Elemen theme in my wordpress site. The problem i am having is in **admin side Ajax functionality is not working**. I have tried **disabling all the plugins but that has not helped** me till now. I have used `define( 'CONCATENATE_SCRIPTS', false );` in wp- config.php, but even that hasn't been working for me. Error after using javascript console is               TypeError: switchEditors is undefined Source File: test.com/wp- admin/post.php?post=761&action=edit#category-pop Line: 1      Please guide me now what should i check to work it in my favor.


How to add post featured image url to inline background url()?

I'd like to get a post's featured image and use it in the style="background: url()" of the post. I thought this would do it, but alas I was wrong because this outputs the whole (img src=""> stuff.               <div style="background: url(<?php the_post_thumbnail( 'thumbnail' ); ?>     ) !important;">adasdasdasd </div>      I tried get_post_thumbnail but don't think I have the format right. Any thoughts?


Change author permalink using htaccess?

The original urls for users look like /author/user-name/ Is it possible to replace login by user's id? (something like: /author/34/ (34 is user id)). I found the solution given here, to not work for my site. Thanks.


Select front page and blog page in custom theme settings page

Im creating a theme which have a custom setting page. I know the best method to choose a static page is by going to Settings -> Reading, but my client wants to have all in the same place. I already got the dropdowns on the settings page and i did the front page by creating the **front-page.php** file and added               $options=get_option('pa_opciones');     <? query_posts( 'page_id='.$options['front_page'] ); ?>      This is working but im not sure if its the best method or cleanest method. Im trying to make a nice new theme using get_template_parts ,etc. How should i proceed with the blog page? currently on my page.php i got:               get_header(); ?>

                          <?php the_post(); ?>                          <?php get_template_part( 'content', 'page' ); ?>                          <?php comments_template( '', true ); ?>

          <?php get_footer(); ?>      And on my index.php:               get_header(); ?>

                      <?php if ( have_posts() ) : ?>                                    <?php /* Start the Loop */ ?>                     <?php while ( have_posts() ) : the_post(); ?>                              <?php get_template_part( 'content', get_post_format() ); ?>                          <?php endwhile; ?>                           <?php else : ?>

<?php _e( 'No se encuentra la pagina', 'defotografos' ); ?>

<?php _e( 'Lo sentimos pero no se puede encontrar lo que busca. tal vez si realiza una búsqueda podrá encontrar algo similar.', 'defotografos' ); ?>
                             <?php get_search_form(); ?>

                      <?php endif; ?>

          <?php get_sidebar(); ?>     <?php get_footer(); ?>      Im trying to make all these nice and clean but im getting a bit lost. Thanks for your comments and suggestions


Add slide option on columns

Created 3 column on my site via Special Recent Posts plugin. But I want add slide option on this columns. Like this: ![enter image description here](http://i.stack.imgur.com/J9FKV.png) How can I do it?


Custom $wpdb returns unexpected time based results

I am using the $wpdb class to do a custom SQL query but I am getting weird results. Basically this is what my SQL query is supposed to do   1. Retrieve the titles of post_types 'question' only if they are   2. published within the last 7 days   3. have a taxonomy of 'question_tag'   4. have the terms 'another-sample' or 'sample' The problem is the number 2. The query seems to be returning questions that are dated later than 7 days. To illustrate this I am also retrieving the post_date. As you can see in the below result set. the question titled 'lkddfs' is more than 7 days old. Help?               function rs_send_email_to_interested_users() {         global $wpdb;         $wpdb->show_errors();         $sql ="SELECT DISTINCT $wpdb->posts.post_title,  $wpdb->posts.post_date FROM $wpdb->posts         INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id)         INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)         INNER JOIN $wpdb->terms ON ($wpdb->term_taxonomy.term_id = $wpdb->terms.term_id)         WHERE 1=1 AND         $wpdb->term_taxonomy.taxonomy = 'question_tag' AND         $wpdb->posts.post_type = 'question' AND         $wpdb->posts.post_status = 'publish' AND         $wpdb->terms.slug = 'another-sample' OR $wpdb->terms.slug = 'sample' AND         //the date logic doesn't seem to qork quite right         $wpdb->posts.post_date > DATE_SUB( NOW(), INTERVAL 7 DAY)";         $question_titles = $wpdb->get_results( $sql, ARRAY_N );         return $question_titles;     }      And here is my result:               Array     (         [0] => Array             (                    [0] => lkddfs                 [1] => 2013-03-03 03:05:57 // This question is more than 7 days old!             )              [1] => Array             (                 [0] => Good tactical games                 [1] => 2013-03-24 04:48:04             )              [2] => Array             (                 [0] => my recent question                 [1] => 2013-03-24 14:58:25             )              [3] => Array             (                 [0] => romans question                 [1] => 2013-03-26 21:18:00             )          )


load custom fields on click

I have too much data stored in custom fields which I don't want to fetch on page-load, instead I'd give the user the opportunity to load the custom field values on click, possibly with ajax. Is there a working way to do this? I don't have any code yet just the wp loop. I'm thinking about putting the custom field queries in a separate php file, but I have no idea how to make connection between single.php and the separate file. (loading the file with ajax is no problem.) UPDATE: I don't need ajax, it's just confusing me so far. I just want to display the custom fields associated with the post on a different page template. I think of it as if the custom fields would be "children" of a given post and clicking a link would load a page with just the custom fields on it. Thanks.


Having problems with paging

My `category.php` lists articles on the first page, and on the bottom I have a pager. When I click page 2, the index.php page is loaded and the url looks like this: `http:// www.mysite.com/some-category/page/2`. Why isn't category.php page loaded when URL has `/page/2/` ? My permalink structure looks like this: `/%category%/%postname%/` If it helps to see the code, here it is:               <?php     /**      * Template Name: Article List - Category      *      * Displays articles from magazine      *      * @package WordPress      * @subpackage Norwegian_Fashion      * @since Norwegian Fashion 1.0      */            get_header();             // Get current page. Is used for pagination.       $page = (get_query_var('paged')) ? get_query_var('paged') : 1;          ?>

             <?php while (have_posts()) : the_post(); ?>

                     <a href="<?php the_permalink(); ?>"> <?php the_related_image_scaled('h=180') ?>

                   <?php the_date(); ?> | by <?php the_custom_author(); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>

<?php the_intro('num_words=25'); ?>

 <?php the_tags('Keywords: ', ','); ?>

<?php comments_number('no comments','1 comment','% comments'); ?>

             <?php endwhile; ?>
           <?php               if(function_exists('wp_pagenavi'))              { wp_pagenavi(); } ?>

               <?php //dynamic_sidebar( 'frontpage' ); ?>

              <?php get_footer(); ?>


Conditional check for front-end which includes ajax

I need a conditional which exits if the context is not a front-end view _including AJAX requests._ I have this at the moment:               if (is_admin() && !DOING_AJAX)          return;      The `DOING_AJAX` bit is required since `is_admin()` returns `true` for ajax requests. However I believe `DOING_AJAX` will be `true` for ALL ajax requests including those on the backend. Thus it doesn't really add anything here. How can I fork the two conditions? Can front-end/back-end ajax requests be distinguished? thanks! # Clarification Thanks for the insights but to clarify, in this instance, the hook itself is NOT an ajax action. It's a filter hook into `get_the_terms` which needs to operate on any front-end request _including_ any arbitrary theme or plugin ajax code. It also needs to bypass processing for the back-end hence the need for the forking condition. The problem is that ajax requests always return true for `is_admin()` In case you are curious it's a plugin which hides "secret" or "hidden" tags on the front-end, while still allowing their taxonomy pages to exist. The "hiding" needs to be bypassed on the backend for obvious reasons. Thanks for the help. Sorry for the initial confusion!


Wordpress Pagination Problem

I want to put Pagination in my wordpress index.php but it does not work. In my index.php there are 3 section of loop that show custom posts and i want put pagination in Blog / recent post section loop in index.php. this is the code in index.php               <?php     /**     * @package WordPress     * @subpackage Adapt Theme     */     $options = get_option( 'adapt_theme_settings' );     ?>     <?php get_header(); ?>
               <?php if(get_bloginfo('description')) { ?>              <?php echo bloginfo('description'); ?>               <?php } ?>               <?php get_template_part( 'includes/slides' ); ?>                <?php     //get post type ==> hp highlights         global $post;         $args = array(             'post_type' =>'hp_highlights',             'numberposts' => '-1'         );         $highlight_posts = get_posts($args);     ?>     <?php if($highlight_posts) { ?>
         <?php         $count=0;         foreach($highlight_posts as $post) : setup_postdata($post);         $count++;         //get img         $feat_img = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full-size');         //meta         $highlights_url = get_post_meta($post->ID, 'adapt_highlights_url', TRUE);         ?>              <article class="hp-highlight <?php if($count == '4') { echo 'remove-margin'; }   if($count == '3') { echo ' responsive-clear'; } ?>">
             <?php if($feat_img) { ?><img src="<?php echo $feat_img[0]; ?>" alt="<?php the_title(); ?>" /><?php } ?>             <?php if($highlights_url) { ?>                 <a href="<?php echo $highlights_url; ?>" title="<?php the_title(); ?>"><?php the_title(); ?>             <?php } else { the_title(); } ?>
                  <?php the_excerpt(); ?>
                       <?php         if($count == '4') { echo '

'; $count=0; }         endforeach; ?>
                   <?php } ?>                    <?php     //get post type ==> portfolio         global $post;         $args = array(             'post_type' =>'portfolio',             'numberposts' => '4'         );         $portfolio_posts = get_posts($args);     ?>     <?php if($portfolio_posts) { ?>

<?php if(!empty($options['recent_work_text'])) { echo $options['recent_work_text']; } else { _e('Recent Work','adapt'); }?>
                  <?php             $count=0;             foreach($portfolio_posts as $post) : setup_postdata($post);             $count++;             //get portfolio thumbnail             $feat_img = wp_get_attachment_image_src(get_post_thumbnail_id(), 'grid-thumb');             ?>                  <?php if ($feat_img) {  ?>             <div class="portfolio-item <?php if($count == '4') { echo 'remove-margin'; } if($count == '3') { echo ' responsive-clear'; } ?>">                 <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><img src="<?php echo $feat_img[0]; ?>" height="<?php echo $feat_img[2]; ?>" width="<?php echo $feat_img[1]; ?>" alt="<?php echo the_title(); ?>" />

<?php echo the_title(); ?>

                          <?php } ?>                  <?php             if($count == '4') { echo '

'; $count=0; }             endforeach; ?>
                       <?php } ?>                    <?php     //get post type ==> regular posts         global $post;         $args = array(             'post_type' =>'post',             'numberposts' => '12'         );         $blog_posts = get_posts($args);     ?>     <?php if($blog_posts) { ?>

<?php if(!empty($options['recent_work_text'])) { echo $options['recent_news_text']; } else { _e('Recent News','adapt'); }?>
             <?php             $count=0;             foreach($blog_posts as $post) : setup_postdata($post);             $count++;             //get portfolio thumbnail             $feat_img = wp_get_attachment_image_src(get_post_thumbnail_id(), 'grid-thumb');             ?>                       <article class="home-entry <?php if($count == '4') { echo 'remove-margin'; } if($count == '3') { echo ' responsive-clear'; } ?>">
         <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><img src="<?php echo catch_that_image() ?>">

<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php echo the_title(); ?>
                     <?php echo excerpt('15'); ?>

                          <?php             if($count == '4') { echo '

'; $count=0; }             endforeach; ?>
                   <?php } ?>
             <?php get_footer(); ?>      The area that i want put paginate is in "AREA WHERE I WANT PUT PAGINATE" (you can see comment tag above), but it is not working, if i click page 2, it always shows the posts of page one (not change). Here is code for file paginate.php that include in my function file               <?php     /**      * @package WordPress     * @subpackage Adapt Theme     */          //pagination function     function pagination($pages = '', $range = 4)     {      $showitems = ($range * 2)+1;            global $paged;      if(empty($paged)) $paged = 1;           if($pages == '')      {          global $wp_query;          $pages = $wp_query->max_num_pages;          if(!$pages)          {              $pages = 1;          }      }             if(1 != $pages)      {          echo "
";          if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "«";          if($paged > 1 && $showitems < $pages) echo "‹";               for ($i=1; $i <= $pages; $i++)          {              if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))              {                  echo ($paged == $i)? "".$i."":"".$i."";              }          }               if ($paged < $pages && $showitems < $pages) echo "›";          if ($paged < $pages-1 &&  $paged+$range-1 < $pages && $showitems < $pages) echo "»";          echo "
\n";      }     }     ?>      Note: I using template "Adapt" wordpress theme from wpexplorer.me.


Strange number at the end of wordpress permalinks

I've just noticed in my google webmaster tools that there are 404 errors and they are pointing from my permalinks which have this number in the end : 9223372036854775807. For example this url : > http://www.designzzz.com/beautiful-pictures-nature/ is shown as this > http://www.designzzz.com/beautiful-pictures-nature/9223372036854775807/ and works fine. I got worried that there might be some hacking or other issue in my site and google it. I found that many urls from different wordpress sites are indexed with this same number in the end. So I am curious what is this about. Google QUery


Shared terms between taxonomies

Need some help from you. It's a matter of classification. Here is the deal: I've got a custom post type about movies and I set up some custom taxonomies (non hierarchical, so acting like tags) for the crew. So I've got "Director", "Screenplay writer" and others. I.e. Movie: The rise of Wordpress Director: John Doe Screenplay writer: John Smith Everything works good, when I click on a term I get a sort of "personal page" of the person (I also add some custom fields to the term page in Wordpress so I can add additional info such as a picture, the website link and something else). So here is the question. What if the Director of a movie is also the screenplay writer? I mean, at the moment I've got to duplicate the term, one for each taxonomy. I wonder if there is a way to do such thing: Define a general taxonomy like "crew" where each term is a single person. Then pick up every term associating it with the role. Someone has an idea about that? Even different approaches will be appreciated! Bye guys, thank you for your great support Carlo


BuddyPress: Adding a new tab in groups

I'm trying to add a new tab to my groups on BuddyPress. All the groups will have different content preferrably from the database. How can I accomplish this?


How to remove parent taxonomy name from the title generated by wp_title()?

I have a custom taxonomy "Portfolio Categories", and a few these categories say "Cloth", "Shoes", ... When open some category page, i want the title to be like 'Site Name | Cloth', but with wp_title(), it becomes 'Site Name | Portfolio Categories | Cloth' How do i remove the "Portfolio Categories" from the title?


feed url problem

hey hii everyone, i have a function to fetch the videos from the rss feed of youtube, so that i can display selected videos to my blog for that i am using this youtube-search-feed url `http://gdata.youtube.com/feeds/base/videos?q=eminem&client=ytapi-youtube- search&v=2` in the url, eminem is included, so it will display me videos of eminem, now my problem is, instead of eminem it should take my posts title name, so if i write this code `$rss = fetch_rss('http://gdata.youtube.com/feeds/base/videos?q='.the_title().'&client=ytapi- youtube-search&v=2'); ` then its returning me with a false video here is my entire code                   <?php      $newvar = str_replace(' ', '', the_title());     include_once(ABSPATH . WPINC . '/rss.php');     $rss = fetch_rss('http://gdata.youtube.com/feeds/base/videos?q='.$newvar.'&client=ytapi-youtube-search&v=2');         $maxitems = 1;          $items = array_slice($rss->items, 0, $maxitems);                                 ?>      here i am using `$newvar` to strip the spaces in between of the title of the posts **@rarst** i change the code but now i am not getting the video here is the code               <?php      $newvar = str_replace(' ', '', the_title());     include_once(ABSPATH . WPINC . '/feed.php');     $feed = fetch_feed('http://gdata.youtube.com/feeds/base/videos?q='.$newvar.'&client=ytapi-youtube-search&v=2');     $maxitems = 1;      $items = array_slice($feed->items, 0, $maxitems);     ?>


How to set configuration options for particular sub blogs?

Is it possible to set configuration options such as DEBUG mode only for specific sub blogs in a wordpress multisite installation? If so, how?


Get data from wp_posts of mysql in to variables of wordpress-php script

I want to get post status, media information like the type of attachments added to the post etc in to my program. I tried this but doesn't work well                $posts = $wpdb->get_results("SELECT  post_status FROM wp_posts WHERE         ID = 1  LIMIT 1");


Natural sort / ordering wp_dropdown_categories

I'm using the following code to display an archive dropdown:                   wp_dropdown_categories( 'taxonomy=week&hierarchical=1&orderby=name' );      However the format of the taxonomy is week-1, week-2 .... week-10, week-11 I need it to be natural orderered as per http://www.php.net/manual/en/function.natsort.php e.g. > Week 1   >  Week 2   >  Week ...   >  Week 10   >  Week 11 Currently it's being ordered true alpha e.g. > Week 1   >  Week 10   >  Week 11   >  Week 2 Not sure what the best way to do this is, any help or thoughts much appreciated.


Not sure how to debug: Send specific users an email when posts are published

I've got the following code, which is supposed to run when a new post is published for the first time, check if a custom field 'specific_users' has data (this uses Advanced Custom Fields), and if so, send an email to each of the selected users.               /**      * Send users a notification of new grower posts       */     function notify_growers($post) {     // Only notify for grower posts     if ( $post->post_type != 'grower_posts' ) return;          $post_id = $post->ID;          // ...run code once     if ( !get_post_meta( $post_id, 'emailsent', $single = true ) ) {              $specific_users = get_field('specific_users',$post_id);         if(isset($specific_users) && is_array($specific_users)) {             foreach($specific_users as $specific_user) {                      $to = $specific_user['user_email'];                 $subject = 'Grower News: ' . get_the_title($post_id);                      $message = '';                 $message .= '
' . get_the_excerpt($post_id) . '…
';                 $message .= '
Continue Reading »
';                      wp_mail($to, $subject, $message );                  }             unset($specific_user);             //print("
User IDs = ".print_r($user_ids,true)."
");         } else { return; }              // Make sure this doesn't run again         update_post_meta( $post_id, 'emailsent', true );     }          }     add_action( 'draft_to_publish', 'notify_growers' );     add_action( 'new_to_publish', 'notify_growers' );      It's not sending any emails, and I'm not sure how to go about debugging it. Side question, is sending the email in the foreach loop the best way to do it? Or should I do it all at once with BCCs somehow? Thanks, Angus


Add multiple pages to theme customizer

So that theme customizer over at `/wp-admin/customize.php` is pretty cool, but it looks like it only lets you customize one page. Is there any way to add multiple pages or other theme template pages to this customizer?


Content area is too small

I want to change to the new twenty fourteen theme because it's a nice look and feel. However if I try so the content is reduced only on a small area and a lot of space on the page is unused. I already tried this: how to create a conditional content_width for a wordpress theme? but it does not help me at all. to give you an image of what i mean look at this: Unused pagearea marked in yellow Some of you know where and what do I have to change to fit the whole area? My blog: www.sysstem.at


How can I force URL of a custom post type archive to use a page template?

I have the following custom post type:               if ( $args->has_archive ) {         $archive_slug = $args->has_archive === true ? $args->rewrite['slug'] : $args->has_archive;         if ( $args->rewrite['with_front'] )             $archive_slug = substr( $wp_rewrite->front, 1 ) . $archive_slug;         else             $archive_slug = $wp_rewrite->root . $archive_slug;               register_post_type( 'jobs',             array(                 'labels' => array(                     'name' => __( 'Jobs' ),                     'singular_name' => __( 'Job' )                 ),             'public' => true,                 'show_ui' => true,             'has_archive' => $archive_slug,                 'hierarchical' => true,                 'query_var' => true,                 'supports' => array( 'title', 'editor', 'comments', 'trackbacks', 'revisions','author', 'excerpt', 'custom-fields', 'thumbnail', 'page-attribute' ),             'rewrite' => array('slug' => 'jobs', 'with_front' => true),                 'taxonomies' => array( 'post_tag', 'category'),                 'can_export' => true,             'show_in_nav_menus' => true,             //'capability_type'=>'jobs',             //'capabilities' => array(             //  'read_post' => 'read_jobs'             //),             )         );      Right now, it is using the template `archive-jobs.php` (WordPress' default template system). Now, the thing I want to do it to use a template called `jobs-page.php` for the url `mysite.com/jobs` but that's not possible because WordPress automatically catches that `/jobs` part and redirects it to the archive template. I tried doing this `'has_archive' => false,` but then WordPress uses `archive.php` for the `mysite.com/jobs`. What's the best way to deal with this issue?


Authors & profiles (and exclude ID's)

I'm facing the following: I need to create a page with all authors and exclude multiple (id's). Strangely I'm using 'subscribers' to list the authors but it's working.                           <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<?php the_title() ?>
         <?php the_content(); ?>              <?php endwhile; ?>                       <?php             // Get all users order by amount of posts             $allUsers = get_users('orderby=post_count&order=DESC');             $users = array();             // Remove subscribers from the list as they won't write any articles             foreach($allUsers as $currentUser)             {                 if(!in_array( 'subscriber', $currentUser->roles ))                 {                     $users[] = $currentUser;                 }             }             ?>
         <?php             printf('
%s
     ', the_title());             foreach($users as $user)             {                 ?>

                         <?php echo get_avatar( $user->user_email, '200' ); ?>

<?php echo $user->display_name; ?><?php echo stripslashes(esc_attr( get_the_author_meta('job_titel', $curauth->ID ) ) ); ?>

 locatie

<a href="<?php echo get_author_posts_url( $user->ID ); ?>"> Bekijk profiel

                           <?php             }         ?>      How can I exclude id's from this list?


Custom Menu based off custom header

I'm using my Child of TwentyTwelve Just for your knowledge, I have two sections to my one WordPress site... one is called pain, the other called anesthesia (It's a medical site for the curious). I have created two menus: "pain-menu" and "anesthesia-menu"... of course, I would like each menu to be seen on its corresponding section. Currently, "pain-menu" is selected for the Primary Menu and is seen all across the site. I'm using the Default page template for the Pain section. I have also created a page template called... wait for it... "Anesthesia." I can currently select this template when creating new pages for the anesthesia section. Even more, this Anesthesia page template calls its own header, called 'header- anesthesia'. No surprises there. So, the question is- how do I hard-code the call for "anesthesia-menu" in the 'header-anesthesia'... or is this even possible? Thanks for taking the time to attempt to help.


Adding style sheet to specific page

I have set a page as a homepage for my site. There are specific style sheets just for the homepage that I don't need to use globally. I'm still new to WordPress so this is so confusing to me. I have read http://codex.wordpress.org/Function_Reference/wp_enqueue_style but I still don't understand how to incorporate it in my page. Can someone please help me?


Want the visual style in wordpress

In my WordPress installation when I want to post something there are only html style to write. I see in video tutorial that a WYSIWYG editor should appear on the screen so I can write easily as I write in word processor. So seems the visual editor in missing from my post edit screen. How do I get that back?


Load child template based on parent

I have child page templates that need to be automatically applied based on the parent template. I'm wondering if there is anyway Wordpress handles this. This is the solution I came up with. (in page.php)               <?php      //Check parent template      if ($post->post_parent != $post->ID )     {         //Get parent template filename         $parentTemplate = get_post_meta($post->post_parent,'_wp_page_template',true);     }          switch ($parentTemplate) {         case 'about.php':             get_template_part( 'child_templates/content', 'about-child' );             break;         default:             get_template_part( 'content', 'page' );     }     ?>      **Edit** Function to apply parent template to child pages.               function switch_page_template() {         global $post;         // Checks if current post type is a page, rather than a post         if (is_page()){             $ancestors = $post->ancestors;                  if ($ancestors) {                 $parent_page_template = get_post_meta(end($ancestors),'_wp_page_template',true);                 $template = TEMPLATEPATH . "/{$parent_page_template}";                 if (file_exists($template)) {                 load_template($template);                 exit;             }             } else {                 return true;             }         }     }          add_action('template_redirect','switch_page_template');      Check if page is parent or child               function is_subpage() {         global $post;                              // load details about this page              if ( is_page() && $post->post_parent ) {   // test to see if the page has a parent             return true;             // return the ID of the parent post              } else {                                   // there is no parent so ...             return false;                          // ... the answer to the question is false         }     }      The template looks like this now               <?php     /*     Template Name: About Us     */     ?>          <?php get_header(); ?>          <?php if (is_subpage()): ?>         <?php get_template_part( 'templates/content', 'about-child' ); ?>         <?php else: ?>         <?php get_template_part( 'templates/content', 'about-parent' ); ?>     <?php endif ?>          <?php get_footer(); ?>


How to change Wordpress theme to one column?

Currently I'm using The Morning After Theme (http://theme.wordpress.com/themes/themorningafter/) It lists one-column as a feature, so how do I change it to one-column? The default is three columns.


Displaying posts with only upcoming dates according their custom field date value

I got posts that have starting date as a custom field value. I'm displaying few of those posts in my sidebar in ascending order so that the post with closest starting date is shown first. This is what I have and it works great:               <?php query_posts('&post_type=events&posts_per_page=5&meta_key=start_date&orderby=meta_value&order=asc'); ?><?php while ( have_posts() ) : the_post(); ?>
<?php the_title(); ?>      But I was wondering, how could I filter the query so that it won't display posts with their starting dates already gone? I've experimented with this:               $today = date('d/m/Y', strtotime('+2 hours'));           query_posts(array(           'post_type' => 'events',           'posts_per_page' => 5,           'meta_key' => 'start_date',           'orderby' => 'meta_value',           'order' => 'ASC',           'meta_query' => array(              array(              'key' => 'start_date',              'meta-value' => $value,              'value' => 'start_date',              'compare' => '>=',              'type' => 'CHAR'              )           )        ));      But it doesen't display anything. One thing to note is that the starting date value is saved in mm/dd/yyy -format, but changing the $today's date format haven't helped either. **UPDATE** So now I got this:                   <?php     $today = date('m/d/Y', strtotime('+2 hours'));     $the_query = new WP_Query( array(           'post_type' => 'events',           'posts_per_page' => 5,           'meta_key' => 'start_date',           'orderby' => 'meta_value',           'order' => 'ASC',           'meta_query' => array(     array(              'key' => 'start_date',     'meta-value' => 'start_date',              'value' => $today,              'compare' => 'DATE',              'type' => 'CHAR'     ))        ));     ?>      Nothing shows up in the sidebar. Note: the date is in that format since the posts are saved with the start_date custom field in that format. I'm just trying to get this work, then I'll change the date format to a more suitable one.


Changing the default WordPress search action

I recently completed a WordPress site design, and I'm just struggling with one bug: when a user clicks the "Search" button without any content in the text field, they are redirected to a list of posts. Is there a way to modify this action? Ideally, if the text field is empty, the user will be redirected to the homepage.


Wordpress settings API VS Table In Database?

I have created an options page for my plugin using Settings API. Now I want to create another tab where user will create records. He will also like to delete/edit records. There will be 10-20 records only. I want to stick with settings API for these records (Single field in database) but I am at a lose to decide if it is possible with settings API. If yes, can you guide me how as user will like to edit/delete records as well. Or should i opt for a table in database?


How to attach sidebar to shortcode's output?

I have one shortcode that should be always next to the sidebar:               // [shortcode] otuput | default sidebar       My theme allows me to set different sidebars for each page. So I have sidebars on a few pages, but not everywhere. What's the best/proper way of achieving this goal? I was thinking about adding `dynamic_sidebar($sidebar_name)` to the shortcode itself, but it doesn't seem to be smart idea (especially with multiple instances of my shortcode at the same page).


Wordpress Search Filter Only for Page with Child of Child of Child of Child of Child

after browsing question from this site I found the workaround for this:               function SearchFilter($query) {         if ($query->is_search) {             global $post;             $query->set( 'post_parent', 21 );         }         return $query;     }     add_filter('pre_get_posts','SearchFilter');      When I do this, its only search child of parent 21 not child of child of parent 21. Also, query_vars only accept single value for post_parent. any solution for this is highly appreciated. thanks


How can I show different image links for different languages with qTranslate?

I have a set of links, each with an image - how can I show different links depending on the language selected (using qTranslate) - the images have text on them.. At the moment I show these links using the rotating links widget. Are there any plugins to help with this? or do I need to resort to PHP?


Customizing wordpress default widgets?

Is there anyway to customize the default WordPress widgets or do i need to create my own? For example, I want my recent post widgets to display date aswell. Thanks in advance! /Richard


Remove "Next Post" in nav_menu

I am creating my custom navigation menu with background-images. The menu items have a title from the Page, and that title is displayed above my background image, which is not what I want because the image itself already contains the link text.               /* menu items */     function nav_menu_items($classes, $item) {          $classes[] = "item-". $item->attr_title;           return $classes;     }      add_filter('nav_menu_css_class', 'nav_menu_items', 10,2);          .item-myitem a {     background: url(someimage);     text-decoration: none;     width: 20px;     }      However in the HTML it is displayed as (background-image is OK)               Next Post      How do I remove that "Next Post"?