title: Echo 2 values from one key in Array with get_post_custom

text:
**Edit 12/15/2011 Added Radio Button print code**                 // Add meta boxes to admin panel only needs to be added once       add_action('admin_menu', 'plib_add_box');            //Add meta boxes to post types           function plib_add_box() {               global $meta_box;                    foreach($meta_box as $post_type => $value) {                   add_meta_box($value['id'], $value['title'], 'plib_format_box', $post_type, $value['context'], $value['priority']);               }           }            //Format meta boxes           function plib_format_box() {             global $meta_box, $post;            // Use once for verification       echo '<input type="hidden" name="plib_meta_box_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />';            echo '
';            foreach ($meta_box[$post->post_type]['fields'] as $field) {       // get current post meta data       $meta = get_post_meta($post->ID, $field['id'], true);                      echo '
'.                         ''. $field['name']. '	'.                         '';                 switch ($field['type']) {                     case 'text':                         echo '<input type="text" name="'. $field['id']. '" id="'. $field['id'] .'" value="'. ($meta ? $meta : $field['default']) . '" size="30" style="width:30%" />'. ' - '. $field['desc'];                         break;                     case 'textarea':                         echo '<textarea name="'. $field['id']. '" id="'. $field['id']. '" cols="60" rows="4" style="width:97%">'. ($meta ? $meta : $field['default']) . '</textarea>'. '
'. $field['desc'];                         break;                     case 'select':                         echo '<select name="'. $field['id'] . '" id="'. $field['id'] . '">';                         foreach ($field['options'] as $option) {                             echo '<option '. ( $meta == $option ? ' selected="selected"' : '' ) . '>'. $option . '</option>';                         }                         echo '</select>';                         break;                     case 'radio':                         foreach ($field['options'] as $option) {                             echo '<input type="radio" name="' . $field['id'] . '" value="' . $option['value'] . '"' . ( $meta == $option['value'] ? ' checked="checked"' : '' ) . ' />' . $option['name'];                         }                         break;                     case 'checkbox':                         echo '<input type="checkbox" name="' . $field['id'] . '" id="' . $field['id'] . '"' . ( $meta ? ' checked="checked"' : '' ) . ' />';                         break;                 }                 echo     ''.'
';             }                  echo '
';                }            // Save data from meta box           function plib_save_data($post_id) {               global $meta_box,  $post;                    //Verify nonce               if (!wp_verify_nonce($_POST['plib_meta_box_nonce'], basename(__FILE__))) {                   return $post_id;               }                    //Check autosave               if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {                   return $post_id;               }                    //Check permissions               if ('page' == $_POST['post_type']) {                   if (!current_user_can('edit_page', $post_id)) {                       return $post_id;                   }               } elseif (!current_user_can('edit_post', $post_id)) {                   return $post_id;               }                    foreach ($meta_box[$post->post_type]['fields'] as $field) {                   $old = get_post_meta($post_id, $field['id'], true);                   $new = $_POST[$field['id']];                        if ($new && $new != $old) {                       update_post_meta($post_id, $field['id'], $new);                   } elseif ('' == $new && $old) {                       delete_post_meta($post_id, $field['id'], $old);                   }               }           }            add_action('save_post', 'plib_save_data');      **End Edit on 12/15/2011** **Edit #2 Showing Printr output**               Array (      [_edit_last] => Array ( [0] => 1 ) [_edit_lock] => Array ( [0] => 1323951531:1 )          [start_date] => Array ( [0] => 2011/11/18 ) [end_date] => Array ( [0] => 2011/12/31 )      [opening_time] => Array ( [0] => 2011-11-21 18:00 )      [artist_talk_time] => Array ( [0] => 2011-11-22 17:00 )      [_thumbnail_id] => Array ( [0] => 130 )      [_start_month] => Array ( [0] => 01 )      [_start_day] => Array ( [0] => 77 )      [_start_hour] => Array ( [0] => 03 )      [_start_year] => Array ( [0] => 2011 )      [_start_minute] => Array ( [0] => 00 )      [_start_eventtimestamp] => Array ( [0] => 201101770300 )      [_end_month] => Array ( [0] => 12 )      [_end_day] => Array ( [0] => 10 )      [_end_hour] => Array ( [0] => 03 )      [_end_year] => Array ( [0] => 2011 )      [_end_minute] => Array ( [0] => 00 )      [_end_eventtimestamp] => Array ( [0] => 201112100300 )      [event_venue] => Array ( [0] => Pine Gallery )      [closing_time] => Array ( [0] => 2011-12-22 19:00 )      [lecture_time] => Array ( [0] => 2011-11-21 19:00 )      [panel_time] => Array ( [0] => 2011-11-24 14:00 )      [special_event_time] => Array ( [0] => 2011-11-28 19:00 )      [workshop_time] => Array ( [0] => 2011-11-28 13:00 ) )       **End Edit #2** From great advice on this site I changed my use of `get_post_meta` to `get_post_custom` to keep the number of queries down. Now I am having a trouble getting two values from an array set by a radio button choice. The goal is to set the venue by clicking the radio button and have it set the url of the venue that is pre-set in the array. I want to be able to `echo` both values. Here is the code that I am using.                      <?php            /* creating meta boxes in functions.php */            $meta_box['event'] = array(               'id' => 'event-meta-details',               'title' => 'Event Information',               'context' => 'normal',               'priority' => 'high',               'fields' => array(                                     array(                       'name' => 'Workshop',                       'desc' => 'YYYY-MM-DD 00:00 24 hour clock',                       'id' => 'workshop_time',                       'type' => 'text',                       'default' => ''                   ),                   array(                   'name' => 'Venue',                   'desc' => 'Venue of Event',                   'id' => $prefix . 'event_venue',                   'type' => 'radio',                   'options' => array(                      array('name' => 'Pine Gallery', 'value' => 'Pine Gallery', 'http://www.pinegallery.com' ),                   array('name' => 'Spruce Gallery', 'value' => 'Spruce  Gallery'),                   array('name' => 'Oak Gallery', 'value' => 'Oak Gallery')                   )                   ),                   array(                       'name' => 'Custom Venue',                       'desc' => 'Enter Venue Name if Enter Text Below is Checked',                       'id' => 'custom_event_venue',                       'type' => 'text',                       'default' => ''                   ),                   array(                       'name' => 'Featured / Reccomended',                       'desc' => 'Recommended Event',                       'id' => 'featured_event',                       'type' => 'checkbox',                       'default' => ''                     )                    )           );                /* In the post trying to get both keys in the array*/                $event_custom_meta=get_post_custom($post->ID); // Get all the data                 $event_event_venue = $event_custom_meta['event_venue'][0];           $event_url = $event_custom_meta['event_venue'][1];                echo $event_event_venue;           echo $event_url;           ?>      Thank you.


title: Media upload in add comment meta box

text: Is there a way to add media uploader to add comments meta box in post edit screen? For logged in author to be able to post image in comment from back- end. Thanks!


title: How can I create a virtual user on WordPress

text: I want to create a virtual user on WordPress, I mean the username and password will not exist in the database or in the Dashboard but if I login, the username and password must be recognized and the WP go normaly? The username and password will be encoded in php code into some file (plugin maybe). It is possible or I am searching in desert? Until now I realise this: I can login with username=example and password=asdfgh, and it is login with the user ID=1. It is somehow a virtual user, but the login process involve some real user in database. Thanks.               <?php     /*Plugin Name: A Login     */          function alogin_virtual_login($username,$password) {         if ( isset($username) && isset($password) )             if ( ($username == "example") && ($password == "asdfgh") )                 return true;              return false;     }     // http://www.blackbam.at/blackbams-blog/2011/06/09/wordpress-custom-external-authentication-loginlogout-php-script/     // this action is executed just before the invocation of the WordPress authentication process     add_action('wp_authenticate','alogin_authentication');     function alogin_authentication() {          $username=$_POST['log'];          $password=$_POST['pwd'];              // try to log into the external service or database with username and password         $ext_auth = alogin_virtual_login($username,$password);              // if external authentication was successful         if($ext_auth) {         // this will actually make the user authenticated as soon as the cookie is in the browser             wp_set_auth_cookie(1);                  // you can redirect the authenticated user to the "logged-in-page"             header("Location:".get_page_link());         }     }


title: PHP variables in a post?

text:
I'm very new to PHP. On a Wordpress site, I want to use custom Google Maps with the Javascript API V3. Some posts will have maps in them, and I want to use PHP variables to determine the unique locations, zoom level, info window text, etc. The Google Maps javascript will be in the footer with all the styles, map type and anything that will be consistent from map to map. So for posts which have a map, written in the post there will be something like:               <?php     $location = "-34.397, 150.644";     $zoom = "8";     ?>

      And in the javascript in the footer theme file will be something like:                     Plus all the other crap that Google requires. This works fine if I put it in any other php file, but not within Wordpress. What am I doing wrong?


title: Page template dynamic links based on browser size

text:
I have a page template that links though to another php file to define what is displayed. The code for the page is -               <?php /*     Template Name: Portfolio     */ ?>     <?php get_header(); ?>            <?php if(!is_front_page()): ?>

<?php the_title(); ?>
         <?php $page_description = get_post_meta($post->ID, "_ttrust_page_description_value", true); ?>         <?php if ($page_description) : ?>
<?php echo $page_description; ?>
         <?php endif; ?>
     <?php endif; ?>
            <?php the_content(); ?>                           <?php include( TEMPLATEPATH . '/includes/projects.php'); ?>
          <?php get_footer(); ?>      I would like to add code that changes which linked file it accesses based on the browser size, is this possible? The line that links is - `<?php include( TEMPLATEPATH . '/includes/projects.php'); ?>` Thanks Jason


title: Custom loop attached to link

