title: Jquery was not found on this server

text: I have two pages, events.php from plugin1 index.php from plugin2. in events.php. I am including jquery for ajax loading                         <a onclick="show_trend(<?php echo $event->output('#_EVENTID');?>)" >Trend      This ajax load works fine. From this ajax call, I am calling a function and rendering a div in index.php. What I am doing is creating a highchart. For this I am including                          in index.php function. But I am not able to create charts beacuse jquery is not loading. In console, I am getting the following error > TypeError: $(...).highcharts is not a function > > **404.** That’s an error. > > The requested URL > > `/ajax/libs/jquery/1.8.2/jquery.min.js%20line%202%20%3E%20eval` was not > found on this server. That’s all we know. Any suggestions?. **Edit** As suggested by TBI Infotech i have done the following thing in my function               function em_bookings_events_table() {     ........     .......     .......     wp_enqueue_script('jquery');               }      add_action( 'wp_enqueue_scripts', 'em_bookings_events_table' );      but now jquery is not loading.


title: Custom CSS for a particular text/html widget in Wordpress

text: I have a couple of text widgets on my Home Sidebar. There is one text widget in particular that I want it to implement custom CSS written in my child theme rather than the default styling provided by the theme. Is that possible? If yes, how?


title: number of posts per page + random + exclude categories

text: I have the following code in my home.php               <?php query_posts($query_string . '&orderby=rand' . '&cat=-182,-184'); ?>      query_posts seems not the best solution. What would be the best way pre_get_post or WP Query. Highly appreciated if you could also write the correct code. Kind regards, Yves


title: How can I modify admin bar only if my plugin is loaded

text: If I want to _always_ change the admin toolbar at the top of the page it's easy.               add_action('admin_bar_menu', 'add_toolbar_items', 100);     function add_toolbar_items($admin_bar){       $admin_bar->add_menu( array(         'id'    => 'my-item',         'title' => 'My Item',         'href'  => '#',         'meta'  => array(             'title' => __('My Item'),                     ),       ));     }      No problem. I want to add something to the top of the page, but only when we are on my plugin page. So I want to do something like this:               add_action('admin_menu', 'my_plugin_menu');     function my_plugin_menu(){       //We add the hook for our menu item on the main menu       $main = add_menu_page( 'My Swell Plugin', 'My Swell Plugin', 'edit_posts', 'blah', 'generate_main_page',,__FILE__));     }     function generate_main_page(){       //We are definitely in our plugins page now - let's modify the admin toolbar.       add_action('admin_bar_menu', 'add_toolbar_items', 100);       require_once('mainwindow.php');     }


title: How can i display custom post types on a 'page' post type?

text: what is the code i have to put in the modifyed 'page' post type template?


title: Archive with months of current year only

text:
I'm trying to figure out how to get the following archive navigation: > JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC 2012 | 2014 Thus, a list with the months of the current or selected year with links to the previous and next year's archive. I've tried to edit the Compact Archives plugin, which comes very close to what I need. It displays the months for all years, including those that don't have posts. However, I cannot get it to display the months for the current/selected year only. I know this has to do with the `for each` statement, but my knowledge of php is not that good that I can make the necessary customizations for it to work. This is what I have customized thus far:                   function get_compact_archive( $style='initial', $before='
', $after='
' ) {     global $wpdb, $wp_version;     setlocale(LC_ALL,WPLANG); // set localization language     $below21 = version_compare($wp_version, '2.1','<');     // WP 2.1 changed the way post_status and post_type fields work     if ($below21) {         $now = current_time('mysql');         $results = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS year, MONTH(post_date) AS month FROM " . $wpdb->posts . " WHERE post_date <'" . $now . "' AND post_status='publish' AND post_password='' ORDER BY year DESC, month DESC");     } else {         $results = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS year, MONTH(post_date) AS month FROM " . $wpdb->posts . " WHERE post_type='post' AND post_status='publish' AND post_password='' ORDER BY year DESC, month DESC");     }     if (!$results) {         return $before.__('Archive is empty').$after;     }     $dates = array();     foreach ($results as $result) {         $dates[$result->year][$result->month] = 1;     }     unset($results);     $result = '';     foreach ($dates as $year => $months){         $prev_year = $year - 1;         $next_year = $year + 1;         $result .= $before . '
';         for ( $month = 1; $month <= 12; $month += 1) {             $month_has_posts = (isset($months[$month]));             $dummydate = strtotime("$month/01/2001");             // get the month name; strftime() localizes             $month_name = strftime("%B", $dummydate);              switch ($style) {             case 'initial':                 $month_abbrev = $month_name[0]; // the inital of the month                 break;             case 'block':                 $month_abbrev = strftime("%b", $dummydate); // get the short month name; strftime() localizes                 break;             case 'numeric':                 $month_abbrev = strftime("%m", $dummydate); // get the month number, e.g., '04'                 break;             default:                 $month_abbrev = $month_name[0]; // the inital of the month             }             if ($month_has_posts) {                 $result .= '
'.$month_abbrev.'
';             } else {                 $result .= '
'.$month_abbrev.'
';             }         }         $result .= '

'.$prev_year.'

'.$next_year.'

' . $after."\n";     }     return $result;      } I've also checked this thread but that doesn't help me either.


title: Is there going to an issue running different features of WP site in different subdomains?

text: I have a main site running in `mydomain.com`. I want to install an e-commerce plugin and want to run it in a subdomain `shop.mydomain.com`. In the future I may want to install an LMS plugin and run it in `lms.mydomain.com`. LMS will need to directly interact with the e-commerce because people may subscribe to courses and pay via the e-commerce plugin. Does this make it more complicated? Should I just install everything in the main domain and make life easier?


title: Remove_action inside a function

text: HI there, I want to remove the actions added to wp_head by a plugin but only in certain circumstances. Here is code that doesn't work:               if (is_single() && get_post_type()  == 'tenant') {       $row = $wpdb->get_row("SELECT * FROM Events WHERE WP_ID='$post->ID'",ARRAY_A);       remove_action('wp-head',array($aiosp, 'wp_head'));       $seo_head = "<title>" . $row['Event'] . " | " . $row['Town'] .                    " | Events in ". $row['Country'] . "</title>";     }


title: jQuery UI in Admin (Best Practice?)

text: Maybe someone has prior experience with this, but when I include the jQuery UI **1.8.9** file within my `admin_head` I break the functionality of the dashboard (i.e. popup for adding featured image, drag and drop menu items, etc.). If I include **1.7.2** , it doesn't break anymore but then my great little calendar won't work anymore. So my questions is, currently (3.0.x),what is the best way to implement the jquery UI within admin pages without breaking everything? ( _Other info: trying to add datepicker to a field within my custom post type_ ) Thank you! Noel


title: Custom post type posts wont show in wp_nav_menu()

text: I have created a custom post type and registered it using this code               $labels = array(       'name' => __( 'Portfolio' ),       'singular_name' => __( 'Portfolio' )     );          $args = array(       'labels' => $labels,       'public' => true,       'exclude_from_search' => false,        'publicly_queryable' => true,       'show_ui' => true,        'query_var' => true,       'capability_type' => 'post',       'hierarchical' => false,       'menu_position' => null,       'supports' => array('title','editor','thumbnail','custom-fields', 'page-attributes', 'excerpt', 'revisions'),       'show_in_nav_menu' => true     );     register_post_type('portfolio',$args);      I can create a portfolio post type and save it. It all works as expected until I go to Appearance > Menus where I can add the portfolio to the menu but it wont show up in the index template using this code               wp_nav_menu(array('theme_location'=>'main_menu'));      All the other menu items show properly just not the custom post types. If you look at the screenshot, all that is shown in the front end is 'Shortcodes' link and 'BBC' link (so page and custom link - not portfolio link) Help! I need those links in there. Screenshot of Appearance > Menus here ![screenshot](http://i.imgur.com/cs1JR.png)


title: How to fix vanilla comments extra iframe space

text: I am using the new vanilla comments on wordpress with my self hosted vanilla forums, but on every page, there is unnecesary iframe space. I was wondering how to fix that. My site is here and my forums are here. Between the submit comment and comments by vanilla link.


title: Insert custom fields to a custom post type

text: I am creating a small blog about my trekking and camping experience. Since different experiences - like campsites, treks and tour operators - have different metadata, I have created a custom post types (e.g. `campsite`), associated with custom field types (e.g. `price`, `water_supply`). Now I'm trying to use these fields in my child theme. I've copied twenty- twelve - the parent - `single.php` to `single-campsite.php`, and started digging in. The problem is that the entire post content - title, content, and date - is created from this single line:               <?php get_template_part( 'content', get_post_format() ); ?>      **How do I edit the post internals, e.g. insert custom fields between the title and the contents, or remove the date below?**


title: Restrict access to trash, only admin

text: I'm new in WordPress. I have to restrict access to the Trash for all users except the administrator. All users CAN move to the Trash, but only admin can delete permanently or restored. I do not know php well, if there is some magical plug or another easy way to do this?


title: Single page Wordpress website - custom fields or meta boxes or something else?

text: Hoping someone can give me a pointer in the right direction. I'm building a website for my friend who's getting married and they've asked to be able to update the site themselves - fair enough. So, what I've done so far is create my main page in Wordpress and assigned that as the template to the 'home' page. For each of the sections, I've created new pages in the Wordpress CMS and used `<?php show_post('Hen and Stag'); ?>` to display the content in the relevant section of the page. The part I'm having problems with is the 'wedding section' - each person require a title, a brief intro and a picture - see here http://www.elandsebswedding.co.uk/main-page/ I'm fairly certain that creating multiple pages for each of the wedding party isn't the best way to tackle this situation, so is there a way that I could use featured images / custom fields to display it instead? And would I assign these to the 'wedding party' page? In which case I guess I would need to tell my main template page where to get the info from? I hope this makes sense? If there's an easier way of doing this then I'm all ears! Thanks


title: How do I add a custom HTML attribute to get_avatar?

text:
I'm trying to add Pinterest's nopin="nopin" HTML attribute to the comment avatar image tags on my blog. Here's the function I'm using to call the avatar on each comment:               get_avatar($comment, 50, vol_random_image())      vol_random_image() just selects an image from an array if the commenter doesn't have a Gravatar. I know get_avatar has an $alt attribute, but that only sets an alt tag, right? How would I go about adding this custom HTML tag? Full code of the function:               echo "
\n     \t
\n     \t\t\n     {$tab3}
\n     {$tab3}\t
\n",     get_avatar($comment, 50, vol_random_image()),     "{$tab3}\t
\n     {$tab3}
\n" .     (($comment->comment_approved == '0') ?          sprintf("{$tab3}") . __('Your comment is awaiting moderation.', 'volatyl') . sprintf("
\n") :      '') .     "{$tab3}
\n{$tab3}\t" .     sprintf('%s', get_comment_author_link()) .     "\n{$tab3}\t
\n     {$tab3}\t\tcomment_ID)), "\"><time pubdate datetime=\"", comment_time('c'), "\">";


