Pagination not working with WP_Query (creates links but no page)

The following loop gets all posts within a relevant category. It does generate a pagination URL, but it does not take me there (it just redirects back to the homepage). Would anyone know why?               $paged = (get_query_var('page')) ? get_query_var('page') : 1;     $category_cat_args =         array(         'category_name' => $current_category,         'posts_per_page' => 2,         'post_type' => 'post',         'post_status' => 'publish',         'orderby' => 'date',         'order' => 'DESC',         '&paged' => $paged     );     $wp_query = new WP_Query( $category_cat_args );     ?>

             <?php echo $current_category; ?> news
             <?php             if ( $wp_query->have_posts() ):             while ( $wp_query->have_posts() ):             $wp_query->the_post();             $images = get_field( 'gallery' );             if ( $images ):             ?>

                     <a href="<?php the_permalink();?>">                     <img src="<?php  echo $images[0]['url'];?>" alt="example-image">                     <?php bottom_note(); ?>

             <?php             endif;             endwhile;             else: echo "There are no posts in this category";             endif;             ?>                  <?php wp_pagenavi( array( 'query' => $wp_query ) ); ?>

             <?php if ( $wp_query->max_num_pages > 1 ) : ?>             <a href="<?php  echo get_next_posts_page_link();  ?>" class="btn-ar"> more articles             <?php endif; ?>         <?php wp_reset_postdata(); ?>


Permalink settings not saving

I just started a new WP installation and my permalink settings are not saving. I have chosen the 'Month and name' option (`/2014/06/sample-post/`), but when I create a new post, the text shows up as `/2014/06/sample-post/`, but the link goes to the default `?p=x`. When I go to `/2014/06/sample-post/` with the correct information for the post, I get a not found error. `?p=x` works and shows the post. The changes appear to save successfully ('Permalink structure updated.') although the `.htaccess` does not change - is it supposed to? Is there anywhere that the setting is stored that I can manually change? This is my `.htaccess` file:               <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>      Thanks in advance for any help! Matt


Display the number of user comments

I would like to display, on the author/user/contributor page, the number of comments the user has posted, and the number of comments he has received on his posts. Is it possible? Thank you !


Remove All, Published and Trashed Post Views in Custom Post Type

I want to remove the below text links in Edit Post screen: All (8) | Published (5) | Draft (1) | Pending (2) | Trash (2) After searching, i found that this can be done by this code here, but sadly it only works with 'post' type. I'm failed to make it works with my custom post type:               add_action( 'views_edit-post', 'remove_edit_post_views' );     function remove_edit_post_views( $views ) {             if( get_post_type() === 'movie' )  {                 unset($views['all']);                 unset($views['publish']);                 unset($views['trash']);             }                  return $views;     }      What's wrong with my code ?


Auto-embed link info from URLs in link post format?

Would it be possible to make the link post format work the way links are shared in Facebook, i.e. auto-populate a title, description, and thumbnail? A plugin for BuddyPress (Buddypress Links, see screenshots) makes this possible for community links... any ideas how I could achieve something similar for link post format items?


Drag and drop isn't working while creating menu

I am creating a new site , in order to create menu , I just need to Drag and drop the item , in order to create exact menu position and sub menu . But Drag and drop isn't working . Thats why I am unable to create menu . I disabled all the plugin , even deleted them . Even I use google libraries plugin . But non of them work , What can I do now ? If there is any way to make menu alternatively . By the way drag and drop are working on widget edition , but doesn't work in menu editor . I am using wp 3.6


How to create custom authors links

I would like to create custom authors links that lead to the page specified by the author. Instead of `http://example.com/author/example` for example `http://facebook.com/authorexample`. How can I do that?


Trouble with pagination