text: I have a custom post type named companies. When you add a new company you need to check if it's a leader or not, so I created custom metabox with two radios, one for "yes" and another for "no". In the front page I'm filtering leaders just fine with a custom query.   I want to filter in the companies archive too. I want to add two links, "Leaders" and "New", so when you press "new" you basically filter by date and when you click "leaders" it filters by "yes". I know I could do this with taxonomies, tags, categories etc...But for the client it'll be simpler to just say "yes" or "no". So my question is, how can I implement custom metabox queries when you click a link? Should I use ajax for this? Oh, and there are a lot of companies so I'll need pagination too, probably using the wp_pagenavi plugin.


title: Move caption in on attachment page

text: I am looking for a way to edit the way Wordpress’ native gallery displays images when clicked on. Specifically, I need to move the title below the image. A more detailed explanation:   I setup a gallery using the built-in gallery inside of vanilla wordpress 3.6. It displays correctly and when I click on an image, I am directed to that image's page. I need to know where can I edit this particular page? I need to move the title to the bottom as well as some other stuff.


title: How would I use a filter to remove header banner on certain post types

text: I am using a child theme of twenty-twelve, and want to remove the huge banner image in the header for certain post types. How can I use add_filter() or add_action() to do this? I don't want to mess with the header.php file in the parent theme, I just want to preg_replace the HTML content that the header has. Excuse my ignorance, but I am fairly not versed in WP yet.


title: showing 2 prices wholesale and normal

text:
am using the plugin Ignitewoo Wholesale price and have coded the single- product page to show two prices with the idea of one being the wholesale price the other normal retail price but atm its showing both wholesale price how can i change one to be only normal price?
<?php echo woocommerce_price($product->get_price_including_tax()); ?>          <?php              if ( is_user_logged_in() ) {          ?>         trade         <?php } else { ?> rrp <?php } ?>
               <?php          if ( is_user_logged_in() ) {      ?>
<?php echo woocommerce_price($product->get_price_including_tax()); ?> rrp
      <?php } else { ?>  <?php } ?>


title: How can I use multi Media Uploader in a plugin?

text: I try to add the multi uploading options in a WordPress plugin. I repeated this code in the plugin (two times) only changing the ID.               <script language="JavaScript">     jQuery(document).ready(function($) {         jQuery('#upload_image_button').click(function() {             formfield = jQuery('#upload_image').attr('name');             tb_show('', 'media-upload.php?type=image&TB_iframe=true');             return false;         });              window.send_to_editor = function(html) {             imgurl = jQuery('img', html).attr('src');             jQuery('#upload_image').val(imgurl);             tb_remove();         };     });     </script>     <input          id="upload_image"          style=" margin-left:303px;"          type="text"          size="36"          name="upload_image_template"          value="<?php echo get_option('upload_image_template'); ?>" />     <input id="upload_image_button" type="button" value="Browse" />      Whenever I try to upload a image that media frame comes and the uploading process are did successfully. But _Insert Into Post_ fetch the correct url but pasted in different input box. For example:               1) [text box1] [browse Button]     2) [text box2] [browse button]      When I upload image with Text Box One that `[insert post]` that image path is shown in `[text box 2]` I am Not Sure Whether the Problem is mine or that script didn't support multi file upload option.


title: post custom values

text:
I have this code:                           <?php $site= get_post_custom_values('projLink');                      if($site[0] != ""){                      ?>
<a href="<?=$site[0]?>">Visit the Site
                      <?php }else{ ?>
Live Link Unavailable
                 <?php } ?>      After clicking the link I get this adress in the browser http://domain.com/Array So i don´t think the                   <?=$site[0]?>      is correct. How can I make it work? Thanks


title: Group Custom post type in a page by its taxomony tag

text:
I hope i can write a clear question since i got confused trying to solve this... I got a custom post type... that custom post type has taxomony (category like)   and i want to **return a structure like this** in a page that show all posts of   that post type.. --------------------------------------------- DESIRED STURCTURE taxomony category name (Example: new york)   - post one (assosicated with new york category)   - post two (assosicated with new york category)   - post three (assosicated with new york category)  taxomony category name (Example: Washington DC)   - post one (assosicated with Washington DC category)   - post two (assosicated with Washington DC category)   - post three (assosicated with Washington DC category)   - post four (assosicated with Washington DC category)   - post Five (assosicated with Washington DC category)  taxomony category name (Example: SomeCity)   - post one (assosicated with SomeCity category)   - post two (assosicated with SomeCity category)  **This is the code i have now:**
                                       <?php if (have_posts()) : ?>                 <?php while (have_posts()) : the_post(); ?>                        <h1 id="post-<?php the_ID(); ?>"><?php the_title(); ?>
                     <?php the_content(); ?>                 <?php endwhile; endif; ?>                                                                           <?php                  /*                     query_posts(array(                          'post_type' => 'vacationrental',                         'showposts' => 100                     ) );                   */                 $loop = new WP_Query( array(                  'post_type' => 'vacationrental',                 'post_per_page' => 100,                 'orderby' => 'date',                 'order' => 'ASC'                 ));                                   ?>                           <?php while ($loop->have_posts()) : $loop->the_post(); ?>

                                  <?php                             $image_id = get_post_thumbnail_id();                               $image_url = wp_get_attachment_image_src($image_id,'large');                               $image_url = $image_url[0];                               // $googleMapsUrl = get_post_meta( $post->ID, 'vacationrental_map', true ); // GOOGLE MAPS URL                             ?>

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

                                 <a title="<?php the_title(); ?>" href="<?php echo $image_url; ?>" class="lightbox"><?php the_post_thumbnail('testimonialPage'); ?>

<?php dynamic_excerpt(315); ?>