title: Add extra field to users

text:
I have this code that adds the check box to the 'Edit User' page but when i check it, and refresh the page, the box becomes unchecked... what is wrong?               add_action( 'show_user_profile', 'module_user_profile_fields' );     add_action( 'edit_user_profile', 'module_user_profile_fields' );     function module_user_profile_fields( $user )      { ?>
Module Options

                 Module Activation	                                      <input id="module_activation" name="module_activation" type="checkbox" value="<?php echo esc_attr( get_the_author_meta( 'module_activation', $user->ID )); ?>" <?php if ( get_the_author_meta( 'module_activation', $user->ID ) == 1  ) echo ' checked="checked"'; ?> />                     <?php _e("Please enter your address."); ?>

     <?php }          add_action( 'personal_options_update', 'save_module_user_profile_fields' );     add_action( 'edit_user_profile_update', 'save_module_user_profile_fields' );          function save_module_user_profile_fields( $user_id )      {         if ( !current_user_can( 'edit_user', $user_id ) ) { return false; }              update_usermeta( $user_id, 'module_activation', $_POST['module_activation'] );     }      EDIT Here is what i got to work.               add_action( 'show_user_profile', 'module_user_profile_fields' );     add_action( 'edit_user_profile', 'module_user_profile_fields' );     function module_user_profile_fields( $user )      { ?>
Module Options

                 Module Activation	                                      <input id="module_activation" name="module_activation" type="checkbox" value="1" <?php if ( get_the_author_meta( 'module_activation', $user->ID ) == 1  ) echo ' checked="checked"'; ?> />                     <?php _e("Please enter your address."); ?>

     <?php }          add_action( 'personal_options_update', 'save_module_user_profile_fields' );     add_action( 'edit_user_profile_update', 'save_module_user_profile_fields' );          function save_module_user_profile_fields( $user_id )      {         if ( !current_user_can( 'edit_user', $user_id ) ) { return false; }              update_usermeta( $user_id, 'module_activation', $_POST['module_activation'] );     }


title: Archive Page Pagination not working

text:
I am using the following template for a custom post type. The pagination does not work as you can see at http://www.xava.ie/testimonials Any hints as to why it is not working for me?               <?php         global $paged;         get_header();         $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;          $args = array(             'post_type' => 'testimonials',             'paged' => $paged,             'posts_per_page' => 1         );         $products = new WP_Query( $args );         if( $products->have_posts() ) {             while( $products->have_posts() ) {                 $products->the_post();                 ?>
<?php the_title() ?>

                         <?php the_content() ?>
                 <?php             }             wp_pagenavi();             echo "Number of post pages = ",$products->max_num_pages;             if($products->max_num_pages>1){?>
                 <?php                 for($i=1;$i<=$products->max_num_pages;$i++){?>                     <?php $query_string = "?paged=".$i; ?>                     <a href="<?php echo $query_string; ?>" <?php echo ($paged==$i)? 'class="selected"':'';?>><?php echo $i;?>                 <?php }?>
             <?php }                  }         else {             echo 'Oh ohm no testimonials!';         }                get_sidebar('Primary'); get_footer();     ?>


title: Show posts from specific roles

text: I'd like to use query_posts() to show only posts from editors and administrators on my home page so that normal authors can post on their own pages, but not affect the home page. Edit : Thanks for the quick reply, I'm a bit of a novice when it comes to php, do you think you could give me the code I require? I'm currently using this, but getting no posts returned despite having several posts by an administrator:               $wp_user_search = new WP_User_Query( array( 'role' => 'administrator' ) );     $admins = $wp_user_search->get_results();     $args = implode(',', $admins);     query_posts("author=$args");


title: Auto login using Active Directory and Windows Authentication

text: I've been able to setup and use a couple different LDAP plugins (CoSign SSO, Simple LDAP Logon) to create new WordPress users based on the Active Directory users but it still requires them to manually log in to make posts. Is there a way to have it pull the user's credentials from the browser and automatically log them in whenever they visit the WordPress site? I have IIS set up with Windows Authentication and the URL is listed in the browser as one it can trust and send credentials to. Do I need another plugin or would this require editing a page or two in WordPress? thanks


title: WP_Query Class custom field parameters

text: In the the `class WP_Query`, using the `meta_query(array)`. The wordpress codex says that the `'value'` is a `string|array`. The `array` support is limited to a `compare` value of `'IN'`, `'NOT IN'`, `'BETWEEN'`, or `'NOT BETWEEN'`. I am having trouble as to understanding the `'IN'`, `'NOT IN'`, or `'BETWEEN'` arguments. Could someone please help me as to understanding this or better yet a working example i could go by. I'm trying to query posts on a single page template by `meta_key` without writing a seperate template for each `meta_value`. After some research the `query_posts` that I've been using is just not the way to go. Any help would be much appreciated. Thanks!


title: Count post view when user open any post

text: I want when any user open the post it count the `post view`. Currently i am using my custom function which is               <?php setPostViews(get_the_ID()); ?>      But the problem is that when user refresh the page it also count the `post view`. So how can i stop this adding views on page refresh.


title: Display wordpress post to static website in the footer

