title: loop with the last commenter on each post on specific category

text:
Hi i have the following code that lists the posts from specific category and the date, post author, the last comment author, last comment date and the avatar for comment author for each post on the list but it shows only all posts from this category with the post author, date, title and a photo functions.php:                   <?php function Theme_get_post_blog()     {                                   $arrImages =& get_children('post_type=attachment&post_mime_type=image&post_parent=' . get_the_ID());                                   if($arrImages)                               {                                 $arrKeys    = array_keys($arrImages);                                 $iNum       = $arrKeys[0];                                 $sThumbUrl  = wp_get_attachment_thumb_url($iNum);                                 $sImgString = '' .                                   '' .                                 '';                                   }                              else                              {                                     $sImgString = '' .                                   '' .                                     '';                                    }                                                 $args_lastcom = array(                             'status' => 'approved',                             'number' => '1',                             'post_id' => get_the_ID()                                 );               ?>                               <div class="post" id="post-<?php the_ID(); ?>">

                     <?php echo $sImgString; ?>

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

Posted <?php the_time('F jS, Y') ?>  By                             <?php the_author() ?>
                                  <?php                                         $comments = get_comments($args_lastcom);                             foreach($comments as $comment) :                             echo( get_avatar($comment->comment_author_avatar,64) . $comment->comment_author . '
');                             endforeach;                                  ?>

      blog_posts.php:               <?php function Theme_blog_posts_area_function(){    global $current_user;   get_currentuserinfo();  $uid = $current_user->ID;       ?>

<?php echo __("All Blog Posts", 'Theme'); ?>

                                                                                <?php                                       $args = array('post_type' => 'post', 'paged' => get_query_var( 'paged' ), 'category_name' => 'general', 'post_id' => get_the_ID());                 $my_query = new WP_Query( $args );                  echo '
 suggestion cat
';                   if($my_query->have_posts()):                    while ( $my_query->have_posts() ) : $my_query->the_post();                                          Theme_get_post_blog();                                      endwhile;                                           if(function_exists('wp_pagenavi')):                         wp_pagenavi( array( 'query' => $my_query ) );                       endif;                                      else:                   _e('There are no posts.','Theme');                                      endif;                                                                                ?>

            <?php dynamic_sidebar( 'other-page-area' ); ?>

                      <?php } ?>      this is what i want to make: ![enter image description here](http://i.stack.imgur.com/kbHA6.jpg)


title: Not able to access admin panel after updating WordPress database fails

text: After upgrading to WordPress 3.5.2 I can't log in to the control panel anymore. Instead, I'm redirected to /wp- admin/upgrade.php?_wp_http_referer=%2Fwp-admin%2F where I'm presented with a 'Database Update Required' message and an 'Update WordPress Database' button. When I click on the button the page reloads, runs for a couple of seconds, and then nothing happens. All I get is a screen with the WordPress logo at the top and nothing else. The URL of the page is /wp- admin/upgrade.php?step=1&backto=%2Fwp-admin%2F. I've tried various things to resolve the issue, without luck:   1. Wait for an hour to see if the problem goes away (the first page does say that "the update process may take a little while")   2. Tried to click the button in four different browsers   3. Checked the server's error log (no errors at the time of the upgrade)   4. Restored the database (I made a backup before I started the upgrade)   5. Renamed the folder of my theme   6. Renamed the plugins folder The only other solution I can think of is downgrading WordPress to an older version. Does anyone have a better idea please? PS - While searching for a solution I noticed a similar query was closed as "too localized". However, I reckon this is an issue "generally applicable to the worldwide audience of the internet". I'm not the first person to come across this issue, nor do I think I'll be the last!


title: How to disable Jetpack modules such as Stats?

text: I want to disable some of the Jetpack modules such as Stats in order to check if they make the web site slower or not. But I couldn't see an option to disable modules one by one. Of course, one can disable the Jetpack plugin as a whole. Is there a way to disable Stats module only? ![](http://i.imgur.com/Hg8cIhO.png)


title: How do I separate link levels in a custom menu walker?

text:
I am trying to build a custom menu walker and I am unclear on how I would be able to build a UL for top level menu items and a separate UL for all menu items of lower levels. Essentially I am trying to output:

                 first level link A

                 first level link B

second level link A.1

third level link A.1.a

             second level link A.2

      Example http://christopheryanceyis.me/test.php Can I do this in a wordpress walker? If so, how?


title: Gravatar - Default IMG

text: Gravatar is slowing my website and I want to host mystery man on my main server. So this is my normal gravatar mystery man                     And I want to host it on my server, so I tried to use this php code               function my_own_gravatar( $avatar_defaults ) {           $myavatar = get_bloginfo('template_directory') . '/design/img/m.png';           $avatar_defaults[$myavatar] = 'DEFAULT SPEED';           return $avatar_defaults;       }       add_filter( 'avatar_defaults', 'my_own_gravatar' );       But then there is still gravatar and redirect that is slowing loading time                     F***ing gravatar - Can you please help me ?


title: Code to remove authors with no posts connected to them

text: I am looking for SQL code that I can run from phpmyadmin to remove all registered users on the blog that do not have any post associated with them.


title: Force WordPress to load a specific template

text: How would I force WordPress by code to load a template file on my home page? I know how to do it via the backend but I would like to create a plugin and have the option to set the front page from inside the plugin. Basically, I am looking for the code to force loading a template when the home page is being loaded. So instead of the `index.php` it would load the plugin template. I can't find anything about this.


title: Parse error on user_register

text: I am trying to add a matching system. When I signup it will loop through all users that have the same interest as me, interests are done in checkboxes and put in one array. This is my whole function:               function registerfunction(){              global $user_ID;                   $velden = array(           'SecondName' , 'street', 'Gender' ,            'postalcode' , 'Province' , 'kvknumber' ,            'Phone', 'phonemobile' , 'website' ,            'company_presentation' , 'beschikbaar_direct',           'beschikbaar_later' , 'vergoeding' ,            'waarkenjevan' , 'test', 'cv_id', 'var_id',            'get_id','kvk_id','dip_id',           'opleiding',"sys_knowledge","task_timespan",           "days_timespan","get_id1","get_id2",           "get_id3","get_id4",           "dip_id1","dip_id2","dip_id3");//de array waar de velden worden opgeslagen              foreach($velden as $item){             if (isset($_POST[$item])) {                 update_user_meta( $user_ID , $item , $_POST[$item]);             }         }              $args = array(             'blog_id'      => $GLOBALS['blog_id'],             'role'         => 'company',             'meta_key'     => '',             'meta_value'   => '',             'meta_compare' => '',             'meta_query'   => array(),             'include'      => array(),             'exclude'      => array(),             'orderby'      => 'login',             'order'        => 'ASC',             'offset'       => '',             'search'       => '',             'number'       => '',             'count_total'  => false,             'fields'       => 'all',             'who'          => ''         );              $gebruikers = get_users($args);                   foreach ($gebruikers as $user) {             $company_match_systeem = get_user_meta($user->ID,'Match_systeem');             $company_match_duur = get_user_meta($user->ID,'Match_duur');             $company_match_opleiding = get_user_meta($user->ID,'Match_opleiding');             $matching_check = get_user_meta($user->ID , 'Match_check');                       if($_POST['opleiding'] == $company_match_opleiding){                      wp_mail('Dennissnijder97@gmail.com', 'Er is een nieuwe match voor u beschikbaar!', 'er is een match gevonden!' );                  }                       //parse error moet gefixt worden             $match_opleiding_result = array_intersect_assoc($_POST['opleiding'] , $company_match_opleiding[0]);                  wp_mail('dennissnijder97@gmail.com' , 'subject' , var_export($match_opleiding_result , true));             wp_mail('dennissnijder97@gmail.com' , 'subject22' , var_export($_POST['opleiding'] , true));             wp_mail('dennissnijder97@gmail.com' , 'subject232' , var_export($company_match_opleiding , true));              }          }          add_action('user_register' , 'registerfunction');      When I try to register it will say `parse error`, but all fields are getting registered, and I get an email with a notification. I just don't understand how this is happening.


title: Upgrade Nightmare - No Posts, Permissions Issues and Can't Create a new post

text: Symptoms:   1. Can't view ANY previous Posts, but the correct totals are listed by class - published, draft....   2. When creating a new post - no save or publish button   3. Unable to administer ANY plug-ins - error message: You do not have sufficient permissions to access this page What Has Changed? Upgraded from 3.0.2 to 3.0.1 or something like that, I was clearly on 3.x What Have I Attempted?   1. validated the roles and access values were correct for the admin user in database tables   2. Created a new admin   3. Changed admin user values to something else and back    4. Changed to default template   5. Disabled ALL plug-ins   6. Re-installed latest version What would you do next?


title: Default, locked sorting of posting fields

text: Is there anyway to disable custom dragging and sorting of the posting fields in admin? From time to time, the fields gets dis-ordered, and I have to sort them back to the way I want it, witch is kinda annoying. I want this also because I'm going to have other editors on the site, and I want a standardized order for everybody. I also want the excerpt-field to be above the content-field. Is all this possible?


title: When use a cache system with WordPress

text: (sorry if this is duplicated but I couldn't find anything related) I have an WordPress 3.0.3 instalation with some custom coding and tried the W3 Total Cache plugin but had some problems...so I've decided to deactivated it. And now I'm wondering that there are any average number of daily visits that becames necessary the use of a cache system. I'm not saying with this that I don't want to use a cache system, but only managing priorities. Thanks in advance!


title: Speed up MU Wordpress on Apache VPS?

text: I have a wordpress multisite 3.6 with 1 main site and 5 subdomains(with mapping domains) I am tried to make it faster, i install the W3 Total Cache plugin i add on my apache the APC 3.1.13 yum install httpd-devel pecl install apc > Enable internal debugging in APC [no] : no Enable per request file > > info about files used from the APC cache [no] : no Enable spin locks > > (EXPERIMENTAL) [no] : no Enable memory protection (EXPERIMENTAL) [no]: no > Enable pthread mutexes (default) [no] : yes Enable pthread > > read/write locks (EXPERIMENTAL) [yes] : no edit php.ini after line eaccelerator.shm_ttl="0"               apc.enabled="1"     apc.shm_segments="1"     apc.shm_size="128"     apc.ttl="7200"     apc.user_ttl="7200"     apc.num_files_hint="1024"     apc.mmap_file_mask="/tmp/apc.XXXXXX"     apc.enable_cli="1"      and on my shh add this command lines               service httpd restart          php -r 'phpinfo();' | grep 'apc'      but i can see big difference :/ **on gtmetrix (but is not solid everytime that i test)** **Before** B (82%) D (62%) 7.88s 1.67MB 118 **After** A (92%) +10% C (73%) +11% 5.33s -2.55s 1.33MB -344KB 101 -17 **on pingdom (but is not solid everytime that i test)** **Before** Page size 1.5MB Load time 3.78s Requests 133 **After** Page size 1.2MB Load time 2.58s Requests 129 This my phpinfo and this my w3 total case setup what I have done wrong and i have something else to add on my server or on my multisite?


title: Showing sticky posts with get_posts()

text: I'm using this to retrieve posts on my index page:               <?php $posts = get_posts( "category=13&numberposts=2" ); ?>      <?php if( $posts ) : ?>     <?php foreach( $posts as $post ) : setup_postdata( $post ); ?>           [code]      Is there a way to include sticky posts on loops like that one? Or I'll have to use WP_Query?


title: Auto delete Wordpress users according to time

text: In my wordpress site spam users are registered so i am add mail confirmation to my resister area. And my problem is how can i delete users when not check or activated the mail. > is it possible to automatically delete users that are x days old? if the user is 7 days old and not active his profile are automatically deleted from the database once every day? If so, could someone please explain how? i am using `tecla_users` field in my database.


title: Child theme only loads on home page

text: I was having the following problem: I created a child theme, it was 'correct', technically. It even worked and displayed the proper changes, and when I navigated to sub-pages (ie not the home page), the child theme's effects seemed to vanish.


title: Plugin activated but plugin files nowhere to be found

text: I installed ThreeWP Broadcast through the WP backend and it works fine. But where can I find the associated PHP files? I've tried looking in the plugins and mu plugins folder of wp-content.


How can I get $id variable in widget's form function? According to widget's structure I see that widget function have $args as a parameter, which will be extracted in function's body. In my case i want to use $id variable (from extracted $args) which contains current sidebar's id. How can I make 'visible' $id variable in form function? Any ideas?               class Ex_Widget_Example extends WP_Widget {         //constructor goes here         function widget($args, $instance) {extract($args);}         function update($new_instance, $old_instance ) { }         function form( $instance ) {}     }      For example we have sidebar with id 'my_sidebar'. I put this widget in it. For example my widget function, which we use to output something on page, looks like this:               function widget($args, $instance) {              extract($args);              echo $id; //or just echo $args['id'];     }      So on my page, in my 'my_sidebar' sidebar I will see a text 'my_sidebar'. That's great. But how can I get this $id or $args['id'] in widget's form function. In class example I see, that only widget function takes $args as argument. I'm not an expert in OOP pragramming, I tried to create a static variable (unsuccessfully), which would keep id value:               class Ex_Widget_Example extends WP_Widget {         public static $widget_id;         //constructor goes here         function widget($args, $instance) {                  extract($args);                  self::$widget_id = $id;                  echo self::$widget_id //here outputs sidebar's id perfectly on my page         }         function update($new_instance, $old_instance ) { }         function form( $instance ) {                  echo self::$widget_id //here outputs nothing on my widget's form         }     }      Maybe wordpress call form function first, before widget function, that's why I can't see anything on my form ....anyway, any ideas how to solve this problem?


title: Function to allow single post template based on custom taxonomy?

text: I'm trying to use Justin Tadlocks function for category specific custom post templates, but have become stuck when trying with a custom taxonomy, as his examples only have normal categories. Can this be edited to work with custom tax's? Thanks for any help :)


title: How does "Your comment is awaiting moderation" work?

text: The question here is if someone could help me to make the comment "Your comment is awaiting moderation" work correctly for custom page. It works ok for standard Wordpress page but not for my own page. I use native wp function `get_comments()` and `wp_list_comments()` to get and display comments. If I submit new comment that awaits moderation the comment and the message `Your comment is awaiting moderation` is accessible to anyone. I always thought that the awaiting comments is visible only to the user that submitted the comment. If it's not the case what is purpose of the message if anyone is able to see the comment? The one purpose I can think of is that it is a kind of notice that this comment will be moderated in the future and could be deleted. If really everyone can see the comment that it would make sense if the message reads `This comment is awaiting moderation`. Is there any way how to change the text of the message from a plugin? # UPDATE ok, so it is my code. If I display the page using standard wp way it works ok. If I use my code it doesn't work (meaning everyone can see the comment with awaiting message. Would someone know what I need to add to my code to make it work? I use just two above functions. The code is something like that               $comments =     get_comments(array(         'post_id' => $post_id,         'status' => 'approve'      ));         wp_list_comments(array(     //              'page' => 1,             'per_page' => 10,             'avatar_size'   => 16,         ), $comments);


title: Custom Post within a custom post

text: I have a custom post called "A". I have created another custom post called "B". I want the hierarchy of B to be a sibling of A, that is http://www.mysite.com/A/B/name-of-post I have A as a custom post type because I want to change the layout, and make it loop through all the items of A and B has another style of it's own. Everything works, when I see the archive of A I see the posts for type A, and same as B (see the posts of B) but when I click on the archive of B to see each individual post, I get NOT FOUND (and yes I have gone to permalink settings). These are my rules: For post type A:               $args = array(         // ... other args removed for clarity         'rewrite' => array( 'slug' => 'A' )         // ...     );      For POST TYPE B:               $args = array(         // ... other args removed for clarity         'rewrite' => array( 'slug' => 'A/B' )         // ...     );      Appreciate any help on the matter.


title: Changing URL scheme, mod_rewrite not helping

text: We're trying to move away from the /YYYY/MM/DD/Post-Title URL structure without breaking links that are floating around on the internet. The mod_rewrite rule is fairly straight forward -               RewriteRule [0-9]+/[0-9]+/[0-9]+/(.*)$ /$1 [R=301,L]      And it works fine (in that it redirects to the non-existent /$1 pages) UNTIL I change the URL scheme on Wordpress. Presumably, Wordpress is fiddling with the URLs itself in a way that's breaking things. I imagine it's something many people have done before, can anyone point me in the right direction? Thanks.               <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /blog/          RewriteRule [0-9]+/[0-9]+/[0-9]+/(.*)$ /$1 [R=301,L]          RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /blog/index.php [L]     </IfModule>


title: Author template, filter sidebar widgets by author?

text: I'd like to be able to filter my sidebar widgets (tag cloud, category, archive) to only show those tags/categories/months that apply to a given author on the author template. What is the correct way to filter or modify these widgets? I found this page in the codex but it doesn't seem that the native functions for any of the widgets can accept an author id as a parameter.


title: WP Query orderby meta key natural sort?

text: I have this code:               $args = array(         'posts_per_page' => -1,         'post_type' => 'product',         'meta_key'   => 'custom key',         'orderby'    => 'meta_value',         'order'      => 'ASC',                 'no_found_rows' => true,         'cache_results' => false,         'include_children' => false,         'tax_query' => array(             array(                 'taxonomy' => $taxonomy,                 'field' => 'id',                 'terms' => array($cat_id)             )         )      );            $loop = new WP_Query($args);          When the custom key is like               FA3     FA1     FA10      the wp query orderby paramaters sorts this as               FA1     FA10     FA3      **when I want a nsort-algoritm:**               FA1     FA3     FA10      Is there any way of acheiving this with `WP_Query`? (Or is the only option to create an array and sort that array with `nsort()`)


title: How to display most recent posts that haven't already been displayed with WP_Query?

text:
I have two content divs that each take up half of their containing div. My plan is to use WP_query to display the 6 most recent posts (3 in each.) It will go: Div 1 -> post 1, post 2, post 3 Div 2 -> post 4, post 5, post 6 At the moment however it is displaying like this: Div 1 -> post 1, post 2, post 3 Div 2 -> post 1, post 2, post 3 How can I get it to display the posts in the order of the first example? Please bear in mind that I'm still learning the Wordpress Codex.                       <?php                   $args = array(             'posts_per_page' => 3,             'orderby' => 'most_recent'             );                  $the_query = new WP_Query( $args );                  ?>
                  <?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>                      <a href="<?php the_permalink();?>">
<?php the_title(); ?>

Published on <?php the_date(); ?> by <a href="<?php echo the_permalink();?>"><?php the_author(); ?>
                 <?php the_excerpt(); ?>                  <?php endwhile; else: ?>                  <?php endif; ?>                            <?php wp_reset_postdata(); ?>
                  <?php                        $args = array(             'posts_per_page' => 3,             'orderby' => 'most_recent'             );                  $the_query = new WP_Query( $args );                  ?>
                  <?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>                      <a href="<?php the_permalink();?>">
<?php the_title(); ?>

Published on <?php the_date(); ?> by <a href="<?php echo the_permalink();?>"><?php the_author(); ?>
                 <?php the_excerpt(); ?>                  <?php endwhile; else: ?>                  <?php endif; ?>                  <?php wp_reset_postdata(); ?>


title: wp_get_attachment_image_src() width and height boolean

text:
I have the following code in my theme:               <?php     $size = 'large';     $postimage = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), $size );     $url = $postimage[0];     $h = $postimage[2]     ?>          <div style="background-image: url(<?php echo $url; ?>); height: <?php echo $h; ?>;">
      Here's an example `var_dump` output for $postimage:               array(3) {      [0]=> string(99) "{base url here}/uploads/2013/10/h3greendeck.jpg?fit=660%2C660"      [1]=> bool(false)      [2]=> bool(false)     }      If I remove the `size` argument for `wp_get_attachment_image_src()` to let it use default I get the same result. Why is size returning boolean, when WordPress knows the size of the image? This happens for every single instance of this code, regardless of the post I'm viewing.


title: Where to update the Static Pages Blacklist for Multisite Install?

text: _**Where in the menu system is the link to this blacklist?_** As referenced in the codex https://codex.wordpress.org/Multisite_Network_Administration > Also note that the blog prefix is not used for static pages which will be > accessible directly under the base address, e.g. domain.com/PAGENAME. If you > try to create a static page in the first site with the name of another > existing site on the network, the page's permalink will get a suffix (e.g. > domain.com/PAGENAME-2). If you create a new site with the slug of an > existing static page, the static page will not be reachable anymore. To > prevent this, you can **_add the names of your static pages to the > blacklist_** so that no site with that name can be created. After a few different searches I cannot find another reference to this static pages blacklist. I want to add a few pages like "contact,about,ect...". I have my wordpress setup and using multi-site.


title: get_post_meta($post->ID, 'Begin', true); don't give me numerical value

text: I'm trying to use the jquery plugin Timeago. With this, I want to countdown from a date (2013/03/04 format) Which is in a custom field. Echo $Begin2 gives me something like : 34 days ago. It's work fine. The problem is I want to take the number "34" as a numerical value. With the following code, echo $Nombre gives me "0". I think it's because get_post_meta($post->ID, 'Begin', true); is not a numerical value ?                  $Begin = get_post_meta($post->ID, 'Begin', true);        $Begin2 = '<abbr class="timeago" title="'.$Begin.'">'.$Begin.'</abbr>';        echo $Begin2;        $Nombre = (int) substr($Begin, 0, strpos($Begin, ' '));        echo $Nombre;      Thank you for your help !


title: User count only for role frontend vendor

text: i use the following code for count the authors                   $count_posts = wp_count_posts( 'download' );         echo 'Published eBook (' . $count_posts->publish .  ')';         echo ' ';         global $wpdb;          $user_count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->users;" );         echo '  Published Authors (' . $user_count . ')';      i need a count from authors who have the role frontend vendor or who have published a downlaod post. any idea? thanks for help


title: "admin_enqueue_scripts" hook or $_GET['page']?

text: When adding a function to "admin_enqueue_scripts" a hook is passed to the function. It looks like this "toplevel_page_nameofyourpage". That works great, but how is it different from checking the $_GET variable to see which page you are on? Is one preferred over the other? Why? I'm only talking about when you create your own menu, not the default admin pages.


title: How to add an admin function only to posts, not pages?

text: I'm having a problem with adding an excerpt counter to the excerpt field. It may be a conflict with another plugin, but basically it screws with other jquery if the excerpt field doesn't exist (e.g.: when it's a page which doesn't have an excerpt). Some issues that occur are: kills admin nav fly-out, media button doesn't work... Is there a conditional I could use that would only add this function if it is a post, or if it has the excerpt field? I have several custom post types, and the default posts all using the excerpt field. Here is the code I have so far, but I can't figure out what conditional would make this work:               function excerpt_count_js(){         if(possible_conditional_here()) {               echo '';           }           return;     }     add_action( 'admin_head-post.php', 'excerpt_count_js');     add_action( 'admin_head-post-new.php', 'excerpt_count_js');      I've tried these (none of which worked): `if(post_type_exists())` - doesn't display at all   `if(!is_page())` - doesn't change anything


title: How to reduce three query to one in multiple output template?

text:
I would like to publish 7 posts from the same category but embedded in different DIV or UL. How could I simplify this code?               <?php     $query01 = array( 'numberposts' => 1, 'offset'=> 0, 'post_type' => array('product') );     $query02 = array( 'numberposts' => 3, 'offset'=> 1, 'post_type' => array('product') );     $query03 = array( 'numberposts' => 3, 'offset'=> 4, 'post_type' => array('product') );     ?>

     get_posts( $query01 ) -> FOREACH WITH ONE POST

     get_posts( $query02 ) -> FOREACH WITH THREE POST

     get_posts( $query03 ) -> FOREACH WITH THREE POST


title: Logout/login redirect CSS issue

text:
I'm using WordPress Multisite. When I use `wp_logout_url()`, I get redirected to the login page but somehow I end at a different login page without any styles applied                  <a href="<?php echo wp_logout_url(); ?>" title="Logout">Logout      That's the only logout function I'm calling. And my login functions look like this:                 // 1. Custom login CSS     function my_login_stylesheet() { ?>     <link rel="stylesheet" id="custom_wp_admin_css"  href="<?php echo get_bloginfo( 'stylesheet_directory' ) . '/style.css'; ?>" type="text/css" media="all" />     <?php }     add_action( 'login_enqueue_scripts', 'my_login_stylesheet' );          // 2. Change logo URL     add_filter('login_headerurl', 'my_custom_url');     function my_custom_url(){     return "http://mydomain.com/domain";     }          // 3. Add personal message to login          function custom_login_message() {     $message = '
KOMM - App
';     return $message;     }     add_filter('login_message', 'custom_login_message');          // 4. Change login button text          add_action( 'login_form', 'wpse17709_login_form' );     function wpse17709_login_form()     {         add_filter( 'gettext', 'wpse17709_gettext', 10, 2 );     }     function wpse17709_gettext( $translation, $text )     {         if ( 'Log In' == $text ) {             return 'OK';         }         return $translation;     }          // 5. Redirect user to index-page after login     add_filter('login_redirect', 'plugin_admin_redirect');      function plugin_admin_redirect($redirect_to, $url_redirect_to = '', $user = null) {          return get_option('siteurl');          }       I guessing that I need to apply function 1 and 2 to the `wp_logout_url()` function to get the CSS applied. I've been trying for long now. Login page: ![Login page with css applied before login](http://i.stack.imgur.com/6tZsL.png) And when I logout I get to next screenshot: ![enter image description here](http://i.stack.imgur.com/smL1D.png) Logout/login page that I'm being redirected to: ![Login/logout without stylesheet applied](http://i.stack.imgur.com/rcxSy.png) I would appreciate if someone could explain or get me on the right path. **NOTE:** _Login link:_               /wp-login.php?redirect_to=http%3A%2F%2Fdesignmobile.se%2Fgomobile%2Fkrisdemo%2Fwp-admin%2F&reauth=1      _Logout link:_.               /wp-login.php?action=logout&redirect_to=http%3A%2F%2Fdesignmobile.se%2Fgomobile%2Fkrisdemo%2F&_wpnonce=17d70b468f


title: Custom permalink structure gives 404

text: For a Custom Post Type called 'matches' I created a custom permalink structure. The structure shows up just the way I want it, however, I get a `404` everytime I visit the post. I have tried removing the `.htaccess`, re-saving the permalinks, flushing the rewrites etc. None of it did any good. The code I use is as follows:               <?php     add_action( 'init', array( $this, 'match_permalink_structure' ) );     add_filter( 'post_type_link', array( $this, 'better_match_permalinks' ), 10, 3 );          function match_permalink_structure() {         global $wp_rewrite;              $structure = trailingslashit( __( 'match', 'apollo' ) );         $structure .= trailingslashit( '%year%/%month%/%day%' );         $structure .= trailingslashit( '%matches%' );              $wp_rewrite->add_rewrite_tag( "%matches%", '([^/]+)', "matches=" );         $wp_rewrite->add_permastruct( 'matches', $structure, true );     }          function better_match_permalinks( $permalink, $post, $leavename ) {         $rewritecode = array(             '%year%',             '%month%',             '%day%',             $leavename ? '' : '%matches%',         );              $timestamp = get_field( 'match_datetime', $post->ID );              if( ! empty( $timestamp ) ) {             $year = date( 'Y', $timestamp );             $month = date( 'm', $timestamp );             $day = date( 'd', $timestamp );         } else {             $year = date( 'Y', strtotime( $post->post_date ) );             $month = date( 'm', strtotime( $post->post_date ) );             $day = date( 'd', strtotime( $post->post_date ) );         }              $rewrite_replace = array(             $year,             $month,             $day,             $post->post_name,         );              $permalink = str_replace( $rewritecode, $rewrite_replace, $permalink );              return $permalink;     }     ?>      I have installed Rewrite Rules Inspector and that gives me the following for matches: > wedstrijd/[0-9]{4}/%month%/[0-9]{1,2}/[^/]+/attachment/([^/]+)/?$ > index.php?attachment=$matches1 matches > wedstrijd/[0-9]{4}/%month%/[0-9]{1,2}/[^/]+/attachment/([^/]+)/trackback/?$ > index.php?attachment=$matches1&tb=1 matches > wedstrijd/[0-9]{4}/%month%/[0-9]{1,2}/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$ > index.php?attachment=$matches1&feed=$matches[2] matches > wedstrijd/[0-9]{4}/%month%/[0-9]{1,2}/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$ > index.php?attachment=$matches1&feed=$matches[2] matches > wedstrijd/[0-9]{4}/%month%/[0-9]{1,2}/[^/]+/attachment/([^/]+)/comment- > page-([0-9]{1,})/?$ index.php?attachment=$matches1&cpage=$matches[2] matches I think that means that something is going wrong with `%month%` maybe? I am not sure. Does anyone have any idea what I could possibly be doing wrong, or what I need to do to fix this issue?


title: Wordpress MU wp_posts table

text: We have wordpress MU and have wp_*_posts tables and wp_posts table. They both seem to get updated. Why are there 2 sets of tables for posts? I was reading somewhere that each blog is suppose to keep track of their posts. I also have noticed that wp_*_posts doesn't always have the excerpt. Do you think something is wrong with our install?


title: wpdb inside foreach loop only returns first result - 2 other similar cases found

text: @Milo Problem solved, found spaces in the array $arrname. I was trying to get post id using post_name. First of all I stored all post_name in an array an then loop through the array to use the key variable in a wpdb query to get post id, really strange though, it only returns the first post id. As you can see I tried to output the array and it works fine, outputs every key value in that array,but the wpdb query only return the first result(tried switch the order of the key values in the array, confirmed that it only output the first result.). Any ideas?               global $wpdb;     $rawname=$_POST['image_post_name'];     $arrname=explode(",", $rawname);     foreach ($arrname as &$value) {     $mypostid = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_name='$value'"));     echo $mypostid;     echo $value;}      Tried to add exit( var_dump( $wpdb->last_query ) );, found out only the first query got executed. string(49) "SELECT ID FROM wp_posts WHERE post_name='unamed3'" last query, "String(49)"?


title: Assign post format to categories

text: I'm looking for a way to allow Wordpress (via a plugin?) to assign a specific post format to categories. (I can assign categories via a third party like IFTTT) Then all my posts in a certain category will be formatted rather than just text posts.


title: Certain aspects of site suddenly not working in Chrome and Firefox

text: My site has been working perfectly in all browsers, until suddenly 2 days ago. Now in Chrome and Firefox, the main page accordion slider is stuck, the "log in" button is not functional, and a few other things. I have tried the site in Safari, Opera, Internet explorer and it still looks and operates as it should. I have cleared the cache and cookies in Chrome and Firefox multiple times hoping that was the problem, but it still appears broken. I even have switched and re-uploaded the theme, same deal. Also, I'm pretty sure it's not a plugin conflict, I have only installed one new plugin and it was days before this happened, and I have since deleted it. I also tried changing the DOCTYPE. Anyone have an idea of what has gone wrong? The site is www.fearlessblue.com (excuse the site, it's my first, and I'm definitely a noob). All the pages are locked for development, so that is not my concern)


title: Redirect Old .php URLs to New Wordpress Page

text: I have an old website that I'm revamping with a custom new Wordpress theme. The old site had a custom (non-WP based) downloads archive that mapped URLs like this: `/downloads/view.php?id=2` The ID maps to a download item in a separate MySQL database. I'd like to move everything over to Wordpress in this refresh and I'm going to be using a custom post type to handle the downloads section, with a custom field that maps the "old ID" to the new post. This isn't difficult and I know how to do this, but the issue becomes remapping the old URLs to the new locations. The issue I see is that the older URLs are all PHP files (have an extension of `.php`). How would I go about create a plugin or Wordpress function in my theme's functions.php file to redirect these old URLs to a new URL. Essentially, I just need to have a Wordpress function redirect from `/downloads/view.php?id=2` to `/downloads/2/`, or another more optimized URL (`/downloads/title-of-archive`). How would I go about handling pages with a URL of "`/downloads/view.php`" and "`/downloads/download.php`" and performing the redirect? I know I can use the `.htaccess` file, but I'd prefer to do this directly in a Wordpress plugin if possible for portability...


title: get_post_meta printing empty fields, but it shouldn't be

text:
I'm trying to call some hidden custom fields into a meta box. The custom fields are the same - a maximum of five named _link and five named _url, with sequential numbers following (eg _link3). However, if the user has only filled in one link when submitting the post, I don't want the empty fields to appear. I have knocked up the following loop. In theory, it should do a get_post_meta for _link0, and if it isn't empty it should do the same for _url1, print the results, and advance the counter to process _link1/_url1. With _link0/_url0 contained in the database, those fields appear fine. What I'm finding is that because _link1/_url1 aren't in the database, the loop will print the first field correctly, followed by four more empty fields. I'm stumped. I've seen posts that suggest using !empty($link) and found that while it prints the first fields fine, the second fields will cause a fatal error (maximum execution time exceeded) and stop the page from loading. My code is below - am I overlooking something simple?               $i = 0;     do {            $link_key = '_link' . $i;            $url_key = '_url' . $i;            $link = get_post_meta($post->ID,$link_key,TRUE);            if (isset($link)) {               $url = get_post_meta($post->ID,$url_key,TRUE);               include(MY_PLUGIN_FOLDER . 'links.php');               $i++;            } else { $i = 5;}         } while ($i<=5);      links.php:
Link Name: <input type="text" name="link<?php echo $i; ?>" id="link<?php echo $i; ?>" value="<?php echo $i; ?>" /> URL: <input type="text" name="url<?php echo $i; ?>" id="url<?php echo $i; ?>" value="<?php echo $i; ?>" /><input type="button" class="addnew" value="Add Link" />


title: Custom taxonomy term as class?

text: I'm trying to add a class to a container within a query, ideally I'd like to use the terms from a custom taxonomy I have setup (guide-categories). As an example:               <div class="myclass *taxonomy term*">       -content-     </div>      Any help would be much appreciated, been looking around trying to find out how to do this for a while, but haven't had any luck yet!


title: How to get comment_ID by post_ID in wordpress

text: I used `get_comment()` but its parameter is `$comment_ID` which I has to enter manually for previous comments from `wp_comments` instead of that I need to get current comment means last updated comment author name based on the `post_ID`. However `wp_posts` and `wp_comments` are related with `post_ID` and `comment_post_ID`, so I can use SQL query to get comment_ID I tried `$wpdb->get_results('select comment_ID from wp_comments where comment_post_ID = 1')` its even manual process but at-least I want to pass comment_ID by fetching from database but could't do that query results nothing so is there any way to get current comment_ID for a post_ID I can get post_id by `$post->ID`.


title: Sorting a query by custom field date

text:
**EDIT: Reworded the question for more clarity** I'm trying to sort by custom meta box data, which I am converting to a date using the `strtotime` function, but I'm having some difficulty. My chief problem seems to be a catch-22 with the `strtotime` function. If I use `strtotime` inside the loop (see below) I cannot use the UNIX time to sort by date. However, if I process the strtotime upon save (in functions.php), I run into a bunch of problems with the meta box updating / not parsing if the user edits the post or re-saves. Is there a simple solution to this? Here is the code... I just want to order these posts in ascending order by the custom date field (not the posted date). **EDIT: Fixed the array by adding a meta-key - solution still pending**                    <?php     $args = array(         "post_type" => "podcasts",         "meta-key" => "_date",         "orderby" => "meta_value",         "order" => "ASC"         );     ?>               <?php $podcasts = new WP_Query( $args ); ?>               <?php if ( $podcasts->have_posts() ) : while ( $podcasts->have_posts() ) : $podcasts->the_post(); ?>               <?php $podcast_date = get_post_meta($post->ID, '_date', true);?>     <?php $fixed_date = strtotime($podcast_date); ?>                **EDIT: Added relevant meta-box code (below) from functions.php** Note -- This code does not include the strtotime function anywhere because I'm currently using it on the page template. I could include it here, but I am not sure what to do to allow the user to edit posts / resave. Once the strtotime function runs upon save, wouldn't it change the meta-box date to something like 1327248252? If so, that won't parse the next time that post is saved, creating issues.               // Create podcast Meta boxes          function add_podcast_metaboxes() {     add_meta_box('podcast_info', 'podcast Information', 'podcast_info', 'podcasts',  'normal', 'high');     }          // podcast Meta Box          function podcast_info() {     global $post;          // Noncename needed to verify where the data originated     echo '<input id="podcastmeta_noncename" name="podcastmeta_noncename" type="hidden" value="' .     wp_create_nonce( plugin_basename(__FILE__) ) . '" />';          // Get the data if its already been entered     $week = get_post_meta($post->ID, '_week', true);     $date = get_post_meta($post->ID, '_date', true);     $description = get_post_meta($post->ID, '_description', true);          // Echo out the field     echo 'Week
What week of the series is this podcast?';     echo '<input class="widefat" name="_week" type="text" value="' . $week  . '" />';     echo 'Date
Enter the Date the podcast was recorded';     echo '<input class="widefat" name="_date" type="text" value="' . $date  . '" />';     echo 'Description
Enter the text you would like to display as a description on the media archives list.';     echo '<input class="widefat" name="_description" type="text" value="' . $description  . '" />';          }          // Save the podcast Meta box Data          function save_podcast_meta($post_id, $post) {          // 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['podcastmeta_noncename'], plugin_basename(__FILE__) )) {     return $post->ID;     }          // Is the user allowed to edit the post or page?     if ( !current_user_can( 'edit_post', $post->ID ))         return $post->ID;          // OK, we're authenticated: we need to find and save the data     // We'll put it into an array to make it easier to loop though.     $podcast_meta['_week'] = $_POST['_week'];      $podcast_meta['_date'] = $_POST['_date'];     $podcast_meta['_thumbnail'] = $_POST['_thumbnail'];     $podcast_meta['_seriesimg'] = $_POST['_seriesimg'];     $podcast_meta['_description'] = $_POST['_description'];          // Add values of $podcast_meta as custom fields          foreach ($podcast_meta as $key => $value) { // Cycle through the $podcast_meta array!         if( $post->post_type == 'revision' ) return; // Don't store custom data twice         $value = implode(',', (array)$value); // If $value is an array, make it a CSV    (unlikely)         if(get_post_meta($post->ID, $key, FALSE)) { // If the custom field already has a value             update_post_meta($post->ID, $key, $value);         } else { // If the custom field doesn't have a value             add_post_meta($post->ID, $key, $value);         }         if(!$value) delete_post_meta($post->ID, $key); // Delete if blank     }          }     add_action('save_post', 'save_podcast_meta', 1, 2); // save the custom fields


title: Comment moderation on custom post types

text: I know that I can require all of the comments on my site to be moderated, but is there a way of forcing moderation for a specific custom post type (i.e. my CPT "species") whilst allowing instantaneous comments across the rest of the site? Thanks in advance,


title: Create Wordpress child page from page actions

text: I am trying to add an option to create a child page from the wordpress all pages screen. I found this link, but cannot get it working properly. It is exactly what I need, but I need help fixing it http://sltaylor.co.uk/blog/easy-child-page-creation-wordpress/               function slt_childPageAction( $actions, $page ) {           $actions["create-child"] = 'ID . '" title="Create a new page with this page as its parent">Create child';           return $actions;       }       add_filter( 'page_row_actions', 'slt_childPageAction', 10, 2 );       function slt_setChildPage() {           global $post;           if ( $post->post_type == "page" && $post->post_parent == 0 && isset( $_GET["parent_id"] ) && is_numeric( $_GET["parent_id"] ) )               echo '';       }       add_action( 'edit_page_form', 'slt_setChildPage' );


title: Theme's window.open call goes to "Page Not Found"

text: I have a theme that has an uploader utility that opens in a popup window from the theme options page. Basically I have a button labeled "Upload" which has an onclick handler that calls window.open to load a popup window containing a php file that handles various upload tasks. The problem I'm encountering only occurs on less than 1% of all installations of the theme, but I'm unable to determine the cause. On these sites, the window.open call opens the popup window but the contents of the window is the WordPress default "Not Found" page (instead of my php upload handler file) Here is the call from functions.php                <button         type="button"          id="fileUpload"          onclick="window.open('<?php echo get_bloginfo('template_directory') ?>/upload-zip.php?action=uploadFile','popup','width=330,height=235,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no'); return false" />Add/Upgrade Templates      </button>      Note: to eliminate the upload-zip.php as a source of the problem, I've removed the contents and just placed this into it:               <php     echo "in upload file";     die;     ?>      However, it does not appear to get to this file before loading the wordpress "Not Found" page.


title: How to get grandparent of a given category

text: Just wondering what the best way to get the top-most level category (grandparent) of a given category assuming it has one? Example structure: Operating Systems - Mac - - Mountain Lion - Windows - - Windows XP I want to be able to somehow get the ID of the "Operating Systems" category from within the Windows XP category. Any suggestions?


title: Two language versions for each article

text: I have a Wordpress website that needs to be available in two different languages. We have the articles written in both languages already. I've seen a lot of solutions providing automatic translations but this won't work in this situation because we have to use translations produced by government approved translators. What would be a good solution to allow each article to have 2 versions and allow switching between them with a button or dropdown?


title: Creating a Front-end based User Search

text: I am working on a membership site which requires a front-end user search. I have been searching for an answer like a mad man, and I could really use some help! While there are several plugins that have this capability (WordPress Members List, AMR Users, etc.); none of them do exactly what I need, and by looking at their source codes, would be a huge mess to pick apart, and seems like it might a fruitless effort in the end anyway. I fully realize that I will likely need to write something custom myself here. The logic I need is actually very straight forward and simple in terms of how it needs to work. **User search logic goes like:** **1.** User enters another users USER ID # into a simple single search field. **2.** Upon submitting search, the user is taken directly to the members profile _Yes_ , users will search for other users by their _user ID_ (think of it as a membership number). There is a specific reason for this, which does make sense for the site. But I don’t want to get off the subject, just know that this requirement cannot be changed. I am thinking this shouldn't matter though, because if you can query “user_nicename” from the “wp_users” table in the database, you should be able to query the _“ID”_ field as well? I do not expect anyone to provide me with the entire code for this obviously, but it would be nice if you could give me some general direction (and perhaps examples if possible) on how I can go about this. I am having a difficult time wrapping my head around this for some reason. Thanks!


title: Is it safe update WordPress 3.4.2. to 3.5?

text: My wordpress 3.4.2 site have 25 activated plugin, so which is safest way to update ?


title: How to do multi site setup

text: A client wants to set up a multi site with tabs looking like this: | Home | About | Broker | Resources On the main site (meaning www.site.com), the links will be www.site.com/home, www.site.com/about, etc. Broker is a drop-down with Broker names that will be subdomains, like john.site.com. When the visitor clicks on an broker, and goes to the sudomain, they want all the tab links to be john.site.com/home, john.site.com/about, etc. Obviously they don't want to have to copy all the posts and pages over to the each subdomain that are the throughout the site. What is the best way of doing this?


title: Dynamic template serving, change theme_root using add_filter from current theme

text: Some plugins use the `'template'`, `'option_template'` and `'option_stylesheet'` to dynamically serve (alternative) wordpress templates. For example, Nathan Rice's `ServeDefaultToIESix`. For Example -               add_filter('template', 'change_theme');     add_filter('option_template', 'change_theme');     add_filter('option_stylesheet', 'change_theme');          function change_theme()      {         // Alternate theme         return 'AwesomeTheme';     }      Above code only works from a wordpress plugin. What i need, is to switch to alternative template, **_located in one of the subfolders_** of the current theme(template). Examples: display an alternative HTML5 theme, serve mobile users a minimal version of the site.. etc. I tried to use 'theme_root' and 'theme_root_uri' as below. But that isn't working.               // Extra lines to change the theme's root.     add_filter('theme_root', 'change_theme_root');     add_filter('theme_root', 'change_theme_root_uri');     //     add_filter('template', 'change_theme');     add_filter('option_template', 'change_theme');     add_filter('option_stylesheet', 'change_theme');          function change_theme()      {         // Display Alternate theme         return 'AwesomeTheme';     }          function change_theme_root()     {         // Return the new theme root         return WP_CONTENT_DIR . 'themes/OrigTheme/lib/AltThemes';     }          function change_theme_root_uri()     {           // Return the new theme root uri          return get_bloginfo('wpurl') . '/wp-content/themes/OrigTheme/lib/AltThemes';     }      Is this the correct way of doing it? Or does anyone know of the possible way to do so? Thanks in advance.


title: How to Disable Color Options?

text: This question is related to my earlier question, but I think it's specific enough to qualify as a standalone question. I am modifying an existing theme (the Twenty Ten theme that ships with WordPress), and I would like to completely control the colors used. The Admin Screen allows the administrator to select a background color, and this seems to be implemented in one of the actions that are automatically registered to the `wp_head` hook (listed by Bainternet here). So I would like to do two things:   * Remove the _Color Options_ menu from the Admin Screen when my theme is activated. Is this possible and if so, how would I go about doing this? (Links to documentation welcome!)   * Remove the automatically registered action to wp_head that controls the color. Which action in particular would be responsible for this? (rsd_link, etc?) Thanks for your help.


title: how to list all subdomain in wordpress multiuser

text: I need to show all sub domains/directory in my wordpress multiuser, for eg: blog1 blog2 blog3 Is their any template tags to do this? stuck with this help me out guys.


title: Wordpress Enqueue Script Chaos (jQuery & Foundation.js)

text: I've been working on building a theme for the past couple days now, and I've run into a wall. While I originally included foundation.js as an enqueued script, I couldn't remember why I had added it. Today, when I tried removing it (to improve page-load speed) from my functions.php file, it messed up all of my jQuery plugins. After some researching, I discovered that Foundation _already_ includes jQuery, so I was loading two instances of it at a time (I also loaded from the theme's js folder). So, now that I've removed foundation, my custom.js file commands don't work unless I prepend 'jQuery' instead of the simpler '$'. I think there's some part of my Wordpress install that I made bug out, even if I keep the 'Foundation' name reference with the jQuery file earlier called, the theme works. It's like it has to have that 'Foundation' name. Below I've included both my script calls, as well as my custom js file, in hopes that someone will be able to aid me in diagnosing this problem. Links: -Chrome Console Error Message -jQuery & Plugins shown loading in Chrome Console SCRIPT CALLS:               function register_js() {     if (!is_admin()) {         wp_deregister_script('jquery');         wp_deregister_script('foundation');         wp_register_script('jquery', get_template_directory_uri() . '/js/libraries/jquery-1.7.1.min.js');         wp_register_script('jquery-ui', get_template_directory_uri() . '/js/libraries/jquery-ui-1.8.16.min.js', 'jquery');         wp_register_script('superfish', get_template_directory_uri() . '/js/plugins/jquery.superfish.js', 'jquery');         wp_register_script('supersubs', get_template_directory_uri() . '/js/plugins/jquery.supersubs.js', 'jquery');         //wp_register_script('foundation', get_template_directory_uri() . '/js/plugins/jquery.foundation.js', 'jquery');         wp_register_script('custom', get_template_directory_uri() . '/js/custom.js', array('jquery','jquery-ui') );         wp_enqueue_script('jquery');         wp_enqueue_script('jquery-ui');         wp_enqueue_script('superfish');         wp_enqueue_script('supersubs');         //wp_enqueue_script('foundation');         wp_enqueue_script('custom');     }     }     add_action('init', 'register_js');      CUSTOM JS FILE:               $(document).ready(function() {          /* Menu - Superfish */     $('ul.menu').supersubs({          minWidth:    11,         maxWidth:    30,         extraWidth:  1         }).superfish({          hoverClass: "sfHover",          speed: 'fast',          dropShadows: false,          delay: 0,         autoArrows: false,         animation: {height:'show',opacity:'show'}     });          /* Blog Tabs */     $('#tab_controls').tabs({ fx: [ {opacity:'toggle', duration:'normal'},{opacity:'toggle', duration:'slow'}] });           });


title: Which action hook can I use when a featured image has been selected

text: I have made a plugin for wordpress which copies the image to another directory when a post has been edit. But if you only upload another featured image and don't save the post. The image has been attached to the post, but the post has not been updated. Which does not trigger my plugin function. Show which trigger (action hook) can I use to also copie the featured image? The action which I now use for the post edit is wp_insert_post(). I forgot the reason why I use wp_insert_post(), but maybe that's why it fails ;)


title: Replacing textarea with wp_editor

text: I have a working front end posting system on my site that initially I designed with a simple text area for the content. I am now attempting to swap the textarea out with the TinyMCE function, wp_editor. I can easily get the editor to display and function properly, but on the submission of the form, the content is saved/not saved in a strange way. The behavior is as follows: When I attempt to publish the post the first time, the content does not seem to save, leaving the textarea blank. If I edit the post and save it again, the OLD content (from the first save) magically reappears and the new stuff is gone. After that, it randomly gives me either nothing or the old content only. I've looked around, but was only able to find this question: wp_editor textarea value not updating which doesn't exactly apply to my situation and I'm not sure that any of those solutions are really what I need. I'm not sure what code would be best to help troubleshoot, but here is my original text box:               <textarea name="user_post_content" id="user_post_content" placeholder="Enter your content..." class="inputwide"><?PHP echo ((!empty($post_obj->post_content))?$post_obj->post_content:''); ?></textarea>      And here is what I want to replace it with:               <?php wp_editor($post_obj->post_content, 'userpostcontent', 'textarea_name=user_post_content' ); ?>      Here is a pastebin of the entire page template file: http://pastebin.com/tncmQGDA Hopefully someone can help.


title: How to list all network sites on one page

text: Can I list all the blogs in my network on one page?


title: Is it possible to use add_filter from a theme to alter a plugin's function?

text: Can add_filter() be used to intercept a plugin function? I'm not having any success, so I'm thinking perhaps I'm doing this wrong. The plugin is "All in One SEO" and the function I'm trying to intercept is in the All_in_One_SEO_Pack class and its called get_original_title() Here's the code I'm trying to intercept...specifically, when the is_404() method is called...               class All_in_One_SEO_Pack {          function rewrite_title($header) {         global $aioseop_options;         global $wp_query;         if (!$wp_query) {             $header .= "<!-- no wp_query found! -->\n";             return $header;          }              $post = $wp_query->get_queried_object();              // the_search_query() is not suitable, it cannot just return         global $s;              global $STagging;              if (is_home() && !$this->is_static_posts_page()) {             $title = $this->internationalize($aioseop_options['aiosp_home_title']);             if (empty($title)) {                 $title = $this->internationalize(get_option('blogname'));             }             $title = $this->paged_title($title);             $header = $this->replace_title($header, $title);         } else if (is_attachment()) {                              $title = get_the_title($post->post_parent).' '.$post->post_title.' – '.get_option('blogname');                             $header = $this->replace_title($header,$title);         } else if (is_single()) {             // we're not in the loop :(             $authordata = get_userdata($post->post_author);             $categories = get_the_category();             $category = '';             if (count($categories) > 0) {                 $category = $categories[0]->cat_name;             }             $title = $this->internationalize(get_post_meta($post->ID, "_aioseop_title", true));             if (!$title) {                 $title = $this->internationalize(get_post_meta($post->ID, "title_tag", true));                 if (!$title) {                     $title = $this->internationalize(wp_title('', false));                 }             }             $title_format = $aioseop_options['aiosp_post_title_format'];             /*             $new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);             $new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);             $new_title = str_replace('%post_title%', $title, $new_title);             $new_title = str_replace('%category%', $category, $new_title);             $new_title = str_replace('%category_title%', $category, $new_title);             $new_title = str_replace('%post_author_login%', $authordata->user_login, $new_title);             $new_title = str_replace('%post_author_nicename%', $authordata->user_nicename, $new_title);             $new_title = str_replace('%post_author_firstname%', ucwords($authordata->first_name), $new_title);             $new_title = str_replace('%post_author_lastname%', ucwords($authordata->last_name), $new_title);             */             $r_title = array('%blog_title%','%blog_description%','%post_title%','%category%','%category_title%','%post_author_login%','%post_author_nicename%','%post_author_firstname%','%post_author_lastname%');             $d_title = array($this->internationalize(get_bloginfo('name')),$this->internationalize(get_bloginfo('description')),$title, $category, $category, $authordata->user_login, $authordata->user_nicename, ucwords($authordata->first_name), ucwords($authordata->last_name));             $title = trim(str_replace($r_title, $d_title, $title_format));          //      $title = $new_title;     //      $title = trim($title);             $title = apply_filters('aioseop_title_single',$title);             $header = $this->replace_title($header, $title);         } else if (is_search() && isset($s) && !empty($s)) {             if (function_exists('attribute_escape')) {                 $search = attribute_escape(stripcslashes($s));             } else {                 $search = wp_specialchars(stripcslashes($s), true);             }             $search = $this->capitalize($search);             $title_format = $aioseop_options['aiosp_search_title_format'];             $title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);             $title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $title);             $title = str_replace('%search%', $search, $title);             $header = $this->replace_title($header, $title);         } else if (is_category() && !is_feed()) {             $category_description = $this->internationalize(category_description());                 if($aioseop_options['aiosp_cap_cats']){                     $category_name = ucwords($this->internationalize(single_cat_title('', false)));                 }else{                         $category_name = $this->internationalize(single_cat_title('', false));                 }                        //$category_name = ucwords($this->internationalize(single_cat_title('', false)));             $title_format = $aioseop_options['aiosp_category_title_format'];             $title = str_replace('%category_title%', $category_name, $title_format);             $title = str_replace('%category_description%', $category_description, $title);             $title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title);             $title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $title);             $title = $this->paged_title($title);             $header = $this->replace_title($header, $title);         } else if (is_page() || $this->is_static_posts_page()) {             // we're not in the loop :(             $authordata = get_userdata($post->post_author);             if ($this->is_static_front_page()) {                 if ($this->internationalize($aioseop_options['aiosp_home_title'])) {                                  //home title filter                             $home_title = $this->internationalize($aioseop_options['aiosp_home_title']);                             $home_title = apply_filters('aioseop_home_page_title',$home_title);                             $header = $this->replace_title($header, $home_title);                      }             } else {                 $title = $this->internationalize(get_post_meta($post->ID, "_aioseop_title", true));                 if (!$title) {                     $title = $this->internationalize(wp_title('', false));                 }                 $title_format = $aioseop_options['aiosp_page_title_format'];                 $new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);                 $new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);                 $new_title = str_replace('%page_title%', $title, $new_title);                 $new_title = str_replace('%page_author_login%', $authordata->user_login, $new_title);                 $new_title = str_replace('%page_author_nicename%', $authordata->user_nicename, $new_title);                 $new_title = str_replace('%page_author_firstname%', ucwords($authordata->first_name), $new_title);                 $new_title = str_replace('%page_author_lastname%', ucwords($authordata->last_name), $new_title);                 $title = trim($new_title);                                 $title = $this->paged_title($title);                 $title = apply_filters('aioseop_title_page',$title);                 $header = $this->replace_title($header, $title);             }         } else if (function_exists('is_tag') && is_tag()) {             global $utw;             if ($utw) {                 $tags = $utw->GetCurrentTagSet();                 $tag = $tags[0]->tag;                 $tag = str_replace('-', ' ', $tag);             } else {                 // wordpress > 2.3                 $tag = $this->internationalize(wp_title('', false));             }             if ($tag) {                 $tag = $this->capitalize($tag);                 $title_format = $aioseop_options['aiosp_tag_title_format'];                 $title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);                 $title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $title);                 $title = str_replace('%tag%', $tag, $title);                 $title = $this->paged_title($title);                 $header = $this->replace_title($header, $title);             }         } else if (isset($STagging) && $STagging->is_tag_view()) { // simple tagging support             $tag = $STagging->search_tag;             if ($tag) {                 $tag = $this->capitalize($tag);                 $title_format = $aioseop_options['aiosp_tag_title_format'];                 $title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);                 $title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $title);                 $title = str_replace('%tag%', $tag, $title);                 $title = $this->paged_title($title);                 $header = $this->replace_title($header, $title);             }         } else if (is_archive()) {             $date = $this->internationalize(wp_title('', false));             $title_format = $aioseop_options['aiosp_archive_title_format'];             $new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);             $new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);             $new_title = str_replace('%date%', $date, $new_title);             $title = trim($new_title);             $title = $this->paged_title($title);             $header = $this->replace_title($header, $title);         } else if (is_404()) {             $title_format = $aioseop_options['aiosp_404_title_format'];             $new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);             $new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);             $new_title = str_replace('%request_url%', $_SERVER['REQUEST_URI'], $new_title);             $new_title = str_replace('%request_words%', $this->request_as_words($_SERVER['REQUEST_URI']), $new_title);             $new_title = str_replace('%404_title%', $this->internationalize(wp_title('', false)), $new_title);             $header = $this->replace_title($header, $new_title);         }              return $header;          }}


title: How to pull blogposts using shortcodes

text: I want to grab the two latest blog posts on my homepage. i would also like the option to select the category if I want to also, but mainly just pulling the latest 2 blog posts. Thanks


title: is there a way to remove featured image from blog page and single page

text:
<?php     /*      *      * The default template for displaying content. Used for both single and index/archive/search.      *      * @package WordPress      * @subpackage Twenty_Twelve      * @since Twenty Twelve 1.0      */     ?>              <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>                 <?php if ( is_sticky() && is_home() && ! is_paged() ) : ?>
                         <?php _e( 'Featured post', 'twentytwelve' ); ?>
                 <?php endif; ?>                                           <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?>                         <?php if ( is_single() ) : ?>
<?php the_title(); ?>
                         <?php else : ?>
                                 <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?>
                         <?php endif; // is_single() ?>                         <?php if ( comments_open() ) : ?>
                                         <?php comments_popup_link( '' . __( 'Leave a reply', 'twentytwelve' ) . '', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?>
                         <?php endif; // comments_open() ?>                                       <?php if ( is_search() ) : // Only display Excerpts for Search ?>
                         <?php the_excerpt(); ?>
                 <?php else : ?>
                         <?php the_content( __( 'Continue reading →', 'twentytwelve' ) ); ?>                         <?php wp_link_pages( array( 'before' => '
' . __( 'Pages:', 'twentytwelve' ), 'after' => '
' ) ); ?>
                 <?php endif; ?>                                               <?php twentytwelve_entry_meta(); ?>                         <?php edit_post_link( __( 'Edit', 'twentytwelve' ), '', '' ); ?>                         <?php if ( is_singular() && get_the_author_meta( 'description' ) && is_multi_author() ) : // If a user has filled out their description and this is a multi-author blog, show a bio on their entries. ?>

                                                 <?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentytwelve_author_bio_avatar_size', 68 ) ); ?>

<?php printf( __( 'About %s', 'twentytwelve' ), get_the_author() ); ?>

<?php the_author_meta( 'description' ); ?>

                                                         <a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author">                                                                 <?php printf( __( 'View all posts by %s →', 'twentytwelve' ), get_the_author() ); ?>

                         <?php endif; ?>
      At moment in the TwentyTwelve theme looks like `the_post_thumbnail()` gets the featured image and render it in the main blog page and the single page I tired removing it but it also removed any other images the blog might have, I would like to only remove the featured image from the main blog page where all the posts are listed and the single.php. Any help would be greatly appreciated                <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?>


title: Is it possible to check is loaded language files correctly with WordPress plugin?

text: I have a plugin to be translated. I have done following tasks: 1. Loaded the TextDomain               $my_td = 'mysignup';     function my_signup_textdomain_init() {         load_plugin_textdomain( $my_td, false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );     }     add_action('plugins_loaded', 'my_signup_textdomain_init');      2. Added language files(po, pot, mo) in `wp_plugin_folder\my_signup\languages` (for Bengali bn_BD)   * mysignup.pot   * mysignup.mo   * bn_BD.po   * bn_BD.mo 3. Changed the language code in `wp_config.php` file               define('WPLANG', 'bn_BD');      But the problem is nothing is changed. I am not sure what I have done wrong.   Now I need to know how can I test everything, whether what I've done is fine, and how can I solve the issue.


title: Best practices for a Style/CSS based theme options page?

text: I would like to create a theme options page based only on changing the site wide CSS styling. For instance body/container background colors, font-sizes, font colors, etc. I have accomplished this by using a stylesheet link to a php file in the header that echo's the CSS and uses get_option. For instance `background-color: <?php echo get_option('background_color'); ?>;` Would I be correct in assuming this is a bad idea performance wise if there are many options? I have tried other methods but they all seem to add inline or embedded styles, which I do not want, how would one get around this? Would creating a custom script that writes to the static CSS file be a good idea? Is there any way the settings API can handle this? ** PS. Great answer but I have decided to actually go with writing to a static file as it provides way less overhead.


title: Delete post is image is missing or broken link

text: Is there a easy way to delete post if image link in post is broken? I want to move large number of posts, but I noticed that some images may have broken links (to external sites) and images are missing. Rather than fixing all this, I would prefer simple to delete posts that have missing images. I noticed there is a script that can unlink broken link - so would be possible to just modify this and say if post have broken link (image or any other broken link) - delete post! Please note I am very interested in this script and not any other solution to sort my website. This script or any other smart solution to automatically delete posts with rboken links would be greatly appreciated. Thanks good people.


title: making my own "related pages" / "pages you might like" section

text: I'm trying to get the tags of a post on the single content page and displaying a list of other articles that share the tags with the post. For example, the user is reading an article with a tag like 'game'; I want to display the titles of other articles that share the tag 'game'. I'm basically trying to make my own "related pages" section. How would I do this without using a plugin and which PHP file does the code go? I am using wordpress 3.2.1 and a child theme for the Twenty-Eleven theme.


title: How to make an image bigger with wp_get_image_editor

text: I'm trying to programmatically increase the size of images that are uploaded. I want to double the size of each image. The code I've written so far is:               $pathDirectory = dirname( $imagePath );     $large_w = $width*2; // These values are correct     $large_h = $height*2; // These values are correct     $largeImage = wp_get_image_editor( $imagePath );     $largeFilename = $largeImage->generate_filename("large", $pathDirectory, $ext);     $largeImage->set_quality(100);       $largeImage->resize($large_w, $large_h, false);     $largeImage->save($largeFilename);      This is making an image with the '-large' bit in the filename but it's exactly the same size as the original image. After reading the WP manual is says regarding resize:               resize( $max_w, $max_h, $crop = false ) // NOTE - max width and max height     Resizes current image.      So I'm thinking that resize only makes images smaller? Am I right in assuming this and, if so, how do I make images bigger with WP? Thanks for your help :-)


title: Adding an input field to the comment form, and not letting it submit if any info is in it

text: I am working on a WordPress plugin that adds a hidden input field into the comment form. I have the code in place that adds the input field in, using this code.               function hiddeninput_more_comments( $post_id ) {         echo '<input type="hidden" id="hidden-input" name="hidden-input" />';     }          add_action( 'comment_form', 'hiddeninput_more_comments' );      Now, I'm stuck on this issue - I have the field empty in value, and I would like it to not allow the comment to submit if any info is put into the input field, but I cannot figure it out for the life of me. Any ideas? **Edit: Figured it out** So, I found this tutorial which shows the following code that checks if data is added to the field.               add_filter( 'preprocess_comment', 'verify_comment_meta_data' );          function verify_comment_meta_data( $commentdata ) {         if ( ! isset( $_POST['city'] ) )             wp_die( __( 'Error: please fill the required field (city).' ) );         return $commentdata;     }      For what I needed, I changed the **isset** to **empty** , so if the field I added in isn't empty, it gives the **wp_die** error message


title: How to programmatically add login form to wp_nav_menu X position

text: I have a menu I created in WP that registers 'main_nav' so the user can still use the Appearance > Menus screen to edit their menu. However I need to add the login form to the 4th (main) menu items sub menu and I am a bit confused on the best way to do that. I have browsed the forums online and found this post: How to Hard Code Custom menu items However it doesn't give me an idea on how to add something to the (4th) menu items sub menu while still retaining the ability for admin to add/edit menu from the Appearance Menus section. I would rather not program the whole nav menu if possible because I would like for the site admin to still be able to edit other menu items. What (if any) is the best way to go about adding the `wp_login_form()` to the 4th menu items sub menu (second position)? An example is lets say I have a menu and one tab is called Members, in that sub-menu I would like to have Register (link), the login form and the last menu item would be forgot password(link). Any ideas?


title: $post->ID not working

text: I have the following code and while get_the_ID() works, $post->ID does not, why?                   $the_query = new WP_Query( array(             'post_type' => 'custompost',         ) );              while ( $the_query->have_posts() ) : $the_query->the_post();             echo $post->ID;         endwhile;


title: page displaying media caption shortcodes

text: I am developing my first wordpress theme. I encountered a problem in page section. I added a image in a page with add media button. When i viewed the page, it does display the image but also the caption part.                [caption id="attachment_50" align="alignnone" width="300"] (actual image) [/caption]      I can't figure out why it's showing up. I googled a lot but couldn't find a solution. Please help me out.


title: Calling external Libraries in Wordpress

text:
I am doing some maintenance on a blog that I was hired to create a couple of months ago. They wanted to add a slider in, so I started to implement FlexSlider. I ran into a problem though with the slider. I have added the needed dependencies into the header:                         <link rel="stylesheet" href="<?php echo get_bloginfo('template_directory'); ?>/flexslider.css" type="text/css" media="screen" />           In my index file, I have:

        <?php query_posts(array ( 'posts_per_page' => 1, 'tag'=> 'one' )); ?>         <?php while (have_posts()) : the_post(); ?>     <?php       $slider_image = get_post_meta($post->ID, 'slider_image', true);?>     <img src="<?php echo $slider_image[0]['image']; ?>" />

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

<?php the_time('F jS, Y') ?> by <?php the_author() ?>

<?php echo excerpt(55); ?>

<a href="<?php the_permalink(); ?>"> Read More >
             <?php endwhile; ?>

      My issue is this really, when you look at the slider, the "slides" dont seem to be styled at all, and the jquery files do not seem to be functioning at all. I keep seeing an error that:               Uncaught TypeError: Object #<Object> has no method 'slides'     :1112/:22Uncaught TypeError: Object #<Object> has no method 'flexslider'      You can see what I am working on at http://louisstephens.cc/blog (using my own blog so I do not mess up the client's site). Does anyone see something that I am missing to get this functioning properly?


title: Count all images of a certain post type

text: I followed two posts related to my query. One was about the number of images attached to a post and second about showing all images of a certain post type. I tried to combine the two codes in the following way but it didn't help:               $query = new WP_Query( array( 'post_type' => 'gallery', 'posts_per_page' => -1 ) );     if( $query->have_posts() ){         while($query->have_posts()){             $query->the_post();             $attachments = get_children( array( 'post_parent' => $parent->ID, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID' ) );             $count = count( $attachments );         }     }      Can anyone help me in counting all images attached to a certain post type?


title: WP 3-way voting system: On to something! Please help!

text:
Okay I posted a question yesterday, that can be found here. I've found some code on the wonderful internet that I think is really the ticket for me, but I don't know how to develop into what I really need. Here is the breakdown - I need three separate vote links. I need to change the word "Vote" on each to something else. IE: Good/Meh/Bad. (I think I can figure this one out) I'm hoping there is a simple and easy way to slap another two vote links into this code, because the code itself is really simple and easy. Just beg pardon my lack of PHP/Jquery knowledge. Header code:               <?php wp_enqueue_script( 'jquery' ) ?>     <?php wp_head(); ?>           vote.php file:               <?php     $file = dirname(__FILE__);     $file = substr($file, 0, stripos($file, "wp-content") );          require( $file . "/wp-load.php");          $currentvotes = get_post_meta($_POST['post'], 'votes', true);     $currentvotes = $currentvotes + 1;          $voters = get_post_meta($_POST['post'], 'thevoters', true);     if(!$voters) $voters = $_POST['user']; else $voters = $voters.",".$_POST['user'];          update_post_meta($_POST['post'], 'votes', $currentvotes);     update_post_meta($_POST['post'], 'thevoters', $voters);          echo $currentvotes;     ?>      Functions.php reference:               function voting($id) {     global $user_ID;     $currentvotes = get_post_meta($id, 'votes', true);     $voters = get_post_meta($id, 'thevoters', true);     $voters = explode(",", $voters);     foreach($voters as $voter) {      if($voter == $user_ID) $alreadyVoted = true;     }          if(!$currentvotes) $currentvotes = 0;     echo '
'.$currentvotes.'';     if($user_ID && !$alreadyVoted) echo '
'.__("Vote").'';     if($user_ID && $alreadyVoted) echo '
'.__("Voted").'';     echo '
';     if(!$user_ID) echo '

'.__('Register').' '.__('to vote').'.

';     }      Source has a demo. Any and all help with this would be really, really appreciated. Thanks in advance.


title: wp_enqueue_style with style.php and Wordpress functions

text: I use wp_enqueue_style to add my stylesheet, like this:               <?php wp_enqueue_style( 'theme-style', get_template_directory_uri() . '/style.php', false, '1.0', 'all' ); ?>      It works fine BUT **I need to run a Wordpress function in the style.php file**. The stylesheet file does not know that the core exists. **This is what I've heard**   * It's bad to include wp-load.php.   * It's bad to include the stylesheet directly to header.php because plugins can't find it.   * It's bad to include the stylesheet direclty to wp_head functions because plugins can't find it. Is there a "correct" way to do this?


title: Is Wordpress "publish" atomic?

text: If it is atomic, this must be a bug. What I have noticed is that, when a post is being published and I close the window, the post gets published partially - one time only body came but not the subject. Is this supposed to happen? I am not using wordpress client, but using it online to post on a blog.


title: Possibility of including third party software/plugins in the Wordpress repository

text: I've been looking into using the Wordpress Repository for one of my larger plugins, the problem is that it's using a lot of third party software. Video players/Slide scripts/Jquery includes, some of which are commercial in nature. My question is related to the content that differs from the GPL v2. Id like to include those into the plugin, since that would make it easier to use. If I get permission from the third party, is this possible? As an example flowplayer (GPL 3) and Longtail Video Player (Commercial). Also will this supporting software be exempt from the GPL 2 license restriction?


title: Remove image caption from post excerpt

text: I am currently using a wordpress plugin called "limit-posts" to better customize my post excerpts. The only issue I have is the excerpt is including the caption text from the image that is within the post. I can see in the code that all captions are enclosed in tags Is there a way I can strip out the any content within em tags from the post excerpt? Here is a link to the current plugin in use - http://labitacora.net/comunBlog/limit-post.phps Thank you very much


title: CSS file not registering through add_action

text: Im having a problem to register and load a gallery css code from my home page. Rest of the styles are loading fine, but this flexslider is not registering. Any guidance appreciated.               <?php           function theme_styles() {          wp_enqueue_style ('normalize', get_template_directory_uri() . '/css/normalize.css');     wp_enqueue_style ('grid', get_template_directory_uri() . '/css/grid.css');     wp_enqueue_style ('main', get_template_directory_uri() . '/style.css');          wp_register_style( 'flexslider', get_template_directory_uri() . '/css/flexslider.css' );     if( is_page( 'home' ) ) {         wp_enqueue_style( 'flexslider' );     }     }     add_action( 'wp_enqueue_scripts', 'theme_styles' );          // Enable custom menus     add_theme_support( 'menus' );          ?>


title: Add Different Actions To Different Page's wp_footer

text: I am trying to add functions to wp_footer based on the the page id. I am hooking my callback to `init`, but its not working. Here is what I am using.               function fl_template_loader() {              if ( is_page( 1032 ) ) {             add_action( 'wp_footer', 'fl_theme_midnight' );         }         if ( is_page( 1032 ) ) {             add_action( 'wp_footer', 'fl_theme_passion' );         }     }     add_action( 'init', 'fl_template_loader', 0 );      What I am doing wrong? Is the `init` firing too early or too late? I tried to hook in `plugins_loaded` (for early execution) and `wp_loaded` (for later execution), but all failed.


title: Show Post Content with AJAX

text: I want to do a very basic AJAX call where, on click of a list item, a container div fills with associated content pulled from a Wordpress page. I'm a newb with AJAX; I've tried a few different routes today but to no avail. I got the page to load in the container but I want only the post content (as if I called the_content() in the div but doing it AJAX style). I only have three pages I would like to pull from. Does anyone know of a simple way to accomplish this? I would greatly appreciate it. Thank you.


title: Write CSV from array or custom $wpdb query results

text:
Inside a template page I do a $wpdb query with two dates recieved from POST method. I process the query results into an array, and then I show them in a table. I want to offer a link to download the array data into a CSV. What options do you suggest me to achieve that? This is my code, just in case.               <?php                      global $wpdb, $current_user;                 //$wpdb->show_errors();                      get_currentuserinfo();                 $tabla_entradas = $wpdb->prefix.'entradas';                      if(isset($_POST['desde'])){                          //Guardo las fechas considerando la ultima hora.                     $desde = $_POST['desde'] . ' 23:59:59';                     $hasta = $_POST['hasta'] . ' 23:59:59';                          //Consulto                     $entradas = $wpdb->get_results($wpdb->prepare("SELECT user, precio, vencimiento                                                                     FROM {$tabla_entradas}                                                                     WHERE updated >= %s AND updated <= %s", $desde, $hasta));                          /*                     echo '
';                     print_r($entradas);                     echo '
';                     */                          $reporte = array();  // the REPORT !                                  //Lleno el arreglo del reporte                     foreach ($entradas as $entrada) {                              $legajo = $entrada->user;                              //sino existe el legajo en el reporte, inicializo total.                         if (isset($reporte[$legajo])) $reporte[$legajo]['total'] += $entrada->precio;                         else $reporte[$legajo]['total'] = $entrada->precio;                              //busco el nombre                         $empleado = get_user_by('login', $legajo);                         $reporte[$legajo]['nombre'] = $empleado->display_name;                          }                          //TABLE.                     echo '
',                          '
',                            '
',                               'Legajo	',                               'Nombre	',                               'Total	',                            '
';                          foreach ($reporte as $k => $v) {                         //Fila.                         echo '
',                                 '' . $k . '	',                                 '' . $v['nombre'] . '	',                                 '$ ' . $v['total'] . '	',                              '
';                     }                     echo '
',                          '
';                      }       ?>


title: Get the author registration date in the header.php file

text: I have some code that executes in header.php as follows:                 if (is_author()) {           $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));           $date = $curauth->user_registered;       }      I've tried to get this user information out of this code in a few different ways and can't seem to get the user object itself at all. It is null. I was thinking maybe the user object isn't available at this stage at where it's being called, but Wordpress is accurately getting into is_author() code based on determining the current page is an author template. What am I doing wrong?


title: Display Custom Post Type and Custom Taxonomy Data on Front End Using Only a Plugin

text: Can anyone suggest a good plugin-based, as opposed to template or theme-based, solution for the following that doesn't rely on shortcodes? I have a plugin that creates a custom post type and four custom taxonomies. The custom post type has the `/songs` slug. The custom taxonomies have the following slugs: `/songs/genres`   `/songs/eras`   `/songs/venue`   `/songs/artists` My question is, how do I get the following URLs to show my custom content IN TABLE FORM without messing with custom templates or shortcodes? `/songs` - show a table of all songs in the database sorted by song name   `/songs/<song-name>` - show a table of data connected to this song   `/songs/genres` - show a table of all genres in the database sorted by genre name   `/songs/eras` - show a table of all eras in the database sorted by era name   `/songs/venue` - show a table of all venues in the database sorted by venue name   `/songs/artists` - show a table of all artists in the database sorted by artist name   `/songs/genres/<genre>` - show a table of songs, sorted by name, with this genre   `/songs/eras/<era>` - show a table of songs, sorted by name, with this era   `/songs/venue/<venues>` - show a table of songs, sorted by name, with this venue   `/songs/artists/<artist>` - show a table of songs, sorted by name, with this artist _Example table I'd like on every page:_               Song Name | Artist  | Genre  | Era  | Venue     --------------------------------------------     song1     | artist1 | genre1 | era1 | venue1     song2     | artist2 | genre2 | era2 | venue2      I've figured out how to do this using custom templates, but these templates won't work with all themes. The custom templates would have to be re-coded for any theme other than the one I'm using for development. In my reading on this issue, I've come to understand that it's not a good idea to put design code into plugins. But, if this is the case, how can I be sure my custom content gets displayed appropriately across many different themes? I think what I'm missing is how custom post types and custom taxonomies can be portable across themes. If I haven't provided enough information, let me know what more I need to share. Thanks.