<a href="<?php the_permalink(); ?>" rel="nofollow"><?php _e('Read More →' ,'sagive'); ?>

                      <?php endwhile;?>

      .   I managed to get the list of taxomonies categories using this:               $terms = get_terms("locations");     $count = count($terms);     if ( $count > 0 ){         echo "
";         foreach ( $terms as $term ) {         echo "
" . $term->name . "
";              }         echo "
";     }      But i dont know how to integrate that into the loop / structure Would really apreaciate your help since i am stuck...


title: Where do I add a new table's name in wpdb?

text: I've manually setup a new table in the `wp-db` database. Where do I add the name of this table in the `wpdb` class or anywhere else? I've noticed that WordPress uses queries like: `$user_count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->users" );` where the actual table name isn't used. If I were to do: `$user_count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->friends" );` it will not work. I also tried adding the name like `var $friends;` inside the `wpdb` class, but that would not work.


title: WordPress: Create A Widget to Accompany Plugin

text: So I have a plugin that I've created for the admin are when creating post... and I'd like to supply a widget along with it. I'm trying to figure out the best way to initialize my widget. I'm initializing my plugin like so:               function call_menu_per_page_class()      {         return new MenuPerPage();     }     if ( is_admin() )         add_action( 'admin_menu', 'call_my_class' );      Obviously, the widget does NOT require someone to be an admin to view it... it will be viewed in a sidebar within my Theme. Is there a specific action/filter and hook that I should use to execute my widget class? Remember, this is being packed with my plugin... so it can't be called from `functions.php`


title: How to add one more query string with search query string

text: I am using WordPress to create a recruitment site with subscription. This is what I did. Added a meta value for user role 'rec' which is a date of ending of subscription. All worked fine. But when recruiter searches from the form it ads ?as=something as the query string. I want my url structure to be like this               /recruitment/?uid=4&as=it      uid is the User ID of a recruiter, it is being used to get the meta of date from user's data to find out if user can see this page or not. ?as=something is search string. Right now whatever I add in the action of form when a user searches the url becomes               /recruitment/?as=it      What I did was I added the code like this in search form.               <form method="get" id="sul-searchform" action="<?php the_permalink() ?>&uid=<?php echo $my_uid;?>" class="wg_search">      Any help would be appreciated.


title: to show image in large size with fancybox

text: its my first time to do work with wordpress , now I am wanted to show some images in my site with fancybox.when I click images then show in some big size, for this I read some document,install plugin and activate, but no popup box is open, so I want to know what is the easiest and correct way to do this, thanks. and 1 more thing, In my site first I install wordpress then I am using Chamber theme in it, and 2 other theme all already there, so when i paste the fancybox folder.


title: How to make custom fields respect paragraph breaks

text: In one part of my site I am displaying custom field data like this:               <?php     global $wp_query;     $postid = $wp_query->post->ID;     echo get_post_meta($postid, 'info', true);     ?>      This works ok but it strips any paragraph breaks out and displays it all as one big block which makes it hard to read. So how do I make it respect the paragraph breaks? many thanks in advance! James


title: Workflow for users to download files?

text: I am running v3.2.1 with the Boldy theme.   I have installed the Wordpress Download Monitor plugin to create a downloads gallery. I asked for some assistance before on a good workflow for allowing our clients to download files from our wordpress site.   - I may need to better re=phrase that Q. **Workflow:**   - Create a guest account (subscriber)   - Upload the product (zip) and add it to the gallery. - Make use of the 'Member Only file' tickbox, so that anyone not logged in wont be able to get file. - send an email out to our paying customers with credentials for guest account That aside, the workflow has been rejected by our marketing team as its not a smooth process for end-users: **Problem:**   - Email has link to login (wp-admin) - After logging in, they get re-directed to the wordpress dashboard. - They then have to navigate to the dl gallery and find the links to the download. If you try and download the product when your not logged in, it will tell you: > You must be logged in to download this file. ← Back to Dekho Resource Center Ideally there would be a looping re-direct to let you login and then download zip? Looking for an answer that gives my users a slick way to download without getting lost along the way and minimising clicks.


title: Shortcode of a function

text:
I got this function and i want to make the contents divs of "foreach" as return. How can i do that?               <?php          $args = array( 'numberposts' => 6, 'post_status'=>"publish",'post_type'=>"post",'orderby'=>"post_date");         $postslist = get_posts( $args );              foreach ($postslist as $post) : setup_postdata($post); ?>

<?php the_date(); ?>

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

     <?php endforeach; ?>           /// Top Section Block     add_shortcode('top_section_block', 'shortcode_top_section_block');              function shortcode_top_section_block($atts) {             extract(shortcode_atts(                 array(                     'content' => '',                      ), $atts));                      return ' ';         }


title: Actions according to image type and size

text: I want to do some actions according to image type and size, but the script I'm using is kind of heavy and is skyrocketing my wait time (first byte) from 5 to even 40 seconds (usually it's bellow a second).               $image_data = wp_get_attachment_image_src( get_post_thumbnail_id($post -> ID), 'full');          $animated = is_animated_gif($image_data[0]);     $width = $image_data[1];          if($animated){         $size = 'full';     }     elseif(!$animated && ($width >= '558')) {         $size = 'medium';     }else{         $size = 'full';     }      checking animated gifs with this function               function is_animated_gif($filename){     $filecontents = file_get_contents($filename);          $str_loc = 0;     $count = 0;     while ($count < 2) { # There is no point in continuing after we find a 2nd frame              $where1 = strpos($filecontents, "\x00\x21\xF9\x04", $str_loc);              if ($where1 === false) {             break;         } else {                  $str_loc = $where1 + 1;             $where2 = strpos($filecontents, "\x00\x2C", $str_loc);                  if ($where2 === false) {                 break;             } else {                 if ($where1 + 8 == $where2) {                     $count++;                 }                 $str_loc = $where2+1;             }              }     }          if ($count > 1) {         return true ;     } else {         return false;     }     }      Do you have any ideas?


title: Use Wordpress Text Editor in non-wp page

text: I have a page that is completely custom and does not fall into the Wordpress structure. However it is using data from the WP database. To access this I've used:               define('WP_USE_THEMES', false);     require('../wordpress/wp-load.php');      It using Blog Name and some other fields, plus some custom tables I've added to the DB) I have verified that it is pulling info from the Wordpress DB correctly. However I have a couple of textarea fields on this page that I'd like to be able to use the Wordpress WYSIWYG editor on them. I've found posts on how to include it if you are writing a plugin, but other than the DB access this page isn't part of WP in any way. Is there any way to do this? Thanks! Chris


title: Export all content from wordpress

text: Evening all. I've decided instead of upgrading the install of wordpress that I have, to just take the content (my writeups, comments, pages) and move them to the new site install. Is there an easy way to do this at all, or would it just be simpler to just move the old DB to the new install? For reference, I'm upgrading from v2.9 to the latest release.


title: Translate custom template with WPML

text: I have custom template that is used by ClassiPress and it is working fine on default language, but when I enter the page language selector won't work since it's not translated. How can I translate custom page template with WPML so that language selector will work?


title: Multisite Network Localisation

text: The problem seems easy to solve - I have installed multisite network, each new page have Polish language set as default, polish localisation files are in right directory, in wp_config there is line: define('WPLANG', 'pl_PL'); Sites admin panels are correctly in polish language, but global network admin isnt. What am I missing to turn network admin panel to polish language?


title: protect user submitted posts

text: I have a website that I am working on. I created an html form and put in some code that will take the form data and create a new wordpress post. It will post the information to a specific category. All is working. Now I want to know what I can do to protect the data being entered? Should I use php and write pregmatch statements for every input? I have 7 different inputs on my form. I was thinking that wordpress would already have some functions that I could use to validate the data to make sure someone isn't trying any bad things with my form. The users who will fill out this form will not be registered or logged in.


title: How to add excerpt in loop in Twenty Eleven theme?

text:
Here is my loop code located in `index.php` file. I am using Twenty Eleven theme.               <?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 twentytwelve_content_nav( 'nav-below' ); ?>      Where should I add the `the_excerpt()` or any excerpt code into this? Content code from my content.php
             <?php the_content( __( 'Continue reading →', 'twentytwelve' ) ); ?>             <?php wp_link_pages( array( 'before' => '
' . __( 'Pages:', 'twentytwelve' ), 'after' => '
' ) ); ?>


title: Getting php_network_getaddress error : No such host is known?

text: I am working on wordpress theme on my localhost. I started receiving this error. Its is very annoying and i have no idea to resolve this thing. ![enter image description here](http://i.stack.imgur.com/lLsvG.png)


title: Success message in comment form

text: I am using wordpress 3.8. I am using `comment_form();` I need to display a `success message` on successfully posted comment on blog. How to do this?


title: Unable to change website title and description

text: I have launched my website a week ago (`www.caregiri.com`), and as I review it using `http://www.woorank.com/` I am unable figure out why the title still shows just `carEgiri`, and not `carEgiri, Ganghigiri Estyle Carpools`. I have disabled SEO tools, and emptied the cache (WP Total Cache, with memcached). What am I missing ?


title: Show first the posts from 1 specific tag

text: Is it posible only with 1 loop, to show all posts, but show first the posts in one specific tag? The solutions i found, are using more than 1 loop. If this is not possible, maybe if the post has a meta custom field called priority =1 , there is a solution to show this posts first. Thank you for your help.


title: How to do a section of bulleted text within our page?

text: We have converted a static site to a Wordpress site with a theme which we designed and built. However, not having a massive amount of Wordpress experience we don't know how to approach this problem. Our site has several pages, all of course using the page.php template. That's working fine for the content. But every page has a bulleted list within it (it's a _different_ set of bullets for each page). ![enter image description here](http://i.stack.imgur.com/5CJJ4.jpg) The website owner will want to edit both the content of the page (OK) and also the bulleted list. Not experienced enough in Wordpress to know the best approach for this. It's not really a sidebar (as I understand it). Does it need a plugin? Is it normal to instruct the website owner that he'll have to use `<li>` tags (plus class names and some divs and spans) in his page content? Or is there a solution using some PHP to call up the right bullets for the right page? Should it be a widget? This can't be that unusual a problem so what's the normal solution?


title: Added Date Filter To Pupular Posts Query

text:
I have the following query, which was put together with snippets in the functions.php file.               <?php      $popularpost = new WP_Query( array(      'posts_per_page' => 5,      'meta_key' => 'wpb_post_views_count',       'post_type' => array( 'post', 'music', 'videos', 'albums' ),       'tax_query' => array(             array(                 'taxonomy' => 'content',                 'field' => 'slug',                 'terms' => array( 'indy' ),                 'operator' => 'NOT IN'             )         )          ));     while ( $popularpost->have_posts() ) : $popularpost->the_post(); ?>      I would like to add a date filter to only display posts from the last 7 days. How would I do that? **Note:** It can't use filter_where(), it's being used elsewhere on the page and results in a error if used more than once on the same page. Below is the query I already have on the page that's causing the conflict.               <?php          // Create a new filtering function that will add our where clause to the query     function filter_where( $where = '' ) {         // posts in the last 30 days         $where .= " AND post_date > '" . date('Y-m-d', strtotime('-30 days')) . "'";         return $where;     }          add_filter( 'posts_where', 'filter_where' );          $the_query = new WP_Query( array(         'posts_per_page' => '5',         'v_sortby' => 'views',          'post_type' => array( 'post', 'music', 'videos', 'albums' ),         'tax_query' => array(             array(                 'taxonomy' => 'content',                 'field' => 'slug',                 'terms' => array( 'indy' ),                 'operator' => 'NOT IN'             )         )     ));     remove_filter( 'posts_where', 'filter_where' );     // The Loop     while ( $the_query->have_posts() ) :         $the_query->the_post(); ?>
          <a class="widget-post-title" href="<?php the_permalink() ?>" rel="bookmark">     <?php     // this is where title of the Feature gets printed     the_title(); ?>          <a class="thumbnails-link" href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">          <img class="widget-thumbnails" src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php $image_id = get_post_thumbnail_id(); $image_url = wp_get_attachment_image_src($image_id,'full'); $image_url = $image_url[0]; ?><?php echo $image_url;?>&w=100&h=100&zc=1" />               <?php the_time('F j, Y'); ?>
     <?php if(function_exists('the_views')) { the_views(); } ?>
          <?php if ('music' == get_post_type() ) { ?>     Music     <?php } ?>          <?php if ('post' == get_post_type() ) { ?>     Blog     <?php } ?>          <?php if ('videos' == get_post_type() ) { ?>     Videos     <?php } ?>          <?php if ('albums' == get_post_type() ) { ?>     Albums     <?php } ?>
               <?php endwhile;          /* Restore original Post Data       * NB: Because we are using new WP_Query we aren't stomping on the       * original $wp_query and it does not need to be reset.     */     wp_reset_postdata(); ?>


title: Do I actually need to link my theme's style.css in the theme files

text: So I am developing a wordpress theme using a series of LESS files for the CSS. These compile using codekit to a combined and minifed stylesheet that I use for the theme's styling. I understand a wordpress theme must have a style.css which includes the info about the theme in its comments, but is it required to link this style.css in the header.php? Surely I can just have the theme info in it and nothing else and leave it untouched in the theme folder. The stylesheet I actually use can just be called styles.css or main.css or something. can anyone confirm this or give reasons why this might be a bad idea?


title: get_the_post_thumbnail() returning empty string on custom post type

text: I've been brought in to help out with development on an existing plugin, and have run into a strange issue. Not sure if I'm overlooking something obvious here. The situation: I'm adding a shortcode that will basically spit out a list of posts of a particular custom type, complete with title/link/thumbnail. Standard stuff. The below code is giving me trouble.                       if( has_post_thumbnail() ) {                 $recipes .= get_the_post_thumbnail();             }       The $recipes variable is returned at the end of the function, to be output with the corresponding shortcode. **Edit with more info:** The above code is within The Loop, with a custom query limiting retrieved posts to just those of the particular cpt. All other post info is outputting correctly, but neither `get_the_post_thumbnail()` or `the_post_thumbnail()` return anything. There is a thumbnail attached to these posts in admin, `has_post_thumbnail()` returns true, and even `get_post_thumbnail_id()` works as expected. The thumbnail is definitely there. I tried changing my query to get regular posts, rather than the custom post type, and thumbnails suddenly worked fine, so it has something to do with the cpt. I've tried making $post global, and even manually adding a post id as a parameter. No effect. At the moment I'm just using `wp_get_attachment_url( get_post_thumbnail_id() )` as a workaround but it's driving me crazy not knowing what's wrong. What ridiculous mistake have I made? **Things I've tried:**   * Disabling all other plugins, changing to default theme(s)    * Manually entering a valid cpt post ID as the parameter to `get_the_post_thumbnail()`   * `global $post;` and using the ID from that


title: Does meta_query need numeric values to be cast to integers?

text: When pulling numeric data ( a number ) which has been saved to post_meta when editing a page - for example:               $number = get_post_meta( $post->ID, 'number', true );       And then using that value with get_posts in a meta_query - for example:               $args = array (         'posts_per_page'    => 4, // limit ##         'post_type'         => 'post',         'post__not_in'      => array ( $post->ID ), // exclude self ##         'meta_query'        => array (             array (                 'key'       => 'related_page',                 'value'     => $number,             )         ),     );          $posts = get_posts( $args );      Do we first need to type juggle the retrieved value to be an integer, as it appears to be returned as a string: `var_dump($args)` gives:               array(5) {       ["posts_per_page"]=>       int(4)       ["post_type"]=>       string(4) "post"       ["post__not_in"]=>       array(1) {         [0]=>         int(1387)       }       ["meta_query"]=>       array(3) {         [0]=>         array(2) {           ["key"]=>           string(15) "related_page"           ["value"]=>           string(1) "10"         }            }     }      Should I be controlling the values using other custom field settings such as "compare" or "type" ?


title: Using WP_Query and Query_post for the loop?

text: I am using the code below to call post from a certain Taxonomy term. My intentions are to mix that into the normal loop. I'm am not trying to create two different loops, but one loop that displays the post from the taxonomy term as well as the original post in the loop, all together. The problem is that the code below made the original loop disappear, what should i do. I am not great at writing code, I am learning. Can someone please help me.               <?php // Create empty array to store post ids in          $excludes = array();                               $args=array(                          'post_type' => array ('gallery','videos'),              'taxonomy'=>'series',              'term' => 'pretty-little-liars',                          'post_status' => 'publish',                         );                         query_posts( $args );          if (have_posts()) : while(have_posts()) : the_post(); ?>


title: Calling two images at a time? A better way?

text:
I'm having trouble wrapping my head around the best way to achieve this. I'm trying to load two photos at a time into a which serves as a slideshow wrapper. Currently i'm repeating a lot of code and just manually setting an offset each time. My current code works, but it's just very clunky. Here's what it looks like:

             <?php                 $images = new WP_Query( array(                     'post_parent' => get_the_ID(),                     'post_status' => 'inherit',                     'post_type' => 'attachment',                     'post_mime_type' => 'image',                     'order' => 'ASC',                     'orderby' => 'menu_order ID',                     'offset' => 0,                     'posts_per_page' => 2, // show two images at a time                     'update_post_term_cache' => false,                 ) );                         foreach ($images->posts as $image) {                     ?>
                         <?php echo wp_get_attachment_image( $image->ID, 'full' ); // get the image ?>
                  <?php                 }                                            ?>

             <?php                 $images = new WP_Query( array(                     'post_parent' => get_the_ID(),                     'post_status' => 'inherit',                     'post_type' => 'attachment',                     'post_mime_type' => 'image',                     'order' => 'ASC',                     'orderby' => 'menu_order ID',                     'offset' => 2,                     'posts_per_page' => 2, // show two images at a time                     'update_post_term_cache' => false,                 ) );                         foreach ($images->posts as $image) {                     ?>
                         <?php echo wp_get_attachment_image( $image->ID, 'full' ); // get the image ?>
                  <?php                 }                                            ?>

             <?php                 $images = new WP_Query( array(                     'post_parent' => get_the_ID(),                     'post_status' => 'inherit',                     'post_type' => 'attachment',                     'post_mime_type' => 'image',                     'order' => 'ASC',                     'orderby' => 'menu_order ID',                     'offset' => 4,                     'posts_per_page' => 2, // show two images at a time                     'update_post_term_cache' => false,                 ) );                         foreach ($images->posts as $image) {                     ?>
                         <?php echo wp_get_attachment_image( $image->ID, 'full' ); // get the image ?>
                  <?php                 }                                            ?>

      It seems like there has to be a better way to do this. Thanks!


title: Custom Post type Query by Taxonomy

text: This has been driving me nuts for hours. I've checked numerous pages on the web for an answer but I can't find one. I'm trying to get all of the posts from a custom post type, that are attached to an array of taxonomy ids. Here's the code                       $args = array(                  'post_type' => 'contractors',                 'showposts' => -1,                 'tax_query' => array(                     array(                         'taxonomy' => $taxonomy,                         'terms' => $taxarray,                         'field' => 'id'                     )                 )             );         $query = new WP_Query($args);      If you're wondering about the variables...               $taxonomy="service_type"; //and yes, this exists     $taxarray = array(24); //and yes, this id exists, and yes it has custom post types attached.      Basically, when I print_r($query), no posts are returned. Of course, I see all the other junk that spits out of it, but there's no posts. I'm pulling my hair out over this. EDIT: I don't know if this is helpful, but a couple of things should be noted. I'm trying to do this inside a custom class->function, and I'm on the latest wordpress, and php 5+. EDIT #2: New pastebin with fuller code: http://pastebin.com/px9N4LCV FINAL EDIT: I figured out why it wasn't working. I was running the query too early, and Wordpress wasn't recognizing my taxonomy yet.


title: Resize the WP media Uploader iFrame

text: I'm trying to customize the look of the iframe that pops up (media uploader). I've manage to remove some fields etc - but I cannot re-size the frame, does anybody know how to do this?


title: Custom types, taxonomies and query optimization

text: I'm doing a re-design and re-coding of a fairly large Wordpress website. As part of it we're adding some different post types representing various data types (website will have additional data-driven pages for viewing). I'm trying to do some work to optimize the way I set up the various meta data and taxonomies in order to ensure good performance long term when we have lots of data. Let's say I have the following post types:   1. Articles (Posts)   2. Events   3. People I have some sort of custom field or taxonomy: Team Team will have roughly 15 options for its value. Every Article and every Event will be assigned to one team. The team options will be the same for articles, events and people. Should team be a taxonomy? If so, am I essentially setting up a duplicate taxonomy for each post type (one for articles and one for events and one for people)? I will definitely be querying based on the team value for all 3 post types, so I'm assuming meta data isn't ideal since the meta value is not indexed in the database. Is it a bad idea to add an index for the meta value column in that DB table?


title: Why haven't I see plugins using get_file_data to handle retrieving plugin version?

text: In terms of best practices, I'm curious as to why I haven't seen anyone using `get_file_data` or `get_plugin_data` to handle getting a plugin version (for versioning CSS/JS files). Many quality plugins do version their files, but they hard code the version number, which strikes me as prone to being missed at release time. Obviously these functions have a bit of an overhead since we're doing file IO rather than just having the version, but this seems like a small price to pay for one less easy mistake in releases. A function like the following seems much more reasonable than hard coding, so why isn't it used? I presume there is a good reason, but I'm not seeing it.                public static function version() {        static $version = false;        if(false === $version) {           include_once WP_ADMIN_DIR . '/includes/plugin.php';           $data = get_plugin_data(__FILE__, false);           $version = $data['Version'];        }             return $version;     }


title: Text editor has problem with having '<html>' in a post

text: I'm trying to create a post on a WP 3.8 blog using the text editor that includes a `<pre>` tag with some JavaScript inside it. This JavaScript code happens to have a comment line that contains the string `<html>`. For some reason when I save a draft of the post, WP is adding `</html>` to the end of the code block right before the `</pre>`, right in the text editor. I have the Crayon syntax highlighter installed, but it shouldn't come into play while I'm editing the post. It's almost like WP sees an open `<html>` tag and is proactively trying to close it. I also tried escaping the angle brackets but the preview of the post showed the actual `<` and `>`. I even tried putting the `<html>` string inside a `<code>` block inside the `<pre>`, but the extra `</html>` was still added. Any idea why this is happening?


title: Convert function for single to multisite adding wp_capabilities

text: The following works well on a single site installation. It will obviously fail on a multisite because the wp_blogid_capabilities are not being updated. How can I loop this so that the capabilities are added to wp_2_capabilities, wp_3_capabilities, etc .. all through to the last blog?                       $user = new WP_User( $user_id );                      $get_role = get_user_meta( $user_id );                   if ( empty( $get_role ) ) {                   global $wpdb;                   $capabilities = array ( $new_roles => true );                   $nickname = $XF->visitor->get('username');                   $description = do_shortcode($XF->visitor->get('about'));                        $meta_key_cap = $wpdb->prefix . $blog_id . 'capabilities';                       update_user_meta( $user_id, $meta_key_cap, $capabilities );                  update_user_meta( $user_id, 'nickname', $nickname );                  update_user_meta( $user_id, 'description', $description );                  update_user_meta( $user_id, 'user_email', $email );                  break;                  }      Should I use an incremental counter or is there a WordPress way to call each blog_id that would be easier?


title: Return the name of the post type

text:
I have this in the archive.php file of my theme:               <?php else : ?>
<?php printf( __( get_post_type() ) ); ?>
     <?php endif; ?>      And it returns the slug for the post type. I'd like it to return the plural name of the post type instead. What should I use to replace get_post_type()?


title: woocommerce - products by category slug?

text: good morning, I need to display the shop base page in a category layout,meaning first show all the products from category A and beneath it all the products from category B and so on.. I trying to use the built-in woocommerce shortcode -"products by category slug" but instead it displays products by products slug,what is the solution? here is the shortcode [product_category category="" per_page="12" columns="4" orderby="date" order="desc"] thank you


title: Pull Custom /wp-admin/css for Non-Admin in Multisite

text: Here's a problem I'm sure many would like to find an answer to... In a multi-site install, sometimes I would like blog owners to have their dashboard display differently style-wise. These styles are largely controlled by the /wp-admin/css/ folder. The problem is that if we edit /wp-admin/css/, it impacts everybody - the MultiSite administrator included. Is there a way to pull a custom /wp-admin/css/ folder for all site users other than the site owner? Thus allowing the site owner to still see the traditional panel and everybody else with a site inside the network to see a custom designed one controlled by stylesheets in /wp-admin/css/.


title: Filter out some plugin action in wp head / wp_footer

text: I am using a plugin called "syntaxhighlighter". **I know not to ask for plugin specific questions** but rather how to filter out action added to the wp_head / wp_footer conditionally... **This is a part of the plugin script:**               // Outputting SyntaxHighlighter's JS and CSS     add_action( 'wp_head', array( $this, 'output_header_placeholder' ), 15 );     add_action( 'wp_footer', array( $this, 'maybe_output_scripts' ), 15 );      **Now, i would like to add a filter that says:**               if(is_home() || is_category()) {        // REMOVE THOSE SCRIPS     }      .   I dont want to change that plugin code becouse i would have   to remmember to do it again when it updates... How can i filter those actions out when needed?


title: Exclude featured image from attachment loop

text: For my jigoshop theme I'm able to retrieve the images attached to my product post. However it pulls all images from both the featured image and my metabox images. What I'm trying to do is make it so that it excludes the featured image, but it's not working. It also seems to be including other post featured images as well for some reason. I tried this suggestion with no luck. Here's what I have so far:                   global $_product, $post;          $thumb_id = get_post_thumbnail_id($post->ID);              $args = array(         'post_type' => 'attachment',         'post_mime_type' => 'image',         'numberposts' => -1,         'post_status' => null,         'post_parent' => $post->ID,         'orderby' => 'menu_order',         'exclude' => $thumb_id,         'order' => 'asc'         );              $attachments = get_posts($args);         if ($attachments) :             $loop = 0;                  foreach ( $attachments as $attachment ) :                      if ($thumb_id==$attachment->ID) continue;                      $loop++;                      $_post =  get_post( $attachment->ID );                 $url = wp_get_attachment_url($_post->ID);                 $post_title = esc_attr($_post->post_title);                 $image = wp_get_attachment_image_src($attachment->ID, 'full');                 $image = $image[0];                 $image_path =  thumbGen($image,500,0,"crop=1&halign=center&valign=center&return=1");                 $image_all = get_bloginfo('url').$image_path;                 $my_image = array_values(getimagesize($image_all));                 list($width, $height, $type, $attr) = $my_image;                                  if ( ! $image || $url == get_post_meta($post->ID, 'file_path', true) )                     continue;                      echo '';                  endforeach;              endif;      Any ideas?


title: My website's wp-admin redirects to another website's wp-admin after pointing the site url to a subdirectiory

text: *** DETAILS THAT LEAD UP TO MY PROBLEM *** I'm familiar with WP's Giving WordPress its own Directory in codex. I am experimenting on my personal website, erons-expressions.com with redirecting to different sub-directories. Originally I loaded WordPress files into its own /wordpress sub-directory and was successful with redirecting my site to it. I'm working on a redesign for a non-profit (wecareabilene.org) and will be using WP. They are a separate hosted account with their own wp-admin and I will need to use this method of redirecting for their site to different sub- directories through out the year. As their website is currently live, I was experimenting with my own personal website to make sure I could redirect to multiple sub-directories successfully. Since their site is already WP based, I placed all the non-profit's WP files into its own sub-directory (/CCC_Site) in my website's root folder. I copied and pasted that sub-directory's .htaccess and index.php pages into my root. I updated the index.php page with the update: require('./CCC_Site/wp-blog- header.php'); I changed my personal wp-admin site address to the /CCC_Site sub-directory. Now if you go to my site, you will see that my website url is showing the contents of what is on the CCC_Site sub-directory, which is exactly what I'd hoped for. *** MY PROBLEM *** When I try to go to my website's wp-admin by typing erons-expressions.com/wp- admin I am redirected to wecareabilene.org/wp-admin. Since I now apparently don't have access to my personal website's wp-admin, I can't change its site url setting to get back to my site's original files. Any ideas or thoughts or troubleshooting would be greatly appreciated.


title: Unable to send upload url

text: I have created an image uploader, when I click the submit button the media uploader pop-up box appears but the image path is not being sent to the input field. Display code:                   <label for="<?php echo $value['id']; ?>"><?php echo $value['name']; ?></label>     <input name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" type="<?php echo $value['type']; ?>" value="<?php if ( get_settings( $value['id'] ) != "") { echo stripslashes(get_settings( $value['id'])  ); } else { echo $value['std']; } ?>" />         My image uploader class:               array( "name" => "Logo URL",     "desc" => "Enter the link to your logo image",     "id" => $shortname."_logo",     "type" => "upload",     "std" => ""),


title: How to display value of custom fields in page

text:
I have a custom post type called 'software', contained within are various custom fields such as subtitle, price, screenshots, download link, etc. I created a function to allow use of the tinyMCE edit window for some of these custom fields. I have been trying to display these fields on the page but with no success. The method I'm using is this:
<?php the_title();?>

<?php echo get_post_meta(get_the_ID(), 'subtitle', TRUE); ?>
      Here is a link to the page. Below the `<hr/>` on the page is a list of all the meta created. The ONLY one of the fields which will display is 'price' for some strange reason. Anyone have any idea what I'm missing?


title: Show child pages by menu order using Superfish Dropdown menu?

text: I'm using the superfish dropdown menu to create a drop down menu. It's created the menu fine showing all the parent pages with the child pages in drop down's below. The only problem I have is that the parent pages are by `menu_order` which is what I want but the child pages are not by `menu_order`. How can I make it show the child pages by `menu_order` so it mirrors the backend?


title: Unable to Find Space in Custom Function

text:
As you can see in my next/previous link I have an extra space before the word "Previous" and I can't seem to find it. Any help is greatly appreciated: http://themeforward.com/demo2/?p=1813&page=2 Custom function:               // Custom Next/Previous Page     add_filter('wp_link_pages_args', 'wp_link_pages_args_prevnext_add');     /**      * Add prev and next links to a numbered link list      */     function wp_link_pages_args_prevnext_add($args)     {         global $page, $numpages, $more, $pagenow;              if (!$args['next_or_number'] == 'next_and_number')              return $args; # exit early              $args['next_or_number'] = 'number'; # keep numbering for the main part         if (!$more)             return $args; # exit early              if($page-1) # there is a previous page             $args['before'] .= _wp_link_page($page-1)                 . $args['link_before']. $args['previouspagelink'] . $args['link_after'] . ''             ;              if ($page<$numpages) # there is a next page             $args['after'] = _wp_link_page($page+1)                 . $args['link_before'] . $args['nextpagelink'] . $args['link_after'] . ''                 . $args['after']             ;              return $args;     }      Calling it:               <?php          wp_link_pages(array(         'before' => '
' . __(''),         'after' => '
',         'next_or_number' => 'next_and_number', # activate parameter overloading         'nextpagelink' => __('Next'),         'previouspagelink' => __('Previous'),         'pagelink' => '%',         'echo' => 1 )     );          ?>


title: How to show custom post template from single page?

text: We know that in WordPress the default post template file is `single.php`. Now, I have one category name "members" and want _members_ posts to show a custom template, like `content-members.php`. I can do that via custom post template plugins. but is there a way to make that without plugins? Maybe we can do that like this:               <?php         if ( is_category( 'members' ) ) {                   get_template_part( 'content', 'members' );              } else {                  get_template_part( 'content', 'common' );              }      ?>      I tried this already, but it's not working and I think category is not triggering here.


title: TinyMCE in ajax modal window

text:
I'm trying to use TinyMCE editor in fancybox ajax loaded (lightbox like modal window). I have managed to load it but i can't type in it and Text tab there are no quicktags buttons.. It respond on every button in Visual tab and adds content in Text tab (HTML) but nothing in Visual, i also can't focus in Visual tab content so i can't type. I'm using this code to printout editor in ajax response:               ob_start();     wp_editor($content,'editor_content', array(         'textarea_name' => 'editor_content',         'textarea_rows' => '10',         'media_buttons' => false,         'quicktags' => array('buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close')     ));     $editor_contents = ob_get_clean();     $return .= '
Content	'.$editor_contents.'
';      And this to reinitialize editor in .load() success function:               quicktags({id : 'editor_content'});     tinymce.init({         mode : "exact",         elements : "editor_content",         theme: "advanced",         skin : "wp_theme",         theme_advanced_buttons1 : 'bold, italic, underline,charmap'     });      What am I missing?


title: taxonomy_template filter do not loads custom taxonomy template properly

text: I'm using taxonomy_template filter in my **plugin** to load a template file for **custom user taxonomies**. This is the code I'm using                add_filter( 'taxonomy_template', 'get_custom_taxonomy_template' );      function get_custom_taxonomy_template($template) {             $taxonomy = get_query_var('taxonomy');             if (strpos($taxonomy,'rcm_user_') !== false) {           $taxonomy_template = UT_TEMPLATES_URL ."user-taxonomy-template.php";           $file_headers = @get_headers($taxonomy_template);           if( $file_headers[0] != 'HTTP/1.0 404 Not Found'){              return $taxonomy_template;           }        }        return $template;      }      It loads the file but I get fatal error for wordpress functions like               get_header(), _e()      I've tried using default theme, saving permalink structures.


title: Header image is overlapping sidebar?

text: I just changed my header from a background to an image, as that seemed to be the easiest way to link the entire header to my main page (after a whole lot of trial and error with other methods). The one problem is that the image is now overlapping my sidebar instead of the other way around. It's also overlapping some of my menu bar, but it's a part that I can live with or possibly fix myself. Here's my site with the header going over the sidebar. How do I get it back under the sidebar like it was before? And now that I think of it, is the whoe header being linked going to cause problems with the various links and buttons in the area where the sidebar overlaps it?


title: Wrap More Link in Div

text: I would like to put the "more" link in it's own div and am having some trouble... my current code looks like: `the_content("<div class='more'>More >></div>");` But the problem is that the output is not cross-browser compatible...Safari and Firefox render this fine, placing the `div` around the more link...but IE8 renders the `div` in the `a` tag of the link, making it look funny. Is there a function I can add to my theme that would allow me to wrap a `div` around the more link so I don't have to worry about how different browsers interpret my original code? Thanks,   Josh


title: Unwanted redirect in admin area

text: I have a strange behaviour on my backend. This is possible due to the way my WordPress is located. I installed it in a VirtualBox, using Ubuntu from the standard repository (i.e., apt-get install wordpress). It is located in `/var/www/` as per default. The virtual mashine is mapped to a subfolder of my institution's web page. Let's call it `www.institution.com/stuff/wordpress`. Most works fine, I can log in to the backend, create pages, etc. But, if I make changes in Settings/General and click on the "Save changes" button I get an "Error: NotFound". The changes are saved, but WordPress tries to send me to               www.institution.com/wp-admin/options-general.php?settings-updated=true      but this has to be               www.institution.com/stuff/wordpress/wp-admin/options-general.php?settings-updated=true      (`/stuff/wordpress` is missing) Both, the "WordPress Address URL" and "Site URL" are set to "www.institution.com/stuff/wordpress". But obviously, this is not enough. Has anybody an idea what wrong with my WordPress?


title: Arrange Combined List of Pages and Categories

text: I'm using the code below to display both top-level pages and categories in my menu. (If this is the incorrect way to do so, please let me know). I would like to arrange the items alphabetically. The problem being that if I add the argument to each set of parentheses, I end up with two separate lists arranged alphabetically - I would like to combine the items in each list and arrange alphabetically from there. I'm not sure where I go from here and would appreciate any help!               <?php wp_list_pages('title_li&depth=1'); wp_list_categories('title_li&depth=1'); ?>


title: Infinite scroll loads new posts several times

text: I've added infinite scroll support of the Jetpack plugin to my own theme with:               add_theme_support( 'infinite-scroll', array(         'container'  => 'content',         'footer' => false,         'render' => 'vividflow_infscroll_render',         'wrapper' => false,         'posts_per_page' => 12     ) );      The `vividflow_infscroll_render` just loads The Loop. However, I'm experiencing some trouble with the infinite scroll: new posts are loaded **multiple times** , so that I get **double posts** on the archive page. My archive page looks like this: ![enter image description here](http://i.stack.imgur.com/iVOSE.png) I think new posts are loaded several times because I have several posts on the bottom line: 3. When I place all the post summaries beneath each other, there is no problem. How can I resolve this issue?


title: Wordpress address URL and bloginfo

text: I have updated my Wordpress Address (URL) and Site Address (URL) to be https:// in the General Settings of Wordpress as I have added a secruity certificate to the hosting. Should the css url automatically update to reflect the new address if I'm using                       <link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url'); ?>" />       in the header code. The url is now https:// but the css url is still pointint to http://


title: how to move a widget from theme 1 to theme 2?

text: I bought two themes for two websites but now I can't buy the domain name and host for both and decided to run just one web I try my two theme 1-metro mag 2-Glider I decided to run Glider at least but by other hand metro mag has two really nice widget I want to move these two nice widget from metro mag theme into Glider theme but I really don't know how to do it ? Please help me by Explain me how to move widget from theme 1 and insert theme into theme 2 ? I'll be really thanksful if any body can help me and full Explain me which file must be Edit and which code must be copy from theme 1 and pase into which file and where in theme 2 ? Great thanks Best Regards : Raha


title: Ordering by meta_value AND date NOT WORKING with wp_query

text: I want to select posts and custom post type with a specific meta value (mb_home!=0), of last week and ORDER them by mb_home. If they have the same mb_home value, I want them to be ordered by date. Both order have to be DESC. I am using this query but it just does not work:               $query = new WP_Query( array(                 'post_type' => array ('post', 'aggregato'),                 'posts_per_page' => 13,                 'post__not_in' => $linked_posts,                 'meta_key' => 'mb_home',                 'orderby' => 'meta_value_num date',                 'order' => 'DESC',                 'meta_query' => array(                                     array(                                             'key' => 'mb_home',                                             'value' => '0',                                             'compare' => '>',                                         )                                 ),                 'date_query' => array(                                         'after' => '1 week ago',                                 )                 ));      If I drop `date` and use `'order by' => 'meta_value_num'` the query gives me back the results correctly ordered by mb_home DESC. But if they have the same mb_home value, they are ordered by date ASC. If I try to change the way I order stuff, using this syntax:               'orderby' => array( 'meta_value_num' => 'DESC', 'date' => 'DESC' ),      instead of the above orderby and order statements, it just falls back to date DESC ignoring completely the mb_home value. All these results are the same with `meta_value` instead of `meta_value_num`. Nothing changes. Please, give me some pointers, because I've been over this for almost a month, trying everything but not succeeding. Oh masters of wordpress! I invoke your help!!


title: Enforce conditions only for draft posts using WyPiekacz, ignore pending and published posts

text: I use WyPiekacz to set various conditions for authors when creating posts, for example checking if the post has a featured image or how many tags that are being used. It works fine. However, these conditions are checked every time the post is submitted for review, updated or published. I want WyPiekacz to only check the conditions **if the post is in Draft status**. How can I do that? The problem that I am experiencing currently is that for instance an editor changes the amount of tags and updates the pending post which then fails the tag rules set in WyPiekacz and thus the post gets changed back to draft status and the editor cannot access it again. Editors are only allowed to edit pending posts.


title: How to add a prefix to existing custom fields over MYSQL query?

text: I've got the problem that after a plugin update I can make the `custom fields` on our directory site searchable, but only `custom fields` which get the prefix `booking_` to them. Now there are some pages (up to thirty already) each with dozens of custom fields. I would like to make a custom field, that is called `testfield` to become `booking_testfield`... So, all custom fields should get the prefix but it shouldn't break the site. The theme framework I am working with will create new custom fields on entering a page, but those new fields get the prefix can be managed over the theme framework.


title: Default widgets assignment - isn't working

text: The question is regarding, calling the default widgets into the sidebar[s]: So, despite the solution given in **THIS THREAD** , I tried a different way - Ian Stewart's borrowed solution given **HERE**. It's like, declaring the following lines into `functions.php`, suppose I have two different sidebars in my theme:               // Preset Widgets     $preset_widgets = array (             'primary_widget_area'  => array( 'search', 'pages', 'categories', 'archives' ),             'secondary_widget_area'  => array( 'links', 'meta' )     );          if ( isset( $_GET['activated'] ) ) {             update_option( 'sidebars_widgets', $preset_widgets );     }          //update_option( 'sidebars_widgets', NULL );                         // Check for static widgets in widget-ready areas     function is_sidebar_active( $index ){            global $wp_registered_sidebars;            $widgetcolums = wp_get_sidebars_widgets();            if ($widgetcolums[$index]) return true;                  return false;          } // end is_sidebar_active      The problem is, my theme is NOT calling the default widgets in absence of any widgets at the beginning. I can't fix it, because I can't understand the code above and obviously the process explained by Ian Stewart. And also, can't understand the explanation regarding `//update_option( 'sidebars_widgets', NULL );`. How can I fix this?


title: Enqueue stylesheets with the same name

text: Ok, maybe i'm thinking too difficult, but I have 2 stylesheets with the same name. One is from the parent theme folder, and one from the child theme folder. I want to enqueue the style from the child theme folder AFTER the parent theme style has loaded, so I can overrule some classes. This is the enqueue script from the parent theme:               // Register Styles :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::     wp_register_style( 'prettyPhoto', get_template_directory_uri() . '/stylesheets/prettyPhoto.css', array(), '1.0', 'all' );     wp_register_style( 'shortcodes', get_template_directory_uri() . '/stylesheets/shortcodes.css', array(), '1.0', 'all' );     wp_register_style( 'retina', get_template_directory_uri() . '/stylesheets/retina.css', array(), '1.0', 'only screen and (-webkit-min-device-pixel-ratio: 2)' );     wp_register_style( 'responsive', get_template_directory_uri() . '/stylesheets/responsive.css', array(), '1.0', 'all' );     wp_register_style( 'rtl', get_template_directory_uri() . '/stylesheets/rtl.css', array(), '1.0', 'all' );     wp_register_style( 'fontello', get_template_directory_uri() . '/stylesheets/fontello.css', array(), '1.0', 'all' );     wp_register_style( 'fontello-ie7', get_template_directory_uri() . '/stylesheets/fontello-ie7.css', array(), '1.0', 'all' );          // Enqueue ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::     wp_enqueue_style( 'shortcodes' );      wp_enqueue_style( 'stylesheet', get_stylesheet_uri(), array(), '1.1', 'all' );     wp_enqueue_style( 'prettyPhoto' );     wp_enqueue_style( 'fontello' );       I want to add another 'shortcodes.css' from the child theme dir, that is loaded after the shortcodes.css from the parent theme dir. How can I do this?


title: Change order that the menu is generated with wp_list_pages

text: I am trying to order the output of one of my menus to be based off of the way they are setup in the `Appearance->Menus` pane, however it seems to only want to do it alphabetically. For example I have setup in the `Menus` pane the following hierarchy:               Weekly Outlook     - Webinars     - Calendar      However it displays like so:               Weekly Outlook     - Calendar     - Webinars      I the menu is generated by the following code. Note, the content is dependant on the page visited.                <div id="dep-menu">      <?php global $post;      if (!is_front_page() && !is_404()) {          if($post->post_parent) {              $children = wp_list_pages("title_li=&include=".$post->post_parent."&echo=0&sort_column=menu_order'");              $children.= wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0&sort_column=menu_order'");          } else {              $children = wp_list_pages("title_li=&include=".$post->ID."&echo=0&sort_column=menu_order'");              $children.= wp_list_pages("title_li=&child_of=".$post->ID."&echo=0&sort_column=menu_order'");          }          if ($children) { ?>              <ul>                  <?php echo $children; ?>              </ul>          <?php }      }      ?>      </div>      **EDIT** Here it is in action: http://dailywealthreport.com.au/ The menu I am referring to is the one that comes up when you click on an item in the main menu.


title: How to create thumbnails in wordpress with jwplayer

text: I can't seem to get a good answer on their site. What's the best way to create thumbnails for videos uploaded to my wordpress site? Users upload videos from the front end and I started doing this with only youtube videos which was great because I could just pull the thumbs from youtube. So how can I can auto create them now and store them in a way that's not complicated. I tries using a the "video thumbnails" plugin but that doesn't work.


title: Adding Categories across posts, and custom post types

text: I currently have a list of categories that go with my 'posts' I want the same categories to go with my custom post types 'services' and 'work' The following code, adds the tags and categories to the work and services custom posts.               add_action('init', 'demo_add_default_boxes');          function demo_add_default_boxes() {         register_taxonomy_for_object_type('category', 'work');         register_taxonomy_for_object_type('post_tag', 'work');         register_taxonomy_for_object_type('category', 'services');         register_taxonomy_for_object_type('post_tag', 'services');     }      But when I categorise a work/service post, it does not appear on the /category/ page, only the 'posts' from that category appear.


title: How we can get the author ID by its Name

text: How can i retrieve the author id if i have its name. I have fornt end form any user can enter the author name to filter the posts by author name so after that how can i get author id. Or there is any other way to write the query so that it return the posts which is posted by specific authors. Thanks


title: How to get the next and previous image title from attachment or gallery?

text: I'm trying to build a slider exactly like this in wordpress. I have managed to make the slider work except the next/prev button. I need to get the next image title and the previous image title for the next/prev button. my code is like this:


title: wordpress gallery plugin won't show gallery online

text: i have installed two different gallery plugins (Slideshow Gallery and Nextgen- gallery) i need both of them since they display photos in different ways and i need'em for different pages. I installed previously the "NextGen-gallery" and it works fine. Than i installed the "Slideshow Gallery" but when i put the short code into the page,it doesn't display anything! It's blank! i tried in a different website to leave just "Slideshow gallery" plugin and it did show up. Is there a problem to install 2 gallery plugins in a website?? What can i do to keep them both?? Thanks in advance!


title: Remove update messages for deactivated plugins

text: Is it possible to hide just update messages for deactivated plugins in WP 3.4+?


title: Possible to add meta box to edit.php pages?

text: I've been googling this for a while, and came across this link here: Can I limit this meta box to a particular page? What I am trying to achieve is adding a custom Meta Boxe I created onto a CPT Posts Screen (`edit.php?post_type=custom`). What I tried to use is this:               add_action("admin_init", "admin_init");     function admin_init() {        global $pagenow, $page;           if ( 'edit.php' == $pagenow ) {              add_meta_box( $id, $title, $callback, $post_type, $context, $priority, $callback_args );           }     }      When adding and saving this into my `functions.php`, the page turns blank. Is it even possible to add a meta box to `edit.php` pages? * * * **EDIT** OP wants to add the "QuickPress" functionality in this meta box. Screenshots from the comments to an answer. > ![enter image description here](http://i.stack.imgur.com/D49m5.jpg)


title: get_bloginfo prints IP instead of url

text: I just recently moved a site to another production environment and I seem to have missed some setting in the db config as a lot of the built-in functions prints the IP instead of the url. Ideas? Tried switching site_url and home under wp_options table from IP to http://project.dev (which is set to default to a specific IP where I manage my different local projects, running on Apache). Entering http://project.dev/wp-admin gives me               http://192.168.33.21/wp-login.php?redirect_to=http%3A%2F%2Fproject.dev%2Fwp-admin%2F&reauth=1      Htaccess is set to               <IfModule mod_rewrite.c>         RewriteEngine On         RewriteBase /         RewriteRule ^index\.php$ - [L]         RewriteCond %{REQUEST_FILENAME} !-f         RewriteCond %{REQUEST_FILENAME} !-d         RewriteRule . /index.php [L]     </IfModule>


title: Why is get_the_category() saying that I have two categories?

text: My post has only one category. The following code:               $categories = get_the_category();      gives me this result:               Array     (         [0] => stdClass Object             (                 [term_id] => 22                 [name] => Style Guide                 [slug] => style-guide                 [term_group] => 0                 [term_taxonomy_id] => 22                 [taxonomy] => category                 [description] =>                  [parent] => 0                 [count] => 2                 [object_id] => 391                 [cat_ID] => 22                 [category_count] => 2                 [category_description] =>                  [cat_name] => Style Guide                 [category_nicename] => style-guide                 [category_parent] => 0             )          )      Why is it double up?


title: Styleswitcher or themeswitcher to allow user to switch back to standard view from mobile device

text: I created a mobile version of my site with CSS, with all my styles in a single stylesheet (using `@media only screen and (max-width: 480px), only screen and (max-device-width: 480px)` to define mobile styles). When it's all in a single stylesheet, it works fine. But I want to allow users to switch back to standard view even if they view the site from a mobile device. I don't know of any way to allow the user to override the `@media`, so it seems I have two options: (1) separate stylesheets plus styleswitcher script, or (2) separate themes plus themeswitcher. Theoretically this should be possible with a styleswitcher, but I can't figure out how to get a styleswitcher to override the media declaration in the header, so even when I click "switch back to standard view," it still loads the mobile stylesheet. So then I started looking into themeswitchers. I want to detect mobile users and direct them to the mobile theme by default, but still allow them to switch back if they want. This is essentially what the WP Mobile Pack plugin does, but it has a lot of extra functionality that I don't need, and I've read some horror stories about the way it modifies the database. I also don't need all the pre-built mobile themes since I've already written the CSS I need for the mobile version. Can anybody recommend a more lightweight solution, like a simple themeswitcher script combined with a mobile-detection plugin that doesn't require me to define media queries in the header?


title: Do Plugins effect site loading time?

text: Is there any way to measure the time it takes for plugins to load and in which pages they load (without figuring out the entire code)? In addition, I would like to find out which plugins load files in which pages and find the ones that load on irrelevant ones.


title: older blog posts not showing in new theme

text:
I have a new, custom theme that I've uploaded on a pre-existing site/blog. Everything seems to be working ok, with the exception of the older blog posts not showing up. Any ideas what I can do to fix?               <?php get_header();?>
         <?php get_sidebar( 'blog');?>
         <?php if(have_posts()) : while(have_posts()) : the_post(''); ?>

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

<?php the_tags('tags: ', ', ', '
'); ?> | <?php comments_number( 'no responses', 'one response', '% responses' ); ?> comments

                 <?php the_content('read more...'); ?>

SHARE THIS POST

         <?php endwhile; ?>         <?php else : ?>
I'm not sure what you're looking for.
         <?php endif; ?>
          <?php get_footer();?>      _**eta_ Finally got the posts to show by cleaning up the code, however they are now all jumbled.** How can I remedy this?


title: Is there a Filter that I can use to filter the tags before they are inserted in to the database?

text: I want to filter the tags before they are inserted into the database. I'm aware of the pre_insert_term filter. But what I need to do is to see all the tags at once. I need to limit the number of tags entered to the database per post. Is there a filter to do this? Or any other method? Thanks


title: How to get title tag of an external page with http api?

text:
What is the best method to retrieve the title tag of an external page using the http api? The snippet below will get the body but I can't find the right documentation about how to just get the tag. :/               $url = 'http://wordpres.org';     $response = wp_remote_get( $url );     if( is_wp_error( $response ) ) {        echo 'Something went wrong!';     } else {     print wp_remote_retrieve_body( $response );     }      > **Edit:** This code snippet gets both the screenshot and title of an > external page (Thanks again @Bainternet). With a little editing this could > be an easy way to display the link post format.               <?php      $content = get_the_content();     $url = strip_tags($content); //assumes only a url is in the_content     $width = '150';     $cleanurl = urlencode(clean_url($url));     $fullurl = 'http://s.wordpress.com/mshots/v1/' . $cleanurl . '?w=' . $width;          // return title tag of an external page     // http://wordpress.stackexchange.com/questions/19424/how-to-get-title-tag-of-an-external-page-with-http-api     function get_page_title($url){         if( !class_exists( 'WP_Http' ) )             include_once( ABSPATH . WPINC. '/class-http.php' );         $request = new WP_Http;         $result = $request->request( $url );         if( is_wp_error( $result ) )             return false;              if( preg_match("#<title>(.+)<\/title>#iU", $result['body'], $t))  {             return trim($t[1]);         } else {      return false; }         }     $title = get_page_title($url);                echo '

';      echo '

'; if ($title !== false){ echo $title;} echo '

' . $content . '

';     echo '

';     ?>


title: Options for authenticated feeds

text: Client has a 3.1x-based site with paywall(using s2Member) which has a public feed that only provides excerpts. He wants to be able to give members full- content feeds, so we need something that can look at the member's role/level and cut them off at the appropriate time, etc. It's accepted this will probably require some templating. I've found a couple of options, like Feed Key(mostly functional, but not quite) but they've all seem to have been abandoned around 2008 for some reason and I don't have the capability or familiarity with the system to fix them. Are there more current options I'm not digging up, or is it that this somehow became possible with core and I'm just not seeing it?


title: Create a blank admin page from plugin

text: is there an opportunity to create a blank admin page in wordpress from a plugin or theme? I mean like the theme customizer without the admin bar or the sidebar menu. Jonathan


title: create relationship between posts from one category and posts from another category

text: What I'm trying to do is adding in a post admin page a meta box, dynamically listing all posts from another category in the for of a check box list. This way I can create relations between a post and other posts belonging to a different category. Any tips will be greatly appreciated.


title: css3-mediaqueries-js failing with child theme

text: Within my parent theme functions.php, I have the following snippet:               // Add mediaqueries-js     function footer_scripts(){         echo '<!--[if lt IE 9]><script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script><![endif]-->';     }     add_action( 'wp_footer', 'footer_scripts' );      This adds media query support to IE7 and IE8. The script runs perfectly in IE7/8 with the parent theme, but fails to work and ignores the media queries when activating the child theme. All other scripts are enqueued correctly and run as they should. The script is showing within the source code when the child theme is activated.


title: Remove image from post_content on save_post

text: I'm trying to setup a function in functions.php that removes an image from the post_content on save. Everything works up until the time I'm trying to save the content, the page just hangs and I get a '500 Internal Server' error.               function remove_post_image( $post_ID ){            // get the post       $the_post = get_post($post_ID);            // get the content of the post       $post_content = $the_post->post_content;            // replace any images       $content = preg_replace("/<img[^>]+\>/i", "", $post_content);            // save the post       $my_post = array();       $my_post['ID'] = $post_ID;       $my_post['post_content'] = $content;            // Update the post into the database       wp_update_post( $my_post );               return $post_ID;     }     add_action('save_post', 'remove_post_image');      I fear I'm missing something very basic. Can anyone spot something I'm doing wrong? * * * _edit_ Already I see how silly this was setup. I'm having success with the following, but still would like to know if this is the best way? I'm using content_save_pre action...               function remove_post_image( $content ){            // replace any images       $content = preg_replace("/<img[^>]+\>/i", "", $content);            return $content;     }     add_action('content_save_pre', 'remove_post_image');


title: how to change the permalink to a specific location?

text:
I have this slider on my front page. Right now when I click on an image it goes directly to the permalink and the post. How do I make all the slides go to one specific page? this is the loop for the slider:
         <?php          $recent = new WP_Query( array(  "cat" => $tmcategory,                                          "posts_per_page" => $tm_totalpost,                                          "post_type" => "post",                                       )                                );          while($recent->have_posts()) : $recent->the_post();          ?>                  <?php if (has_post_thumbnail()) { ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">             <img src="<?php $image_id = get_post_thumbnail_id(); $image_url = wp_get_attachment_image_src($image_id,"img737", true); echo $image_url[0]; ?>" alt="<?php echo get_the_title(); ?>" title="<?php echo get_the_title(); ?>">
                    <?php } else { ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">             <img src="<?php echo get_template_directory_uri(); ?>/images/nophoto515.png" alt="<?php echo get_the_title(); ?>" title="<?php echo get_the_title(); ?>">
             <?php } ?>              <?php endwhile; ?>
      I changed the code to this but still it dosent work?:               <?php if (has_post_thumbnail()) { ?>
<a href="<?php get_permalink(22); ?>" title="<?php the_title_attribute(); ?>">             <img src="<?php $image_id = get_post_thumbnail_id(); $image_url = wp_get_attachment_image_src($image_id,"img737", true); echo $image_url[0]; ?>" alt="<?php echo get_the_title(); ?>" title="<?php echo get_the_title(); ?>">
                    <?php } else { ?>
<a href="<?php get_permalink(22); ?>" title="<?php the_title_attribute(); ?>">             <img src="<?php echo get_template_directory_uri(); ?>/images/nophoto515.png" alt="<?php echo get_the_title(); ?>" title="<?php echo get_the_title(); ?>">
             <?php } ?>              <?php endwhile; ?>


title: SQL query to remove first image in all posts

text: I've built a site up over a few years (3,500+ posts) where I've inserted images using the traditional method into the post content itself. I'm now moving to a different theme, and have made the first image for each post the featured image (which I want to keep), but I now would like to remove the first image from the_content. I have found that I can remove the first image (with or without captions) on the fly by instead of using the_content(), doing this: `echo preg_replace("/\\[caption .+?\\[\/caption\\]|\< *[img][^\>]*[.]*\>/i","",get_the_content(),1);` Is there some way I can run this command on the database to actually remove those images? Thanks for any pointers


title: How do I test PHP files in WordPress?

text: I've downloaded a Wordpress theme, but I want to edit it before uploading it to my live server. I read I need to run a server in order to test the PHP files, but I don't know what to use in order to do so. Or would it just be better to upload then edit it?


title: How to get Page/Post Gallery attachment images in order they are set in backend using WP_Query()?

text: I am trying to retrieve all the images from the `Gallery` of a page in the order they are set in the backend. So far I have:                 $my_wp_query = new WP_Query();            $all_wp_pages = $my_wp_query->query(         array(           'post_type' => 'attachment',           'post_parent' => 54,             'post_mime_type' =>'image',           'post_status' => 'inherit',            'posts_per_page' => '20'            'orderby' => 'menu_order',           'order' => 'ASC'         )       );            var_dump( $all_wp_pages );      But this seems to return all the attachment images in the standard/default order rather than the order I have dragged and dropped the images in the backend edit gallery interface. I believe this might be due to the fact that I am querying all attachment images of my page rather than specifically the Gallery, and as such the sorting information for the gallery is not passed in the returned array. Can anyone tell me how I get all the gallery images of a certain page_id in the order they are set in the backend? There will only be one gallery per page if that helps. thanks


title: Removed plugin generating error message

text: I kinda did something stupid. To test something I created a couple of plugins and during testing I think I renamed the plugin. Now I deleted the plugins but I'm still getting an error message saying the plugin couldn't be found:               The plugin something else has been deactivated due to an error: Plugin file does not exist.      I searched the database and there's an activate_plugins entry in wp_options. It contains the following:               a:4:{i:0;s:23:"bandpress/bootstrap.php";i:3;s:56:"posts-from-single-category-widget/post_from_category.php";i:4;s:15:"something else ";i:5;s:68:"syntax-highlighter-with-add-button-in-editor/syntaxhighlighterpp.php";}      So, I think I need to remove the "something else " part of this field, but I don't know which parts I should (or shouldn't) remove. What part do I need to remove to get rid of the error message, without affecting the other plugins?


title: Access Shortcode in ajax code?

text: I have some data which is pulled over using `ajax`. Data works all fine, however, I have some `shortcode` been used in the same data which doesn't display as expected. It looks like `shortcode` function isn't available at the time of `ajax` call. Could anyone please help with how I can have access to `shortcode` within `ajax`? Unfortunately code isn't very straightforward to put here. I am using Calendar plugin to display Calendar. Then using Tippy shortcodes to display events within calendar to expand on mouseover. Shortcode to display event with Tippy popup doesn't work when the calendar is updated (on hitting next month or year) using ajax. Because somehow when content is pulled out using ajax at that particular time shortcodes API isn't available.


title: Stray closing paragraph tag when using shortcodes

text:
I'm using a basic shortcode to wrap some text in an expandable div. What appears to be happening is that the wpautop is inserting a stray closing paragraph tag at the beginning and a stray opening paragraph tag at the end of the content being wrapped. Here's how it looks in the editor: > [expandable text="Show Content"] > > Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras fermentum > facilisis malesuada. Suspendisse potenti. Aenean dui turpis, ornare in ipsum > eget, vestibulum egestas nulla. > > [/expandable] And the rendered HTML:
Show Content

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras fermentum facilisis malesuada. Suspendisse potenti. Aenean dui turpis, ornare in ipsum eget, vestibulum egestas nulla.

      This is the shortcode function:               function expandable_content_shortcode( $atts, $content = null ) {         $args = shortcode_atts( array(             'text' => __( 'View More', $this->plugin_slug ),             'linklocation' => 'top'         ), $atts, 'expandable' );              if ( $args['linklocation'] === 'top' ) {             $output = '
' . $args['text'] . '' . $content . '
';         } else {             $output = '
' . $content . '' . $args['text'] . '
';         }              return $output;     }


title: excerpt - don't use main content if empty

text: trying to stop get_the_excerpt() from defaulting to the_content() if its empty. this kinda works - well it seems to return 'xxx' so i think has_excerpt() isn't working?               function get_link_excerpt(){         if(has_excerpt()){             $LinkExcerpt = get_the_excerpt();             return $LinkExcerpt."...";         }         return 'no excerpt';      }     add_filter('get_the_excerpt', 'get_link_excerpt');      what's the best way to control this? best,Dc


title: Archive query not working correctly

text:
I think I am missing something while trying to create an archive page for my post type I decided to put three levels of data in one post type and was going to separate it by templates depending on the value of a custom field. (collection, product, variant) I am going this route because my other method of having a taxonomy>CPT1>CPT2 relationship was not building the link structure I needed. Anyway. For my top level data, each post will be assigned the input_type=> collection. So when going to the archive page, The archive is listing all post which I don't need. I only want it to list post marked collection. I managed to get part of the code figured out, but it is not displaying in the grid format like I had it with the previous post type arrangement. And for some reason, it is displaying the same title on each post, yet having different descriptions. And it is displaying post without children and not displaying some of the post with children that I want it to do. What am I missing here? For each level of data, I am actually going need it to check to see if children are present under the given post type. Otherwise that post type will not be displayed. Each Collection must have at at least 1 Product, each product must have at least one variant. If a collection only had one product, but that product did not have a variant defined, then that collection will not display either. http://dev.unicriscreations.com/collection/               <?php           get_header();                $args=array(              'post_per_page'=> 12,         'post_type' => 'uc-collections',         'orderby' =>'ID',         'parent' => 0,         'post_status' => 'publish',         'meta_query' => array(             array( 'key'=>'input_type',             'value'=>'collection'))     );           $collections =  get_posts($args);           ?>
<?php echo "Product Collections";  ?>

          <?php             foreach ( $collections as $col )                       {                     setup_postdata( $col ); ?>

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

             <?php the_content();                               echo '

';             }                       ?>
     <?php          wp_reset_postdata();     ?>

          <?php get_footer(); ?>