text:
I am a totally fresh with wordpress I have this website : http://www.raminusa.com/ in footer there is a column name "Popular Link" and I want to replace it with Recent News that I will do but below this heading I need my first 5 or 4 recent post from my wordpress blog. My wordpress blog is : http://immigrationstatus.wordpress.com I do not know how is it possible can some one help me with this. Here is the code I used:               <?php          $url = "http://immigrationstatus.wordpress.com/rss2/";         require_once(ABSPATH . WPINC . '/rss-functions.php');         $rss = fetch_rss($url);     ?>
         <?php             foreach ($rss->items as $item ) {                 echo "
".$item['title']."
";             }         ?>


title: Custom page only editable by one user

text: I am looking for a plugin which can allow a user only to see and edit one single page in the backend. Means: user 1 can edit and see page #20 user 2 can edit and see page #21 .... The other pages, posts, settings can not be entered, seen or edited by these users. any ideas? In the frontend everyone of these users has one page. It is for a customer who has 20 customers who should have their own personal page.


title: Checking for page templates in child theme

text: I have a simple problem I'm hoping someone can shed some light on. I have a child theme with a custom page template and I'm simply trying to check weather or not the template is in use. Under normal circumstances, I would have just used the `is_page_template` function, however it doesn't seem to be working with child themes. I've tried the following               if(is_page_template('template-custom-fullwidth.php')){         //do something..     }      as well as               if(is_page_template(dirname(get_bloginfo('stylesheet_url')).'/template-custom-fullwidth.php'){         //do something..     }      Neiter works and I was hoping there is a more elegant solution than using `$_SERVER` to check for URLs. I can't imagine there not being a function for this seeing as this seems like a common task. I believe the problem is the difference between template and stylesheet directories. Is it possible to use Wordpress to check for page templates located in a child theme? Thanks in advance!


title: Plugin to count file download

text: I'm looking for a plugin which will allow me to count how many times a file has been downloaded. I don't need neither a fancy download page nor showing the download count on the page itself, I want it just for me. I'm aware that GA can track them but if the user right-click the link it might not detect it.


title: Parent drop-down not appearing for custom post type

text: I'm trying to create a custom post type that I can associate with parent posts (they are posts not pages). Wordpress is version 3.0.1. I was hoping to see a list of posts in a parent post drop-down under Page-Attributes but all I get its an 'Order' field. Have I missed something vital?               register_post_type( 'mytest_post_type',         array(             'labels' => array(                     'name' => __( 'mytest Interviews' ),                     'singular_name' => __( 'mytest Interview' ),                     'add_new' => __( 'Add New' ),                     'add_new_item' => __( 'Add New mytest Interview' ),                     'edit' => __( 'Edit' ),                     'edit_item' => __( 'Edit mytest Interview' ),                     'new_item' => __( 'New mytest Int.' ),                     'view' => __( 'View mytest Inteview' ),                     'view_item' => __( 'View mytest Int.' ),                     'search_items' => __( 'Search mytest Interviews' ),                     'not_found' => __( 'No mytest Interviews found' ),                     'not_found_in_trash' => __( 'No mytest Interviews found in Trash' ),                     'parent' => __( 'Parent mytest Interview' ),                  ),             'public' => true,             'show_ui' => true,             'hierarchical' => true,             'query_var' => true,             'supports' => array('title', 'editor', 'author','custom-fields','page-attributes'),              )     );      Or is it not possible to create a new custom post type and have those new posts be children of existing posts? thanks!


title: Show multiple next and previous posts

text: I've created a portfolio with single posts. When viewing the posts i'd like to show the next / previous 2 posts (portfolio items). Currently i'm using the following code but only shows one post:               <?php $prevPost = get_previous_post(true);         if($prevPost) {?>         <?php $prevthumbnail = get_the_post_thumbnail($prevPost->ID, array(114,114) );}?>         <?php previous_post_link('%link',"$prevthumbnail <h3>%title</h3>", TRUE ); ?>      I want to create the following:               [next post] | [next post] | [current post (active state)] | [previous post] | [previous post].      Does anyone know how to change this to a working code?


title: Page Options Saving But Not Updating In Backend

text:
I have created a custom options page for a slider that you can upload slides to. Everything works great except when trying to save the data. It will get saved and I can use it on the front end. But the options screen won't update, it will even do a flickr on the screen (I'm assuming a page refresh when it sends the form). I am using a jQuery plugin called Apendo to clone the slides to add multiples, I'm not sure if that is the culprit. If the page is manually refreshed then the right content shows up, it's so weird! Any ideas why this could be happening? This is handling the creation of the page and setting up the slides global:               global $slides;     $slides = get_option('slides');          // Add Menu Link     add_action('admin_menu', 'slider_menu_options');     function slider_menu_options() {              // Check If Form Is Posted & Save An Array     if (isset($_POST['action']))  {     $slides = array();         foreach($_POST['src'] as $k => $v) {             $slides[] = array(                 'src' => $v,                 'link' => $_POST['link'][$k],             );         }     update_option('slides', $slides);     }                add_object_page('Slider', 'Slider', 'edit_themes', 'slider_settings', 'slider_options_page');                     }      And here is the html handling the options:               function slider_options_page() {     global $slides;      ?>

Slider Manager
         <form id="manager_form" method="post">
                 <?php foreach($slides as $k => $slide) : ?>
                     <input type="text" name="link[]" id="slide_link" value="<?php echo $slide['link'] ?>">                     <input type="text" name="src[]" class="logo_url" value="<?php echo $slide['src'] ?>"/>                     <input class="upload_button" type="button" class="button" value="<?php _e( 'Choose Slide' ); ?>" />
                         <img style="max-width:100%;" src="<?php echo $slide['src'] ?>" />
                     <button class="remove_slide button-secondary">Remove This Slide</button>
                 <?php endforeach; ?>
                  <input type="submit" value="Save Changes" id="manager_submit" class="button-primary">             <input type="hidden" name="action" value="save">              </form>
     <?php }      And here is the jQuery handling everything:               jQuery(document).ready(function($) {      $('.upload_button').click(function() {          targetfield = $(this).prev('.logo_url');          imgpreview = $(this).parent().find('img');          tb_show('', 'media-upload.php?type=image&TB_iframe=true');     window.send_to_editor = function(html) {          imgurl = $('img',html).attr('src');          jQuery(targetfield).val(imgurl);          tb_remove();          $(imgpreview).attr('src', imgurl);          $('#submit_options_form').trigger('click');     };     return false;     });               // calls appendo     $('#manager_form_wrap').appendo({         allowDelete: false,         copyHandlers: true,         focusFirst: false,         labelAdd: 'Add New Slide',         subSelect: 'li.slide:last'     });          // slide delete button     $('#manager_form_wrap li.slide .remove_slide').live('click', function() {         if($('#manager_form_wrap li.slide').size() == 1) {             alert('Sorry, you need at least one slide');             }         else {             $(this).parent().slideUp(300, function() {                 $(this).remove();                })           }         return false;     });          // jQuery UI sortable     $("#manager_form_wrap").sortable({             placeholder: 'slide-highlight'     });           });


title: Cannot echo a JS variable to a jQuery plugin coming from wp_localize_script

text: **Short version:** I'm able to get a PHP variable into a JS file using wp_localize_script. On JS file i'm able to echo the variable using console.log, but I cannot get it echo into the jQuery plugin's options. **Long version:**   1. The plugin shortcode.              public function slider_shortcode($atts) {              $data = shortcode_atts (              array(                 'slideshow' => '',                 'responsive' => '',             ),              $atts          );              $slideshow_att = $data['slideshow'];              // DEBUG -> IT WORKS. I can see $responsive value on the page.         print_r($data['responsive']);                   ob_start();         $my_slider( $slideshow=$slideshow_att );             $my_slider_content = ob_get_clean();              wp_enqueue_script( $this->plugin_slug . '-public-script', plugins_url( 'assets/js/public.js', __FILE__ ), array( 'jquery' ), $this->version, TRUE);         wp_localize_script(                 $this->plugin_slug . '-public-script',                 'myScriptObject',                 $data             );                        return $my_slider_content;     }        2. The OUTPUT JS file.              (function ($) {         "use strict";              $(window).load(function () {                  var $resp = myScriptObject.responsive;                  // DEBUG -> IT WORKS. I CAN SEE THE SHORTCODE VALUE.             console.log($resp);                  $('.my-slider').SuperSlider({                 'fullWidth': true,                 'responsive': $resp, // <<-- HERE IS PROBLEM. IT NEVER CHANGES.                 'dimensions': '900,300',               });         });     }(jQuery));        3. The shortcode `[myslider responsive=true]`   4. The value _true_ is printed out using `print_r($data['responsive'])` and `console.log($resp)`. But for some reason `responsive: $resp` **do not change!** What am I missing here?


title: Wordpress Image Attachment using remote image

text: Is it possible to use remote image as wordpress attachment? * Not stored on our server.. How about the code/script? i see that attachment is act as post in database.. seems it's possible. _**UPDATE_** what i need is to programatically attach image from remote URL and the final goal is the remote image can show as attachment page template just like uploaded image. is that possible? Any suggestion would be highly appreciated. Thanks.


title: Search result by range?

text: I have to search for posts that have in tags or custom fields a number(price): example 152. Each post have a price tag. How I do to search for all post greater than a price for example I need to search for all post who have a price tag of minimum 100. Something like /?s=keyword&price>=300 Thx


title: make wordpress log errors in apache log file

text:
I need to log 404 errors and wp-login failed attempts on wordpress site. Unfortunately it natively handles everything and doesn't write to apache log file. I tried this: 404.php               <?php get_header(); ?>

<?php _e('Page Not Found', "magazine-basic"); ?>

<?php _e('The page you requested could not be found.', "magazine-basic"); ?>

     <?php     error_log("File does not exist: " . rtrim($_SERVER['DOCUMENT_ROOT'], "/") . $_SERVER['REQUEST_URI'], 0);     get_footer();     ?>      Functions.php               // Log login errors to Apache error log     add_action('wp_login_failed', 'log_wp_login_fail'); // hook failed login          function log_wp_login_fail($username) {         error_log("WP login failed for username: $username");     }      But it doesn't seem to do the trick. Any thoughts ideas how to do this?


title: WordPress SLOW, tried everything!

text: I have read every wordpress solution and tried them all (at least most), but I CAN NOT get my site to run faster. I am using the couponpress theme, which is a coupon listing theme where users can list different offers and coupons. I'm finished customizing it but I'm having real speed issue! I included a query count and load time function in the footer of my site and **the site runs 40-52 queries and loads in 4-8 seconds (depends on page)** , too many queries and too slow for comfort. I would like to get the speed to down to at least 2 seconds. I looked into the queries being ran and one in particular, the "wp_schedule_event," is generating an extremely large query, but not sure how to reduce it or eliminate it. I searched for any references to this function but I don't know what to do. I have tried different plugins and either they don't work as expected or they crash my site. **Main plugins Ive tried:**   * W3 Total Cache (Didn't work as expected)   * WP Super Cache (Didn't work as expected)   * Autoptimize (crashed)   * WP Minify (crashed) W3 Total Cache had the best results, but **I couldn't understand the cache settings and some of my changes to the site were not being applied** , so I deactivated it. I know that I have to clear the cache for changes to take effect, but since users to my site will be always be adding new listing, I don't know if the cache settings will allow their listings to display properly or at all for that matter. WP Super Cache didn't crash my site at first, but when I changed some settings I did not see any increase in speed. The other two seemed promising but for one reason or another crashed my site. There are probably conflicts between plugins and with some existing code, but I can't pin point the cause. Using firefox, I ran firebug and used the net console to see what processes are being ran on the different pages and **the initial load to the domain is taking a long time to load, average 7-9 seconds**. Most of this time is the "waiting" part of the process. I researched solutions to reducing this waiting time but can't increase the speed. I really want to speed up my site and I need some major help with this. I have been struggling for the past week trying different options but nothing seems to make it faster. If you need to check out the site **here** it is. Thanks a lot, I appreciate any advice with this.


title: Calling mysql_query() on another database, assumes WordPress using that database

text: I'm attempting to import some data from a legacy site into WordPress. First step is terms for taxonomy `event_category`. Here is my approach:               $link = mysql_connect(         'localhost',         'blah',         'blah'     );          // connect to old database     $dkpl_db = mysql_select_db('dkpldump', $link);          $event_categories = mysql_query('SELECT * FROM calendar_cats');     while($event_category = mysql_fetch_assoc($event_categories)){         //create term!         $term = wp_insert_term(             $event_category['categoryId'],             'event_category',             array(                 'slug' => $event_category['categoryName']             )         );         var_dump($term);     }      In my `var_dump` I'm getting following error:               WP_Error Object     (         [errors] => Array         (             [db_insert_error] => Array             (                 [0] => Could not insert term into the database             )         )         [error_data] => Array         (             [db_insert_error] => Table 'dkpldump.wp_terms' doesn\'t exist         )     )         The problem is `dkpldump` is the database I'm trying to _read_ from, not the database WordPress is installed on (`dkpl`). So why is it trying to write to `dkpldump` database and how can I fix it?


title: WP Customer Reviews - shortcodes

text: **WP Customer Reviews Plugin** Looking for some **shortcodes** for displaying the **review form only** / **reviews only**. On the plugin page there is an info about shortcode ( _Shortcodes available for inserting reviews and review form on any page or widget_ ), but I cannot find theme anywhere. http://wordpress.org/extend/plugins/wp-customer-reviews/ Have you got any experiences with the plugin? Any suggestions much appreciated.


title: Add Post type menu to another menu

text: I've created a menu page in the dashboard, then I created a custom post type and now I want to put the menu of the custom post type as a submenu under the first menu page I had created. I tried 'show_in_menu' => 'admin.php?page=mytestpage', However that did not work. Any tips?


title: JS / JQuery form validation in backend admin menus

text: I'm building a plugin to manage course information and am struggling to put form validation on the new meta boxes I've added. Has anyone a good way of putting JS / JQuery validation on the admin menus? Thanks


title: Adding a rich text editor to Excerpt

text: I need add to the excerpt field the TinyMCE Advanced editor, any ideas? I have the qTranslate plugin (multilanguage), and it's impossible to connect teh excerpt with this plugin and an editor. Thanks


title: Trouble saving wp_dropdown_pages()

text: I'm really hoping that someone can help me out here, I'm trying to give the admin the ability to choose a page for a button to link to. I've created the select using...               wp_dropdown_pages($args)      ... and am creating the arguments via...               $args = array(       'echo'  => 1,       'selected' => $the_link,       'name'  => 'theme_option[the_link]');      ... and have attempted to save the value generated               $input['the_link'] = (int) $input['the_link'];      ... but so far no luck. The selected option just resets once the form has been sent, and it doesn't look like the value is getting saved at all. Does anyone have any advice?


title: Cannot retrieve active members only

text:
Below is a page template where I'm trying to retrieve active members metadata (of Restrict Content Pro). Displaying users' meta is working just fine; but I can't get ONLY active members to display, rather than everyone. I wondered if perhaps there a simple error in the syntax below that might correct this. I need to check if a member is active [that's using `if( rcp_is_active() )]`, where all members are also subscribers on the site `[ $members = get_users( $args ); foreach ($members as $member)]` .               <?php     /**      * This file adds the User Directory template to the Parallax Pro Theme.      *      * @author StudioPress      * @package Parallax      * @subpackage Customizations      */          /*     Template Name: Directory     */          add_action( 'genesis_entry_content', 'ogs_directory', 5 );     function ogs_directory() {             $args = array(                 'blog_id'      => 1, // unless yours is a multisite install, you shouldn't need to change this                 'exclude'      => array(), // IDs of users that need to be excluded                 'orderby'      => 'display_name' // Sort by 'ID', 'login', 'nicename', 'email', 'url', 'registered', 'display_name', or 'post_count'; defaults to 'login'              );              $members = get_users( $args );              if( rcp_is_active() ) {             foreach ($members as $member)                             echo '
';                 echo 'Name: ' .esc_attr( $member->first_name ).  '' ;                 echo ' ' .esc_attr( $member->last_name ).  '
 ' ;                 if ( $member->rcp_address ) {                 echo 'Address: ' .esc_attr( $member->rcp_address ).  '
 ' ;                 }                 if ( $member->rcp_univ_1 ) {                 echo 'University: ' .esc_attr( $member->rcp_univ_1 ).  '
 ' ;                 }             echo '
';                   }   }          //* Run the Genesis loop     genesis();


title: Do_shortcode on PHP file outside theme ALMOST works

text:
I recently incorporated a new interface into my wordpress site that mimics an iGoogle layout. (If interested, It can be found here: Link and DEMO ) It uses several widgets to make up the layout that are added dynamically. The way to edit these widgets come from a file called widgets_rpc.php. I want to add another plugin I have, which allows users to edit text that is wrapped in a shortcode - [ce_sc did="1"][/ce_sc]. When some text is wrapped in this shortcode is clicked, it allows users to edit the text, and also shows "save' "Toggle editor" buttons below the text. When done with the changes, the user clicks "save" to save. I read about how to include shortcodes in PHP pages outside the wordpress theme, and ended up with this for the widgets_rpc.php file:               <?php     require('../../mysite/wp-blog-header.php');     ?>     <?php          header("Cache-Control: no-cache");     header("Pragma: nocache");          $id=$_REQUEST["id"];                    if ($id=="widget1")       echo do_shortcode("[ce_sc did='1']

[/ce_sc]");          if ($id=="widget2")       echo do_shortcode('[ce_sc did="2"]

[/ce_sc]');          if ($id=="widget3")       echo do_shortcode ("[ce_sc did='4']

[/ce_sc]");      So this actually works, almost. It acts as the shortcode regularly does, by allowing user to add text and even pops up a "save" "toggle editor" button on the bottom of the text area, but does not do anything when I click these buttons (as it normally does when done through wordpress). Is there a different method I could try for better results? Or am I missing a crucial step in the shortcode's function in php outside the theme? Thanks! PS. This site is on my local computer using server2go as development, otherwise I would have included a link.


title: How to compress thumbnail images of two different sizes?

text: I'm new to wordpress and so far with a limited knowledge of PHP, I was able to build up a theme from scratch. I removed the compression for my homepage images for a better quality of pics. Now, the thumbnails of very small sizes on either side of the trending pane are a little too heavy and I'd like to compress them alone. This is how my homepage looks: (All the images are not compressed by default) ![Home Page_Geekswipe](http://i.stack.imgur.com/fPvjT.png) I need to compress `A` and `C` only. I'm not sure how to do it. Is there a way to compress thumbnails based on the size it is displayed?


title: Issue with order of elements in responsive P2 theme

text: I forked this theme: http://p2.nmecdesign.com/ and here's my current fork: http://pattyayers.com/p2re2/ If you try the first one, you'll see that at smartphone size, the gray sidebar drops down below the main content section. My theme _had_ been the same, but while I was writing CSS for my forked theme today, something caused the _main content_ to drop below the _sidebar_ , at smartphone width, as you can see. I didn't edit the theme files, except to change some minor front-end text strings. I didn't edit functions.php. Did a lot of testing to try and figure this out, but I'm stumped.. any help much appreciated.


title: Hide plugin dashboard menu item for specific roles

text: I am writing a plugin and I am trying to only display the admin dashboard menu item to specific roles. I have this controlling snippet so far...               // Check User Role      global $current_user;       if( !empty($current_user->roles) ){         foreach ($current_user->roles as $key => $value) {           if( $value == 'administrator' ){                new myplugin_Wp_List_Table();           }         }       }      This isn't working for some reason, when i'm logged in as administrator it doesn't display the menu. Anyone any ideas?


title: Wordpress dot com blog full backup

text: I am really frustrated looking for a method to **backup** the **whole WordPress site** including the back-end files **from * _wordpress.com_ ***. I am planning to move the entire site to a new hosting account in godaddy, but cant find a solutions yet, I read that wordpress.com dont provide facility to even upload a plugin, and dont have the access the the back-end files... Blog which I want to backup http://dogwalkdiary.wordpress.com/ The theme I used in it **'Benevolence'** by _Theron Parlin_ Please help me if anyone knows how to do this... Thanks in advance


title: How to get multiple checkboxes in one meta field

text:
I can manage to show one checkbox using woocommerce products custom fields However, I need to show multiple values from multiple checkboxes in my admin area. I have the following code:                <input type="checkbox" name="myoption[option_one]" value="1"<?php checked( isset( $options['option_one'] ) ); ?> />      <input type="checkbox" name="myoption[option_two]" value="1"<?php checked( isset( $options['option_two'] ) ); ?> />      Now how would I be able to save them into one meta field? Similar to the idea below?               $product_field_type =  $_POST['product_field_type'];     update_post_meta( $post_id, '_product_field_type_ids', $product_field_type );      **EDIT** Ok so I have been able to define a custom box in my product page. But my checkboxes aren't storing! What am I missing here?                  /* Define the custom box */     add_action( 'add_meta_boxes', 'wpse_61041_add_custom_box' );          /* Do something with the data entered */     add_action( 'save_post', 'wpse_61041_save_postdata' );          /* Adds a box to the main column on the Post and Page edit screens */     function wpse_61041_add_custom_box() {       add_meta_box( 'wpse_61041_sectionid', 'title_color', 'wpse_61041_inner_custom_box', 'product', 'normal', 'high' );     }     /* Prints the box content */     function wpse_61041_inner_custom_box($post)     {         // Use nonce for verification         wp_nonce_field( 'wpse_61041_wpse_61041_field_nonce', 'wpse_61041_noncename' );              // Get saved value, if none exists, "default" is selected         $saved = get_post_meta( $post->ID, 'title_color', true);         if( !$saved )             $saved = 'default';              $fields = array(             'red'       => __('Red', 'wpse'),             'green'     => __('Green', 'wpse'),             'blue'      => __('Blue', 'wpse'),             'default'   => __('Default', 'wpse'),         );              foreach($fields as $key => $label)         {             printf(                 '<input type="checkbox" name="title_color" value="%1$s" id="title_color[%1$s]" %3$s />'.                 ' %2$s ' .                 '
',                 esc_attr($key),                 esc_html($label),                 checked($saved, $key, false)             );         }     }             /* When the post is saved, saves our custom data */        function wpse_61041_save_postdata( $post_id )         {             // verify if this is an auto save routine.            // If it is our form has not been submitted, so we dont want to do anything           if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )                return;                // verify this came from the our screen and with proper authorization,           // because save_post can be triggered at other times           if ( !wp_verify_nonce( $_POST['wpse_61041_noncename'], 'wpse_61041_wpse_61041_field_nonce' ) )               return;                if ( isset($_POST['title_color']) && $_POST['title_color'] != "" ){                 update_post_meta( $post_id, 'title_color', $_POST['title_color'] );           }      }


title: Automatic Updater Emails

text: When a site has been automatically updated, WordPress sends out an email based on something like..... [Example.com] Your site has updated to WordPress 3.8.1 Howdy! Your site at http://www.example.com has been updated automatically to WordPress 3.8.1. [...] How would it be possible to modify the content of this email - e.g. to re- write the text? Happy to write this into a plugin, but need to know if there is any kind of filter for this email text. There doesn't appear to be any mention of it anywhere!


title: Creating an RSS feed with all of the prior month's posts

text: How can I create an RSS feed that will display all posts from the prior month. So on any day in December, the feed will show all posts from November and so on. Thanks.


title: Wordpress returns the same Post ID every time everywhere!

text:
There is something weird happening in a recent theme I have developed.   Inside the post page when I use `$post->ID` and `get_the_ID()` it always returns the same ID which belongs to one of my posts!   I'm wondering what's happening there?!!! **Edit** : I found the reason behind this behavior. And it is that I have created a widget which inside it I use the `WP_Query` class (you can see the code at the end) and I guess it's overwriting the global $post. class TextAds extends WP_Widget{               function TextAds(){              $widget_ops = array( 'description' => __( "نمایش تبلیغات متنی", 'appthemes') );              $this->WP_Widget('textads', __('تبلیغات متنی', 'appthemes'), $widget_ops);          }          function widget($args, $instance){              //global $userdata;              extract($args);              if ( !empty($instance['title']) ) {                  $title = $instance['title'];              } else {                  $title = 'تبلیغات متنی';              }              echo $before_widget;              $title = apply_filters('widget_title', $title, $instance, $this->id_base);              $term = get_term_by( 'slug','text', 'ad_cat' );              $text_query = new WP_Query( array('post_type' => APP_POST_TYPE, APP_TAX_CAT => $term->slug, 'ignore_sticky_posts' => 1 ));              ?>
<?php echo $title; ?>

                              <?php while ( $text_query->have_posts() ) : $text_query->the_post(); ?>
<a href="<?php                                  //$url = get_post_meta(get_the_ID(),'cp_url',true);                                  if(stripos($url,'http://') === false){                                      $url = 'http://'.$url;                                  }                                   echo $url; ?>"><?php the_title(); ?>

                              <?php endwhile; ?>                        <?php              echo $after_widget;          }          function form( $instance ) {          ?>
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('عنوان ابزارک:', 'appthemes') ?>                  <input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php if (isset ( $instance['title'])) {echo esc_attr( $instance['title'] );} ?>" />
              <?php          }              function update( $new_instance, $old_instance ) {                  $instance['title'] = strip_tags(stripslashes($new_instance['title']));                  return $instance;              }      }


title: page not found for single-type.php file

text: i have created custom post type 'event' to display in single page named single-event.php file but it provides me 404 error. how i can solve this problem even i used > flush_rewrite_rules(); please provide some idea.......               function custom_event() {     $labels = array(         'name' => _x('Event', 'post type general name'),        'singular_name' => _x('Event', 'post type singular name'),        'add_new' => _x('Add Event', 'Content'),        'add_new_item' => __('Add New Event'),        'edit_item' => __('Edit Event'),        'new_item' => __('New Content'),        'view_item' => __('View Event'),        'search_items' => __('Search Content'),        'not_found' =>  __('Nothing found'),         'parent_item_colon' => '',        'menu_name' => __('Event')     );           $args = array(     'labels' => $labels,     'public' => true,     'publicly_queryable' => true,     'show_ui' => true,      'show_in_menu' => true,      'query_var' => true,     'rewrite' => true,     'capability_type' => 'post',     'has_archive' => true,      'hierarchical' => false,     'menu_position' => 20,     'supports' => array( 'title', 'editor')      );          flush_rewrite_rules();     register_post_type('event', $args);     }       //$wp_rewrite->flush_rules();       //add_action('admin_init', 'flush_rewrite_rules');         add_action ('init', 'custom_event');


title: How do I add a featured image to a single post page?

text: I'm using the Pinboard theme on WordPress 3.9.1. I'd like to edit Pinboard (or, more accurately, make a child theme) so that on single post pages, if the post has a defined featured image, it displays at the top of the post. I've gathered that doing so requires editing single.php in the theme, but my knowledge of PHP is minimal at best, so when I open single.php, I can't figure out where to make the changes--or, in fact, what changes to make. Would anyone be willing to walk me through what it would take to include the featured image at the top of a post page such as this one? Once I understand how to properly get the image on the page, I should be able to style it the way I want. This is probably asking for a little more hand-holding than is normal around here, so big thanks in advance.


title: Use get_post_types to query only custom posts types

text: I need to query only custom posts types - that is all post types in my WP install excluding posts and pages. I have used `get_post_types` to build a string of all custom post types which I want to query:               $args=array(         'public'                => true,         'exclude_from_search'   => false,         '_builtin'              => false     );      $output = 'names'; // names or objects, note names is the default     $operator = 'and'; // 'and' or 'or'     $post_types=get_post_types($args,$output,$operator);           // Loop thru the cpts and assign a related taxonomy to a variable     $posttypes_array = "";     foreach ($post_types  as $post_type ) {         $posttypes_array .= "$post_type, ";     }     $posttypes_array = rtrim($posttypes_array, ', ');     echo $posttypes_array;      The output for the variable `$posttypes_array` is this string:               'puzzles', 'quizzes', 'challenges', 'tales', 'can_you_help'      My issue is that I can't use this variable to query all of these post types like this:               $buildArgsAllQuestions = array( // Add out new query parameters         'post_type' => array($posttypes_array),         //'post_type' => $posttypes_array,         'orderby' => 'date',         'order' => 'DESC',     );      My query for all custom posts only works when I use this line for post_type:               'post_type' => array( 'puzzles', 'quizzes', 'challenges', 'tales', 'can_you_help' ),      Can anyone tell me how I can use the variable `$posttypes_array` or something similar to query all custom posttype like this: `'post_type' => array($posttypes_array)` ?


title: How to add an empty entry to masonry?

text:
I am using masonry js library for display posts in my wp installation. The problem with it is that you cannot really add anything between posts entries because absolute positioning is used. So either I should use js to hack into masonry to add the block I want, or I can customize wp categories/tags loop (that's where I need it) to add an empty entry, that I can use as placeholder, and place stuff on it with css. So How can I add an empty entry to category and tag loop? In my case I need the empty entry to be ahead, so it should be like this: - first the empty entry - then normal loop continues How to do it?               add_action( 'wp_enqueue_scripts', 'sk_masonry_script' );          //* Add custom body class to the head     add_filter( 'body_class', 'sk_body_class' );     function sk_body_class( $classes ) {             if (is_home()||is_archive())                     $classes[] = 'masonry-page';                     return $classes;     }                         //* Display Post thumbnail, Post title, Post content/excerpt, Post info and Post meta in masonry brick     add_action('genesis_meta','sk_masonry_layout');     function sk_masonry_layout() {             if (is_home()||is_archive()) {                          //add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );                               remove_action( 'genesis_entry_header', 'genesis_do_post_title' );                     remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );                     remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );                     remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );                          remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );                     remove_action( 'genesis_entry_content', 'genesis_do_post_content' );                          remove_action( 'genesis_entry_footer', 'genesis_post_meta' );                          add_action( 'genesis_entry_content', 'sk_masonry_block_post_image', 8 ) ;                     add_action( 'genesis_entry_content', 'sk_masonry_title_content', 9 );                          add_action( 'genesis_entry_footer', 'sk_masonry_entry_footer' );                          remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );                     add_action( 'genesis_before_content', 'genesis_do_breadcrumbs' );                          remove_action( 'genesis_before_loop', 'genesis_do_taxonomy_title_description', 15 );                     add_action( 'genesis_before_content', 'genesis_do_taxonomy_title_description', 15 );                          remove_action( 'genesis_before_loop', 'genesis_do_author_title_description', 15 );                     add_action( 'genesis_before_content', 'genesis_do_author_title_description', 15 );                          remove_action( 'genesis_before_loop', 'genesis_do_author_box_archive', 15 );                     add_action( 'genesis_before_content', 'genesis_do_author_box_archive', 15 );                          remove_action( 'genesis_before_loop', 'genesis_do_cpt_archive_title_description' );                     add_action( 'genesis_before_content', 'genesis_do_cpt_archive_title_description' );                          remove_action( 'genesis_after_endwhile', 'genesis_posts_nav' );                     add_action( 'genesis_after_content', 'genesis_posts_nav' );                  }     }          //* Helper function to display Post title and Post content/excerpt wrapped in a custom div     function sk_masonry_title_content() {             echo '
';                     genesis_do_post_title();                     genesis_do_post_content();             echo '
';     }          //* Helper function to display Post info and Post meta     function sk_masonry_entry_footer() {                     genesis_post_info();                     genesis_post_meta();     }          //* Set the second parameter to width of your masonry brick (.home .entry, .archive .entry)     add_image_size( 'masonry-brick-image', 255, 0, TRUE );          //* Helper function to display featured image     //* Source: http://surefirewebservices.com/development/genesis-framework/using-the-genesis-featured-image     function sk_masonry_block_post_image() {                     $img = genesis_get_image( array( 'format' => 'html', 'size' => 'masonry-brick-image', 'attr' => array( 'class' => 'post-image' ) ) );                     printf( '%s', get_permalink(), the_title_attribute( 'echo=0' ), $img );     }          //* Add more link when using excerpts     function sk_excerpt_more($more) {         return '  [Continue Reading]';     }     add_filter('excerpt_more', 'sk_excerpt_more');          //* Modify the length of post excerpts     add_filter( 'excerpt_length', 'sk_excerpt_length' );     function sk_excerpt_length( $length ) {             return 33; // pull first 10 words     }


title: Rewrite rule is catching pages not posts

text: I am trying to implement a wordpress site where there possibly is a name generated in the format firstname.lastname at the front of the url. I have the following rule                   $wp_rewrite->rules = $newrules + $wp_rewrite->rules;         $newrules = array('('.$var['RealName'].')/(.+)$' => 'index.php?pagename='.$name.'&brokername='.$wp_rewrite->preg_index(1));              $wp_rewrite->rules = $newrules + $wp_rewrite->rules;      I am looping and adding rules for each individual. My problem is this works fine for Pages but does not work for Posts? Any ideas?


title: Preventing Search Engines Indexing Pages 2, 3 and More?

text: Do you know how to prevent indexing of pages past the home page in WP? I mean I don't want `mysite.com/page/2`, `mysite.com/page/3` to be indexed. This is because I use `home.php` for my theme, so that `page/2`, `page/3` are all the same. Please give me a hint or a code snippet please, I don't want to add another plugin (robots meta).


title: How can i add new post on new page

text: I have set up my blog (WP 3.4) the following way: I had created pages in my blog, so that I have them as separate navigation items in the header (it looks like: Home, PageA, PageB, etc.). What I want to do now is to create posts on the pages. When I create posts, there is no way to select the page, where my post should appear. The posts always appear on the "Home" page. Actually I want to do post in specific page. Is there any way to do it.If it is then please help me out. Thanks.


title: Wordpress 3,5 and Jquery version

text: I updated my WordPress installation to latest version (3.5)when i am looking at source code of my site, i saw following lines               <script type='text/javascript' src='http://localhost/myblog/wp-includes/js/jquery/jquery.js?ver=1.8.3'></script>      It seems like WordPress is only loading un-minifed version of Jquery, Is there any way i can configure it to load minified version in production? I am unable to find any minified version under `/wp-includes/js/jquery`


title: Multiple TinyMCEs breaking Distraction Free Writing

text: I created a meta box which has multiple tinyMCE editors. However, now when I go to edit a page and click the fullscreen button on the main editor, it shows the content of the metabox. When I close it and go back to fullscreen, it shows the correct content. Anyone know where to begin on fixing this? Thanks!


title: Display most recent post in full, excerpts of older posts

text: Running 3.5.1. Is there an easy way to display my most recent post in its entirety and only display excerpts for my older posts on my home page?


title: How to exclude page in pages module

text: Site has page with url http://example.com/mywpsite/mypage Pinboard theme is used. Pages module shows this in left sidebar. How to remove it from this? Pages module setting contain field excluded page ids I put mypage to it but page is still shown in page list. I havent found any other page id in wordpress for this page. **Update** Pages confing menu can reached as follows (texts translated to english): In admin panel click Appearance Modules and look into "Sidebar left". It contains word Pages below. After that is Change link After that config menu appears containing field Jäta välaj - "Excluded page ids, separated by comma". There is page name "viga" entered but page viga still appears in list. I use page name as post link setting. For posts I can click in get link button and see number which is probably post id. For page there is no such setting. ![pages config](http://i.stack.imgur.com/VievO.png)


title: How to get the list of posts in a static page other than front page?

text: So, for the thousands using WP as CMS, a typical approach is that of using the 'A Static Page' option from the Settings > Reading admin page. However, I'm in a different scenario: our front page is displaying static content ( _home.php_ template drives that), and we have a secondary static page (called _News_ ) which should display the list of most recent posts (what you usually find on an average blog's front page). I set up the News page to use a custom template ( _page-NewsIndex.php_ ); based on TwentyTen's archive.php template, this file displays a header, calls rewind_posts() and then calls get_template_part('loop', 'newsindex') so that we end up in loop.php (or loop-newsindex.php, if it exists). Peachy. _Loop.php_ has your typical loop structure (again, based on TwentyTen's loop.php template - tweaked to simplify since we don't need 3 type of loops):               <?php while ( have_posts() ) : the_post(); ?>      However, when we access the page, this loop seems to use the current URL to determine the posts to display, as if the News page was defining a category - which is not the case for us. What would be the appropriate query_posts for me to use to simulate the query_posts that WP usually runs for you when you get to the front-page of a typical blog?


title: Can you keep session data for visitors?

text: I read that you can use session_start() in config.php, but that it is not recommended. I have a form where a user fills out their name and submits. On confirmation of the submission they land on a new page that says 'Thank-you First Last.' What is the preferred way of passing this information from page1 on to page2?


title: Search input area autogrow - how?

text: I've tried for many hours to style my searchform. I managed to get it all done after some research. I even managed to get the text highlighted when on focus using javascript (no idea if there's a non-javascript solution as well). anyways, I've been googling around and trying out all sorts of things (e.g. playing around with the width when "onfocus" in my style.css) - nothing worked. I want a width autogrow for my searchform like in the Twenty Eleven Theme. Basically what I want is when you click on the input area the it will get a bit wider. What I could find was this plugin which uses jquery. I don't know how to implement it, though. Is using jquery the only option I have? Can I get this effect via a different method? I really tried a lot and searched around for hours, but couldn't find an answer, so I'd be happy for any kind of advice you can give me :) Thanks a lot in advance!


title: Enable Recent Comments widget to display comments on attachment posts

text: Is it possible to hook into the default Recent Comments widget to enable it to display comments for attachment posts? If so, how?


title: How do I create a multi site network?

text: I'm wondering how to do make a multi-site network with wordpress. The best example I have is the cheezburger network.


title: .htaccess and WordPress Admin Bar

text: I have a built a number of WordPress sites for clients and my usual practice is to keep all the WP stuff in a /wordpress/ directory at root level. However, I don't like this directory appearing in the urls, so I simply omit it from the links and use .htaccess to reinsert it silently...               # If it's not a direct request for an existing file or directory,     # then add /wordpress/ at the start of every filepath unless it's there already          RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteCond %{REQUEST_FILENAME} !^\/wordpress\/.*     RewriteRule ^(.*)$ /wordpress/$1 [L,NE]       (This is a manual edit to the .htaccess file at the root level of the site. The .htaccess file in the /wordpress/ directory implements the `/%postname%` permalink structure.) This arrangement worked fine until the Admin Bar arrived (WordPress 3.1?). The problem I have now - on all these sites - is that the Admin Bar (on the front end for logged-in users) is only displayed if I manually reinsert "/wordpress/" into the url in the address bar of the browser. `http://www.hlbc.org.uk/wordpress/about` - Admin Bar visible `http://www.hlbc.org.uk/about` - Admin Bar **not** visible I rather suspect that this is something to do with the WP_Rewrite object, but I haven't yet attempted to wrestle with this. Can anyone give me some pointers to help me understand what's going on? Any help much appreciated. Thanks! * * * @Milo: Thanks. Didn't know about that hack. But for ease of upgrades I'd prefer something that didn't require messing with WP core files - and I'd still like to know why my system doesn't work! @Sean Lee: Nice try - and useful. Spent many hours fiddling with deregistering etc and am now convinced that it's nothing to do with javascript, but rather that without `/wordpress/` in the url, I'm not regarded as logged in at all. Is this likely to be a problem with `COOKIEPATH` perhaps? @Milo: I'll give that another look and maybe try it out on the next site I do. I was initially put off by the bit about having to edit the WP `index.php` file. But I suppose if it's outside the `\wordpress\` directory then it's not likely to be overwritten when upgrading. Are the 2 active lines of code in it guaranteed never to change in future versions?


title: allow user to style widget backgound per widget

text: Is there a way to allow a user to style a widgets backgound per widget? Lets say there are 4 widgets in the sidebar, i want the user to be able to style the first 2 with a blue background, the second with a purple background and the final one to have no background but how would you allow the user to make this choice?


title: Multi Site Search Pagination is Broken

text: the CG Cookie network is running a WordPress multi site install. There is a strange bug happening with the search pagination when on any of the sub sites. For example, if you go to http://cgcookie.com/blender/, which is one of the sub sites, and do a search for "blender", you will be taken to a search results page with about 389 items. The first page displays perfectly fine, but if you try to click over to page 2, or any of the other pages, you will be directed to a random tutorial post. Upon closer investigation, you will notice that the url of the page numbers is of the following structure: http://cgcookie.com/blender/blender/page/2/?s=blender This is incorrect, and should be: http://cgcookie.com/blender/page/2/?s=blender So, for some reason, the site name is getting inserted into the search URL twice. If I manually remove one of the site names, and enter the correct url, everything works fine. Why is it putting two site names in the url? It's important to note that this bug ONLY happens on the search results pagination (not on any of the archives) and it also ONLY happens when on a sub site. If you search for "blender" from the http://cgcookie.com domain, it works perfectly fine. For the pagination, I am using the function that Kriesi wrote here. Note, however, that I do not believe it is a problem with the function, as the WP Page Numbers plugin had the exact same problem. I ran into this problem once before, and you can see my question about it here. The fixes described there have made no difference. Anyone have any ideas?


title: Show Homepage (only) Hits Count

text: I need a counter to put in my theme (using php) or widget to show homepage view counts I've tried "Cystats" but i couldn't get 'only' homepage hits by it how can I do this ? (there is a idea to show how many times website has been opened -sessions counts- for example- but i couldn't find any counter to do that , it's ok to find a way to show that instead of homepage counts)


title: add_rewrite_rule query_var not being set

text: I have an unusual use of add_rewrite_rule (is there a usual use?) and I am getting some unexpected behavior. First here is my code:               if(!empty($list_view_template))         add_rewrite_rule(             "{$list_view_template}/(.*)?",             'index.php?mlscrit=$matches[1]/list-view/&pagename=' . $list_view_template,             'top'         );          add_filter('init', 'mls_declare_mls_custom_vars');          function mls_declare_mls_custom_vars() {         add_rewrite_tag( '%mlscrit%', '(.*)' );     }      so as you can see I am using a pagename set within the admin dashboard to a variable called $list_view_template to limit a rewrite rule. This works fine so long as I flush rewrite rules after I update the value (which I do). The problem is with the query variable mlscrit. When I run this through Jan Fabry's excellent rewrite analyzer, http://wordpress.stackexchange.com/a/3608/27556, it gives me what I expect, mlscrit = '/list-view/' plus whatever is in the regex even if the regex is empty. However if I do this:               add_action( 'template_redirect', 'mls_feed_rewrite_catch' );     function mls_feed_rewrite_catch()     {              echo 'mlscrit: ' . get_query_var('mlscrit' );     }      and the regex has something in it, it works. But if the regex is empty, the variable also loses the '/list-view/' part such that it is empty. Can anyone explain to me why this would be the case? I should also mention I have tried hardcoding the pagename, I have tried using the query_var filter in lieu of the add_rewrite_tag and I have tried grabbing the value of mlscrit in a bunch of different places and I always get the same answer, mlscrit is empty unless there is something in the regex. Thank you! Matthew


title: Retrieve options set through a plugin

text: I am creating a simple "global settings" plugin, which simply saves a few text fields. Saving works as intended, and I can retrieve my data in frontend as follows:               <?php $options = get_option('wpglobalsettings'); ?>     <?php echo $options['wpglobalsettings_image1']; ?>      What I would like though, would be to avoid having to call get_option('wpglobalsettings'); on each page I plan to use my plugin on. So I was thinking I could add my $options to an action hook. I did the following, but it doesn't work ( I get an empty array.               function wp_global_settings_frontend(){       $options = get_option( 'wpglobalsettings' );     }          add_action('the_content', 'wp_global_settings_frontend');      Can You help? Many thanks!


title: JavaScript added as link/stylesheet

text: I am just trying to create a plugin that will add some JS to the header and custom CSs. I have this below but it adds the css wrong and shows as JS. This is first plugin i have attempted.               <?php     /**      * Plugin Name: mmoore5553 Simple Range Slider      * Plugin URI: mailto:mmoore5553@gmail.com      * Description: Simple Range Slider      * Version:  1.0      * Author: mmoore5553@gmail.com      * Author URI:       * License:GPL2      */               function SimpleRangeSlider() {     wp_register_script('SimpleRangeSlider', plugins_url('/js/simple-slider.js', __FILE__), array('jquery'),'1.1', true);     wp_enqueue_script('SimpleRangeSlider');     }          add_action( 'wp_enqueue_scripts', 'SimpleRangeSlider' );                     function SimpleRangeSlider1() {     wp_register_script('stylesheet1', plugins_url('/css/simple-slider.css', __FILE__));     wp_enqueue_script('stylesheet1');     }          add_action( 'wp_enqueue_scripts', 'SimpleRangeSlider1' );            function SimpleRangeSlider2() {     wp_register_script('stylesheet2', plugins_url('/css/simple-slider-volume.css', __FILE__));     wp_enqueue_script('stylesheet2');     }          add_action( 'wp_enqueue_scripts', 'SimpleRangeSlider2' );       ?>


title: include <p> content within conditional statement?

text: I have a gallery page wherein there are multiple individual galleries/sub- pages. I handle this function by using-               <?php              if( is_page( 39 ) ) {         echo do_shortcode('[nggallery id=1]');         } else {         }     ?>      I'm wondering, is there a way to include page specific content in that? For example, if that code is used to show A's gallery, how can I include A's bio info within that statement(using `<p>`)?


title: Query Custom Post Type based on text input

text:
I want to query the custom post type by the three fields below. The two select fields and the one text field. The text field is the one that is not working currently. What is wrong? How can I fix that?                       <form name="search" action="" method="get">                      City:                 <select name="city" style="width:175px;" >                 <?php                 $cities = mo_baptist_get_meta('street_city');                 if ($cities) {                     foreach ($cities as $city) {                         echo "<option value=\"" . $city . "\">" . $city . "</option>";                     }                 }                 ?>                 </select>                 Association:                 <select name="association" style="width:175px;">                 <?php                 $associations = mo_baptist_get_meta('association');                 if ($associations) {                     foreach ($associations as $association) {                         echo "<option value=\"" . $association . "\">" . $association . "</option>";                     }                 }                 ?>                 </select>                      <input type="text" name="zipcode" placeholder="Zip Code" value="<?php $zip_code = mo_baptist_get_meta('street_zip'); ?>"                      <input type="submit" value="search" />             </form>             <?php $az = range('a', 'z');                       ?>
               <colgroup>                 <col width="300">                 <col width="200">                 <col />                 <col />               </colgroup>
                 <?php _e('Name'); ?>	                 <?php _e('City'); ?>	                 <?php _e('Phone'); ?>	                 <?php _e('Website'); ?>

                 <?php $zip_code = $_GET['street_zip']; $cities = $_GET['city'];  $associations = $_GET['association'];                  if ($cities  || $associations  || $zip_code) {                     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;                     $args=array(                     'post_type'  =>  'church',                     'order'  => 'ASC',                     'orderby'  => 'title',                     'posts_per_page'  => 25,                     'paged'=>$paged,                     'meta_query'  =>  array(                         array(                             'value'  =>  $cities,                         ),                         array(                             'value'  =>  $associations,                         ),                          array(                             'value'  =>  $zip_code,                         )                     )                   );                   query_posts($args);                 } else {                  query_posts(array(                     'post_type'  =>  'church',                     'order'  => 'ASC',                     'orderby'  => 'title',                     'posts_per_page'  => 25,                     'paged'  =>  $paged                 )); } if (have_posts()): while (have_posts($paged)): the_post(); $church = get_post_custom($post->ID); ?>
                     <a href="<?php the_permalink(); ?>" id="church-<?php the_ID(); ?>"><?php the_title(); ?>	                     <?php echo $church['street_city'][0]; ?>	                     <?php echo $church['phone'][0]; ?>	                     <?php if (!empty($church['website_url'][0])): ?><a href="http://<?php echo $church['website_url'][0]; ?>"><?php _e('Homepage') ?><?php endif; ?>
                 <?php endwhile; endif; ?>

                    <?php kriesi_pagination(); ?>


title: javascript onload calling a function of a plugin

text: A friend created a plugin for me which allows the users to mark posts as read or unread. The code of this plugin is the following : edit of the code !               <?php     /**      * @package Read-Unread      * @version 1.0      */     /*     Plugin Name: Read-Unread     Plugin URI: http://www.google.fr     Description: Read-Unread plugin     Author: Moi     Version: 1.0     Author URI: http://www.google.fr     */          global $wpdb;          $table_name = $wpdb->prefix . "users_read";           $sql = "CREATE TABLE IF NOT EXISTS `$table_name` (       `ID_USER` int(11) NOT NULL,       `ID_POST` int(11) NOT NULL,     ) ENGINE=InnoDB DEFAULT CHARSET=latin1;";          require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );          dbDelta( $sql );          function all_css()     {         echo '         ';     }          function all_js()     {         echo '         ';     }          function ajax_read() {         global $wpdb;              $idUser = intval(get_current_user_id());         $idPost = intval($_POST['idPost']);              $table = $wpdb->prefix . "users_read";         $data = array('ID_USER' => $idUser, 'ID_POST' => $idPost);         $format = array('%d','%d');               $res = $wpdb->insert( $table, $data, $format );              if($res == false)         {             return 1;         }              return 0;              die();     }          function ajax_unread() {         global $wpdb;              $idUser = intval(get_current_user_id());         $idPost = intval($_POST['idPost']);              $table = $wpdb->prefix . "users_read";         $where = array('ID_USER' => $idUser, 'ID_POST' => $idPost);         $where_format = array('%d','%d');               $res = $wpdb->delete( $table, $where, $where_format );              if($res == false)         {             return 1;         }              return 0;              die();     }          add_action( 'wp_ajax_read', 'ajax_read' );     add_action( 'wp_ajax_unread', 'ajax_unread' );          function get_img_read_unread()     {         global $wpdb;              $idUser = intval(get_current_user_id());         $idPost = intval(get_the_ID());              $msg = '';              if($idUser > 0 &&  $idPost > 0)         {             $read = $wpdb->get_var( "SELECT COUNT(*) FROM wp_users_read WHERE ID_POST=$idPost AND ID_USER=$idUser");                  if($read == 1)             {                 echo '';             }             else             {                 echo '';             }         }     }          function add_button($content)     {         global $wpdb;              $idUser = intval(get_current_user_id());         $idPost = intval(get_the_ID());              $msg = '';              if($idUser > 0 &&  $idPost > 0)         {             $read = $wpdb->get_var( "SELECT COUNT(*) FROM wp_users_read WHERE ID_POST=$idPost AND ID_USER=$idUser");                  if($read == 1)             {                 $msg = '';             }             else             {                 $msg = '';             }         }     $posttype = get_post_type( get_the_ID() );     if ($posttype == post)     {         return $content . $msg;     }     else     {         return $content;     }     }          add_filter('the_content', 'add_button');          add_action( 'wp_footer', 'all_js' );          add_action( 'wp_head', 'all_css' );               ?>      I would like to mark as read a post when a post is opened by a user. So how could I do that ? If i am not understandable enough, please let me know and i'll try to explain better. Thank you. Corentin


title: Metabox to list/store a certain type of post tag

text: I'm at an impasse here. I'm admin-ing a food blog for a friend. She enters the ingredients for each recipe post as post tags. Down the road I'm going to create a page where a user sees a list of all ingredients in the database, they can check ingredients they have, and they'll get a list of recipes tagged with all those ingredients they checked. The crux here is I need a way to describe each of those ingredient tags as ingredients in the database, so the query automatically lists those ingredients for the user. Using custom fields doesn't seem to be the way to go because all the built-in WordPress functions will only list post_meta keys/values for a given post. Also, there's a lot of duplication, as there will be many instances of the same ingredient value, so simple MySQL queries won't help there. Also, entering those in the Edit Post screen isn't very user friendly with the default custom fields metabox, nor is it possible with the Advanced Custom Fields plugin. I'd like to use something like the category metabox--a simple list with checkboxes and the ability to add a new ingredient to the list. When the user publishes the post, the tags in that metabox would somehow save to the wp_terms, wp_term_taxonomy, and wp_term_relationshiops tables with a unique identifier distinguishing it as an ingredient tag (its own taxonomy? use the term_order column? create a new column and use that?). I've read about creating custom metaboxes, and I get how it's generally done; however, I'm not so savvy on how to customize what categories/tags are retrieved and listed, and how to customize the data it saves to the database, so I can ensure the tags being entered from that metabox are saved in a unique fashion. Hope this makes sense. Maybe I'm overlooking an easy solution to this? Any help would be appreciated. Thanks.


title: Where does the gallery shortcode gets its attachments from?

text: I know that media are an attachment post type that are children to a post, but how are galleries stored in WordPress?


title: How to get children/attachments in header?

text:
I am trying to add a slider to my custom page template. I would like to have the flexibility to upload images from the add media button in the editor and have no restrictions on the number of images. Below is the code I am using:               /*      Template Name: Property     */           add_action('genesis_entry_header','property_slider',15);     function property_slider() {           // array with parameters     $args = array(         'post_parent' => $post->ID,         'post_type' => 'attachment',         'orderby' => 'menu_order',          'order' => 'ASC',         'numberposts' => -1,           'post_mime_type' => 'image'     );     if ( $images = get_children( $args ) ) {              echo '

';                      foreach( $images as $image ) {                     echo wp_get_attachment_image( $image->ID, 'full' );                 }              echo '

';      }          }      The above is outputting all the images in my gallery. How do I output only the images "uploaded to this page"? Your input is very much appreciated!


title: How to tell which Plugin is displaying?

text: I'm editing a Wordpress website for a client that was written by someone else. I'm noticing that a video and button are displayed on the home page. I used the Reveal-Template plugin to figure out which template was displaying but I can't seem to figure out which plugin is being used to display the video and button. I'm sure it's a plugin too because I changed the video yesterday. The problem I'm trying to fix is that I want to put a link on the button but currently, it only gets set by a drop down menu. This means I'll need to go and edit the plugin being used to allow for a URL instead of just internal pages. If I could figure out which plugin it is, I would go edit that code. Does anyone have a good way of figuring this out? I'm very new to Wordpress development so I apologize if this is a really basic question. Thanks in advance for your help!


title: Wordpress global variables?

text: I've got page with metabox called "something". It can have two values "value" and "value2". I'm using a shortcode at this page and want it to display something's value. The problem is I don't know how to access global variable in a shortcode? Example, I have this in page.php:               if($something == "value") {             global $one, $two;           $one = 120;          $two = 240;     }      Now I want to access these variables in my shortocde (functions.php file), but               echo $one; echo $two;      Gives no output. Any ideas?


title: Strange Search Query Appearing on Google Index - "/?q=Save+Us+From+Berlusconi"

text: Strange. Stripping my site URL, and searching for the term "/?q=Save+Us+From+Berlusconi" on Google shows up this blog post written way back in 2009: http://www.seroundtable.com/archives/021647.html My site is facing something similar. What should I do? Is this really a bug from Google? It looks like Berlusconi is the prime minister of Italy; however my site has nothing to do with political stuffs. I see there are a couple of threads in Google forum -- older ones -- that talk about this strange query indexed on Google. Example query: http://www.google.com/search?q=%22websites+to+automatically+post+blog+post+on+twitter%22&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en- US:official&client=firefox-a Check the second URL.


title: Weird undefined index: id,std notices. How to fix it?

text: Ok I'm running my wordpress in debug mode. I'm getting lot of notices. This is my code.               <?php     //allows the theme to get info from the theme options page     global $options;     foreach ($options as $value) {         if (get_option( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; }         else { $$value['id'] = get_option( $value['id'] ); }         }     ?>      This is what i'm seeing.               Notice: Undefined index: id in functions\get-options.php on line 5          Notice: Undefined index: std in functions\get-options.php on line 5      These notices repeated around 20 times. Whats wrong in my code?. Can anyone help me to fix those errors. Thanks.


title: Manage edit user capabilities on user list (user.php)

text: I would need to disable the user edit for some users from the user's list (user.php). I thought I could use the map_meta_cap hook or user_has_cap but I'd need to know the user_id inside the loop in order to disable the edit capability, just for that specific (or more) user . How can I get the user_id inside the loop? Thanks


title: 2 posts same excerpt?

text:
I'm facing the following problem: I'm outputting 2 posts with different titles, dates, permalinks but the excerpt are both the same.                       <?php         $query = new WP_Query( array( 'post_type' => array( 'events' )));              $months = array("", "januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december");              function sortFunction( $a, $b ) {             return $a["date"] - $b["date"];         }              while ( $query->have_posts() ) : $query->the_post();                 $date = get_post_meta(get_the_ID(), 'date');                         $id = get_the_ID();                      $tosortposts []= array(                     'date' => strtotime($date[0]),                     'link' => get_permalink($id),                      'title' => get_the_title($id),                      'excerpt' => get_the_excerpt(5)                 );              endwhile;              usort($tosortposts, "sortFunction");              foreach($tosortposts as $p){                      echo '
';                 echo ''; echo $p['title']; echo '

';                 echo date('j ', $p['date']).$months[date("n", $p['date'])].'
';                                                echo excerpt(35);                      echo '
»  Lees meer over dit evenement
';         }         ?>               <?php endwhile; ?>      What am I doing wrong?


title: how to make a child theme replace functions in different php files that are loaded throu require_once

text: i'm working on a child theme for the "news" template. my problem is that there are some functions in the parent theme that are defined in different php files. these files are called in functions.php with require_once. i think i understand how to unload functions and define my own functions, but how do i point the require_once call to my new file in the child-theme path? cheers, troy


title: Order by first name

text:
I'm trying to order the member list by ~~display_name~~ or first name ASC. http://sim.is/sim/felagatal-sim/ This doesn't seem to work. Any pointers out there? :/               $users = get_users(array(         'role' => 'sm_flagar',         'orderby' => 'display_name',         'order' => 'ASC',     ));              foreach ($users as $user) {             $firstName = get_user_meta($user->ID, 'first_name', true);             $lastName = get_user_meta($user->ID, 'last_name', true);                 echo '
user_url . '">' . $firstName . ' ' . $lastName . '
' . PHP_EOL;         }


title: Related Posts loop - offset

text:
I've been working on this for many, many, many weeks already. I've already asked similar questions here and elsewhere, but nobody seems to be able to sovle this problem. Maybe it's not possible anyways? My related posts are tag based and the code looks like this:               <?php                              $backup = $post;                             $tags = wp_get_post_tags($post->ID);                             if ($tags) {                                 $tag_ids = array();                                 foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;                                      $args=array(                                     'tag__in' => $tag_ids,                                     'post__not_in' => array($post->ID),                                     'showposts'=>4, // Number of related posts that will be shown.                                     'caller_get_posts'=>1                                 );                                 $my_query = new wp_query($args);                                 if( $my_query->have_posts() ) {                                     while ($my_query->have_posts()) {                                         $my_query->the_post();                                     ?>      I want users to be able to scroll to the next 4 related posts after that, and again to the next 4. A total of 12 posts. I'm using jQuery Tools' Scrollable to do so. Each loop will sit between divs so that scrollable will where to cut the content and where to scroll. All I could find about offsetting your loop was this:                  // FIRST LOOP: display posts 1 thru 4     <?php query_posts('showposts=4'); ?>     <?php $posts = get_posts('numberposts=4&offset=0'); foreach ($posts as $post) : start_wp(); ?>     <?php static $count1 = 0; if ($count1 == "4") { break; } else { ?>          <?php the_title(); ?>     <?php the_content(); ?>          <?php $count1++; } ?>     <?php endforeach; ?>               // SECOND LOOP: display posts 5 thru 8     <?php query_posts('showposts=5'); ?>     <?php $posts = get_posts('numberposts=4&offset=4'); foreach ($posts as $post) : start_wp(); ?>     <?php static $count2 = 0; if ($count2 == "4") { break; } else { ?>          <?php the_title(); ?>     <?php the_content(); ?>          <?php $count2++; } ?>     <?php endforeach; ?>               // THIRD LOOP: display posts 9 thru 12     <?php query_posts('showposts=4'); ?>     <?php $posts = get_posts('numberposts=4&offset=8'); foreach ($posts as $post) : start_wp(); ?>     <?php static $count3 = 0; if ($count3 == "4") { break; } else { ?>          <?php the_title(); ?>     <?php the_content(); ?>          <?php $count3++; } ?>     <?php endforeach; ?>      I tried, but keep getting error messages. Basically I just have no clue how to combine my original code with that one. Or is there a more elegant solution? **EDIT: UPDATE October 17th** The code basically works, there's only ONE HUGE PROBLEM. It now produces the same related posts in every single entry, even in posts that don't even have any tags!! Also, it messes up the comments, too! It doesn't display the correct number of comments and shows the pingbacks of another post instead. Any idea why?
Related Posts
                                               <?php      $args=array(     'tag__in' => $tag_ids,     'post__not_in' => array($post->ID),     'showposts'=>12, // get all the posts at once, then split them up afterwards.     'ignore_sticky_posts' => 1      );          $posts_per_block = 4;          $my_query = new wp_query($args); ?>

          <?php     if( $my_query->have_posts() ) : while ($my_query->have_posts()) : $my_query->the_post();     if ( ($my_query->current_post) == 0 ) {         echo '
';     }     elseif ( ( $my_query->current_post ) % $posts_per_block == 0 ) {         echo '

'; //close and open a new div every nth post     }     elseif ( ( $my_query->current_post + 1) == ( $my_query->post_count ) ) {         echo '
'; //close the div if you run out of posts     } ?>
<a href="<?php the_permalink() ?>" rel="bookmark"><?php the_post_thumbnail(array(120,80)); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>

               <?php     endwhile; endif;     ?>

                     I really hope that finally somebody can help me figure this out. Thanks a lot in advance.