So, been reading tons of posts on here and int he Codex but just not having any luck. I have a custom post type called Work. On my portfolio page I have "posts_per_page" set to 12. In total in this custom post type I have 300 posts. I am trying to get paging working but not getting it at all. My query:                       <?php                 $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;                 $all_work = new WP_Query(array(                     'post_type' => 'work',                     'tax_query' => array(                         array(                             'taxonomy' => 'type',                             'field' => 'slug',                             'terms' => array('case-study', 'portfolio')                         ),                     ),                     'posts_per_page' => '12',                     'orderby' => 'title',                     'order' => 'ASC',                     'update_post_term_cache' => false,                     'nopaging' => false,                     'paged' => 10                     )                 );                 while ( $all_work->have_posts() ) : $all_work->the_post();             ?>      My code for the pagination:                                                                                <?php                        global $wp_query;          $total_pages = $wp_query->max_num_pages;          if ($total_pages > 1){            $current_page = max(1, get_query_var('paged'));            echo '
';            echo paginate_links(array(           'base' => get_pagenum_link(1) . '%_%',           'format' => '/page/%#%',           'current' => $current_page,           'total' => $total_pages,           'prev_text' => 'Prev',           'next_text' => 'Next'         ));            echo '
';          }                                  ?>                                              Not getting anything though. Any help would be greatly appreciated! Thanks!


Too many pages causes Wordpress admin to be unusable

We have a Wordpress website that now has around 9k pages in it after an import of many location targeted pages. The frontend runs perfectly fine and there is no performance damage (after I replaced wp_list_pages with a custom MySQL query), but the Page administration section can't even be touched. All other sections of the admin open fine. Even if I navigate to a page on the frontend and use the Edit Page link, it's never able to pull up the Edit Page screen. Changing permalink structure doesn't help, which I know that was an issue with pre 3.0 wordpress. Also tried disabling all plugins, no help there. I'm running on Wordpress 3.3.2. Halp please! My only alternative I'm thinking would be to split the website up into smaller subsites built on a Wordpress Network, but that would cause at least a month of delay of restructuring the entire website. Someone mentioned using https://github.com/rackerhacker/MySQLTuner-perl to optimize my.cnf and MySQL. I'll have to see if this is doable on my host, if not then we'll have to move. Anyone else's thoughts would be very appreciated, thanks! **EDIT** A wordpress developer mentioned that I could "turn off hierarchical display in edit.php. A filter in wp_edit_posts_query() might be able to accommodate this" as a potential workaround. Does any one have experience in dealing with something like that?


How display widget by id

I fetched widget id this way:               $the_sidebars = wp_get_sidebars_widgets();     print_r( $the_sidebars['sidebar-1'] );      It shows:               Array ( [0] => recent-posts-2 [1] => recent-comments-2             [2] => archives-2 [3] => categories-2 [4] => meta-2 )       Now I just want to show the `recent-posts-2` widget, which means I just want to pass the widget ID `recent-posts-2` to the function, and the function will display the widget, such as the following code:               function display_widget($widget_id) {       ...       return $wid;     }      When I `echo display_widget($widget_id)`, it will show the widget with HTML, and the class of the default theme. Do you have any idea?


How to add and display a taxonomy term image in any template? (Taxonomy Images)

How do I add and display an image for a taxonomy term in any template? I am using the plugin Taxonomy Images but I can find the right code snippet that will display the image in all template files. I'm trying to do fetch an image for a single term on index.php, archive.php and taxonomy-term.php. Each page contains a loop of posts and I want to display the taxonomy term image for each post filed under a taxonomy term. Is that clearer?


how to search in custom fields & custom taxonomy for custom search

I have a custom search which is a form that submits to the same page and uses wp_query to filter the results for a jobs site that I would also like the keyword search to also search in custom fields and a custom taxonomy but I am unsure how to use posts_join to do this. I want to allow the user to type in the reference number into the keyword box and for it to search in all custom fields and the custom taxonomy but not filter the results as they won't always match so if i search for a skill i dont want it to not return results if it doesnt match the skill custom field as the keyword maybe in the main description does that make sense? UPDATE: I found this code: Include custom taxonomy term in search But it doesnt work correctly for some reason rather than bringing back 11 results it is showing 114 so somethihng is not quite right Hover it is searching in the custom taxonomy so this is a starting point. I just need it to search the custom taxonomy and custom fields but fix the amount of results


Any gallery plugins that allow commenting on single images?

I am looking for a gallery plugin that will allow users to comment on each individual photo as opposed to the entire gallery. I have tried Lazyest Gallery; however, it doesn't seem to be integrating well with another plugin I have installed called Facebook Comments for WordPress which I'm using to replace the default WordPress commenting system. Does such a plugin exist? Or perhaps there is a better solution? What do you guys think?


WordPress Comment posting problem

I am getting trouble with WordPress comment posting. As per my WP setting there is no approval needed to display the comments under blog after posting. Most of the comments posted display immediately. But some of them do not display and need aproval from the admin / Author.


Images not showing on blog

This morning most of the images on my wordpress blog (http://records.photodharma.net) have stopped loading. This even happening on embeds. All the images here are embedded: http://records.photodharma.net/photos/chiang-mai-photo-albums-of-modern- structures When I view them in Firebug, they appear, but not on the page. A couple of times I have seen images load and shortly after disappear, so it seems that they try to load but are being blocked. I have done some searching and tried various things like updating the permalink settings, the media settings, etc. I also updated to the latest version of wordpress, and updated the .htaccess but nothing has worked. Does anyone have any ideas about this?


Limit 'contributers' abilities in WordPress

I have a few custom post types which i don't want any contribute to view or touch. However, the default settings allows contributes to see these in their admin. How do i disallow contributes access to certain post types?


Displaying a custom post type alphabetically

I've created a custom post type which now has around 100 posts in it. I simply want to display these in alphabetical order by the post title rather than the default which seems to be most recent first. I've tried various plugins and other solutions, but most only allow manual sorting (too many posts for that to work), I'm told that the code below should work but it seems to have no effect at all. Any help appreciated.               <?php          $args = array( 'post_type' => 'tenant', 'posts_per_page', 'orderby=title&order=ASC' => 5 );         $loop = new WP_Query( $args );         while ( $loop->have_posts() ) : $loop->the_post();     ?>


Integrating Google Maps with custom marker and hover?

I want the exact output of this site. I want to edit the marker and hover options in the Google map, but I don't know how to do that. Please also list any ideas for Google Map plugins


Edit Page or Post from Top Admin Bar

I'd like to be able to edit a Page or Post that I'm on in Wordpress rather than go to the admin panel on left and find the page or post. I somehow think it used to be there, but when I navigate to a page, it's not in the Top Admin Menu options.


Wordpress Migration error phpupdate_option is not a function

I'm trying to migrate my wordpress from a subfolde to the root. I've already done it from localhost to the subfolder with the same method               update_option('siteurl','http://example.com/blog');     update_option('home','http://example.com/blog');      But this time it does not look to work... It says "Call to undefined function phpupdate_option() in functions.php line 1. In config.php there is no url define(). Is there someone who had a solution for it? Thanks in advance.


Can Username and Password be passed to WP Login page in an IFrame?

I am using a real estate commercial theme, that uses a custom login/registration from on the frontend. The admin panel and option pages are restricted to Administrators, but **if the theme is deactivated** , non-Admins can visit the admin panel and see the setup options for listing authors. When the theme is active, Authors only see the front end of the site with the front end login. I have embedded an iframe using another popular WP plugin into the User Front End form. In the IFrame the WP login can be accessed that would lead to the core WP Admin screen where the plugin is seen and is available for Users with Author roles. But I need for this WP Admin view to open with the same Username and Password as the Front End. What is the best way of passing the User's Front End login credentials back to the core WP Admin inside the IFrame? So that when the IFrame calls up wp-admin/ or wp-admin/plugins.php that it will display the same core wp-admin view as if the real estate theme had not been installed? Thanks for any insight! Neither the custom real estate developer nor the IFrame plugin developer have an answer for this situation.


Run a filter when a walker runs

Is there any way to run a particular `add_filter` function whenever a specific `Walker_Nav_Menu` class runs? The function always needs to run when the walker goes, and I'd like them to share variables, in particular `$column_limit`. The function should run just before all the other stuff in the walker, in order to add classes to the li's before they get generated. The purpose of this whole set of PHP is the enable mega-menu functionality in WordPress. Essentially, if I have markup like this:

Example

             Example

Example

Example

Example

Example

Example

Example

Example

Example

Example

      With `break` and `widget` being classes added by the user in the WordPress menu editor, then the walker and function output this:

Example

             Example

Example

Example

Example

Example

Example

Example

Widget Title

Widget text

Example

Example

Example

      The function is adding `mega-menu-columns-#` to the `<li>` in the above code. All the other changes are being made by the Walker. All of this works, but I'd like it to work with less configuration; essentially I want to be able to set the column limit once, and not have to set the `theme_location` in the function. If I set a menu to use the walker, I want all of my PHP to run automatically. If this isn't clear enough, just ask for further clarification. Here's my current code:               // mega menu walker     class megaMenuWalker extends Walker_Nav_Menu {         private $column_limit = 3; // used to how many columns can be generated (

 and the widgets)         private $show_widget = false; // used to determine weather or not to show a widget in the drop down         private $column_count = 0; // for counting how many columns are in a drop down         static $li_count = 0; // for counting how many lis are in a drop down, used only to check if the li is first in its list         function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) {             $classes = empty($item->classes) ? array() : (array) $item->classes; // retrive array of classes for each li             $item_id = $item->ID; // retrieve item id for each li, not really used, keeping it to maintain standard WP menu structure             if ($depth == 0) {                 self::$li_count = 0; // reset the li counter when we return to the top level in the menu             }             if ($depth == 0 && in_array("widget", $classes)) {                 $this->show_widget = true; // show the widget if the top level li has a class of "widget"                 $this->column_count++; // if the widget is shown, increase the column counter by one             }             if ($depth == 1 && self::$li_count == 1) {                 $this->column_count++; // if there's anything in a drop down, increase the column counter by one             }             if ($depth == 1 && in_array("break", $classes) && self::$li_count != 1 && $this->column_count < $this->column_limit) {                 // if we're in ul ul, and an li has a class of break, and it's not the first in its list, and we haven't met the column limit...                 $output .= "

"; // add a break in the list                 $this->column_count++; // increase the column count by one             }             $class_names = join(" ", apply_filters("nav_menu_css_class", array_filter($classes), $item)); // set up the classes array to be added as classes to each li             $class_names = " class=\"" . esc_attr($class_names) . "\""; // set up class HTML             $output .= sprintf(                 "
%s", // output li structure                 $item_id, // not really used, keeping it for standard WP menu structure                 $class_names, // add the class names                 $item->url, // add the URL                 $item->title // add the title             );             self::$li_count++; // increase the li counter. Not used except if == 1         }         function start_lvl(&$output, $depth = 0, $args = array()) {             if ($depth == 0) {                 $output .= "
"; // if a drop down exists, wrap it in
. I'm not sure why $depth == 0 and not 1, but it works, so I'm not complaining.             }             $output .= "
"; // output standard WP menu UL for drop downs         }         function end_lvl(&$output, $depth = 0, $args = array()) {             $output .= "
"; // close UL for drop downs             if ($depth == 0) {                 if ($this->show_widget) {                     // if the parent li has a class of widget...                     ob_start();                     dynamic_sidebar("Navigation Callout"); // show the widget                     $widget = ob_get_contents(); // retrieve the widget's HTML as a variable                     ob_end_clean(); // clear the shown widget                     $output .= $widget; // show the widget                     $this->show_widget = false; // reset the widget variable to false so the next li doesn't get one unless indicated.                     // I know this section is complicated, but it was the only way to correctly display the widget                 }                 $output .= "
"; // end the
 that contains the drop downs.             }         }         function end_el(&$output, $item, $depth = 0, $args = array(), $id = 0) {             if ($depth == 0 && $this->column_count > 0) {                 $this->column_count = 0; // reset the column counter when a drop down ends.             }             $output .= "
"; // close the li of each menu item         }     }          // add mega-menu-columns-# classes     // I didn't write this, but I'll do my best to explain it     add_filter("wp_nav_menu_objects", function($items, $args) {         if ("first" !== $args->theme_location) {             return $items; // don't run the function if it's not a specific menu. This should really be a check if the walker is set to a menu, not the menu's location.         }         static $post_id = 0; // set up the post id variable         static $x_key = 0; // not sure what this is         static $column_count = 1; // set the initial column count to 1         static $column_limit = 3; // set the column limit to 3. Ideally would pull from the walker.         static $li_count = 0; // set up the li counter         $tmp = array(); // not sure waht this is         foreach($items as $key => $item) {             if (0 == $item->menu_item_parent) {                 $x_key = $key; // not sure...                 $post_id = $item->ID; // set the post ID to the item's ID                 $column_count = 1; // reset the column count                 $li_count = 0; // reset the li count                 if (in_array("widget", $item->classes, 1)) {                     $column_count++; // if widget is in the li class, add 1 to the column count                 }             }             if ($post_id == $item->menu_item_parent) {                 $li_count++; // if an item has children, increase the li count by one                 if (in_array("break", $item->classes, 1) && $li_count > 1 && $column_count < $column_limit) {                     $column_count++; // if break is in the item's classes, and the li count isn't one, and the column count is'nt equal to the column limit, increase the counter by one                 }                 $tmp[$x_key] = $column_count; // not sure what this is.             }         }         foreach($tmp as $key => $value) {             $items[$key]->classes[] = sprintf("mega-menu-columns-%d", $value); // adding the new class based on column count to the lis         }         unset($tmp); // not sure         return $items; // ending the filter     }, PHP_INT_MAX, 2); // not sure


Upload or Choose Avatar on comment

My market is not the tech savvy Gravatar using folks. So...I'd like to allow them to choose from a list of nice avatars or be able to upload upon **commenting.** Users will not necessarily be registering, but I'd like them to be able to comment and upload or choose an avatar upon Comment. Would love to hear your thoughts. I Haven't found the right plugin yet...


How to detect a user that is not logged in

Is there an easy way to see if a user - someone how has logged in in the past but is not currently logged in - is visiting my site? I was thinking that checking if `$COOKIE[TEST_COOKIE]` is set, but I am uncertain.   1. Is this a good method?   2. Is there a better cookie to check for?   3. What would you do?


How do I use jQuery UI tabs in a WordPress page?

I want to use jQuery UI tabs in my WordPress 3.1.4 pages. I write programming tutorials for a VB .NET audience but like to provide C# source as well, and I want to use the tabs to let the readers switch between the two. I could probably make my own given time, but this was supposed to be a "learn things about jQuery" project. It's turning out to be more of a "WTF WordPress" project. I'm barely functional in JS and trying to correct that. I'm no WP guru, and don't care to learn more than I need to know yet. I've got a page that is nothing but a copy/paste of the jQuery UI Tabs demo. It doesn't work; the list and all divs are visible and there's no actual tabs. I know this is because I need some CSS, but this is where I got exhausted. I'm not confident having the CSS will make it work anymore, and I don't even know how to tell if it's the CSS, my JS, or my WP that's the problem. Until I started this project my blog "just worked" and that's how I like my not-work things. The first thing I tried was putting the Google CDN for jQuery in my theme's header.php. I could get alerts working, but no matter what I did the tabs didn't show up. (I know now this is because I apparently needed some CSS. Thanks for not mentioning that jQuery documentation!) So I started doing some reasearch and realized that WP loads jQuery, as do many plugins (though I'm running only Spam Karma and Askimet.) It made sense that maybe loading the Google jQuery caused some confusion. After some research, I found several sites that suggested putting wp_enqueue_script() in my header. The documentation listed a bunch of scripts, so I added "jquery", "jquery-ui- core", and "jquery-ui-tabs". I can see a script tag loading jQuery (version 1.4.4...) in my header, but the other tags seem to have no effect. I understand it's loaded in "no conflict" mode so you use "jQuery()" when you'd normally use "$()". I can get alerts working but not the tabs. Again, I'm suspicious because it doesn't look like my page is trying to load jQuery UI at all. It probably wouldn't matter because I'm not sure if WP comes with the right CSS. I've seen a few pages that suggest I have to load jQuery UI in the page's footer, others that claim I need to add some stuff I don't understand to functions.php, and a couple of other solutions from articles too old to trust. I don't know what to try next. If I did some work to figure out what CSS I need (thanks again, jQuery "documentation"!) I could get tabs working on a local file. In WP, I'm using the TwentyTen theme; my only modifications have been to add the SyntaxHighlighter scripts (which I'll disable if someone can tell me I'm close enough it should be working and they may be the problem.) I just upgraded to WP 3.1.4 today. Here's the contents of relevant files, you can view source to see what the HTML looks like: **header.php**               <?php wp_enqueue_script("jquery"); ?>     <?php wp_enqueue_script("jquery-ui-core"); ?>     <?php wp_enqueue_script("jquery-ui-tabs"); ?>                         <link type="text/css" rel="stylesheet" href="http://www.owenpellegrin.com/blog/highlight/styles/shCore.css"/>     <link type="text/css" rel="stylesheet" href="http://www.owenpellegrin.com/blog/highlight/styles/shThemeDefault.css"/>          <meta charset="<?php bloginfo( 'charset' ); ?>" />     <title><?php     (... the rest of the default TwentyTen header.php ...)      **the linked page**

Nunc tincidunt

Proin dolor

Aenean lacinia

Tab 1 content.

Tab 2 content

Tab 3 content

      I added the ready() call because I was curious if perhaps the code from the demo wasn't running. I've also tried this variant of the code with no joy:               jQuery("document").ready(function() {         jQuery( "#tabs" ).tabs();     });      What am I missing?


Wordpress function.php on ZendFramework CMS

I'm working on a CMS based on Zend Frameowrk and I'm triying to get the mos usefull features from wordpress. One of these is the use of functions.php in the template directory and I think I could do it for my CMS. What about adding a Class in the theme directory (templates/public) and calling (instanciate) it in the bootstrap. What do you think??


Building a better media uploader for WordPress

I'm building a complex gallery component for a client in WordPress. My main stumbling point is creating a media uploader in the admin screen that will let them upload images into different folders. Due to the number of images, organizing by folders is critical. I essentially need to emulate the functionality of the current WordPress media uploader, but with the ability to create/choose folders for the images. I don't really know where to start- Is there a standard way of implementing file uploads in websites that would lend itself to this scenario?


How to list most popular post

I want list the popular posts.popular post is defined by number of comments.If number of comment is high it will consider as popular. How can i do this !


Hide posts from users with a specific role

Simply put, I need to hide all posts on the frontend if they are written by authors with a specific role. The role I have created is called 'Suspended'. I'm happy with putting a simple IF statement around the loop which prevents posts from a certain role ID from appearing. Preferably though it would be something I can enter into the WP_Query. I Can't use user ID as there would be xx number of users with the same role. Does anyone know how this could/ would be done? Any help would be very much appreciated. Thanks in advance.


Add Blog to WP homepage Manually

I'm using the »Free e-commerce Theme Balita«, as posted on Smashing Magazine. It's great, but doesn't have the standard WP blog with corresponding number of post per homepage as settings; as default Twenty Eleven. > **Q:** How do I manually add the blog to appear at homepage?


Redirect URL while building site

Here's what my client wants to do: He wants me to build his wordpress site, but while he's building it, he wants the URL to redirect to his facebook page. I know how to set up the redirect with his domain host, and I know how to set up a wordpress site in maintenance mode, but how do I combine those things-- redirecting the URL while still building out the site? Should I build it locally (which is ugh, b/c he wants access while building it), or setting up a sub-domain for the WP site (again ugh but not horrible), or some other idea I am not aware of?


How to crop thumbnail height to auto with set width

I'm looking for a way to only set the width of a thumbnail size and let the height set auto. So if I have two images. One is 600px/420px and one is 600px/600px. I want to set only the width of the thumbnail to 200px so wordpress crops the thumbnails of the above dimensions to 200px/140px and 200px/200px. Any ideas?


Filter by Custom Taxonomy AND Custom Field

I'd like to give my users the possibility to filter the posts by Taxonomy Terms AND Custom Field values. Like so:               [tax]Country:[terms]     [tax]Company:[terms]          [field]Price:[values]      Filtering by Custom field range would be awesome. At the moment I am filtering my posts with query multiple taxonomies plugin and looking for a solution to get a combined query of custom taxonomies and custom fields.


media uploader filter library so see only images without parent post

I am using this code to enable users to upload images from front end. I would need to filter the library tab to only how images that do not have post_parent set. Any way to do that? Code below:                 var _custom_media = true, _orig_send_attachment = wp.media.editor.send.attachment;            jQuery('#kv_multiple_attachments').click(function(e) {         wp.media.controller.Library.prototype.defaults.contentUserSetting=false;         var send_attachment_bkp = wp.media.editor.send.attachment;         var button = jQuery(this);         var id = button.attr('id');         _custom_media = true;         wp.media.editor.send.attachment = function(props, attachment){           if ( _custom_media ) {             var newImage = '

';             var imgList = jQuery("#image-list");             imgList.append(newImage);           } else {             return _orig_send_attachment.apply( this, [props, attachment] );           };         }              wp.media.editor.open(button);         return false;       });            jQuery('.add_media').on('click', function(){         _custom_media = false;       });


Randomly add a 'ul' list of images

I'm developing a photo gallery WP site. I would like to add "ul" list of images that are randomly picked from the gallery. How would I randomly pick a number of images from the media library. Any pointers would be greatly appreciated.


How do you code for WordPress?

In plain php and frameworks coding is done with the help of IDE tools, im using PhpStorm and very happy so far, recently i decided to discover most popular CMS this days and got confused how do you code for it? **1)** do i have to deploy WordPress not only on my server, but locally too? edit files in IDE/editor and use WordPress "import/export" feature to sync my changes? how team of developers would work on this? what about VCS? **2)** or i have to develop in dashboard? if so, there's no highlight/auto- complete/intellisense and others benefits that drive your development futher.. and plugins for highlight i seen so far suck big time. WordPress is path of a lone wolf? Which general way WordPress developers follow?


WordPress plugin/code to to to next/previous post in same category

I have spent days looking for a WordPress plugin to automatically add next and previous links to the bottom of each post. I have found loads of plugins but I want one that will restrict the posts shown to posts in the same category. I really dont know anything about php to write a custom plugin myself so any suggestions would be very much appreciated.


update_user_meta not updating

I'm trying to force password change upon first user login, which overall is not working, but so far I find a problem update_user_meta() is not updating at all, this is my code:               function track_last_login($login)     {         global $user_ID;         $user = get_userdatabylogin($login);         $Nlogins = (int)get_user_meta($user->ID, 'Nlogins', true);              if (!$Nlogins) $Nlogins=1;         else $Nlogins++;              update_user_meta($user->ID, 'Nlogins', $Nlogins);              if ($Nlogins==1)         {             add_action('admin_notices', 'showAdminMessagePwd');             header("Location: http://example.com/wp-admin/profile.php");         }         else             remove_action('admin_notices', 'showAdminMessagePwd');          }     add_action('wp_login','track_last_login');          //(showAdminMessagePwd is a function already defined)      According to my log messages, the value of Nlogins is 1 before update_user_meta but it stays in 0 in database an every new login is like the first. What am I doing wrong? Another question is: Why does *add_action('admin_notices', 'showAdminMessagePwd')* only works when called from outside a function (directly in _functions.php_ ) and not when called inside this function. Thank you


Echo used hierarchical taxonomies parent name

I want to echo my hierarchical taxonomies parents which I used in my posts.   I've see answers about that, but no one didn't help me. To get all taxonomies, currently I use               <?php the_terms( $post->ID, 'mytaxname', '', ' / ', ' ' ); ?>`      How to get only parents of used tax's?


redirect second domain to static page

I got a little problem. My client is a restaurant. I set up their site using WordPress. Now the client also started a catering business. So I created a static page for this subject in WordPress. Of course with WordPress rewritten URLS it's now www.domain1.com/catering Now my client ordered a second domain just for his catering business and wants to forward this domain to the static page. I tried linking via .htaccess to www.domain1.com/catering but this doesn't work of course, because it's no physical folder just a rewritten URL. What's the right way for doing that? Found a lot about redirecting in WordPress but nothing really gave me a simple answere i could follow. I would heavily appreciate you helping me out. Cheers Andy


Proper way to secure certain uploaded files

I'm working on a site which includes a members-only area. Once logged in, a user should see pages and posts that are otherwise hidden from view, and should be able to access file downloads which are otherwise inaccesible. The problem I'm having is that I can't quite decide how to go about securing the files. I know you can put a username and password on individual pages / posts but this doesn't apply to media. **TL;DR** So my question is, how should I go about securing _certain_ file uploads so that they are only viewable to logged-in users? **P.S** Assume that I'm adding new users as subscribers through wordpress, and registration is disabled. Posts and Pages will be secured separately but media needs some sort of higher-level security, to prevent anyone guessing the URL and requesting the file directly. I realise I _could_ hack something into .htaccess to deal with this but my gut tells me that would either be too messy or difficult to implement sensibly. **EDIT** : After a bit more research and reading I found this question whose answer worked for me: simple solution for restricting access to (some) uploads/downloads


Can't get Geotrust seal to show up

I have purchased and installed a Geotrust certificate on my website. The certificate is running just fine. I would like to display the seal, but I can't get it to show up. Geotrust tells you to paste this into the html page:               <SCRIPT LANGUAGE="JavaScript"  TYPE="text/javascript" SRC="//smarticon.geotrust.com/si.js"></SCRIPT>      but that doesn't work. I have tried to echo it out from the .php page, escaping the quotes. Nothing showed up. I have tried to register and enqueue the script and then call it with a function. I have tried to paste it into header.php and then call it later in the file, as explained from the Codex. None of this works. Geotrust support and my hosting provider can't help. They say it's a developer problem. Any ideas?


How can I include sub-forum topics in a bbpress topic loop?

Out of the box, bbpress shows topics from a particular forum when you are on that forum's archive page. Makes sense. If that forum has a sub-forum, it will link to those sub-forums, but it won't show the actual topics from that sub- forum. I'm trying to modify the default bbpress loop on a forum page (loop- topics.php) to include the sub-forum topics. Here's an explanation:   * Forum A      * Sub-forum A1     * Sub-forum A2   * Forum B      * Sub-forum B1     * Sub-forum B2 So when viewing Forum A's archive page, I'd like to show topics from Forum A, sub-forum A1 and sub-forum A2. The code needs to be dynamic in order to work with whatever parent forum archive a user is on. You can pass wp_query args into `bb_has_topics()`, but I can only only come up with code that shows topics from one forum - not multiple forums. To better explain what I'm working with, here's an example of a loop that grabs topics from the parent forum:               <?php          $parents = get_post_ancestors( $post->ID );          $id = ($parents) ? $parents[count($parents)-1]: $post->ID;          $parent = get_page( $id );          ?>          <?php $bbp_loop_args = array('post_parent' => $parent->ID, 'post_type' => 'topic'); ?>          <?php if ( bbp_has_topics($bbp_loop_args) ) : ?>              <?php while ( bbp_topics() ) : bbp_the_topic(); ?>                  <?php bbp_get_template_part( 'loop', 'single-topic' ); ?>              <?php endwhile; ?>          <?php endif;?>      Any ideas on how this can be achieved?


I can't add any shortcode in my wordpress editor. it shows - TypeError: window.tinyMCE.execInstanceCommand is not a function window.tinyMCE.execInstanceCommand(id, 'mceInsertContent', false, shortcode) . please help me to solve this. Full code :-               function submitData($form) {         try {             $form = $form || jQuery('form');             if(window.tinyMCE) {                 var selectedContent = tinyMCE.activeEditor.selection.getContent(),                     id = tinyMCE.activeEditor.editorId || 'content',                     shortcodeName = $form.attr('name'),                     shortcode = ' [' + shortcodeName + ' ';                      $form.find('[data-name]').each(function() {                     var $this   =   jQuery(this),                         type    =   $this.data('type'),                         value   =   ($this.attr('type') == 'checkbox')                                 ?   ($this.is(':checked')) ? 'on' : ''                                 :   $this.val() || '';                     value = fitValue(type, value);                     shortcode += $this.data('name') + '="' + value + '" ';                 });                 shortcode += ']' + selectedContent + '[/' + shortcodeName + '] ';                      window.tinyMCE.execInstanceCommand(id, 'mceInsertContent', false, shortcode)                 tinyMCEPopup.editor.execCommand('mceRepaint');                 tinyMCEPopup.close();             }         } catch (e) {             console.error(e);         }         return;     }


What does ?cat=2-5-results mean at the end of URLs?

I'm seeing a lot of visits in my Analytics to my home page with the query string "?cat=2-5-results". These pages are getting a lot of traffic. To the best of my knowledge, I'm not using this parameter on my site anywhere. If I google "wordpress ?cat=2-5-results" I find a lot of other sites with the same phantom pages. Anyone know what this means? My site: http://www.barbadospropertylist.com Here are how the pages appear in GA: ![alt text](http://i.stack.imgur.com/INezh.png)


Fastest way to get the comment and ping total count for a post

I'm making my own comment template (like this) and I need to know how can I get the comment and ping count for the current post, maybe using a fast database query or something like that? Note that I can't use `count($comments)` or anything like that, because I'm not running the default `comments_template()` function which gets all the comments from the database. Instead I'm pulling only the newest 10 comments using `get_comments()`. `$post->comment_count` (apparently initialized by get_post) is close to what I'm looking for, but it counts both comments and pings :(


Loop - how to get previous/next post for first/last post?

I have a simple loop for a JS slider, I want to display previous and next posts titles on my slide, but I can't get previous post title on the first slide (because apparently first post have no previous posts):               $prev_post = $loop->posts[$loop->current_post - 1]; // ALWAYS NULL FOR FIRST POST :(     $next_post = $loop->posts[$loop->current_post + 1]; // ALWAYS NULL FOR THE LAST POST     echo $next_post->post_title;     echo $next_post->post_title;       Is there any easy way to fix that?


can you make changes to a theme in trac while it is waiting for review?

I am wondering if there is a way to make changes to a theme that has been submitted for review and is waiting in trac. I see in this ticket, that it _may_ be possible, but I'm not sure how: http://themes.trac.wordpress.org/ticket/12476#no1 I noticed a few days after submitting my theme that I had left an extra php file in the folder that isn't needed. http://themes.trac.wordpress.org/ticket/12497 I also notice a minor error in the style sheet - I put the version number in the theme name. I would really like to fix these two issues, just not sure how to go about it. Should I fix the errors and re-upload the zip file? Will that make the theme loose it's place in line.. It's been 13 days waiting already.


Automatically fill custom field value on post publish/update

I've searched around a bit, and I'm having trouble finding an answer to this question. What I'm trying to do is automatically fill a custom field when a post (custom post type) is updated or published. Ideally the completed script will call out to an API and fill the custom field with the resulting information whenever a post is created or updated. For right now though, I'm just trying to automatically fill my custom field with a simple string for testing. Here's my code:               add_action( 'save_post', 'update_tmv' );     function update_tmv($postid) {         if ( !wp_is_post_revision( $postid ) && get_post_type( $postid ) == 'inventory') {             $field_name = 'market_value';             add_post_meta($postid, $field_name, 'TEST_STRING', true);             }     }      I've used this page as reference: http://www.wpbeginner.com/wp-tutorials/how- to-add-custom-fields-automatically-on-post-publish-in-wordpress/ but unfortunately it's not working. When I publish or save a post the 'market_value' custom field continues to be empty (also, I'm using Advanced Custom Fields to create the custom fields). Any ideas? Thanks!


SQL error with custom query

I'm trying to create a custom post query for sorting posts that have been voted "thumbs up". I'm joining my custom "wp_post_votes" table (which stores the number of votes each post received) with the default "wp_posts" table and displaying posts `WHERE votes > 1`. The WHERE cause is causing an SQL error. When I remove the `posts_where` filter I get no errors but all my posts are displayed regardless of their vote number.                   add_filter('posts_join', 'vote_join' );         add_filter('posts_where', 'vote_where' );              function vp_join( $join )         {                global $wpdb;                if (isset($_GET['vote_sort'])) { //when visitor browses voted posts             $join .= " LEFT JOIN wp_post_votes ON " .                 $wpdb->posts . ".ID = wp_vote_posts.vote_post_id ";           }                return $join;         }              function vp_where( $where )         {           if (isset($_GET['vp_sort'])) {             $where = "voted > 1";            }                return $where;         }          //custom permalinks code follows...      The SQL error I get in index is.. > WordPress database error: [] SELECT t. _, tt._ FROM wp_terms AS t INNER JOIN > wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN > wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id > WHERE tt.taxonomy IN ('category') AND tr.object_id IN (0) ORDER BY t.name > ASC ..and in my sidebar I have a recent posts widget. In that I get via `$wpdb->show_errors();` > WordPress database error: [You have an error in your SQL syntax; check the > manual that corresponds to your MySQL server version for the right syntax to > use near 'voted > 1 ORDER BY wp_posts.post_date DESC LIMIT 0, 5' at line 1] > SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts LEFT JOIN wp_vote_posts > ON wp_posts.ID = wp_vote_posts.vote_post_id WHERE 1=1 voted > 1 ORDER BY > wp_posts.post_date DESC LIMIT 0, 5 I noticed `WHERE 1=1 voted > 1`.. not sure if that's causing the error and how to fix it.


How to add filter only for custom plugin?

I made a plugin which uses the WP media-uploader. I like to store the images in a custom folder only for the plugin image uploads. But adding the filter only for my custom plugin doesn't work               if (($_GET['page']=="add_contender") {     add_filter('intermediate_image_sizes', 'wpse_101197_image_sizes');     }     function wpse_101197_image_sizes($sizes) {         /*which images to use in plugin*/         $sizes = array('thumbnail','logo-contender');         return $sizes;     }      I am using the media-upload in a thickbox modalbox could this be the problem as the variable $_GET['page'] doesn't exist in the modalbox? I tried adding the page variable to the javascript, but it didn't work.               jQuery('#upload_logo_button').click(function() {             formfield = jQuery('#deelnemer_logo_upload').attr('name');             tb_show('', '../wp-admin/media-upload.php?type=image&TB_iframe=true&width=640&height=345');             return false;         });      Any tips, suggestions?


Checking if a user is logged in, if so redirect to a different page

I'm making a member-only site that requires users to be logged in to use the site. The homepage is publicly viewable. On the homepage, I'd like to put in a function to redirect users to a page inside the site if they are logged in. The code I tried               <?php if (is_user_logged_in() ) {      wp_redirect ('dashboard' );      exit;      }     ?>      Gives me a "headers already sent" error. The code is placed at the top of my php file. What am I doing wrong?


Making a Multisite Dashboard Widget

I tried to use the code from this question: How to Check Disk Space used by Media Library But it's displaying this error in a Multisite: ![dashboard widget error](http://i.stack.imgur.com/EjG9E.png) How can I display it on my network Dashboard instead root site Dashboard?


Share DB tables between two blogs on the same WP Multisite installation

Is it possible for two separate blogs running on the same multisite installation to share tables in the database? By default, Wordpress adds the blog ID to the table prefix for all of the associated tables such that blog #1's posts are stored in the `wp_1_posts` table, blog #2's posts in the `wp_2_posts` table etc.. However, for my peculiar development workflow I would like to use blog #1 for public use and blog #2 for development while sharing database tables between them such that any changes made to either blog are reflected on both immediately (i.e. **both** blog #1 and blog #2's posts are stored in `wp_1_posts`, their users in `wp_1_users`, and so forth). Any ideas?


Wordpress join posts with meta values of array type

How do I get all the posts matching meta value of type array               function author_posts_join_filter($join){         global $wpdb,$wp_query;         $meta_name_author = '_authors';         if(is_author()){             $join .= " LEFT JOIN $wpdb->postmeta ON $wpdb->postmeta.post_id = $wpdb->posts.id "                    . "AND $wpdb->postmeta.meta_key = '$meta_name_co_author' "                    . "AND $wpdb->postmeta.meta_value = '" . $wp_query->query_vars['author'] . "' "; //this condition removes need for DISTINCT         }         return $join;     }     }          add_filter('posts_join', 'author_posts_join_filter');      it does not returns all the posts which are co_authored. I am storing the co_authors as an array in the meta field '_authors'.


What can i do add title to 'large' image?

<?php       if ( has_post_thumbnail()) {        $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large');        echo '';        the_post_thumbnail('medium');        echo '';      }      ?>      This code adds a big image to the thumbnail image. What can I do add title to 'large' image?


Query post by date (stored custom field meta as yyyymmdd) and differentiate across 12 months

I have a post type that holds a custom meta field with a date in it. The date is stored in the format: `yyyymmdd`. On the archive page for this post type I want to create 12 separate containers, one for each month, and to display in each the posts matching the corresponding month. My question was about looking for ideas to achieve what I wanted. Thanks to Krzysiek Dróżdż idea, I did filter pre_get_posts and came up with this code in my archive template for the post type:               $posts_by_month = array()     while ( have_posts() ) : the_post();                                              // get the post meta where the date is stored in yyyymmdd format                                        $recurrence_date = strtotime( get_post_meta( $post->ID,'recurrence_futuredates_0_recurrence_from', true ) );          // return the month only in '1-12' format         $current_month = date( 'n', $recurrence_date );                // loop 12 months         for ( $i=1; $i<=12; $i++ ) {                  if ( $current_month == $i ) {                       // store all the posts for the $current_month                  $posts_by_month[$current_month][] = array(                           'posts' =>  array(                                             'id' => $post->ID,                                            'title' => get_the_title(),                                            'permalink' => get_permalink(),                           ),                  );                    }               }             endwhile;          // sort the month order              ksort( $posts_by_month );               // loop 12 months     for ( $i=1; $i<=12; $i++ ) {              // if there are no posts for current month, skip month          if ( $posts_by_month[$i] ) {                  ?>             <?php echo $i; ?>             <?php foreach ( $posts_by_month[$i] as $this_month[$i] ) : ?>                      <?php echo $this_month[$i]['title']; ?>
                  <?php endforeach;              }          }


How change menu for each user in plugin?

I need to change navigation menu in my plugin for each user for example:               if(is_user_logged_in())         wp_nav_menu(...);     else         wp_nav_menu(...);      But when I apply the above code in my plugin it shows me some errors. What should I do?


Remove whitespace at the end of posts?

My writer has a tendency to add extra newlines (Enter key) and spaces (space bar) at the ends of posts. Sometimes this results in inches of extra whitespace onscreen! Is there a way I can make sure extra trailing whitespace is removed when he hits "Update" in the Wordpress post editor?


How to get post content from an array of ids?

How do I get post content if I have an array of id's. Basically, I have a function that get post content if you provide an ID. but it doesn't work if I have an array of id's. My function is:               function get_post_by_id($id){         $post_content = get_post($id);         $content=$post_content->post_content;              return $content;     }      Now if I pass an id to this function it will work. For example:                   $last_post = get_post_by_id(83);              print_r($last_post);      How do I get `post_content` if I have an array of `ID's`.Something like:               $last_post = get_post_by_id(array(83,80,92));      It doesn't work this way now. Please help!


Default Wordpress gallery or very lightweight alternative to it?

I've tried looking up but I cannot seem to find the following... What must I include in functions.php and in style.css to have the default Worpdress gallery working? I have a new Wordpress theme, totally custom, and I've removed everything from functions.php. However, now, the gallery images do not open in a popup like they should and I don't quite like the way the images are resized also. So could you please help me with a suggestion on what styles/functions I must include to have the Wordpress gallery functioning correctly? OR - if you could suggest a lightweight alternative plugin to the default Wordpress gallery? Many thanks.


Get Wordpress login functions without printing anything

I want to serve a dynamically-generated PDF with a "File Transfer" header               header('Content-Description: File Transfer');      However, before I generate the document I need to verify the user's login and credentials.               if(is_user_logged_in()){          $currentUser = wp_get_current_user();          $userLogin = $currentUser->user_login;          if(userAllowedAccess($requestID, $userLogin)){              header('Content-Description: File Transfer')               ....... file content          }          else{              //Do nothing... get off my lawn          }      } Where do I put this so I don't get any headers or output from my wordpress page? I need to load enough of the API to get my is_user_logged_in() and wp_get_current_user() function but don't want to load anything that prints to the page... Suggestions? Thanks- J


Import posts into SQL

Is there a way to bulk import posts directly into the database? like from csv into sql database. I don't want to use those csv import plugins since they don't always work they either only import half of my data or they timeout since my data file contains 100k posts


Changing the permlink and SEO

I have a doubt on changing my permlink structure for the second time. What happened was I have moved my old website to the wordpress blog by copying all the posts. After the migration, i have set the 301 redirect to the new url of wordpress and now it is updated in the google. After that I found the permlink is not good I am changing the structure to shorter url. I found the old urls are correctly redirected to the new one i think it is handled by the wordpress. Will it be a 301 redirect by the wordpress? Please help me.


Add class to menu items of one specific menu (nav_menu_css_class)

This code adds an extra class to all my menu items:               add_filter('nav_menu_css_class' , 'special_nav_class' , 10 , 2);     function special_nav_class($classes, $item){       $classes[] = 'btn';       return $classes;     }      How do I confine this filter to my main menu (in theme location 'primary- menu')? Regards, Daniel


Getting values from options page to css

i got an options page that needs to affects a certain (for now) css value.. i have about using php variables in css and creating custom global variables in wordpress but havent something easy enough to understand so i have done this and places it in my header file `<style type="text/css"> .current-menu-item { background: <?php echo get_option('sg_currentbuttoncolor'); ?> !important; } </style>` does that look like a good solution to you? what is the preffered way of creating changes in my css using values from my options page?


Only show <li> when content added via custom field

I've gone through a few of the other similar topics but any of the solutions won't work for me. Basically I only want to show an * if the custom field has had information added into it. Here's my code, even if you don't give me an answer could you point me in the correct direction as to how to do this.

<?php the_field('helpline_name'); ?>

AREAS OF HELP: <?php the_category(', ') ?>

<?php the_field('helpline_address'); ?>

<?php the_field('helpline_phone_number'); ?>

<a href="http://<?php echo the_field('helpline_url'); ?>" class="tiptip web" title="<?php echo the_field('helpline_url'); ?>" target="_blank"><?php echo the_field('helpline_url'); ?>

<?php echo the_field('helpline_comments'); ?>

<a href="mailto:<?php echo the_field('helpline_email'); ?>" class="tiptip email" title="email us your problem"><?php echo the_field('helpline_email'); ?>

      Thanks in advance Tyler


Configuring WordPress for Amazon CloudFront Caching?

Amazon CloudFront is a content distribution network (CDN) that can help you survive a huge amount of load in a short amount of time. What's the easiest way to configure WordPress to host its files (media library, CSS, plugin files, theme) on S3/CloudFront? (I'm currently using W3 Total Cache to do this.)


Plugin upgrade issue

I'm updating plugins installed on my wordpress site. However, for almost an hour, it's still doing maintenance mode. When I accidentally hit reload, I got BIG white screen of death saying: **"Briefly unavailable for scheduled maintenance. Check back in a minute."** Is there anything I can do to fix this mess?


Do you have any effective strategies for launching a v2 of a WP site?

My team and I are working with a client who has an existing WordPress site with a fair bit of content and a custom theme they built. It is a group blog, meaning it has several bloggers all around the world who are adding & editing content all the time. Our job is to create an entirely new theme, with quite a few new features. Some of these features will require new custom widgets, plugins, and database fields. We're currently working off our own development machines and integrating them into a single development server. All code is versioned in SVN. Our appointed DBA is manually merging any database changes into the dev DB right now, though hopefully he'll be able to automate that soon. We just started talking about our production release process. Meaning: once we're done, how are we going to get all of our custom code onto the production (the live) server smoothly and with as little disruption as possible? We have a few plans in mind, but I would love to hear how others have tackled this issue too. Are there any best practices to follow or known pitfalls to avoid? Thanks in advance!


Is there a function to get post info for any publish_status by post ID?

I'm trying to, essentially, check whether a post exists and if it does (in published, draft or auto-draft states) return the post info. I'm finding `get_post()` doesn't seem to work with drafts, and `get_posts()` doesn't allow me to specify the specific post ID I'm looking for. Is there a function to get post info for any `publish_status` by post ID?


Can I add/replace the Wordpress image in the Dashboard

Is it possible to change the Wordpress logo and header in the Dashboard so I can customise it a little more to my business? Ideally it could be done in a way so that it wouldn't break every time I upgrade Wordpress to the latest version.


How do I add content to the dashboard in Wordpress?

I have created some content using php, js and html which shows the bandwidth the site has used (using the cPanel API and the Google Graphs API) I want this to be shown on the dashboard in Wordpress (viewable to Admins and Editors only) How do I do this?


WP 3.3 makes it possible to add meta box to Category Editor Screen?

I have a plugin that appears on the post and page editor screen and parses the editor content and reports back some info to the user. I need this same plugin to appear on the category editor screen and report against the "Description" field. Any ideas how it can be done? I'm hoping WP 3.3 may make it easier to implement. Here's how I'm adding the plugin to the editor screens:               add_action('admin_menu', 'my_post_options_box');          function my_post_options_box() {         add_meta_box('my-plugin', __('My Plugin'), 'test', 'post', 'side', 'high');         add_meta_box('my-plugin', __('My Plugin'), 'test', 'page', 'side', 'high');      }      I'd like to be able to add this:                   add_meta_box('my-plugin', __('My Plugin'), 'test', 'category_edit', 'side', 'high');


Some questions regarding filter

1) Take a look at this example               add_filter( "xxx_xxxxx", "blah_blah" );     function blah_blah(){             echo "filter added";         }      `xxx_xxxxx` can be anything like my_filter or it should be one of the name listed here. 2) Lets say i have some content in my theme outside `the_content` loop. Example               <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
                     <?php the_content(); ?>

Blah blah some text goes here

          <?php endwhile; ?>      Is there a way to filter `Blah blah some text goes here` text? Thanks


Improving Co-Authors Plus Plugin

I've been using the Co-Authors Plus plugin for assigning multiple authors to posts. The authors are very particular in the ordering of the names on the public-facing side of the website so I need the ability to arbitrarily order the authors. It turns out it's not that hard using a line of jQuery to make the Co-Author Plus metabox sortable on the edit post screen:               jQuery('#coauthors-edit').ready(function($) {         $( "#coauthors-list" ).sortable({ axis: 'y', containment: 'parent'     });     });      Now I can drag and drop to re-order the authors and it all works! Yay! The problem is the order of the authors rearranges if the post is modified in quick edit/batch edit mode on the post listing screen (the page that lists all of the posts before you choose one to go in and edit). I need to find a way to prevent the author terms from updating during a quick edit/batch edit post and for the life of me can't figure out how it is done. Maybe someone here can help shed some light on what I'm missing. The source code is here: http://plugins.trac.wordpress.org/browser/co-authors- plus/trunk/co-authors-plus.php Any ideas?


Is it possible to reuse wp.media.editor Modal for dialogs other than media

To expand: I'd like to utilize the same Modal code/appearance ( as used in wp.media.Modal, wp.media.FocusManager ) to open a modal of my own custom dialog, not the Media Editor. In the past, I've used thickbox for this sort of thing, but wp.media.Modal appears to be the way of the future for modals -- Not to mention it looks cool. I've poked at the JS source a bit and have come to a couple possible solutions:   1. "Borrow" the code media-views.js and use it in my plugin.   2. "Extend" wp.media.Modal ( it is a Backbone View, after all ).    3. Create a custom implementation, jQueryUI, etc.   4. Just give up and use thickbox. Borrowing seems slightly less dangerous than using wp.media.Model.extend({}), but wasteful. I'm not a big fan of jQueryUI's modals, but it would get the job done. At the same time, I could do a custom implementation of modals ( or base it off another lib ). Feels like I'm missing something obvious: Has anyone else pulled this off or is the new media library modal code "too new" to allow for reuse?


Why does the My Site dropdown show only a single domain?

I ran a Network Update today from Network -> Update Network, and since then all the sites, and all the links to sites within my Admin area reference the same domain. The domain it uses is relative to the domain I've logged into. In one example I logged into my primary domain, and now WP thinks all sites have the name and URL. If I log into another site within my multi-site installation it'll use that one. I can't navigate to my sites using the admin area. The site's themselves seem untouched. I'm running 3.5.1, but this change occurred in 3.5.0. I tried to post an image, but I didn't have enough reputation points.


I've got a few special needs in terms of post formatting, but do not want (and cannot) break out of the standard Post Format paradigm per best practices. I've come up with a mapping of WordPress core types to my company's own nomenclature (e.g. show "chat" as "discussion"). I'd like to (from a UI perspective only) rename these post formats to the internal names. I'd like to do this via filters if possible, and not via some JavaScript hack after load. Is it possible to filter the display name for post formats for display in the Formats meta box?


Can i duplicate pages created via plugin?

I have a custom built plugin which generate event pages, now my client wants the event to copy.. how can i copy the page generated via plugin. I have used plugins available but they only work with wordpress post or pages.


How to work with custom styles saved in theme option?

I am creating a theme where user can save custom styles from theme customizer through settings API. Those style info are saved in options table as serialized data. When Custom skin is active I will have to print those css styles in the site. There are three route I might go about it.   1. Printing custom styles on header area with `<style>` tag.   2. Creating a `custom.css.php` file where I print those styles.   3. Create a css file using php file operation and save those styles whenever user saves custom styles. **All those have pros and cons**   1. **Printing inside`<head>` using `<style>`:** The theme will be used by internet marketers and they are concerned about code to text ratio. Adding a 20-30 lines of css code will increase code ratio.   2. **Creating CSS file using PHP`header()`**: Wordpress functions isn't available. Will need to load them which is inefficient. Also IE have some issues with this method.   3. **Writing a CSS file whenever user saves custom style:** It seems to be a good idea. But I don't have enough knowledge about what is the pros and cons of this method. And if there is any permission issues the theme may be facing when it installed in various servers by users. _I will appreciate if you could enlighten me on this topic_. So, What is the right way to go with in this situation.


How to move existing Wordpress wp-content folder along with database to new server and new domain name?

Running WP 3.5.1 on a LEMP stack (over at Linode) ... I have a wp-content folder for a WP site along with a full backup of the database. The URL of the site was something like: > test.example.com I want to get the site operational on my own server at: > test.mydomain.com And once the site is finished and DNS changes take effect, I want to have the site URL be: > myclientsdomain.com What is the preferred (and hopefully most straightforward way) of handling server moves and domain changes like this? I'm looking for a step-by-step answer, one that accounts for all the situations described above for both the files and database.


pre-upload text and video for the future

I want to upload text and a video for a future date. On that future date, a new post/html is added to the site (without me doing anything that day).


Custom Post Type order by modified date and custom meta field issue

I'm creating a plugin with some kind of offers that users can publish. User, in his custom administration panel, can managed his own offers. Offers are free and premium. If offer is premium it take place above the free offers in whole list. User can refresh premium offers daily so offer that has been refresh is landing at the top of the list. I figured it out like this: offers has `custom fields "premium"` and if offer is "premium" the value is "2", otherwise (free offer) the value is "1". When user is refreshing his premium offer, it's `'post_modified'` is changed. What kind of query do I have to made to make this happen: newest (with latest modified date) premium offers (with custom meta "premium" equal "2") on top of the list and other offers below it. My actual query looks like this:               $args = array(         'post_type' => 'mycustomposttype',         'post_status' => 'publish',         'paged' => $paged,         'meta_key' => 'premium',         'orderby' => 'modified meta_value_num',         'order' => 'ASC',         'meta_query' => array(             array(             'key' => 'paid',             'value' => array('paid','free'),             'compare' => 'IN'             )         ),     );      but the newest offer is in the end of list. even when i changed order to 'DESC'. Any help (or new way to do this) will be much appreciate.


How to remove attachments from main query via pre_get_posts?

I'm struggling to find a solution to the following problem. The main query should only check pages and selected custom post types for the selected post type name.   1. address.com/flower-post-name [custom-post-type]   2. address.com/flower-page-name [page] As you can see, my custom post type has the slug removed from permalink using this solution vip.wordpress.com. The problem I encountered is that the query also checks if there are attachments with the same slug. So despite having an unique slugs for both posts and pages there are still conflicts with my media library.   1. address.com/post-name [attachment] -> displayed   2. address.com/post-name [custom-post-type] -> should be displayed  Is there a way to exclude attachments from main query? This is the code I'm using:               function vipx_parse_request_tricksy( $query ) {     // Only noop the main query     if ( ! $query->is_main_query() )         return;     // Only noop our very specific rewrite rule match     if ( 2 != count( $query->query )         || ! isset( $query->query['page'] ) )         return;     // 'name' will be set if post permalinks are just post_name, otherwise the page rule will match     if ( ! empty( $query->query['name'] ) )         $query->set( 'post_type', array( 'flower', 'page' ) );     } add_action( 'pre_get_posts', 'vipx_parse_request_tricksy' );      From my understanding the query is being rewritten to check if there's a custom post type 'flower' then 'page' with the particular slug.               $query->set( 'post_type', array( 'flower', 'page', 'attachment' ) );      I tried this approach, but it did not work. Wordpress is still checking if the slug corresponds to attachments first and the page displayed is a media page, instead of custom post type page.


jQuery Ajax / Modal admin event not firing since 3.6. Seems to not recognize "a" tag

This came up immediately after upgrading to wordpress 3.6. Upon clicking the modal "anchor" tag, an ajax event fires to refresh the content in the box. It was working before, then ceased afterward. I noticed some small changes have been made to jQuery in the admin regarding plugins, but I'm not sure it affects my situation. I guess the question is, why doesn't this event get recognized/fired. Here is the modal example: http://codex.wordpress.org/ThickBox Here is my link that fires it up:               » Edit 6617      Then here's the function that it should fire based on link with class:               //get_image_ajax     $(document).on('click', '.edit-image', function (e) {              e.preventDefault();              var data = {             action: 'ss_professional_ajax',             security: '<?php echo $ajax_nonce; ?>',             image_id: $(this).attr('id'),         };              $.post(ajaxurl, data, function (response) {             $('#ss-edit-image-box-content').empty();             $('#' + loading_icon).show();             $('#ss-edit-image-box-content').append(response);             $('#' + loading_icon).hide();         });         return false;     });      EDIT: The ajax itself / the function is not firing. The modal window does pop up. Its also worth noting that this is "live" content delivered by ajax.


Performing a POST action on homepage goes to posts page

On every page of my site I got a contact form that will send an email to the respective address. On this site also I've set the front page display to a static page. The contact form will basically post to self and if successful will take the user to a new page, otherwise will anchor down to the contact form and display the error. But on the home page, be it any type of POST request, it will set the page to the posts page. Seems bizarre to me as it can be an empty POST request and still take the user back to the posts page but the URL won't change. This only happen if you do a POST to the homepage, all other pages work as expected. Any ideas?               add_action( 'wp_head', 'process_contact_form' );     function process_contact_form() {              if( isset( $_POST['submit'] ) && $_POST['submit'] ) {             echo'test';         }          }          add_shortcode( 'mini-contact', 'get_mini_contact' );     function get_mini_contact( $atts = array() ) {              extract(shortcode_atts(array(             'title'   => 'Contact US',             'button'  => 'Submit',             'label'   => 'Message us',             'subject' => 'Message'         ), $atts));              $html  = '';              $html .= '
';             $html .= '
';                 $html .= '';                     $html .= '
' . $title . '
';                 $html .= '';                      $html .= '                     <form class="contact-form" method="post" action="">

                                 Name                                 <input type="text" name="name" class="form-contact__text" />

                                 E-mail                                 <input type="text" name="email" class="form-contact__text" />

                                 Share your business problem today                                 <textarea name="comment" rows="20" class="form-contact__textarea"></textarea>

                                 <input type="submit" name="submit" value="' . $button . '" class="button  expand">

                         <input type="hidden" name="subject" value="' . $subject . '">                     </form>                 ';                  $html .= '
';         $html .= '
';              return $html;          }


Problem with multiple loops in wordpress theme

I am using multiple loops like this                           <?php     $posts = get_posts('numberposts=1&order=DESC&orderby=post_date&category='.get_cat_ID( 'سیاست' ));               foreach ($posts as $post) : start_wp(); ?>     <?php          if ( has_post_thumbnail() ) {         the_post_thumbnail();         }              ?>

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

<?php the_excerpt(); ?>

                         <?php        endforeach;     ?>      In most part of my theme like sidebar, footer, slidershow with different category, the problem that I've faced with is that when I'm using the following loop in archive.php or category.php to show the post data(like title, excerpt and feature image) based on category it doesn't show me anything. When I remove all above loop, it works. This is the loop in my archive or category.php to show post excerpt and title:               <?php if(have_posts()):?>             <?php while ( have_posts() ) : the_post(); ?>                       <?Php the_title(); ?>
             <?php endwhile; ?>             <?php endif;?>      I remember a time that I had this problem and solved by using `wp_reset_query` after each loop but it doesn't work now. Maybe `wp_reset_query` doesn't work for foreach loop.


edit formatting.php in a theme so it wont get overwritten

There are some parts of wpautop I want to remove, but keep the rest. I found in wp-includes/formatting.php within the function wpautop:               $pee = preg_replace('|
\s*
|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace      &                $pee = preg_replace('|(?<!
)\s*\n|', "
\n", $pee); // optionally make line breaks      Lines 251 & 261 in my version. I want to delete these parts of the function, and deleting or // the lines works fine. But how can I remove these lines in a theme file so it wont be overwritten in an update? Can I do something in functions?


Migrating a Test site to Main site on a multisite

I have cloned my main site using the plugin WP-Clone to a folder and installed wordpress on it (Mysite.com/test) and have spent about a month adding features and installing plugins and adding pages and improvements. Now I want to move the wordpress installation DB and themes and plugins and pages to mysite.com. Note : I have another site installed , so its not just mysite.com. I have tried restoring my test backup on the main site. And caused major problems to it. ( subdirectory folder in URL showing , Screwing up my themes , blocking me from logging in to wp-login.php , 404 page not found , and that stuff) Is there a more easier and less troubling way to migrate or transfer my files over without screwing around the core root installation? Thanks alot!! appreciate all the help !!!


Wordpress site cant display media when it's live

In localhost this code works fine to display images from my media gallery but when my site goes live $images are empty although there are images in the media gallery.   Are there something I've missed out?               $images =& get_children( 'post_type=attachment&post_mime_type=image' );          if ( empty($images) ) {        echo "There are no logos to display.";     } else {        foreach ( $images as $attachment_id => $attachment ) {           echo '
';           echo wp_get_attachment_image( $attachment_id, 'full' );           echo "
";         }     }


Theme Customizer - Nested Sections?

Is it possible to put sections within sections at all? It would be very helpful for me to be able to do so due to having several options per section and I don't want the user to be overloaded with information.


custom rearranged menu with excerpt for selected children in sidebar.php

I'm trying to make a custom index menu on the sidebar for an editorial multisite wordpress website. Suppose my pages are as follows:               Level 1          Level 2             Level 3             Level 3          Level 2             Level 3     Level 1     Level 1      what I ultimately want to achieve is to display in the following manner for all the pages:               Level 1 (Title)        Level 3 (Title)          Level 2 (Title)        Level 3 (Excerpt)      so it would look something like this:               Genre Name (Level 1 Title)        Article Name (Level 3 Title)          BY: Author (Level 2 Title)        Excerpt of the article goes here...(Level 2 Excerpt)      I really would like to not use a plugin for this as I'd like to copy and paste for a new issue (subpage on the multisite) of the editorial site without much work on my client side. I'm hoping it can just be a php code I can plug in on sidebar.php unless of course you have something really good in mind. Thanks so much for your help in advance!


WordPress SimplePie modifications

I am using the fetch_feed() function provided in WordPress to build a SimplePie feed object. The code from WP is the following:               function fetch_feed($url) {     require_once (ABSPATH . WPINC . '/class-feed.php');          $feed = new SimplePie();          $feed->set_sanitize_class( 'WP_SimplePie_Sanitize_KSES' );     // We must manually overwrite $feed->sanitize because SimplePie's     // constructor sets it before we have a chance to set the sanitization class     $feed->sanitize = new WP_SimplePie_Sanitize_KSES();          $feed->set_cache_class( 'WP_Feed_Cache' );     $feed->set_file_class( 'WP_SimplePie_File' );          $feed->set_feed_url($url);     $feed->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 12 * HOUR_IN_SECONDS, $url ) );     do_action_ref_array( 'wp_feed_options', array( &$feed, $url ) );     $feed->init();     $feed->handle_content_type();          if ( $feed->error() )         return new WP_Error('simplepie-error', $feed->error());          return $feed;     }      How can I modify which HTML elements get stripped during the feed import? SimplePie in its documentation says that there is a function strip_htmltags(), but I'm not sure how I can use it within the WordPress context. http://simplepie.org/wiki/reference/simplepie/strip_htmltags Here's what I tried, but didn't work:               function wpse87359_feed_options( $feed) {     $feed->strip_htmltags(array_merge($feed->strip_htmltags, array('h1', 'a', 'img','em')));     }     add_action( 'wp_feed_options', 'wpse87359_feed_options' );


Creating a Custom Post as a repository for theme constants

I was wondering if it would be possible to create a custom post with different custom fields so that if a download document used in many pages changes the user can come here to update the name. In other words, if the document sitting in www.web.com/uploads/catalog2012.pdf is upgraded to catalog2013.pdf, the user would be able to change the document name here. Thanks in Advance, Mauro


Custom post type & role issues

I am having issues with using custom post types and custom user roles. I created a custom post type called Businesses. Then I created capabilities for users of a certain type to be able to add and edit business listings. The problem I am having is when I create the user type and add the capabilities of edit_business, edit_businesses, read_business, publish_businesses, the user has the ability to edit other peoples businesses. I can't figure out why this is happening. A snippet of the code I used to create the capabilities is `'capabilities' => array( 'edit_post' => 'edit_business', 'edit_posts' => 'edit_business', 'edit_others_posts' => 'edit_others_businesses', 'publish_posts' => 'publish_businesses', 'read_post' => 'read_business', 'read_private_posts' => 'read_private_businesses', 'delete_post' => 'delete_business' )` Any help understanding this would be appreciated


Shortcodes and a list of IDs?

I'm creating a simple shortcode function and need to specify a list of IDs as a variable. I've checked the Codex but I'm not sure how this is handled. The shortcode is:               [video_vote users="13027,13023,12583"]      Is the best way to loop through them by using a split or explode on the comma or is there a WordPress-specific method?               function video_vote($atts) {           extract(shortcode_atts(array(             'users' => 'no foo'         ), $atts));                   return $users; // works but need to loop through the IDs              // register to vote         // selected videos     }


Doing a loop with multiple DBs simultaneoulsy

I have a website setup made up of with more than 3-4 WordPress setups as subdirectories of main. For example:               Site     |     ---------- Site/Site1     |     ---------- Site/Site2     |     ---------- Site/Site3      Each have separate codebase, separate DB for itself. The Database server is one and the host directory is also one. Basically we can say these are the mirrors of same setup as subdirectories of the main site. Now, I want to know: how can I run a Loop in _the homepage of parent site_ "Site" which will fetch and _include the posts_ from "Site1", "Site2", "Site3"? Note: \-- I can't make it Multisite setup as the codebase is existing one and complex. \-- The tables inside each DB are prefixed the same. \-- For better understanding of the setup situation I have attached a image here.![Setup with DB](http://i.stack.imgur.com/CPK1R.png)


Wordpress Media Manager 3.5 - default link to

Media Manager once again. This time I'm looking for a simple hack/hook/filter to change default "Attachment Display Settings" from media manager. The option is "Link To" that is default set to "Media File" and I would like to force it for all users to be default set to "none". ![Media Manager Screen](http://i.stack.imgur.com/P0smV.png) If there is no way to do it with hook/filter (media-template.php lines 282 - 306) - is there a way to attach jQuery file to Media Manager and use it to force change option after Media Manager is loaded?


How to enqueue script based on post category?

I have scripts for various little tools I have made using some js and html. I want the js to load only on specific single posts in side a specific category. I have tried the following code and it does not work. I removed the "if" statement and the script does run and work so it's a matter of fixing the if statement. Here's what I've got so far,                   if ( is_single() && in_category( 'mouse' ) ) {     wp_enqueue_script( 'mousescript');     }      Thank you very much for any and all help, it's greatly appreciated!


home.php or frontpage (via settings) for theme?

OK. I'm getting conflicting instructions from my training resources (again). This time the issue for me is **"how to set a default homepage"**. One tutorial _(Coyers "WordPress 3: Creating and Editing Custom Themes")_ **uses home.php** , while another _("Professional WordPress")_ recommends setting "Front page displays..." via WordPress (Settings > Reading). ...aargh! In checking the forums and blogs, I see the same issue: **conflicting advice**. With one user advising to **NEVER** use the home.php template page in a theme as _"It can cause problems on some servers"_. **Is this true?** And another user swearing by it. ...What is a noob to do? So, given the confusion (and given that I'm a noob looking to do things the right way)...   1. What is the difference between the two approaches?   2. Which approach to a standard homepage should one use **when creating a theme**? thanks, sleeper


Page Attachment Permalink Structure based on Menu Order?

I've been on a quest for the past couple of days reading up on Rewrite in WordPress but still can't seem to figure out how to accomplish this. When using pretty links in WordPress, media attached to a page forms a URL like:               http://www.domain.com/page_name/attachment_name/     http://www.domain.com/page_name/page_name/attachment_name/     http://www.domain.com/page_name/page_name/.../attachment_name/      What I would like to do is create a permalink structure based on the order in which the images are attached to the page. For example:               http://www.domain.com/page_name/menu_order/     http://www.domain.com/page_name/page_name/menu_order/     http://www.domain.com/page_name/page_name/.../menu_order/      where `menu_order` is the number in which the image is ordered. From what I understand, the way permalinks work in WordPress is that it reads the URL and then translates that to its original query (in this case, `index.php?attachment_id=ID`). And then from there, it pulls whatever information needs to display. Any suggestions as to how I could accomplish this? Links to posts that might guide me in what I need to do? Thanks in advance.


make a login system for site visitors

down vote favorite share [fb] share [tw] I want to make a content driven site, where people can register for an account, and then have the ability to submit content/articles that they write to the website. When someone registers that person should get an email for activation, they should not be able to do anything on the site until they verify their email address. The site admin should be able to specify what "Categories" the site has for the articles, the people who register should not. They should be able to pick from the list of categories ... just one. The should also be able to specify up to 4 tags. Each person should have a profile page that shows their picture and all their info (except password), and links to all the articles they have submitted. I tried searching over google, i found plugins like theme my login or users meta. But these doesn't solve my problem. Can you please suggest me, whether i have to custom code or i can get this functionality through some plugin.


content filter (add_filter) for category description?

I'm running an add_filter function on the_content and I need to run the same function on the category description. Does something like that exist or do I need to create a custom function for it?


custom walker class for own menu?

i have designed a html template for own blog, in my theme my menu is this structure,

     Home

Home Page - Default

Home Page Type 1

Home Page Type 2

TouchM Sliders

Slider Revolution

Flexislider

Camera Slider

     Features

About Us

Services

Pricing Tables

Shortcodes

404 Not Found

Under Construction

Third Navigation Level

This is a simple example

Of the Third Level

     Blog

Blog Default

Blog Type 1

Blog Type 2

Sidebar Right

Sidebar Left

Single Post

     Portfolio

Portfolio Default (4 Columns)

Portfolio 2 Columns

Portfolio 3 Columns

Portfolio 4 Columns

Single Project

Contact

      but when i use wp nav menu to fecth menu , wordpress not correct create this, i google this problem and then i undrestand to solve this problem muse use wp nav wlaker class, this time my question is which walker class compatible with this menu structure


WP_Query not looking at child category

Hi all I have a loop that shows a post on a single page and puts the first category name in the variable $cat:               $cat = $category[0]->cat_name;?>      Now after the post I have a link to show related posts based on this category:               $catPosts1 = new WP_Query(array('category_name'=> $cat, 'orderby' => 'rand', 'posts_per_page' => 1));         while ($catPosts1->have_posts()) : $catPosts1->the_post();      The problem I'm having if a Child Category is selected for the first post I.e. Under the category Phones the child category Accessories is chosen nothing is appearing in the related link area. Is there a way of making Wordpress use this child category? Thanks


Create custom markup to use in posts?

Is there some way - a plugin, a technique, some file to edit - to define some custom markup to be interpreted, parsed and replaced with custom, generated content when generating posts? The simplest example of what I want would be smileys, getting a `:)` or in text of the post replaced by a specific `<img scr="...">` when generating the HTML, or custom version of BBCode, but in my case the generated content would be more complex, at the very least requiring the use of the post ID, but probably more, so I'd prefer a PHP-side solution working somewhere under the `the_post()` surface, not a simple client-side Javascript rewriter.


Conditionally load class in the comment section of the post page

I want to be able to conditionally load a class containing the word 'AUTHOR' in the comments section, next to the name of the person who was the author of the post. I know it has something to do with class bypostauthor, what I've got so far is:               <?php if $class == 'bypostauthor' ?>
AUTHOR
      <? endif; ?>      More info: In comment section of my wordpress post page, the class .bypostauthor exists whenever a the author of post page comments on there post page, giving this for one of the comments in the comment section -> I'm trying to accomplish having the word 'AUTHOR' next to the author of post name whenever they comment on there page. Considering bypostauthor class appears whenever page author post a comment on his page I tried to use the following code to make a div class conditionally appear whenever the post author comments ->               <li <?php comment_class('clearfix'); ?> id="li-comment-<?php comment_ID() ?>">              <div class="comment-block" id="comment-<?php comment_ID(); ?>">

                          <?php echo get_avatar( $comment->comment_author_email, 32 ); ?>
                         <?php printf(__('%s', 'playne'), get_comment_author_link()) ?><?php if $class == 'bypostauthor' ?>
AUTHOR
      <? endif; ?>

                         <a class="comment-time" href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ) ?>">  <?php echo themeblvd_time_ago_1(); ?>   <?php edit_comment_link(__('(Edit)', 'playne'),'  ','') ?>

                 <?php comment_text() ?>
                     <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>

             <?php if ($comment->comment_approved == '0') : ?>                 <?php _e('Your comment is awaiting moderation.', 'playne') ?>             <?php endif; ?>
      "> comment_author_email, 32 ); ?>
                         <?php printf(__('%s', 'playne'), get_comment_author_link()) ?>                              <?php echo author_tag(); ?>

                         <a class="comment-time" href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ) ?>">  <?php echo themeblvd_time_ago_1(); ?>   <?php edit_comment_link(__('(Edit)', 'playne'),'  ','') ?>

                 <?php comment_text() ?>
                     <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>

      Tried something based on answer ->               function author_tag() {         $classes = get_comment_class();         if(in_array('bypostauthor',$classes)) {             $output =

AUTHOR

;         } else {             $output =

NOT AUTHOR

;         }         return $output;     }


Problem with trying to display subheader in posts

On this article, it was said that you can use the `h4` tag to create a subheader to break up long posts. However, whenever I wrap text in the tags, it displays the tags as regular characters. Wordpress doesn't seem to recognize the use of HTML. I have this               Hello... blah blah
And there was freedom!
      But it renders exactly the same, with no header. I am using the theme December if that has anything to do with it


Deleting all Options on theme switch

I am looking to reset or delete all options on theme switch. Currently when I switch themes my options in my current custom theme that I am developing, will transfer to its associated child themes. This should not happen. **How do i delete all options upon theme switch?**


how to add radio field on user meta on function.php?

i have added gender filed on user meta it is not value               <?php          add_action( 'show_user_profile', 'show_extra_profile_fields', 10 );     add_action( 'edit_user_profile', 'show_extra_profile_fields', 10 );          function show_extra_profile_fields( $user ) { ?>
                                 Gender
                                     <input type="radio" name="radio-inline"  <?php if ($gender == 'Male' ) { ?>checked="checked"<?php }?> value="Male">Male                                     <input type="radio" name="radio-inline"  <?php if ($gender == 'Female' ) { ?>checked="checked"<?php }?> value="Female">Female

                                   <?php }          add_action( 'personal_options_update', 'save_extra_profile_fields' );     add_action( 'edit_user_profile_update', 'save_extra_profile_fields' );          function save_extra_profile_fields( $user_id ) {              if ( !current_user_can( 'edit_user', $user_id ) )             return false;              update_usermeta( $user_id, 'gender', $_POST['gender'] );     ?>      i saw this same question but still not saving How to add checkbox and radio button in Profile Page


Follow-up Comments Notification Without a Plug-in

I'm trying to find the code to insert in my Comments.php to add the functionality of "Follow-up Comments Notification" but I can't find it. I can't use a plug-in because it's for a theme that I'm starting to develop for a client and he doesn't want to use plug-ins. I know there has to be a way because I've been told that some themes come with that feature but I don't seem to understand where that piece of code is. Any help or suggestions will be greatly appreciated. Cheers


Stripping wp_link_pages?

I can't figure out for the life of me how to strip the following code of the `<p>` tag. Even adding the remove code for wpautop in my functions won't do it.               <?php wp_link_pages('before=Pages'); ?>


passing javascript variable into php wordpress

I am trying to pass variable from JS to PHP. I have this JS code that runs in my footer.php:               <script>     function printResponse(response) {         if ( response.errorCode == 0 ) {             var NumberOfCommentsPerStream = response.streamInfo.commentCount;             //alert(NumberOfCommentsPerStream);         } else {             alert('Error :' + response.errorMessage);         }     }               var NoumberOfCommentsParams = {         categoryID: "iphones_comments",        streamID: '<?php the_ID(); ?>',         callback:printResponse     };          gigya.comments.getStreamInfo(NoumberOfCommentsParams);      as you can see I have a variable there which counts my gigya comments: **NumberOfCommentsPerStream** it works fine when I am using alert. it shows the number of comments. I would like to integrate it to wordpress so I can echo it and display it in wordpress tried to simply echo it out:               <?php echo $NumberOfCommentsPerStream; ?>      of course it is not working. just trying to demonstrate what I am trying to achive anyone has a clue?