title: Redirecting sub-domain to main domain has incorrect URL on subsequent pages

text: I just redirected my sub-domain, _www.simco-apts.com/testsite_ to takeover my main domain, _www.simco-apts.com_. While this works for the homepage, all other links/pages contained within the site add _/testsite_ back into the URL when clicked. My Hosting went into the wp-config.php file and changed the WP URL and Site URL. Now, if I remove _/testsite_ from the WordPress Address URL, my pages open without _/testsite_ in the URL but the page is blank. From everything I've read, the steps I took were correct to redirect the site. I even installed a plugin to try to redirect the pages and it works, but the pages are blank. What am I missing?


title: Adding custom fields to the Quick Edit screen - puzzled about the column concept

text:
We've been told that: > The `quick_edit_custom_box` action hook will not fire unless there are > custom columns present. (Source^) If so, then adding a custom field edit functionality to the Quick Edit panel needs a Custom Field column first. It's hard to believe for me. Because there are certain fields in the Quick Edit panel that isn't present in any of that posts column, like the **"Make this post sticky"** checkbox. ![Quick Edit Panel](http://i.stack.imgur.com/8z6WP.png) I'm not dealing with any custom post types of custom taxonomy. I just implemented 3 individual custom fields from the Add New Post panel using 3 drop downs: ![Input Box](http://i.stack.imgur.com/FGHeo.png) **Translation:** The free translation of the Bangla texts here says: _You can choose where you want to show the news. Neither of the field is mandatory_. And I queried them three in the Posts List display page with 3 individual query like this:               add_action('manage_posts_custom_column', 'news_column', 10, 2);          function news_column($column_name, $id) {         if ( $column_name == 'news-box' ) {             global $wpdb;             $featuredQuery = 'SELECT meta_value                             FROM ' . $wpdb->prefix . 'postmeta                             WHERE meta_key="featured"                             AND post_id=' . $id;             $scrollQuery = 'SELECT meta_value                             FROM ' . $wpdb->prefix . 'postmeta                             WHERE meta_key="scrollnews"                             AND post_id=' . $id;             $breakingQuery = 'SELECT meta_value                             FROM ' . $wpdb->prefix . 'postmeta                             WHERE meta_key="breakingnews"                             AND post_id=' . $id;                  $resultFeatured = $wpdb->get_results($featuredQuery, ARRAY_A);             $resultScroll = $wpdb->get_results($scrollQuery, ARRAY_A);             $resultBreaking = $wpdb->get_results($breakingQuery, ARRAY_A);             if ( isset($resultFeatured[0]) && ($resultFeatured[0]['meta_value'] == '1')) { ?>                 <img src="<?php echo bloginfo( 'template_url'); ?>/images/icon-1st.png" title="<?php _e( 'শীর্ষ খবর', TEXTDOMAIN) ?>"/>
             <?php }             if ( isset($resultScroll[0]) && ($resultScroll[0]['meta_value'] == '1')) { ?>                 <img src="<?php echo bloginfo( 'template_url'); ?>/images/icon-scroll.png" title="<?php _e( 'তাজা খবর', TEXTDOMAIN) ?>"/>
             <?php }             if ( isset($resultBreaking[0]) && ($resultBreaking[0]['meta_value'] == '1')) { ?>                 <img src="<?php echo bloginfo( 'template_url'); ?>/images/icon-breaking.png" title="<?php _e( 'ব্রেকিং নিউজ', TEXTDOMAIN) ?>"/>             <?php }         }     }      So I made them three visible in a single column to make them a bit sorted out for the admin/editor.   ![post listed custom fields in a single column](http://i.stack.imgur.com/tNrS5.png) In that case:   * If "Sticky Post" checkbox can be enabled without any column, then why not I can add a custom field edit box or checkbox into the Quick Edit column without their individual column?   * Do I have to make their individual column to add them to the Quick Edit screen?


title: Release Model for Wordpress?

text: Is there a reference for the wordpress release and version model? In particular   * When a new release like 3.6 comes out, will 3.5 have security fixes for a period of time?   * Are some release more likely to have breaking changes? In other words, will 3.5 to 3.6 break less than something like 3.9 to 4?


title: Insert posting automatically based in acf field

text: good day   I found a code that works, but it creates several posts of the same name, do not want that, he wanted to create only once post_type if the value is 'x', but he is creating a 'x' every time updates , how do I create it only once this post_type?      **My Code** :               <?php          wp_insert_post( array(             'post_status' => 'publish',             'post_type' => 'fornecedores', // post_type which is created posting             'post_title' => get_field('fornecedor'), // Custom field to generate the post type             'post_content' => ''         )     )     ?>         Code is in a loop of the post type products.   Understand me?


title: Changing when mobile menu is displayed

text: Wordpress seems to be displaying the mobile menu (in Twentythirteen at least) at 643px wide, however i need it to activate at 767px. I cannot seem to be able to find what activates the menu at 643px, it's certainly not in the CSS and i can't seem to find it relating anywhere in the corresponding JS files. Anyone had experience with this in the past?


title: Pagination on custom page template

text:
I have a page with videos, which are getting from custom plugin which attaches videos to post _(not my work)_ and through loop by posts shows on video page. _(not my work too)_ The page have link like **mysite.com/?page_id=21** I need to make a pagination by 10 videos on page, but I was trying different methods and didn't get any results. The code of page is :               <?php     //Template name: Video gallery     get_header();     ?>

Video

                 <?php                 $posts = get_posts(array( "meta_key" => 'select', "meta_value" => 1, "posts_per_page"=> 10));                 foreach($posts as $post){ setup_postdata($post);                 ?>                       <?php                        $p = get_post($post->post_parent);                         echo "

".$p->post_title."

"; ?>                      <video id="example_video_<?php echo $post->ID;?>" class="video-js vjs-default-skin" controls preload="none" width="420" height="265" style="display: inline-block; margin: 0 8px 0 0px; clear: both;"                       poster="<?  $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); echo $url;?>"                       data-setup="{}">                     <source src="<?php echo (get_post_meta($post->ID, 'videourl', true)); ?>" type='video/mp4' />                     <track kind="captions" src="demo.captions.vtt" srclang="en" label="English"></track>                   </video>                        <?                       $url = $post->guid;                 $exp = explode("/", $url);                 $file_name = end($exp);                       ?>                  <a href="/wp-content/uploads/download.php?file=<?php echo $file_name; ?>" class="button red">Download video
                      <?php } ?>

<?php next_posts_link('«Previous Entries') ?>

<?php previous_posts_link('NextEntries »') ?>

     <?php get_footer();?>      PS sorry if my problem was solved, but I've read more than 30 posts, and didn't get the answer.


title: Genesis Child Theme Modifying Comments display

text: I'm using a theme which works with Genesis Framework. The theme is called pinsomo & I'm wondering how to "move" comments count div to the bottom of the post. Here is the demo: [[link has expired]] You see the comment icon next to the title. I want to move it to the heart icon.


title: add_editor_style is not loading in frontend. Any solution?

text: This is default wordpress add_editor_style function:               function add_editor_style( $stylesheet = 'editor-style.css' ) {              add_theme_support( 'editor-style' );              if ( ! is_admin() )             return;              global $editor_styles;         $editor_styles = (array) $editor_styles;         $stylesheet    = (array) $stylesheet;         if ( is_rtl() ) {             $rtl_stylesheet = str_replace('.css', '-rtl.css', $stylesheet[0]);             $stylesheet[] = $rtl_stylesheet;         }              $editor_styles = array_merge( $editor_styles, $stylesheet );     }      As you see `if ( ! is_admin() ) return;` is there and basically we cant add custom styles to frontend wp_editor.. What is proper solution for it?


title: Display count number of posts with the same specific meta_key meta_value

text:
I want to display a list of posts ordered by a specific meta_key. My posts have the following custom fields: `author_lastname` and `author_firstname`. So far, it works good. The posts are displayed correctly. My query is:                       <?             $category = $wp_query->get_queried_object();             $query = new WP_Query(                 array (                     'post_type' => 'post',                     'cat' => $category->cat_ID,                     'posts_per_page' => -1,                     'orderby'   => 'author_lastname',                     'meta_key' => 'author_lastname',                     'meta_key' => 'author_firstname',                     'order' => 'ASC'                 )             );                  if ( $query->have_posts() ) :                 while ( $query->have_posts() ) : $query->the_post(); ?>
<a href="<?php the_permalink(); ?>"><?php echo get_field('author_lastname') . ', ' . get_field('author_firstname') . ' (' . count($query) . ')'; ?>
                 <?                 endwhile;                 wp_reset_query();             endif;             ?>      Now, let's say two posts have the same author (same values in `author_firstname` and `author_lastname`). I will get this result:               Einstein, Albert (1)     Einstein, Albert (1)     Tesla, Nikola (1)      This is not what I want. How could I get this?               Einstein, Albert (2)     Tesla, Nikola (1)      Thank you in advance for your help!


title: Multisite 404 on pages - rewrite error breaks database

text: After updating my reading settings on my multisites, I get 404 errors on all my pages. The only way to fix the issue is by reverting the database to previous version, that is the only way it can be fixed. I dont think you get this error if the post type is empty, I think it needs some posts adding to it. After painstaking process of elimination via dropping databases and re uploading a 100 times whilst removing functions one by one, I found the function causing the issue...               // REGISTER POST TYPE INDIVIDUALS     register_post_type(         'individual',array(             'label' => 'Individuals',             'description' => '',             'public' => true,             'show_ui' => true,             'show_in_menu' => true,             'capability_type' => 'post',             'hierarchical' => false,             'rewrite' => array(                 'slug' => ''             ),             'query_var' => true,             'exclude_from_search' => false,             'supports' => array(                 'title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes'             ),             'taxonomies' => array(                 'type'             ),             'labels' => array (                 'name' => 'Individuals',                 'singular_name' => 'Individual',                 'menu_name' => 'Individuals',                 'add_new' => 'Add Individual',                 'add_new_item' => 'Add New Individual',                 'edit' => 'Edit',                 'edit_item' => 'Edit Individual',                 'new_item' => 'New Individual',                 'view' => 'View Individual',                 'view_item' => 'View Individual',                 'search_items' => 'Search Individuals',                 'not_found' => 'No Individuals Found',                 'not_found_in_trash' => 'No Individuals Found in Trash',                 'parent' => 'Parent Individual'             ),             'menu_icon' => get_bloginfo('template_url').'/images/menu_icon.png'         )     );     register_taxonomy('individual-group',array (       0 => 'individual',     ),array( 'hierarchical' => true, 'label' => 'Group Number','show_ui' => true,'query_var' => true,'rewrite' => array('slug' => ''),'singular_label' => 'Group Number') );     register_taxonomy('individual-role',array (       0 => 'individual',     ),array( 'hierarchical' => true, 'label' => 'Role','show_ui' => true,'query_var' => true,'rewrite' => array('slug' => ''),'singular_label' => 'Role') );     register_taxonomy('individual-territory',array (       0 => 'individual',     ),array( 'hierarchical' => true, 'label' => 'Territory','show_ui' => true,'query_var' => true,'rewrite' => array('slug' => ''),'singular_label' => 'Territory') );         My multisite runs absolutely fine, until randomly (possibly because of updating a setting), I get 404 errors on all pages. I can force create the 404 error by updating the reading settings to a static page... http://i.imgur.com/RRqBU1m.png Within the reading panel I can choose any page template, or try to revert "Your Latest Posts" on this page, and the 404 occurs. If you switch to another theme, the 404 error is carried over, but weirdly you just get the home page for every single page - so the problem must be in the db. The only way I get rid of the 404 error is by reseting my database to a previous version before the 404 error has occurred    **This is how i found what was causing it step by step...**   1. I deleted my functions.php contents. And updated my reading settings. The site works fine! No 404 error.   2. I re added my functions.php contents. Still no error.   3. I updated my reading settings to force create the error - and yes, I got the 404.    4. I reset my database, and 404 has gone.   5. I deleted all my function contents, added them one by one, refreshing my website each time. I did NOT get a 404, site works fine.   6. I deleted all my functions again, added them one by one, but each time I added one, I updated my reading settings, and when I add the function below, I got the 404, see below what is causing it...   7. I tested this on its own in twentytwelve theme (with posts added to individual post type) with reset database and the error still occurs.    How can this function be fixed as its prooving to be a nightmare. Thanks in advance.


title: What is the best way to handle deprecated functions?

text: Wordpress 3.3 has deprecated the add_contextual_help() functions and it's filters, so in order to continue supporting 3.0 - 3.2.1 and also comply with 3.3, I have done the following:               global $wp_version;     if ($wp_version >= '3.3') {         // New method         add_action("load-$admin_page", 'CrayonSettingsWP::help_screen');     } else {         // Depreciated method         add_filter('contextual_help', 'CrayonSettingsWP::cont_help', 10, 3);     }      Is there a better approach?


title: How to migrate from wordpress.com to self-hosted wordpress

text: I'm trying to migrate from wordpress.com to self-hosted wordpress. These are some of the things I've done, but I'm not quite able to migrate successfully.   * Changed my Godaddy account DNS to wordpress   * Through Godaddy Web hosting connection, I installed wordpress application   * From wordpress.com I performed domain mapping ***The site is allenkim.me and it currently works. From here, I decided I want to change it to self-host wordpress and no longer use wordpress.com   * I downloaded wordpress   * Followed the 5 min instruction   * Uploaded wordpress files on my web server PROBLEM when I try to visit allenkim.me/wp-admin/install.php in a web browser, it doesn't open. I'm not sure what the problem is. Any help?


title: Add item to media library from blob or dataUrl

text: I'm trying to build a webcam snapshot recorder. It should take a picture and upload it to the WP media library via ajax / async-upload. Already managed to add a view to the media library. Recording also works. I can either store the raw image data in blob or in base 64 encoded string (like data url) How can I put this data into the upload queue? Any suggestion / further reading / well explained reasons why this won't work appreciated. Thanks a lot, joern EDIT: This is my code so far. It   * adds a panel to WP media library.    * displays an image with `src="data:image/`   * Tries to generate a file-like object and put it in the upload queue. (That's where I'm failing)  JS-Dependency: Needs github repo blueimp/JavaScript-Canvas-to-Blob


title: How can I list posts by author?

text:
How can I list posts as sub-items of authors? It should look like:

Author

Post1

Post2

      I have an array containing author data including `$author->ID`. My function looks like this:               function add_custom_menu_items($items, $args) {              $authors = get_users('role=author');              return $items.$authors_str;         }     add_filter( 'wp_nav_menu_items', 'add_custom_menu_items', 5, 2);      Where can I get a list of posts?


title: How to get pages of parent (non-recursive)?

text: I'd like to get all pages that are direct children of HOME_ID. Per http://codex.wordpress.org/Function_Reference/get_pages#Parameters (see 'parent' parameter), I think this should be done with get_pages:               $top_pages = get_pages(array('parent' => HOME_ID, 'sort_column' => 'menu_order'));      but this returns no results. I get results back if I plug in 0 for HOME_ID. No sweat because I can achieve what I want with:               $menu_wp_query = new WP_Query();     $top_pages = $menu_wp_query->query(array('post_type' => 'page', 'post_parent' => HOME_ID, 'orderby' => 'menu_order'));      But still uncomfortable; is this a bug? Using WP 3.2.1 Thanks.


title: Ways to give a wp_list_pages menu link specific class names?

text:
I'm looking to style my wp_list_pages with a span class. I'd like to give it a unique class so that I can give each a specific icon.               'link_before' => '',      I was thinking of using the page slug but the menu I use also has child pages involved so it would have to pull the target links page slug not the `$post->post_name` one. I'm not sure if it's a good option which just needs better logic or if there's a better solution altogether. Here's my full menu code:               global $post;          if ( is_page() && wap8_has_children( $post->ID ) == '1' || wap8_has_siblings() == '1' ) {           if ( $post->post_parent ) {                $args = array(                'sort_column' => 'menu_order',                'title_li'    => '',                'child_of'    => $post->post_parent,                'echo'        => 1,            'link_before' => 'post_name.'">',           );           } else {                $args = array(                'sort_column' => 'menu_order',                'title_li'    => '',                'child_of'    => $post->ID,                'echo'        => 1,         'link_before' => 'post_name.'">',           );           }           echo "
\n";          wp_list_pages( $args );      echo "
\n";          }      -edit- What I'd like the output to look like.


title: Where is defined a custom register_taxonomy?

text: Where is defined a custom register_taxonomy for my website url? Now is showing:               http://localhost:1337/wordpress/portfolio-list/yapbond/      But I want               http://localhost:1337/wordpress/product-list/yapbond/      In which file I change this?


title: How to Disable UNICODE slug?

text: I am inserting the post titles in UNICODE, but i dont want to save in unicode UTF8 characters. Instead, i want to use my title convert function before slug auto-creation: like this:               function my_convert($string)     {     $string = str_replace('ჲ','a',$string);     $string = str_replace('ძ','b',$string);     ..............     .............     return $string;     }


title: Why if i enqueue the tinymce script i get undefined error

text: <?php      /*     Plugin Name: random plug     Plugin URI: http://example.com/wordpress-plugins/my-plugin     Description: A plugin demonstrating Cron in WordPress     Version: 1.0     Author: Brad Williams     Author URI: http://wrox.com     License: GPLv2     */          add_action('init', 'register_tagging_post');           function register_tagging_post(){            $tagging_args = array(                'public' => true,                'supports' => array(                    'title',                    'thumbnail'                     ),                 'query_var' => 'tagging',                'rewrite' => array(                   'slug' => 'tagging',                   'with_front' => false                ),                 'labels' => array(                 'name' => 'Tagge Albums',                 'singular_name' => 'Album',                 'add_new' => 'Add New Album',                 'add_new_item' => 'Add New Album',                 'edit_item' => 'Edit Album',                 'new_item' => 'New Album',                 'view_item' => 'View Album',                 'search_items' => 'Search Albums',                 'not_found' => 'No Albums Found',                 'not_found_in_trash' => 'No Albums Found In Trash'             ),                 );                 register_post_type('tagging', $tagging_args);                  wp_enqueue_script('tinymce123','http://tinymce.cachefly.net/4.0/tinymce.min.js');                }          ?>      This is my plugin created, I want to ask why the firebug produced an error:               TypeError: tinymce.onAddEditor is undefined      when i enqueue the tinymce script and it is not functioning?


title: I am using multi image metabox plugin but I did get how to display the images in templete?

text: please help me... here is plugin url http://wordpress.org/plugins/multi-image- metabox/ I am using this plugin but after uploading images. I need to get those images on template... code to display the images on single post page.


title: Magento and Wordpress URL integration

text: so I'm in a bit of a conundrum. I've integrated wordpress into my Magento site, currently by a subdirectory. Check it out: http://vapetropolis.ca. If you go to the "reviews" section, you'll note there's a /wordpress in the URL. Obviously, this sucks for SEO. So, I want to get rid of the /wordpress. How can I do this?   1. Integrate Magento as a subdirectory into Wordpress. This is no good, because now Magento will get a /magento - and Magento is strongly SEO'd for as well.   2. Put wordpress files in the root folder along with the Magento files: I've tried doing tihs, but it breaks all Magento pages (maybe I'm doing it wrong?)   3. I've tried URL rewrites, but I can't seem to get rid of the /wordpress. So...how can I integrate Wordpress into Magento, without having a subdirectory in the URL messing with my site's SEO?


title: Page Automatically Generated from Theme?

text: I'm running WordPress multisite and would like each site to have a specific page (with pre-loaded content) generated from a page template, contact.php. Rather than go through each site and create this page, I would like it to be created automatically by the theme. I plan to add all the content in contact.php itself. I'm assuming there is a way I can do this with a theme hack but have no idea where to start. To put it more simply, the theme would automatically create a page at domain.com/contact from the template contact.php.


title: Changing Permalinks for Category Pages Only

text: I am working to redesign a site and would like to rework the permalink structure for the category pages only. Right now they are using:               /category/category-name      I would like to switch this to:               /category-parent/category-name      When doing this though, I don't want to change any of the post URLs that are currently `/year/month/post-name`. Is there a way to change the category permalinks, but not the post links? A few comments too:   * I know I will likely have the restructure the categories to be in parent/child form, since they currently are not.   * I thought about using custom post types, but I would rather not do that since it doesn't seem like the best use here.


title: Wordpress: Remove link in the_tags

text: How do I remove the link generated by the_tags? This is what I use today: `<?php the_tags( '', '', '' ); ?>` That results in the tags assigned to the post. But I want to remove the link. Any idea?


title: Taxonomy posts on Archive page

text:
* * * Hello, I have been stumped for a few days on a perfect way to display the posts using my custom post type (track) and the taxonomies ( genre, sub_genre). When a user goes to http://sitename.com/genre/"sub_genre name" , i want all posts of that sub_genre to be categorized by those sub_genre taxonomies with content. ex.. http://sitename.com/genre/hip_hop **Genre: West** junior test track **Genre: Old School** Song 3 track Rap title track Song 2 track This is the code Im using but but its looping all wrong...               <?php if (have_posts()) : ?>     <?php while (have_posts()) : the_post();     $cam_brands = get_the_terms( $post->ID, 'sub_genre' );?>     <?php foreach( $cam_brands as $brand ) : ?>
 <?php echo $brand->name; ?>
          <?php $wpq = array( 'post_type' => 'track', 'taxonomy' => 'sub_genre', 'term' => $brand->slug, 'post_status' => 'publish','posts_per_page' => -1, 'caller_get_posts'=> 1 );     $brand_posts = new WP_Query ($wpq);?>
     <?php foreach( $brand_posts->posts as $post ) : ?>
 <?php echo $post->post_title; ?> <a class="sc-player" href="<?php echo get('soundcloud_link'); ?>">track
     <?php endforeach ?>
     <?php endforeach ?>     <?php endwhile; ?>     <?php endif; ?>      Its seems to be going through the foreach as many times as there are actual posts in the genre taxonomy rather than the sub_genre. ex. **Genre:West** junior test track **Genre:Old School** Song 3 track Rap title track Song 2 track **Genre:Old School** Song 3 track Rap title track Song 2 track **Genre:Old School** Song 3 track Rap title track Song 2 track Any help Please Please Please would be appreciated. My php skills are not the best and the loop is making my brain hurt a little. Thanks


title: Exclude stylesheet from admin

text: I have been using the following function to enqueue some CSS to my theme. However, they are used in the admin area as well:               wp_enqueue_style(...)      I don't want them to be used in the admin area. Sadly I cannot find anything about that neither here nor on Google in combination with this function. The codex doesn't explain it as well and the function does not support an option to apply to a specific style the exclusion of the admin area. I hope somebody could tell me how to exclude a specific css from the admin area. Thanks in advance.


title: 1 column admin screen options - move submitdiv to bottom

text: I'm using this code.               add_filter('meta-box-order_post','one_column_for_all');     function one_column_for_all($result, $option, $user){         $result['normal'] = 'postexcerpt,formatdiv,trackbacksdiv,tagsdiv-post_tag,categorydiv,postimagediv,postcustom,commentstatusdiv,slugdiv,authordiv,submitdiv';         $result['side'] = '';         $result['advanced'] = '';         return $result;     }      My `submitdiv` always appearing in the middle instead of bottom. Can anyone help me to move it to the bottom? Please note: I also have some custom metaboxes which is added by some plugins. So i want to move the `submitdiv` very bottom of the page


title: Filtering Wordpress Contents based on URL

text: This is just a theoretical question for now. Given a website that has items of content that are tagged into categories, for example "Coding" "Writing" "Gaming", it is possible to configure the site in some way that the categories are only available dependant on the incoming URL from which they are viewed? For example, if everything is available on www.mysite.net, the coding posts are available at coding.mysite.net (with the other categories still available for view), and the coding posts available without any sign of the other categories on a seperate domain www.mycodingsite.com and using a different theme from the main site? In this way I could "split out" a section of my site by category, and have it appear as a standalone website?


title: Ideal top-level slug methods

text: Right now I have a post type that generates a slug, e.g. http://url.com/l/abcd/ for each entry. I have a query in my `404.php` that checks for http://url.com/abcd before output and redirects it if found in that post type "l"... What I'm wondering is, since `404.php` will always send a 404 http header, is it not ok to do 301 inside `404.php` (before any "output" starts)? It "works", but I suspect there is a better way... Is it a bad idea to do a new `rewrite_rule()` for every slug in that post type? Is there a way to make post type "l" be top-level or checked "along with" page slugs?


title: Restrict users on multisite WordPress install

text: I have a series of sites that I maintain as part of a WordPress multisite install. I'd like to be able to create users accounts that are restricted to viewing only a single one of these sites. Is this possible? Once this is accomplished, is there a way to determine this permission status programmatically? I'd like to be able to get a list of all the sites the current user has access to, or at the very least, test if the user has permission to access a specific site.


title: How does W3 Total Cache CDN URL rewrites work?

text: I just setup W3 Total Cache S3 CDN (origin push) and most of the URLs are being rewritten correctly but we have some custom plugins where the URLs are not being rewritten. How do I grab the rewritten URL of W3TC from another plugin? I'm currently using the following code to grab the image: `wp_get_attachment_image_src( get_post_thumbnail_id(), 'car-thumb');` I'm assuming there is a filter of some sort that just replaces the original "origin" url with the asset URL on the S3 bucket but I've been unable to find where in the code.


title: Importing WP settings to another host

text: I am doing development and testing of a WordPress site on my local machine and have tweaked the WP settings accordingly using the GUI. Installation of WP on my host is easy however, I do not want to go through the GUI and setup everything from the beginning and would like to just import the settings from my local machine. I know that there is an import/export function in WP but this is only for importing and exporting WP content not WP settings. So what would be the best method to import the settings. Thanks in advance. nav


title: Custom loop page with post navigation

text:
I created a custom loop for a particular category. Can I create a list of those posts -- kind of like a table of contents -- and have it link to that service in that loop? Pagination is not used. My current loop is created with this function (I'm sure my function could be more efficient and cleaner -- I'm still learning):               function add_services() {              echo '

';              $custom_query = new WP_Query('cat=5');              while($custom_query->have_posts()) : $custom_query->the_post();                      echo '
';                 echo '
';                 echo the_title();                 echo'
';                 echo the_content();                       endwhile;         wp_reset_postdata();          }


title: Dynamic WordPress editor in meta box

text: I created the WordPress editor using wp_editor function dynamically. While i click add more button i just cloned editor and append new editor using jquery. While i am cloning editor i just changing id distribution_ _0 to distribution_ _1 etc. Editor Properly creating, But editor tools of the dynamic editor is not working and producing js error like 'd' is not defined. While go throw the wp_editor function codex. I saw notes about id should be used only lower case not any other like below. So i try to create 2 editor on same page directly using id with underscore (distribution__0) and it works fine. So is that statement falls in codex.Do you have any idea about this problem. kindly share with me.               Note that the ID that is passed to the wp_editor() function can only be comprised of lower-case letters. No underscores, no hyphens.> Anything else will cause the WYSIWYG editor to malfunction.      PHP code to create editor               wp_editor('content',        'distribution__0,        array(        'media_buttons' => false,        'textarea_rows' => 8,        'textarea_name' => 'rw_toplist_description[]',        'tabindex' => 4,        'tinymce' => array(        'theme_advanced_buttons1' => 'bold, italic, ul, min_size, max_size',             ),        )     );


title: Help with WP_Query - Too many mySQL queries

text:
I need some kind of help with `wp_query`. Am I doing something wrong? I am getting a lot of mySQL queries, while building a new theme. My WP_Query is:               <?php      $args = array(        'post_type' => 'items',        'order' => 'ASC',     'posts_per_page' => 4,      ); ?>
     <?php $lastitems = new WP_Query( $args);     while ( $lastitems -> have_posts() ) : $lastitems -> the_post();?>
         <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?>
         <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail('thumbnail', array('title' => get_the_title())); ?>         Posted: <?php the_time('d M, Y'); ?>  <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
                                         <?php endwhile; ?>
      Link to pastie. For this WP_query I'm receiving 5-7 mySQL queries per retrieved info about post. For example, if i put `posts_per_page' => 1` i will get 15 mySQL queries, if i put `posts_per_page' => 2` i will get 21 mySQL queries, for 3 is 28, for 10 posts it will be around 60-70 queries just for listings and about 90 mySQL queries in total, etc.. I think that's a little too much. Also, `get_posts` uses the same `wp_query`, so it's not helping. Do you have any idea how to minimize number of mySQL queries, or how to fix my `wp_query` if I wrote it wrong. Thanks Dusan


title: Build a content and excerpt grid loop with paging and options for # of posts

text:
What I'd like to do: on index.php, a loop that shows a selectable number of full posts using `the_content` and then below that shows a selectable number (the number of posts can be hardcoded in the function) of excerpts (using `the_excerpt`) in a grid pattern 2 excerpts wide. Any `paged` page of posts only uses the grid display of excerpts. Like this: ![index post display](http://i.stack.imgur.com/svLRf.jpg) ![paged post display](http://i.stack.imgur.com/qhv9R.jpg) This loop would be ideal if it handled text and excerpts and content rather than images: http://www.billerickson.net/a-better-and-easier-grid-loop/ **Yet Another Update 11/03/12:** Thanks to kaiser for this. One last bug: the second page shows the 2 full posts and excerpts rather than all excerpts.                   global $wp_query;         if ( have_posts() )         {             while( have_posts() )             {                 the_post();                      // Add Class: "post-number-X"                 $current_post = "post-number-{$wp_query->current_post}";                      // Add Class: "home" (for index page) or "post-number-X-of-total";                 $current_in_total = 'home';                 if ( is_paged() )                 {                          $current_in_total  = "post-number-";                     $current_in_total .= get_query_var( 'paged' ) * get_query_var( 'posts_per_page' ) - $wp_query->current_post;                     $current_in_total .= "-of-total";                 }                      // Add Class: Even/Odd                 $even_odd = ( 0 === $GLOBALS['wp_query']->current_post % 2 ) ? ' even' : ' odd';                 // Avoid even/odd class for excerpts (everything after the 2nd post)                 2 > $wp_query->current_post AND $even_odd = '';                      // MarkUp: Uses `post_class()` to add classes                 ?>          <article <?php post_class( "{$current_post}{$even_odd} {$current_in_total}" ); ?>>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
                     <?php                      // Home/Index/Front-Page/Archive first page                     if ( ! is_paged() )                     {                         // Display the_content(); for the first 2 posts, then the_excerpt();                         2<= $wp_query->current_post ? the_excerpt() : the_content();                     }                     // Paged archives (starts at second page)                     else                     {                         the_excerpt();                     }                     ?>
                 <?php             }           // Add navigation ...         twentyeleven_content_nav( 'nav-below' );              } // endif;         unset( $current_post, $current_in_total, $even_odd );


title: Free themes for commercial use

text: Does anyone here know weather or not a free theme on Wordpress can be used for commercial purposes? I am using the Pinboard theme. Would I need to get some sort of licence to operate the website as a business?


title: Combine several CSS files into one

text: I've been working on a site where specific CSS files have been written and loaded only when required. I would like to combine all those scripts into one single file. I'm not interested in minifying or compressing, though the first one may be good. I've tested so many cache and compression mechanisms unsuccessfully including W3 Cache or WP-Minify (that it is not updated since years now). Isn't there a simple procedure to do this, interacting with the wp_styles variable? This script available at the url below sounds promising, but doesn't work as it is https://gist.github.com/bainternet/1802367 Any idea?


title: Hide user fields based off capability

text: I'm struggling with this one. I am trying to hide 2 user profile fields for the current user. Only the admin or user with "edit_users" capability should be able to view/edit these fields. Code:               function modify_contact_methods($profile_fields) {              // Field addition and removal will be done here         // Add new fields         $profile_fields['company_name'] = 'Company Name';         $profile_fields['company_id'] = 'Company ID';              if(current_user_can('edit_users')) {             return $profile_fields;         }     }     add_filter('user_contactmethods', 'modify_contact_methods');      Now it displays fine when the user is an admin, but if the user doesn't have the 'edit_users' capability, this error shows on the page between the other contact fields: > Warning: Invalid argument supplied for foreach() in > /home/xxxxxxxxxxx/xxxxxxxx/wp-admin/user-edit.php on line 421 How can I correctly code it so it doesn't come up with this error? Any ideas? Any suggestion/code example is appreciated.


title: query if page has not child

text: I'm trying to create a page which display a few of sub pages (child pages), however if the page has not child I would like to display a message. I cannot get a query that allow me to do something like this:                if (Page has childs) {         do this      }      else {         display this      }      Any help? Thanks in advanced


title: Input ordering in wordpress theme customizer

text: I'm trying to add custom fields to the wordpress theme customizer for the theme that I'm creating.               $wp_customize->add_section(           'sometheme_theme_customization_section',           array(               'title' => __('Settings', 'sometheme'),               'description' => 'Custom settings for the sometheme theme',               'priority' => 35,           )       );            $wp_customize->add_setting(         'sometheme_headline',         array(             'default' => '',             'sanitize_callback' => 'sometheme_sanitize_text'         )       );            $wp_customize->add_control(         'sometheme_headline',         array(             'label' => __('Headline', 'sometheme'),             'section' => 'sometheme_theme_customization_section',             'type' => 'text',         )       );            $wp_customize->add_setting(         'sometheme_tagline',         array(           'default' => '',           'sanitize_callback' => 'sometheme_sanitize_text'         )       );            $wp_customize->add_control(         'sometheme_tagline',         array(           'label' => __('Tagline', 'sometheme'),           'section' => 'sometheme_theme_customization_section',           'type' => 'text'         )       );      As you can see from the above code the headline is declared before the tagline. But for some reason the output always ends up like this: ![enter image description here](http://i.stack.imgur.com/pg5hE.png) Is this weird or have I miss something? Thanks in advance!


title: Register sidebar 'before' and 'after' html as div rather than li tags

text:
I am making sidebars for my theme using the register sidebar function. The codex does it something like this               if ( function_exists('register_sidebar') )     register_sidebar(array(     'name' => 'Right Sidebar',     'id' => 'right-sidebar',     'before_widget' => '
',     'after_widget' => '
',     'before_title' => '
',     'after_title' => '
',     ));      however Jason Tadlock does it something like this:               if ( function_exists('register_sidebar') )     register_sidebar(array(     'name' => 'Right Sidebar',     'id' => 'right-sidebar',     'before_widget' => '
',     'after_widget' => '
',     'before_title' => '
',     'after_title' => '
',     ));          ie that (causes the dynamic_sidebar function to ) output

 ... etc ...

 ... etc ...

      using no
 tags becuase of the before and after widget paramaters      I have found nothing on the w3c that allows anything other than
 tags inside
 tags, but yet I cant imagine Justin Tadlock endorsing invlaid code. To be honest Justin's way makes a bit more sense to me semantically but I'm sure others would differ. My questions are - is it ok to do it this way? .... and which is best ?


title: How to move plugin link from left navigation to a different location?

text: I have the Advanced Custom Fields plugin. How do I move the link so it's under Settings (like some other plugins) or under the Screen Options Tab? I don't want to hide it completely as I would still need to be able to use it. Is this possible and if so how do I do it?


title: Display Posts of a Category in Alphabetical Order (Custom Post Type)

text:
1. I have a **custom post type** called "link"   2. I have a **custom taxonomy** for this post type called "link-category"   3. I have a **template file** for this taxonomy, "taxonomy-link-category.php"   4. I need the template to display the posts of the selected link category in **alphabetical order** **EDIT** : On the LINKS page of the website all of the category names for the custom post type **LINK** are displayed in a list. Once a visitor clicks a category name I need wordpress to list all the posts in that category, in alphabetical order. I have it working, with the code below (using template file: taxonomy-link-category.php), but the posts are displayed chronologically, and only 10 of them (the wordpress default). I've tried things like this: Displaying a custom post type alphabetically but of course it displays... **EDIT** : all of the LINK posts, not just the posts of the selected LINK category. This is my current code in taxonomy-link-category.php, can I not just add `'orderby' => 'title', 'order' => 'ASC'` somewhere/somehow?               <?php get_header(); ?>

Links

<?php echo get_queried_object()->name; ?>
         <?php if (have_posts()) :   // start the loop ?>                                 <?php while (have_posts()) : the_post(); // loop the posts ?>
<?php the_title(); ?>
                 <?php the_content(); ?>              <?php endwhile;     // stop looping the posts ?>                                             <?php else :        // what to do if there are no posts to show ?>
No posts
         <?php endif;        // end the loop  ?>
     <?php get_footer(); ?>


title: Custom /Page/2/ Template Only

text: Is there a method of doing this? Can I use PHP to say `if(URL=page/2/) { }` or something like that within my template? Essentially, I want an ad to appear in my sidebar when a user clicks 'Older Entries' and Wordpress directs them to "myblog.com/page/2/". I'm pretty sure I know how to accomplish this with JQuery, but I was wondering if there was a way through PHP, and without a plugin. Thanks WPA


title: Remove Query String from Google jQuery

text: Was wondering if anyone knew of a way to remove the query string from external Javascript sources, such as Google's jQuery. Thanks in advance for any help


title: Remove height attribute from wp_get_attachment

text: I found this great solution: Stop wordpress from hardcoding img width and height attributes But I was wondering if I could do it only in one specific case and not in all the site because it messes up other stuff. This would be the case:               <?php echo wp_get_attachment_image($attachment->ID, 'six', false, $default_attr); ?>      Removing only height but not width in all the site would also work.


title: How do I duplicate a single post, with all its properties, and save it as a different post?

text: In a wordpress plugin, how can I duplicate/clone a single post? I would need to: 1) get a specific post 2) clear its ID property so that it's saved as a new post 3) save it. In the process, I would like to see all the meta info + taxonomy associations preserved.


title: Wordpress theme (or plugin) that uses Contenteditable property

text: I'm doing an experiment and looking for a WordPress theme that utilizes the **contenteditable** html5 property to allow in context editing on the live website (for authenticated admin users). Are there any examples?


title: Search by tag name and category

text: How can I return all posts that match a specific taxonomy using `<?php get_search_form(); ?>` For example: if a user enters a search query that matches the name of a tag or category, `search.php` will return all posts with a matching tag, or that fall into a matching category. I am working with a custom post type, and as of now, `get_search_form();` seems to only return matches based on content and title alone. Please Help! Thanks.


title: What's the hook for filtering every texts of site?

text: I'm developing a plugin to replace a character that google doesn't show it with an accepted character. I want to get all the texts that wordpress returns (content, comments, title, names, etc.) but I don't know what hook should I use to do it. Can anybody help me?


title: The images in the post arent Visible after publishing them?

text: I write a post in new post editor and then add media. I can see the images in the editor but when i publish them they aren't loading up and a frame with little square in the middle comes up. This is the link to one of my posts: http://getprogramcode.com/2013/03/c-program-for-bit-stuffing/ . For some people only link to the image comes up and it opens up with 404 error. See the line after OUTPUT: bit stuffing. Also i want to remove the featured image from appearing in my posts. I have a option in my theme on a new post: "disable featured image" - but that doesnt work . Also if i dont put the image or i remove the featured image the empty image appears: see the home page: http://getprogramcode.com Please help me to solve this problem


title: Custom front end login not working

text: I'm trying to create a photo sharing site for my brother and his fellow guardsmen who are over in Afghanistan. I'm having issues with wordpress login/register. I have everything set up so you can log in, in the header or register in the main content area. When you are logged in you can view the photos. I'm trying to do with all with using just index.php by doing this...               <?php get_header(); ?>                                  <?php if (is_user_logged_in()) :?>                             <?php include('loop.php'); ?>                             <?php else : ?>                             <?php include('register.php'); ?>                             <?php endif; ?>                    <?php get_footer(); ?>      So if the user is logged in they see the loop, if they aren't they see the register form. Then then in the header you see the login form which I found a solution for by looking around...                 <?php if (!is_user_logged_in()){ ?>       <?php wp_login_form() ; ?>        <a href="<?php echo wp_lostpassword_url( get_permalink() ); ?>" title="Lost Password">Lost Password            <?php } else { ?     Welcome,        <a href="<?php echo wp_logout_url( get_permalink() ); ?>" title="Logout">Logout            <?php }?>      When I hit "login" it just stays on the page and adds the info to the url. Nothing changes. You can see it live @ www.kevinmonahan.com/test I've never done a user login on the front end before, so thanks for the help in advance!


title: How to add a default item to a custom taxonomy?

text: Wordpress default taxonomy (Categories) has the item Uncategorized by default. How to add a default item to a new custom taxonomy? **functions.php:**               // === CUSTOM TAXONOMIES === //     function my_custom_taxonomies() {         register_taxonomy(             'block',        // internal name = machine-readable taxonomy name             'static_content',       // object type = post, page, link, or custom post-type             array(                 'hierarchical' => true,                 'labels' => array(                     'name' => __( 'Blocks' ),                     'singular_name' => __( 'Block' ),                     'add_new_item' => 'Add New Block',                     'edit_item' => 'Edit Block',                     'new_item' => 'New Block',                     'search_items' => 'Search Block',                     'not_found' => 'No Block found',                     'not_found_in_trash' => 'No Block found in trash',                 ),                 'query_var' => true,    // enable taxonomy-specific querying                 'rewrite' => array( 'slug' => 'block' ),    // pretty permalinks for your taxonomy?             )         );     }     add_action('init', 'my_custom_taxonomies', 0);      **EDIT: I just want to have the taxonomy item there when the theme is installed. It doesn't have to automatically be added to any empty term**.


title: Ajax future single post query doesn't work when NOT logged in

text: I am having a problem with an ajax request for a single post, when the user is not logged in. The post is a calendar date and is in the future. the query works fine if I am logged into wordpress but doesn't when I am logged out. This type of query also works when there is no ajax involved, for example if I want to display all future dates in a category page. Do I need to fire up an instance of wpdb to get the results? Must be a permission thing but cant find any answers.               function ajax_get_date_post()      {         // get the submitted parameters         $post_id = $_POST['post_id'];              $args = array(             'post_type' => 'mandy_dates',             'p' => $post_id,             'post_status' => 'future,publish'         );              // build and make query         $clicked_date =  new WP_Query( $args );              // response output         header( "Content-Type: application/html" );         if ( $clicked_date->have_posts() ) {             while ( $clicked_date->have_posts() ) {                 $clicked_date->the_post();                 include( $this->get_single_post_template_path() );             }         } else {             echo "Sorry, Date not found";         }              exit;     }      UPDATE: these are the hooks:                   add_action( 'wp_ajax_nopriv_ajax_get_date_post', array(&$this, "ajax_get_date_post") );         add_action( 'wp_ajax_ajax_get_date_post', array(&$this, "ajax_get_date_post") );      this is the Ajax JS:               function ajax_get_post( _id )      {         $.post(             mandy_dates_js_config.ajaxurl,             {                 action : 'ajax_get_date_post',                 post_id : _id             },             function( response ) {                 on_date_loaded( response );             }         );     }      UPDATE 2: I figured it out. modified the "show-future-posts-on-single-post" to work in my ajax request, here the updated code               function ajax_get_date_post()      {         // get the submitted parameters         $post_id = $_POST['post_id'];              $args = array(             'post_type' => 'mandy_dates',             'p'         => $post_id             // 'post_status' => 'future,publish'         );              // build and make query         $this->clicked_date = new WP_Query();              add_filter( 'the_posts', array( &$this,'show_future_posts') );         $this->clicked_date->query( $args );         remove_filter( 'the_posts', array(&$this,'show_future_posts') );              // response output         header( "Content-Type: application/html" );         if ( $this->clicked_date->have_posts() ) {             while ( $this->clicked_date->have_posts() ) {                 $this->clicked_date->the_post();                 include( $this->get_single_post_template_path() );             }         } else {             echo "Sorry, Date not found";         }              exit;     }          function show_future_posts( $posts )     {         global $wpdb;              if( $this->clicked_date->post_count == 0 ) {             $posts = $wpdb->get_results($this->clicked_date->request);         }              return $posts;     }


title: wp_insert_post bulk import 500 server error

text: I am working on a Wordpress import tool, where I use a custom city table in my database with longitude, latitude which combine with some other text and then import by `wp_insert_post()`. This works great but after 3200 - 3600 the script stops and I get a 500 internal server error. I have tried multiple solutions to fix this problem: I increased the following php.ini settings:   * max_input_time   * max_execution_time   * memory_limit    * mysql.connect_timeout   * max_input_time   * post_max_size Increased the WP_MEMORY_LIMIT is wp_config.php:               define('WP_MEMORY_LIMIT', '128M');      And increased my time limit in wp_config.php too.               set_time_limit(240);      Tried it also with my htaccess file:               php_value max_execution_time 240      Debugged my bugs but I still got the 500 error. I contacted my host and they told me to set the `set_time_limit();` which I have set in function.php, in the file of my importer and wp_config.php, but no success. I viewed my php settings by `phpinfo();` and there I have a max_execution_time of 120. I have asked my host to increase it and still the same problem. This is my import script:               // Get results             global $wpdb;             $results = $wpdb->get_results( "SELECT * FROM stn_locations" );              if( $results ) {                  // Submit button clicked             if( isset( $_POST['submit'] ) ) {                      foreach( $results as $result ) {                          // Set variables                     $location_name      = $result->stnl_name;                     $location_longitude     = $result->stnl_longitude;                     $location_latitude  = $result->stnl_latitude;                     $location_country       = $result->stnl_country;                     $location_term      = $_POST['term'];                          // Content                     $location_content       = $_POST['stn_filter_import_content'];                     $location_content       = str_replace( '%%location%%', $location_name, $location_content );                     $location_content       = str_replace( '%%category%%', $location_term, $location_content );                          // Build post_title                     $post_title = $location_term . ' ' . $location_name;                          if( $location_country == $_POST['country'] ) {                              // Import data                         $import_data = array(                             'post_title'    => $post_title,                             'post_content'  => $location_content,                             'post_status'   => 'publish',                             'post_type' => 'filter',                         );                               // Insert post                         $post_id = wp_insert_post( $import_data );                              if( ! is_wp_error( $post_id ) ) {                                  // Set Term                             wp_set_object_terms( $post_id, $location_term, 'service' );                                  // Set meta fields                             update_post_meta( $post_id, 'longitude', $location_longitude );                             update_post_meta( $post_id, 'latitude', $location_latitude );                                  $success = true;                              } else {                             $error = true;                           }                               }                      }                      }     }      Does anyone have a solution, tip, setting or other function for me? Let me know! Thank you.


title: return page name in url

text: This the url format: `www.mysite.com/pageone` How do I get the page name? what is the wordpress function/method for this? bloginfo('name') return the site name. I want the function that returns (return not echo) the name of the current page.


title: Do not run this code on posts with a specific tag!

text: This is sort of complicated. I am looking for some php help related to WordPress blog. The basic requirement is that some HTML code (ad code) is not supposed to run on posts with a specific tag. In simple terms... I do not want to run ads in posts which have a specific tag! How can it be accomplished? I believe this would use this WordPress function: http://codex.wordpress.org/Function_Reference/has_tag I am not very proficient at PHP. I suppose this can be easily used to run specific code if the post has a specific tag. I want to do the opposite!


title: meta_query displays all results and none, my query is wrong

text: I´ve read almost this articles but unfortunately my query is no working, I think i´m very close but could be so far away. I´m trying to get metadata using a custom form with method get, $rob = $_GET['rob'];   $bedrooms = $_GET['beds'];   $bathrooms = $_GET['baths']; the array is $args = array( 'meta_query' => array( array( 'key' => 'beds_value', 'value' => '$bedrooms', 'compare' => 'LIKE',                       ),             array(             'key' => 'baths_value',             'value' => '$bathrooms',             'compare' => 'LIKE',                  ),             array(             'key' => 'rob_value',             'value' => '$rob',             'compare' => 'LIKE',                  ),               ),     );          $args = array_merge( $args , $wp_query->query );     query_posts( $args );      depending on final query the results are diferent this display none, seems to be this clean the query   $args = array_merge( $args , $wp_query->query ); query_posts( $args ); but if is used $query = new WP_Query( $args ); I get all results without any filter. but I can see the query data Ex 2 beds, 2 baths Do I need to write something more?


title: Choose User to email when adding a new post?

text: I am trying to find out a way to "email" users when a post is made? It would be nice to have a drop down menu or check box to check to "email that user" when Publishing a new post?? So I can just check one of the USERS to notify?? Anything like this available? I have found this as a plugin - Email Post Changes -- but it doesn't individualize each post??


title: Custom Post Type, Pagination and 404s?

text: Head is getting melted with this pagination crap in WordPress! What am I doing wrong here… **Test site** http://www.clients.eirestudio.net/savvas/reviews/ **Code**               <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     query_posts("post_type=bingo_review&posts_per_page=1&paged=$paged");     if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>        blah     <?php endwhile; ?>           <?php endif; ?>          <?php wp_paginate(); ?>


title: How to remove/exclude specific posts in a category from RSS feeds after particular date

text:
I want to remove/exclude some posts of a category from RSS feeds after particular date. First of all i want to specify that same requirement i already accomplish for front page posts. I have two categories x and y and i am showing the posts of these categories on front page. I have created custom field name **'expiration'** in which i am giving the date like 2011/08/12 as value which will remove the particular post from front page on given date. Below is the code to remove particular post where custom field expiration is set.               <?php if (have_posts()) :query_posts($query_string .'&cat=3'); while (have_posts()) : the_post();              $currentdate = date("Ymd");             $expirationdate = get_post_custom_values('expiration');             if (is_null($expirationdate)) {             $expirestring = '30005050'; //MAKE UN-EXPIRING POSTS ALWAYS SHOW UP;             } else {                  if (is_array($expirationdate)) {             $expirestringarray = implode($expirationdate);             }             $expirestring = str_replace("/","",$expirestringarray);             } //else             if ( $expirestring > $currentdate )              {              // Enter your post display code after that.?>                 <a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>" class="recent_news"><?php the_title(); ?>

<?php the_time('l, jS F Y'); ?> at <?php the_time('g:i a'); ?>
            <?php } endwhile; endif; ?>      In the above code you can see that '&cat=3' is mention which is my category X and similar for Category Y. Now come to the point how can i set the date once in custom field expiration for front page posts as well as RSS feeds. i used ( exclude ) tag whose id is ('7') on the posts and filter out but problem is when i put the exclude tag it immediately remove/exclude the post from RSS Feeds. I want to exclude on the basis of expiration date. Below is the function placed in function.php file which filter out the tag on basis of ID.               <?php function filter_feed_posts($query) {     if($query->is_feed) {          $exclude_tags = array(7);     $query->set('tag__not_in',$exclude_tags);     }     }     add_filter('pre_get_posts','filter_feed_posts');     ?>      Please help me to get this done. Your help is appreciated.


title: Clean links in: the_author_meta('description')

text:
I need to clean any links returned from the_author_meta('description') The code I use is simply that:
<?php the_author_meta('description'); ?>
      I Searched old question but could not find the right anwer.. ideas anyone?


title: Secure Wordpress: Change admin

text: I'm sorry if this is an extremely stupid question. I've been looking for ways how to secure my WP and a lot of websites suggest to create a new admin user account and delete the old one. Now, if I use a different screenname as author (when writing comments etc.) - how could hackers still find out what my admin username is anyways? I'm just wondering if this step really makes sense unless your administrator username is "admin". Thanks a lot for clarification.


title: get_posts not working as expected

text: I'm trying to get posts from 3 different categories and list them on the front page:                 // Carousel articles       $args = array( 'numberposts' => 3, 'orderby' => 'date', 'category' => 'karusell' );       $carousel = get_posts($args);            // News articles       $args = array( 'numberposts' => 3, 'orderby' => 'date', 'category' => 'nyheter' );       $news = get_posts($args);            // Featured articles - max 2 posts       $args = array( 'numberposts' => 2, 'orderby' => 'date', 'category' => 'feature' );       $featured_posts = get_posts($args);      Then I output them by doing this:               foreach( $carousel as $post ) : setup_postdata($post);      // code here     endforeach;      My problem is that all my loops outputs the same posts. Am I using the wrong function for getting posts? I could use something like this:               query_posts("category_name=feature&posts_per_page=2&orderby=date");     while (have_posts()) : the_post();     //code     endwhile;      But I was hoping I could fetch all the articles at the top of my code and not "inline".


title: need help to arabic text in wordpress

text: I am doing a worpdress theme which is in Arabic language. When I write anything in Arabic. It turn into ????(question mark). Please help to fix this. Thanks


title: Run shortcode at certain resolution

text: I've gone a roundabout way of trying to ask a question about this here: Loading shortcode with ajax but figured it might be worth asking the fundamental question of what I am trying to do without adding my confused, naive problem-solving into the mix. I want to run this:               <?php echo do_shortcode('[metaslider id="8302"]'); ?>      But only if the window size is greater than, for example, 800px. Any ideas would be much appreciated!


title: the_content() returning null in one category only, even though there is content

text: A friend's heavily customized blog has a category with a specific `categoryname-single.php` file to display posts. Apparently for no special reason, since yesterday, `the_content()` is not returning any content any more for posts in that category, even though the WP back-end is clearly showing content in the post. All other categories are unaffected. What I have tried / excluded:   * There are no PHP errors: I have tried with `echo get_the_content()` instead, to no avail.   * I am working on the correct file: When I change something else in the file or hard-code some HTML text in it, it shows up on the page. That also excludes any caching issues                <? echo "start"; the_content(); echo " end"; ?> // outputs "start end";        * The content is physically missing, it's not just hidden or something: I have inspected the DOM using the DOM inspector, and looked into the HTML source. Where there is supposed to be content, there is nothing.    * This affects all articles in that category; none of them has been changed for weeks. They are all published.    * The problem is not caused by some shortcode that doesn't get parsed: I have tried entering pure text into a post, with the same results.   * There is no loop mix-up: `the_ID()` returns the correct post ID.   * The problem occurs for logged-in and not logged-in users.  There has been some installing and uninstalling of plug-ins yesterday, and some editing of files (although purely hygienic measures like removing superfluous comments and such) by the blog owner. I can't exclude that one of these things caused the issue, but I can't really see how. I'm at my wit's end. My questions:   * Is there any way to output the raw, unfiltered post HTML to find out whether this is a rogue filter deleting all the content in that specific category for some weird reason?   * What else could cause a wholesale deletion of content in one category only?   * Does anybody have any other ideas on how to debug this?


title: How to insert content from another Custom Post type into Post?

text: Say I have a custom post type called "Performers". This gets populated with different bands/performers. These posts have a featured image as well as custom fields (mp3 file, facebook link, myspace link, etc). I have another custom post type called "Events". When I create a new Event post, I would like the option to have a drop box to select one of the bands from the "Performers" custom post type. This will insert all data from the specific Band/Performer into the Event post (custom fields, featured image, etc.). What is the best method for inserting/injecting this sort of loop from the "Event" admin?


title: wp_insert_post hook for a wordpress plugin

text: I'm trying to make a wordpress plugin to auto-translate posts just before it's inserted, it's for a specific need where I want to write in a language, post in a different one, so far, I'm not able to hook the wp_insert_post, or I don't understand how to do this properly, I posted my hook code here, I note it's my very first plugin, I appreciate any help or helpful remarks. Mike,               function tr_insert_post($post, $wp_error = false)     {              $post ['post_title'] = "the title: ".$post ['post_title'];              return $post;     }               add_action('wp_insert_post', 'tr_insert_post',1,2);


title: Default archive URL wordpress

text: In wordpress you have a few 'default' archive URL's. Like for example: http://www.mydomain.com/2011/ generates an overview of the posts of (only) that year. If you have an category blogs the url http://www.mydomain.com/blogs/ generates an overview of all the posts within that category. (Spread over multiple pages) Now is my question is there any link which generates an overview of all posts (spread over multiple pages) starting with the newest first and going back in time? So not like the 2011 url, which only fetches from this year, but go's further back in time when applicable. My current permalink structure is:               /%category%/%postname%/      Thanks.


title: Changing Top Level Items into Radio Buttons in the Categories Meta Box?

text:
I know it is possible to change the WordPress category list to radio buttons in the admin panel for posts, but I would like to make the just the Parents radio buttons and the sub categories or children checkboxs... something like this.

<input type="radio"> Category 1

<input type="checkbox">Category 1 - Sub Cat 1

<input type="checkbox">Category 1 - Sub Cat 2

<input type="radio"> Category 2

<input type="radio"> Category 3

<input type="radio"> Category 4

<input type="checkbox">Category 4 - Sub Cat 1

<input type="checkbox">Category 4 - Sub Cat 2

<input type="radio"> Category 5

      I don't really want to mess around with the core files and wondered if anyone knows a way to override the output via the theme functions or another method.


title: CSS not updating in browser when I change it

text: I am working on the CSS of my wordpress site. When I make changes and refresh the page the changes are not reflected. When I clear the browser history and cache the changes are still reflected. When I view the source code of the page and look at the css file it has the old content before the change. How do I get this to update so I can develop?


title: 2 small questions: How to redirect to a created page & show that pages title in wp, bp

text: im trying to redirect the loggedin user to a page i created on the backend, i want to use my index to do so so, i added a `do_action` wrapped in an if statement `is_user_loggedin()` to call my function. here's the function:               function my_redirect() {       global $bp;           if ( $bp->current_component == $bp->root_domain ) {       bp_core_redirect($bp->current_component == MY_CUSTOM_SLUG  );       }      }      but it's not working. The page shows when you navigate to it, but it wont redirect when viewing the root page (index). Here's whats in the index.php                <?php if ( is_user_logged_in() ) : ?>           <?php do_action( 'my_redirect'); ?>           <?php endif; ?>      Thanks ahead of time :)


title: How to display related posts from same category?

text: Is it possible to display related posts from same category as the current post?


title: WordPress auto update for core but use local package

text: I have several local WordPress dev environments but, for the moment, a very very slow internet connection. The WordPress auto updater for core is very convenient, but would it possible for it to use update packages from localhost instead of downloading it for every site?


title: Where can you find the available filter tags?

text: In my attempt to alter navigations current-menu-item class, I found a possible solution http://stackoverflow.com/a/7941864/520265 ,               add_filter('nav_menu_css_class', 'my_css_attributes_filter', 100, 1);      He makes use of a filter who is called with a tag 'nav_menu_css_class' , But it got me wondering, where can you find information about what filters are available to use? http://codex.wordpress.org/Function_Reference/wp_nav_menu does not mention anything about filters...


title: List terms of custom taxonomy if matches other taxonomy

text:
So the title is confusing but I can't think of a better way to word it. Basically, I have two taxonomies of "state" and "city" (that have to stay separate for other reasons). Lets say for instance, a term in the taxonomy of "state" is "Connecticut" I then want to display a list of terms from the taxonomy of "city" that populate only from posts with the "state" term as "Connecticut". Basically, I want to dynamically call the state and display the cities in the sidebar on the archive page... I know, this sounds really confusing. This code works but obviously causes duplicates, I would like each one only listed once.               <?php     $pterms = get_the_terms( $post->ID, 'property_location' );          if ( $pterms && ! is_wp_error( $pterms ) ) :           $prop_links = array();          foreach ( $pterms as $el_term ) {         $prop_links[] = $el_term->name;     }          $st_location = join( ", ", $prop_links );        ?>     <?php endif; ?>     <?php endwhile; ?>                    <?php     $args = array(      'post_type' => 'property',      'post_status' => 'publish',      'posts_per_page' => -1,      'property_location' => ''.$st_location.''     );     $the_query = new WP_Query( $args ); ?>     <?php while ($the_query->have_posts()) : $the_query->the_post(); ?>
<?php echo get_the_term_list( $post->ID, 'city', '', '', '' ); ?>
           <?php endwhile; ?>      Any suggestions?


title: Conditional Tags for Membership Levels when using Wishlist Member Plugin?

text: I am currently using a plug-in called Wishlist member. It allows you to create membership levels in WordPress. I want to be able to display different content on a page depending on the membership level of the viewing user. Something like this -               <?php global $current_user; get_currentuserinfo();      if ($current_user->user_level == 10 ) { ?>       Admin Stuff (In my case I left this blank)     <?php } else {   ?>       Stuff Seen By Visitors     <?php } ?>      But not just for the admin. I have found that this plug-in create creates these for each member level "wpm_access[1296320588]" and "wpm_level[1296320588]". Any ideas on how I could check the current user against this? Thanks!


title: How to apply a class to the second word in menu list item?

text:
I want to apply a class to a word in my menu. For example, say I have a list item in my menu called "My Item". I would like to apply a class to the word "Item" so that I can style it anyway I want. Do I need to add a span to the list item and then add the class to my css like this?

My Item

          #nav ul li a.dark-blue {         color: #00008B;     }


title: Display first name instead of username

text:
I have a plugin that outputs username after login, I want it to display first name instead. Here is the code that does it.                       global $userdata,$user_identity;             get_currentuserinfo();                  if ($userdata->ID>0) {                 // User is logged in                 echo '
' . $before_widget . $before_title . "Welcome ".$user_identity . $after_title . '
';                 echo '

Logout

Dashboard

Profile

                 ';             } else {             // User is NOT logged in!!!                     echo $before_widget . $before_title . '
Welcome Guest, Login
' . $after_title;      $user_identity is what outputs that username I searched through wordpress forums and someone said I have to add `$current_user->first_name` to the code. The question is, where and how do I add it? I assume I would need to add it to this line `global $userdata,$user_identity;` But how do I properly syntax that? I tried doing this but getting syntax errors `global $userdata,$user_identity = $current_user->first_name;` Your help is highly appreciated.


title: Hooking custom PHP output into WP: how to do it, parse_request almost works but not quite

text: I'm new to wordpress, so chances are I'm missing something pretty basic here. I'm trying to write a plugin which uses custom PHP code to generate output. I managed to get this working on the admin-side, but on the user side a properly working solution eludes me. I've managed to find the following 2 hooks to use:               add_action ('parse_request', 'myPluginFunc');     add_action ('wp', 'myPluginFunc');      When I call index.php?MyPlugin=myPluginFunc this works in the sense that myPluginFunc() is called and it's output is echoed back on the screen, _however_ the output is placed _above_ the main theme output area (right below the top black WP menu bar). So: How do I display output generated by a custom PHP function (output which is not a Post) on the main display area of the page? What hooks do I use to achieve this? Any pointers would be much appreciated. Greetings/Thanks Robert


title: Custom Post Type, limit to one

text: I'm using custom post types for a few pages where I have a very customized template...but I only need one of each post (maybe not the best way to go about this...but it's built so I'd like to not have to change this). Is there a way to remove the "Add New" link on the **left side admin menu** just so the user doesn't keep making more than 1 version of this post? I'm okay with the "Add new" inside the actual page as that seems a bit harder to find.


title: Running a function on comment status change

text: I am making a review system where i need to find update rating average when:   * A comment gets approved from pending/trash/spam.   * A comment gets upapprove from approve   * A admin post reviews (auto approved)   * A comment gets edited (from backend or frontend custom dashboard when user wants to edit/update/remove his already made review) **Here is the code i've written:**               add_action('edit_comment', 'update_business_rating_avg');     add_action('comment_post', 'update_business_rating_avg');     add_action('comment_unapproved_to_approved', 'update_business_rating_avg');     add_action('comment_approved_to_unapproved', 'update_business_rating_avg');     add_action('comment_spam_to_approved', 'update_business_rating_avg');     add_action('comment_approved_to_spam', 'update_business_rating_avg');              function update_business_rating_avg($comment){             //fb($comment);             $post_id = $comment->comment_post_ID;             $post_type = get_post_type($post_id);             if('business' == $post_type){             //fb($post_type);                 $args = array(                                         'post_id' => $post_id,                                         'status' => 'approve'                             );                 $comments = get_comments($args);                 $total_ratings = 0;                 $avg = 0;                 foreach($comments as $comment){                     $total_points += get_comment_meta($comment->comment_ID, 'rating', true);                         $total_ratings++;                 }                 if($total_ratings > 0){                     $avg = $total_points/$total_ratings;                     $avg = (float)$avg;                 }                 $avg = roundToNearestFraction($avg,0.5);                 update_post_meta($post_id, 'avg_rating', $avg);             }         }      **Problem:**   * I am still missing something because when an admin post a review the function not triggered (Its gets auto approved).   * Check the function `update_business_rating_avg()` and how I use `get_comment_meta()` inside foreach. Is it performance killing? Is there a better way to do this? Custom SQL parhaps? Appreciate your help, Thanks! **SOLVED:** _Final Code_ Thanks to @Soulseekah to send me to right direction. Here is final code for the solution if someone needs it in future. The SQL is a complex one because i had to JOIN both `wp_comments` and `wp_commentmeta` to compare approved comment and comment associated with the current post ID.               add_action('edit_comment', 'update_business_rating_avg');     add_action('comment_post', 'update_business_rating_avg');     add_action('comment_unapproved_to_approved', 'update_business_rating_avg');     add_action('comment_approved_to_unapproved', 'update_business_rating_avg');     add_action('comment_spam_to_approved', 'update_business_rating_avg');     add_action('comment_approved_to_spam', 'update_business_rating_avg');     add_action('comment_approved_to_trash', 'update_business_rating_avg');     add_action('comment_trash_to_approved', 'update_business_rating_avg');          function update_business_rating_avg($comment){         if ( !is_object( $comment ) ){             $comment = get_comment( $comment );         }              $post_id = $comment->comment_post_ID;         $post_type = get_post_type($post_id);         if('business' == $post_type){             $avg = 0;             global $wpdb;             $query = "SELECT AVG(meta_value) FROM $wpdb->commentmeta ";             $query .= "INNER JOIN $wpdb->comments ON $wpdb->commentmeta.comment_id = $wpdb->comments.comment_ID " ;             $query .= "WHERE $wpdb->commentmeta.meta_key = 'rating' ";             $query .= "AND $wpdb->comments.comment_approved = 1 ";             $query .= "AND $wpdb->comments.comment_post_ID = '$post_id'";                  if( $result = $wpdb->get_var($wpdb->prepare($query)) ){                 $avg = roundToNearestFraction($result, 0.5);                 update_post_meta($post_id, 'avg_rating', $avg);             }else{                 // report error                 //$wpdb->print_error();             }         }     }


title: 2 seperate installation 1 theme same server

text: i got 2 separate installation on the same folder   each in their own sub folder - they use the same theme   which i copied twice. Every time i edit a file i need to do it twice and its   a real hassle... How can i define so that they both   use the same theme - a shared theme but a different   database? I have no "initial code" to share since i don't know   where to begin so an example code would be much appreciated


title: Getting taxonomy images to display on single-post with their terms

text:
Having some trouble with taxonomy images plugin. I am on single-post.php and I want to display my post's taxonomy terms & the term's associated images. Ideally, I'd like the taxonomy description there too. No idea why this has me stumped because it seems like it should be a simple thing to do. I have this code, which displays just the post's term's images:               $terms = apply_filters( 'taxonomy-images-list-the-terms', '', array(                 'taxonomy' => 'comedians',             ) );                  foreach( (array) $terms as $term){                 echo $term;             }      I also have this, which displays the post's terms:                       print get_the_term_list( $post->ID, 'comedians', '
', ',

', '
' );      And then I have this code, which displays all of the term's images, with the terms & links & descriptions:               $terms = apply_filters( 'taxonomy-images-get-terms', '', array(                 'taxonomy' => 'comedians',             ) );             if ( ! empty( $terms ) ) {                 print "\n" . '
';                 foreach( (array) $terms as $term ) {                     print "\n" . '
';                     print "\n\t" . 'image_id ) . '" rel="lightbox unique-woo-feature">' . wp_get_attachment_image( $term->image_id, 'unique-woo-feature' ) . '';                     print "\n\t" . '
' . esc_html( $term->name ) . '
';                     print "\n\t" . '
' . esc_html( $term->description ) . '
';                     print "\n" . '
';                 }                 print "\n" . '
';             }      What I need is something in between. I understand the crucial part is the filter, specifically the difference between `get-terms` and `list-the-terms` but the latter one, which gets the post's terms like I need, doesn't seem to do anything but just the images no matter what I do. Any help with this, much appreciated.


title: How to Filter Facebook Plugin to Post a Specific Only Custom Post Type

text: I am using WordPress Facebook plugin to post my new posts from WordPress to my Facebook Page. So far everything works perfectly and I set up an app on my Facebook to integrate with my WordPress. Now my question is, is there any way to filter the plugin to ONLY post just one specific Custom Post Type, lest's call it "News", to Facebook and not the other post from WordPress native Post or even any other


title: How to integrate external user tables with WP?

text: I have about 10K+ users that I get from a company feed (LDAP). I can authenticate WP via SSO based on someone's username matching on the WP user table. I would like to take the user table I have and combine it with the wp- user table so that I can set permissions, change display name and things like that. Is there a best way to do this? Also we have about 15 WP installs and will probably have 30 by mid next year. How can I manage these users in one table given that some may have admin rights on one site yet not admin rights on another site?


title: VERY weird problem with switch in meta box

text:
I created a new custom meta box and everything work well (saving, outputting) but I don't get any change when I try to add some lines of code to the switch statement For example: when I delete few 'cases' from the 'switch' statement no changes taking place... or even when I add new class to an input inside the switch, still I get no changes Here is the full code:               $prefix = 'ks-';     $header_meta = array(       array(         'name' => 'header-options',         'id' => $prefix . 'header-options',         'type' => 'radio',         'options' => array(             array('name' => 'Show Page Title', 'value' => 'title-true'),             array('name' => 'Hide Page Title', 'value' => 'title-false'),             array('name' => 'Fancy Header', 'id' => 'fancy-header-setting', 'value' => 'fancy-header'),             array('name' => 'Slideshow', 'value' => 'slideshow')         )     ),     array(         'name' => 'header-effect',         'id' => $prefix . 'header-effect',         'type' => 'radio',         'options' => array(             array('name' => 'Normal', 'value' => 'normal'),             array('name' => 'Overlaping', 'value' => 'overlaping')         )     ),     array(         'name' => 'Text box',         'desc' => 'Enter something here',         'id' => $prefix . 'text',         'type' => 'text',         'std' => 'Default value 1'     ),     array(         'name' => 'Textarea',         'desc' => 'Enter big text here',         'id' => $prefix . 'textarea',         'type' => 'textarea',         'std' => 'Default value 2'     ),     array(         'name' => 'Select box',         'id' => $prefix . 'select',         'type' => 'select',         'options' => array('Option 1', 'Option 2', 'Option 3')     ),     array(         'name' => 'Radio',         'id' => $prefix . 'radio',         'type' => 'radio',         'options' => array(             array('name' => 'Name 1', 'value' => 'Value 1'),             array('name' => 'Name 2', 'value' => 'Value 2'),             array('name' => 'Name 3', 'value' => 'Value 3')         )     ),     array(         'name' => 'Checkbox',         'id' => $prefix . 'checkbox',         'type' => 'checkbox'     ),     array(         'name' => 'Colorpicker',         'id' => $prefix . 'colorpicker',         'type' => 'text',         'default' => '#ffffff',         'class' => 'ks-display-colorpicker',       )     );          // Meta box output html     function ks_header_settings_display( $post ) {       global $header_meta, $post;       echo '
';       foreach ($header_meta as $field) {          // get current post meta data          $meta = get_post_meta($post->ID, $field['id'], true);          echo '
',                 '', $field['name'],    '	',                 '';         switch ($field['type']) {             case 'header-options':                 echo '<input type="radio" name="', $field['id'], '" id="', $field['id'], '" value="', $meta ? $meta : $field['std'], '" size="30" style="width:97%" />', '
', $field['desc'];                 break;             case 'header-effect':                 ?>
<?php                 echo '<input type="radio" name="', $field['id'], '" id="', $field['id'], '" value="', $meta ? $meta : $field['std'], '" size="30" style="width:97%" />', '
', $field['desc'];                 break;             case 'text':                 echo '<input type="text" name="', $field['id'], '" id="', $field['id'], '" value="', $meta ? $meta : $field['std'], '" size="30" style="width:97%" />', '
', $field['desc'];                 break;             case 'textarea':                 echo '<textarea name="', $field['id'], '" id="', $field['id'], '" cols="60" rows="4" style="width:97%">', $meta ? $meta : $field['std'], '</textarea>', '
', $field['desc'];                 break;             case 'select':                 echo '<select name="', $field['id'], '" id="', $field['id'], '">';                 foreach ($field['options'] as $option) {                     echo '<option ', $meta == $option ? ' selected="selected"' : '', '>', $option, '</option>';                 }                 echo '</select>';                 break;             case 'radio':                 foreach ($field['options'] as $option) {                     echo '<input type="radio" name="', $field['id'], '" value="', $option['value'], '"', $meta == $option['value'] ? ' checked="checked"' : '', ' />', $option['name'];                 }                 break;             case 'checkbox':                 echo '<input type="checkbox" name="', $field['id'], '" id="', $field['id'], '"', $meta ? ' checked="checked"' : '', ' />';                 break;             case 'colorpicker':                 echo '

';                 echo '

';                 break;             ?>
<?php         }         echo     '	',             '
';     }     echo '
';     }          // Save metaboxes     function ks_save_pagedata( $post_id ) {      global $header_meta;           // Verify the nonce before proceeding      if ( !isset( $_POST['ks_page_header_nonce'] ) || !wp_verify_nonce( $_POST['ks_page_header_nonce'], basename( __FILE__ ) ) )         return $post_id;           // If this is an autosave, our form has not been submitted, so we don't want to do anything      if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )         return $post_id;           // Check the user's permissions      if ( 'page' == $_POST['post_type'] ) {         if ( ! current_user_can( 'edit_page', $post_id ) )             return $post_id;      } else {         if ( ! current_user_can( 'edit_post', $post_id ) )             return $post_id;      }           // Save data      foreach ($header_meta as $field) {         $old = get_post_meta($post_id, $field['id'], true);         $new = $_POST[$field['id']];         if ($new && $new != $old) {             update_post_meta($post_id, $field['id'], $new);         } elseif ('' == $new && $old) {             delete_post_meta($post_id, $field['id'], $old);         }       }          }     add_action( 'save_post', 'ks_save_pagedata' );      Here is a screenshot of the meta box ![enter image description here](http://i.stack.imgur.com/SDmoa.png) Thanks   Michael K.


title: Move Jetpack Stats dashboard widget to right side

text: is there anyway to move this? I've followed the instructions in the WP docs to no avail.. /               / Global the $wp_meta_boxes variable (this will allow us to alter the array).     global $wp_meta_boxes;          // Then we make a backup of your widget.     $my_widget = $wp_meta_boxes['dashboard']['normal']['core']['{dashboard_stats}'];          // We then unset that part of the array.     unset($wp_meta_boxes['dashboard']['normal']['core']['{dashboard_stats}']);          // Now we just add your widget back in.     $wp_meta_boxes['dashboard']['side']['core']['{dashboard_stats}'] = $my_widget;


title: WP Plugin Running before jQuery

text: I'm having problems with jQuery and a plugin, the console error says jQuery is not defined. What I don't understand is it only fails when I load it to the production server, on my local dev installation it worked perfectly. > ReferenceError: jQuery is not defined. The plugin code:               add_filter( 'wp_footer', 'enqueue_footer_scripts', 9);     add_filter( 'wp', 'enqueue_styles', 11);          function enqueue_footer_scripts() {         wp_register_script( 'sjs', plugins_url('/js/sjs.js', __FILE__), array('jquery'));         wp_enqueue_script( 'sjs' );         echo "<script>jQuery(document).ready(function ($) { $('p').sJS();});</script>";      }          function enqueue_styles() {         wp_register_style('sjcss', plugins_url('/css/sjs.css', __FILE__), false, '2.1');         wp_enqueue_style('sjcss');     }


title: Site transferred to new server produces 404s

text: I have transferred my site to a new server. I can login to wp-admin ok and can view the home page but all other pages produce 404s. I have changed the 'Home' and 'Site URL' options in the settings area but this makes no difference. Does anyone know how to amend this?


title: Can free plugin on WordPress.org site promote pro-version of this plugin?

text: * **Can free plugin onWordPress.org site promote pro-version** (not free version) of this plugin? Or it requires special permission from WordPress team? _Example: "All in one seo pack" plugin_   * Can one free plugin on WordPress.org promote other pro-version plugin on another site?   * What type of licence pro-version plugin should be?   * Is there any official WordPress docs about it? Can somebody explain more detailed the quote of Mika Epstein?: > All plugins must be GPLv2 compatible. You can sell 'em on your own site, you > can even upsell them from wordpress.org provided you're not crippling the > free plugin. GPL being 'free' isn't about cost, change what you want.


I used the Buddypress Message Compose to send a site wide email to all members wasnt sent though. Where would I look to see why messages were not delivered to all site members of my buddypress wp site? Can I configure this to use smpt instead? I researched this some and found others have had similar problems with the "send to all" from the buddypress message compose screen but couldn't find solutions. I am thinking it may have something to do with the wp config file and how emails configured? Thanks


title: Email notifications: Where in database to save user options?

text: I'm working on an email notifications plugin which sends emails when events happen on my site. So for example, if someone comments on a post, the post author will receive a custom email notification. There will be about 5 or 6 different types of email notification sent out. I'm planning to let authors disable notifications via a form containing radio button options such as:   * Would you like to receive an email when someone comments on your posts? Y - N   * Would you like to receive an email when someone mentions you in a comment e.g @username? Y - N etc... Where in the database would you recommend I save these user options? I was thinking about user meta but is there somewhere more suitable?


title: Pages, aside from admin-side and the home page, read "500 Internal Server Error - nginx/1.1.19".

text: I've set up a WordPress website. I'm able to login, and browse the front page- but everything but the admin-side brings me to a white page with the texts "500 Internal Server Error - nginx/1.1.19". I've read up on this and can't seem to solve the issue. I'm unable to find the .htaccess, even with my FileZilla forcing the showing of hidden files. I read that you may have to enable 'fancy' permalink, so I did, but it held no results.


title: Inject post (from specific category) between posts in Loop

text:
I would like to add a post (from specific category) between posts in the WordPress Loop (such as 'Sponsors'). Example: P P P S   P P S P   P S P P How can I achieve this? I am a beginner with coding, so I don't know enough to modify a Loop on my own. Any Loop Coding Ninjas out there that can provide a solution? Note that below is my current Loop. It is used to sort posts by price, or by random order: index.php               <?php while (have_posts() ) : the_post(); ?>
<a href="<?php the_permalink() ?>"><?php the_title(); ?>
     <?php  the_excerpt(); the_meta ();     endwhile;           previous_posts_link();     next_posts_link();     ?>      functions.php               function my_custom_query($query){      if ( $query->is_home() && $query->is_main_query() ) {            $sort= $_GET['sort'];            if($sort == "A"){        $query->set( 'orderby', 'rand' );        $query->set( 'posts_per_page', '2' );       }            if($sort == "B"){        $query->set( 'meta_key', 'price' );        $query->set( 'orderby', 'meta_value_num' );        $query->set( 'order', 'DESC' );        $query->set( 'posts_per_page', '2' );       }     }     }          add_action( 'pre_get_posts', 'my_custom_query' );      **Edit: Update** Birgire's plugin works! Initially, I had problems getting the plugin to work on my theme. The problem was this piece of code that I use within the Loop in index.php (I use it to call for the custom field to appear).               <?php         global $wp_query;         $postid = $wp_query->post->ID;         echo get_post_meta($postid, 'price', true);         wp_reset_query();     ?>