title: The 'user_has_cap' hook seems to take two page loads to trigger

text:
This question relates to another question I asked recently (http://wordpress.stackexchange.com/questions/29009/how-to-assign-specific- users-the-capability-to-edit-specific-pages-posts-cus/), the answer to which got me most of the way there to what I was trying to do. However, rather than keep updating that question I thought it better to post a new one as I really consider it more of a new issue now. I am basically restricting Read access to a custom post type (projects) on a per-user basis, I'm using the `user_has_cap` hook and I check whether the User trying to Read a page has the post type's ID in an array of IDs that are assigned to the User, depending on whether the array has the current post ID in it then Read capabilities are added / removed accordingly. This is done with the following code:               function allow_user_to_read_cpt_filter($allcaps, $cap, $args) {         global $current_user; // Get user id         get_currentuserinfo(); //...         $userid = $current_user->ID; //...         $wos_uspr_checked_read_ids = explode(',',esc_attr(get_the_author_meta('wos_uspr_read_data', $userid)));         /* The above is a comma separated list of IDS, e.g. 724,736,784 */         global $wpdb;         $post = get_post($args[2]);         if (!in_array($post->ID, $wos_uspr_checked_read_ids)) {             $user = wp_get_current_user();             $user->remove_cap('read_project');             $user->remove_cap('read_projects');             $user->remove_cap('read_others_projects');             $user->remove_cap('read_published_projects');                } else {             $user = wp_get_current_user();             $user->add_cap('read_project');             $user->add_cap('read_projects');             $user->add_cap('read_others_projects');             $user->add_cap('read_published_projects');         }              return $allcaps;     }          add_filter('user_has_cap', 'allow_user_to_read_cpt_filter', 100, 3);      (Yes, I have used different code than the answer given to my previous question, I don't _think_ this is contributing to the problem here though as I have used the other method of assigning capabilities, I just prefer using the above method.) Anyway, the problem I am encountering with this is that it is taking two loads of the page before my post types content is being hidden. The code I am using on my page looks like this:               if (current_user_can('read_projects')) {         echo '
Yes, you can read this.
';     } else if (!current_user_can('read_projects')) {         echo '
No, you cannot read this.
';     }      My guess was that the hook was not being triggered quickly enough when the page is loaded in order to show or hide the content on the first load, but I'm struggling to find an answer to when `user_has_cap` is triggered.


title: Will wp_get_attachment_metadata display PDF metadata (eg: keyword, author, description)?

text: I used this technique to display attached PDF metadata on a page. It shows the title and path but not info like keyword, author, and description. Can Wordpress access all the properties uploaded with a PDF file and if so, what's the best way to get at them? TIA


title: Custom Post Type With Categories

text: I have copied custom post type code from WordPress and modified and added to function.php but Where is the categories box. I cant seen anywhere. I want also for this post. ![I want to see this in my post](http://i.stack.imgur.com/65FJL.png) I am not good for WordPress So please guide me to solve this issue. Thanks :) **My Code:**               function codex_custom_init() {       $labels = array(         'name'               => 'Prices',         'singular_name'      => 'Price',         'add_new'            => 'Add New',         'add_new_item'       => 'Add New Price',         'edit_item'          => 'Edit Price',         'new_item'           => 'New Price',         'all_items'          => 'All Prices',         'view_item'          => 'View Price',         'search_items'       => 'Search Prices',         'not_found'          => 'No prices found',         'not_found_in_trash' => 'No prices found in Trash',         'parent_item_colon'  => '',         'menu_name'          => 'Prices'       );            $args = array(         'labels'             => $labels,         'public'             => true,         'publicly_queryable' => true,         'show_ui'            => true,         'show_in_menu'       => true,         'query_var'          => true,         'rewrite'            => array( 'slug' => 'price' ),         'capability_type'    => 'post',         'has_archive'        => true,         'hierarchical'       => false,         'menu_position'      => null,         'supports'           => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )       );            register_post_type( 'price', $args );     }     add_action( 'init', 'codex_custom_init' );


title: Uploading .webm format on WordPress results in security guidline breach and fail

text: I cannot upload the .webm video format on WordPress. This is after adding: AddType video/webm .webm into both: my .htaccess file (on the root folder of the WordPress installation) the mime type handler of our apache server (via our site cpanel) As far as i remember, at first this message instantly gave me the error, it would even begin uploading it. Now it uploads it all the way and then while crunching, i get the error. The error is               “1.webm” has failed to upload due to an error     File type does not meet security guidelines. Try another.      Has anyone else had this problem?! What's really peculiar is that another video format called ogv (Theora) was not being recognised in the html5 player, BUT it wasn't breaching security according to WordPress. So I added the mimetype to the apache (not via htaccess) and voila, it worked. Also, the file actually 'Uploads', it 'Crunches' and then rejects the file, which is odd, surely WordPress would deduce it can't upload the file format by just checking which file format it is first?


title: Category and guest post with 404

text: i use twenty twelve theme in wp with plugin of guest post and redirection because if any of user click on category and blank category shows a guest post page in redirection plugin i set one category redirection its work when i set another so its not work, i need a proper solution of 404 page not found and also blank category redirection, please suggest. > For details i share complete info of plugins here   1. Guest Posts By ericgrld   2. Redirection By johnny5   3. Theme : Twenty Twelve


title: Cron job not firing

text: I'm having this problem where cron jobs doens't seem to post delayed posts.. I'm using this cron job               wget -O /dev/null http://domain.com/wp-cron.php?doing_wp_cron      Am i doing something wrong?


title: __(): What if I have to pass in a variable?

text: In the docs for the translate function `__( $text, $domain )`, it states that you must put the string directly in place of $text, that you cannot do something clever such as `__( $my_text, 'text-domain' );`. However, I am writing a method which takes in a string and needs to pass it to `__(` ... `)` somehow. Is there a way, e.g. via `printf` or `sprintf` that I can work around this? Something like...               function print_description( $text ) {         echo '<p>' . __( printf( '%s', $text ), 'text-domain' ) . '</p>';     }


title: get_post_meta image width for lazy load

text: I'm trying to lazy load a page of images in Wordpress - I've tried the plugins but none of them seem to work(I only want to lazy load image on some pages.) So I'm now trying to do it with a plugin - http://www.appelsiini.net/projects/lazyload This plugin requires the image width and height in the img tag.                         I'm attaching the images from custom fields like                   <img src="<?php echo get_post_meta($post->ID, 'img1', true); ?>">      Is it possible get the images width and height from the get_post_meta I've looked at wp_get_attachment_image_src but I can't see how to use it get_post_meta


title: JW Player popup with s2member & amazon s3/cloudfront

text:
I have been working on Developing a Tutorial site. I am using WordPress, ACF, s2member, amazon s3 & cloudfront and JW Player. I have integrated amazon cloudfront with s2member but now I am having problem to play video in JW Player. I actually want to open the video player in a new window. I am going to use a custom post type for tutorials. Then custom field for Video name & links. Can anybody help me find a way to play the video in a new window. Here is an exact demo of what I need to do : http://www.vtc.com/products/MasterClass!-Cinema-4D-Lite-in-Adobe-After- Effects-CC-Workflow-Tutorials.htm If you click on Input Devices, you will see the video open in a new window. Here is my site : http://demo.mamb2b.us/training/courses/photoshop-course-1/ And here is my single-courses.php ::               get_header('courses'); ?>                        <?php              /* Run the loop to output the posts.               * If you want to overload this in a child theme then include a file               * called loop-single.php and that will be used instead.               */              the_post();                   //get_template_part('loop', 'single');              ?>
          <?php do_action('icl_language_selector'); ?>
             <?php if(get_field('introduction')) : ?>

Introduction

                 Name	                 	                 Duration	                 Files
                  <?php while(has_sub_field('introduction')) : ?>
                 <a href="javascript:;" id="introduction<?php the_sub_field('sl._no.'); ?>"><?php the_sub_field('name'); ?>	                 <a rel="shadowbox" href="#introduction<?php the_sub_field('sl._no.'); ?>">	                 <?php the_sub_field('duration'); ?>
                      <?php endwhile;          endif;          ?>                               <?php if (current_user_is("s2member_level1")){ ?>             <?php if(get_field('basic_tutorial')) : ?>

Basic

                       <?php while(has_sub_field('basic_tutorial')) : ?>
                 <a href="<?php the_sub_field('video_link'); ?>"><?php the_sub_field('name'); ?>	                 <a href="<?php the_sub_field('video_link'); ?>">	                 <?php the_sub_field('duration'); ?>
         <?php endwhile;          endif;          ?>         <?php } else { ?>     <?php if(get_field('basic_tutorial')) : ?>

Basic

                       <?php while(has_sub_field('basic_tutorial')) : ?>
                 <?php the_sub_field('name'); ?>	                 	                 <?php the_sub_field('duration'); ?>
         <?php endwhile;          endif;          ?>         <?php } ?>                               <?php if (current_user_is("s2member_level1")){ ?>             <?php if(get_field('advanced')) : ?>

Advanced

                  <?php while(has_sub_field('advanced')) : ?>
                 <a href="javascript:void(0)" onclick="window.open('http://www.w3schools.com/html/movie.mp4<?php //the_sub_field('video_link'); ?>',     'welcome','scrollbars=yes,location=no, toolbar=no')"><?php the_sub_field('name'); ?>	                 <a href="<?php the_sub_field('video_link'); ?>">	                 <?php the_sub_field('duration'); ?>
         <?php endwhile;          endif;          ?>         <?php } else { ?>              <?php if(get_field('advanced')) : ?>

Advanced

                  <?php while(has_sub_field('advanced')) : ?>
                 <?php the_sub_field('name'); ?>	                 	                 <?php the_sub_field('duration'); ?>
         <?php endwhile;          endif;          ?>         <?php } ?>

Course Description:

<?php the_content(); ?>

         <?php //comments_template(); ?>         <?php echo do_shortcode('[facebookall_comments]'); ?>
     <?php get_footer('courses'); ?>      Thanks in Advance for your Help!


title: Making a string translation ready with html in it

text: I can make a simple translation string like this:               <?php _e('Hello world','text-domain'); ?>      But how to make a translation string if there is a markup in it? For example this:               <?php _e('Hello world','text-domain'); ?>      Is the above correct?


title: How to execute SQL SELECT query and see the results?

text: I want to run a SELECT query on the Wordpress database and get the results on the screen. Any widget which does it?


title: How to add font in wordpress

text: I have a oswald.woff font file downloaded from some free fonts site. Using ftp i have created folder called fonts in the themes folders. (i.e /wp- content/themes/esplanade/fonts). In the fonts folder i put the oswald.woff file.               @font-face {         font-family: "Oswald";         font-style: normal;         font-weight: 400;         src: local("Oswald Regular"), local("Oswald-Regular"), url("fonts/oswald.woff") format("woff");     }      I use this font for an heading h1. When open my site, it says "www.mysite.com/fonts/oswald.woff" (mysite.com used for representation, its not the origianl site) not found in the firebug errors console. how to get the url of the file oswald.woff


title: Writing Mysql and Php code in wordpress Posts

text: I am on wordpress and i am writing php or mysql code in a post but finally when i hit publish it gives an Server Error : 500 , i also trying putting my code under [code] [/code] tags nothing happened but when i remove my codes and hit publish then it's working Any idea guys Waiting for help


title: Featured Images on Front Page

text: I currently have a static front page and a /blog. My goal is to have the front page be a grid of hand selected images (similar to a portfolio). I would like to be able to easily switch the images are featured on this page without having to change the raw html. Is the best way to do this, using custom fields on a page? Or is there a better way to handle managing featured images on a static page? Thanks!


title: Side by side blogging?

text: I'm designing a blog with wordpress as my CMS. My client would like one page on the site to have two main content areas, each with a title above and streaming posts from different categories. So far I haven't seen any examples of this anywhere on the web. Is this possible to do? If so, whats the best approach?


title: Wordpress Development understanding core

text: Just like any other framework, I preassume that Wordpress is a framework that should be understood before any further development should take place. I am keen to know about the recommended steps to understand Wordpress. I am coming from .Net technology with more than 10 years of programming experience. I know how wordpress external. However, I want to know about internals' so that I can build my own plugins and stuff like that. Since it is the community dedicated to Wordpress development, I would like to know the best possible way of understanding internals and then write plugins. I just need a direction, I will find my way. thank you, Mr. Codebased.


title: line break are not working when editing a post

text: So I have a problem when making a post. If I press enter and make a new line in the editor and press safe the line break diapers. But when I show the post it have inserted a line break. So somehow the editor is not able to show the line break? If I save the editor again the line break disappears from the post as well. Any ideas? I read in a post to try and use:               remove_filter ('the_content', 'wpautop');     remove_filter('the_content', 'wptexturize');      Which I did and now line breaks don't work at all. I have build a custom page where the posts are shown with the               echo the_content();


title: Changing the display of the themename_posted_on() function

text: At present, this is what the `pl_dev_posted_on()` function is displaying: ![pl_dev_posted_on\(\)](http://i.stack.imgur.com/kHBPY.png) Where can I find this function to be able to edit what it displays?


title: WOW.js Script Tag Initialization Header/Footer

text: hope things are going well. I'm attempting to use WOW.js http://mynameismatthieu.com/WOW/docs.html with animate.css to add animations to my site. WOW.js requires me to initialize it by adding the following in the header:               <link rel="stylesheet" href="css/animate.min.css">     <script src="js/wow.min.js"></script>     <script>      new WOW().init();     </script>      The theme I'm using, JointsWP, is utilizing wp_register_style, wp_enqueue_style, and wp_enqueue_script to link the js and css files.               // register wow.js & animate.css         wp_register_style( 'animate-stylesheet', get_stylesheet_directory_uri() . '/library/css/animate.css', array(), '', 'all' );         wp_register_script( 'wow-js', get_stylesheet_directory_uri() . '/library/js/vendor/wow.min.js', array(), '', 'all' );          wp_enqueue_style( 'animate-stylesheet' );     wp_enqueue_script( 'wow-js' );      I've successfully linked the required css and js file using these WP functions.. I'm having trouble adding the inline `new WOW().init();` method to the page source. What would be the best way to add this to the page? I've attempting adding the function referenced in this link wp enqueue inline script due to dependancies but I wasn't able to successfully implement it. I've also added the script tag code to the header.php, but the animation isn't being applied. I greatly appreciate any help that can be provided. Thanks!


title: Another flat level URL question (no hierarchy)

text: I read some issues with related topics, but found no answer. I have categories and subcategories on my site. **The only reason having hierarchy is because I need to have on the category page all child subcategories.** I want this:   * `example.com\category`   * `example.com\subcategory`   * `example.com\postname` How can I get this?


title: Display results with an Autocomplete

text: Just need some help on this `function wp_ajax_nopriv_izwootsy_charity_autocomplete() { if (strlen($_GET['q']) > 1) { global $wpdb; //$results = $wpdb->get_results("SELECT post_title FROM ".$wpdb->prefix."posts WHERE post_type='store-charity' AND post_title LIKE '%".esc_attr($_GET['q'])."%'");                   global $posts;              $results = new WP_Query( 'post_type=store-charity&post_title='.esc_attr($_GET['q']) );              foreach($results as $result) {             print $result->post_title."\n";         }     }     exit;      }` I want this to load up post results and prepare them for an autocomplete Here is the JS ` jQuery(document).ready(function($) { $("#charity").autocomplete('/wp- admin/admin-ajax.php?action=izwootsy-charity-autocomplete', { width: 300, multiple: false, matchContains: true, formatItem: function(data, i, n, value) { return value; }, formatResult: function(data, value) { return value.split(".")[0]; } });               function formatResult(row) {         return row[0].replace(/(<.+?>)/gi, '');     }      });` For some reason it only shows the number 0. Any Ideas


title: How to add comment on scripts using function in wordpress?

text: this is the code im using to call script if the browser is ie               <!--[if IE]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <style type="text/css"> .clear { zoom: 1;display: block;} </style> <![endif]-->      but how can i add this on function.php as normal way we do this to call the js               wp_register_script('html5js', ("http://html5shiv.googlecode.com/svn/trunk/html5.js"), false, '1.3.2');     wp_enqueue_script('html5js');      and i dont want to statically insert the code on header is there any other way to generate comment?


title: How do I retain url parameters the entire time a user browses my site?

text: We have customers that come from other sites and I would like to retain a url parameter /?lead=openeye throughout the time that they're browsing. That way when they fill out a form I can capture the lead for sales. How do I retain url parameters the entire time they're browsing the site. **Update..** I've began using a combination of sessions and cookies to accomidate this. It sort of works but doesn't seem to stick for more than a few seconds between pages. In the header               <?php          $lead = $_GET['lead']; $_SESSION['lead'] = $lead;         $url = parse_url(get_bloginfo('url'));         setcookie("lead", $lead, 0, $url['path'], $url['host']); (set)      ?>      To test               <?php          echo ($_COOKIE['lead']); // Lead Cookie     ?>


title: Why am I seeing 'yes' and 'no' in URLs crawled by Xenu?

text: This may not be a WordPress thing at all, but I've never seen it before and it's happening to a WordPress site we're completing. I use Xenu for checking sites for broken links, images etc. When I run it over our dev site I see loads of 404s for what are valid URLs, but with /yes and /no appended to them. i.e.               http://mysite/2014/04/my-fascinating-post/yes     http://mysite/2014/04/my-fascinating-post/no      Has anyone seen anything like this before?! Thanks, Toby


title: Possible to get all posts with my shortcode?

text: So here's what I'm trying to do. I'm building a plugin for a business directory. Each business is assigned to a category. There are two views, listing and detail. To give the user as much flexibility as possible, I have created a shortcode where they can pass in the category and that will display the listview. This works great. They can create a page, called "Fishing" with a permalink of "/fly-fishing" and the content is                  Here's some title information about our fishing.  Thanks yadda yadda.        [business-directory category=fishing]      Notice that the category and the permalink are different. Again, to show the flexibility I'm trying to achieve. In my listings, I would like a permalink to each business that uses the permalink of the category page that they select. So one might be /fly- fishing/abc-fishing. When that permalink is visited, I need my plugin to know that the category is actually fishing and the business is abc-fishing. I'm having trouble with creating the add_rewrite_rule such that it knows what page to pass back to. My thought was to query each page, look for my shortcode, and then add the rewrite_rules accordingly. This means I will have to do this on every page creating/update. Is there a better way?


title: Wordpress caching issue

text: I've updated a page in wordpress and can see the correct result in "preview mode", but if I view the page outside of the admin interface the update does not show. I've search around and tried the following, of which nothing worked:   * Disable or clear wordpress cache plugins, of which I have non installed   * Checked the wp-config.php file for anything referencing to cache    * Cleared browser cache, and tried multiple browsers   * Checked .htaccess file for any apache modules to do with caching Now I'm stumped and don't know where else to look.


title: Wordpress custom post type and taxonomy

text:
So I have a custom post type called `Video` and a taxonomy called `category` that I use to group videos togheter, so I want to list them like this:               Taxonomy NAME 1     VIDEO 1     VODEO 2          Taxonomy NAME 2     Video 1     Video 2      So I tried something but it doesn't work, the problem is that for each video I also display the taxonomy name like this:               Taxonomy Name 1     Video 1     Taxonomy Name 1     Video 2      So this is not what I want, mabe you guys can figure it out, what I do wrong:               <?php get_header();?>     <?php         $args = array( 'post_type' => 'Video');         $loop = new WP_Query( $args );     ?>     <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>             <?php $fg = get_the_terms(get_the_ID(),'category'); ?>             <?php foreach($fg as $term): ?>
<?php echo $term->name; ?>
                     <?php wp_reset_postdata(); ?>                     <?php                             $posts = new WP_Query(array('post_type' => 'Video', 'category' => $term->name) );                             while ( $posts->have_posts() ) : $posts->the_post();                                 the_post_thumbnail();                                 ?>                                 <a href="<?php the_permalink(); ?>"><?php the_title(); ?>                                 <?php                             endwhile;                     ?>             <?php endforeach; ?>     <?php endwhile; ?>          <?php get_footer(); ?>      If someone can help please do it :( I can't get this


title: Creating a blog on my companies new website using Wordpress but I have sidebar issues

text: As said in the title, I am creating a blog on my companies new website using Wordpress but I have sidebar issues. The website is only in production phase at the moment. The Link is so you can see is: http://madhousecreative.co.uk/completegroup/Blog/ Heres an image of what it is currently. ![enter image description here](http://i.stack.imgur.com/EtHGK.jpg) Whenever I try to move the sidebar up it messes up and the bit move up dissapears. Heres another image to show you what I mean: ![enter image description here](http://i.stack.imgur.com/2DH3r.jpg) I hope the images help explain what I am trying to say. Im really stuck on this so I hope someone can help.


title: Can't make permalink of CPT work

text: i'm learning how to use wordpress, but i've encountered a big problem. I'm trying to create a custom post type, i've used this code:               add_action('init', 'init_realizzazioni');          function init_realizzazioni() {          $labels = array(         'name'               => __('Realizzazioni'),         'singular_name'      => __('Realizzazione'),         'add_new'            => __('Aggiungi realizzazione'),         'add_new_item'       => __('Nuova realizzazione'),         'edit_item'          => __('Modifica realizzazione'),         'new_item'           => __('Nuova realizzazione'),         'all_items'          => __('Elenco Realizzazioni'),         'view_item'          => __('Visualizza Realizzazione'),         'search_items'       => __('Cerca Realizzazione'),         'not_found'          => __('Realizzazione non trovato'),         'not_found_in_trash' => __('Realizzazione non trovata nel cestino'),     );          $args = array(         'labels'             => $labels,          'public'             => true,             'rewrite'            => array('slug' => 'realizzazioni'),          'has_archive'        => true,          'hierarchical'       => false,          'menu_position'      => 5,          'supports'           => array(                                  'title',                                 'editor',                                 'thumbnail',                                  'excerpt'                                 ),     );                  register_post_type('realizzazione', $args);      }      and everything seems ok.. i can see the post type and create ne ones. The problem is that i can't visualize a the archive page. I've set has_archive and rewrite in the right way.. i can't figure out because when i go to: `localhost/wp/realizzazioni` or `localhost/wp/realizzazione` it give me 404. I've also tried to create an `archive-realizzazione.php` but it gives me 404 again. here is the archive-realizzazione code:               <?php     /*      * Template Name: realizzazione      */               get_header(); ?>                    <?php get_footer(); ?>


title: Earliest hook to reliably get $post/$posts

text: What's the earliest possible action I can hook into where I'll be able to access the global `$post/$posts` variables on both the front and back ends? I've tried looking through the Codex reference, Adam Brown's reference and skimming through the source several times but haven't had much luck finding a good one. `pre_get_posts` is too early; Using `posts_selection` doesn't work if you want to make a second get_posts() call during the callback; and `template_redirect` doesn't run on the admin side. `the_post` might be earlier than `template_redirect` for the front end, but it also doesn't run on the back end. Ideally I'd want something that runs right before `get_post()/get_posts()` returns, but I'm not seeing anything like that. I've used the `the_posts` filter in the past, but I'd prefer an action because it's more technically correct. Right now I'm just hooking in twice; once using `template_redirect` for the front end, and again using `admin_xml_ns` for the back end. I don't really like that, though, since the my logic isn't semantically related to either of those hooks, and it seems like this is a very common need and there should be a hook like "post_get_posts" (ala `pre_get_posts`) that works on both sides.


title: Get current Blog ID in Tinymce Plugin Dialog Window in WPMU

text: is there any way, to get the current blog id in a Tinymce Dialog Window? Currently I only get the id, from the main blog. This is my current code:               $wp_load = "wp-load.php";     while(!file_exists($wp_load)) {     $wp_load = '../' . $wp_load;     if(file_exists($wp_load)){         break;     }     }     require_once($wp_load);     global $blog_id;     echo $blog_id;     $blog = get_blog_details($blog_id);      Any help is welcome. Lars


title: Control term order on a per-post basis

text: I have a taxonomy in which term order matters, but varies from post to post. So I want to be able to set the order that terms are displayed in on a per- post basis:   * **My first post** | Tagged: Apples, Oranges, Bananas   * **Some other post** | Tagged: Oranges, Bananas, Apples Since this would vary from post to post, I need something other than the taxonomy-wide term ordering supported by plugins like Custom Taxonomy Sort and Taxonomy Terms Order. I am looking for advice on how to implement this. Here is an outline of my current thinking: ## Per-post term ordering using a custom field   1. Remove standard taxonomy metabox using `remove_meta_box()`   2. Add custom metabox containing term ordering interface, e.g., drag-and-drop (or simple text input next to each term for an integer describing term's order. (Or perhaps it's possible to add drag-and-drop to the existing meta_box without having to remove and add a new one?**)   3. Using javascript, save a comma-separated list of term IDs, in order, in a hidden custom field, _mytermorder_taxonomyname. (Separate custom field for each taxonomy, e.g., _mytermorder_category, __mytermorder_tags, etc.)   4. Create a custom function `my_get_the_terms()` that loops through the IDs in the _taxonomyname_termorder custom field. If a post has terms but no _taxonomyname_termorder field (as with old posts), just return get_the_terms().   5. In relevant theme files, replace instances of `get_the_terms()` or other native term functions with `my_get_the_terms()`. Do you have advice, alternatives, warnings, or related snippets? I'd be grateful for any thoughts. Thank you! ### Concerns   * What if the list in the custom field gets out of sync with the actual term list (as it would if terms were added through an interface other than the post edit screen, such as the quick-edit/bulk edit form or Front-End Editor). **Solution:** At the beginning of `my_get_the_terms()`, we can check whether the IDs in the custom field match the terms returned by get_the_terms. If not, default to get_the_terms.   * New terms wouldn't be captured on first use, because they don't yet have an ID. You'd have to save a new term before it would work. (I could live with this, but it is a problem.)   * The meta box has to list terms in the right order when the post edit page loads. * * * ** For drag-and-drop sorting in the default metabox, I discovered that I can use jQuery UI's .sortable, already available in the admin; for a non- hierarchical taxonomy, it's `$('#taxonomyname .tagchecklist').sortable()`.


title: Pagination on 2nd loop

text: OK, I am creating a business listing site that is using a custom taxonomy for the listing "type". I need to display two loops on the taxonomy archive page, one for "sponsored" listings and one for regular ones. taxonomy archive: http://pastie.org/3187162 pagination function: http://pastie.org/3187168 Both parts are doing exactly what I want, with one hitch: there are approx 50 non-sponsored listings in a specific category, but the 2nd query is maxing out at 5 "pages" (i.e. 25 listings if I set posts_per_page to 5, 35 if I set posts_per_page to 7) I'm stumped. Any ideas? **UPDATE** FWIW, I've been testing the code layout here: http://www.kriesi.at/archives/how-to-build-a-wordpress-post-pagination- without-plugin and it's working a bit better, in that I get the total number of "pages" it should have. But it still gives me a 404 after page 5.


title: Single page site (Wordpress) including posts

text: I'm creating a single page site and obviously want to include the blog posts. I'm currently looping through the pages and using the_content() and the_title() to display them. However, the_content doesn't include the blog posts on the blog page. I tried another loop in this one, but it didn't work. Any ideas to point me in the right direction? Thanks


title: "Error establishing a database connection" - Intermittent error on GoDaddy

text: After transferring a working WordPress site to GoDaddy hosting, we've begun getting "Error establishing a database connection" errors on all pages- first intermittently, and now consistently. It's strange because it worked most of the time, at least at the beginning, but now errors all the time. This is all within the first few hours of our install- I'm wondering if this might be a database caching issue on WordPress? Is there a cache to clear? Thanks-


title: Adding new Post through Custom Post Type only offers me "Slug" as an option, how do I get more?

text: I've just added a new Custom Post Type to my WordPress site. When I go to create a new post though, the only option I have to edit is "Slug". Normally with a regular post you would have Format, Categories, Post Tags, Featured Image, Excerpy, Send Trackbacks, Custom Fields, Discussion, and Author. How do I get all of these options to show up for me under a Custom Post Type? This is the code I used to create my custom post type.               function create_post_type() {               register_post_type( 'intrigue_faculty',                       array(                               'labels' => array(                               'name' => __( 'Faculty' ),                               'singular_name' => __( 'Faculty' ),                             'add_new_item' => __( 'Add New Faculty Member' ),                             'new_item' => __( 'Add Faculty' ),                             'add_new' => __( 'Add Faculty Member' ),                             'view_item' => __( 'View Faculty Profile' ),                             'not_found' => __( 'No faculty members found' ),                             'search_items' => __( 'Search Faculty Members' ),                             'edit_item' => __( 'Edit Faculty Member Profile' ),                             'description' => __( 'A collection of the profiles for Intrigue Dance Intensive faculty members.' )                         ),                   'public' => true,                   'menu_position' => 5,                   'rewrite' => array('slug' => 'faculty')                   )           );       }             add_action( 'init', 'create_post_type' );


title: Pretty URL with add_query_var

text: I'm trying to add a 'sub post' to each post on my site, eg site.com/product-one/changelog site.com/product-two/changelog site.com/product-three/changelog This is the code I'm using atm, which I found here somewhere:               global $wp,$wp_rewrite;     $wp->add_query_var('sub-page');     $wp_rewrite->add_rule('([^/]+)/(changelog)','index.php?pagename=$matches[1]&sub-page=$matches[2]', 'top');     $wp_rewrite->flush_rules(false);  // This should really be done in a plugin activation      This works fine if I browse to site.com/product-one?sub-page=changelog but if I goto site.com/product-one/changelog i just get redirected back to site.com/product-one So I disabled the canonical redirect as a test using:               remove_filter('template_redirect', 'redirect_canonical');       site.com/product-one/changelog then doesn't redirect but does return a 404 and site.com/product-one?sub-page=changelog still works. Is there something I can change with my rewrite to make this work? Note: I know I could do this easy with custom post types and I started to go down that route, but because the site is already using the %postname% permalink structure, I then wouldn't be able to have the custom post type have that structure as well as the sites pages.


title: Reapproval for edits and deletion after post is published

text: I regularly have guest authors who post one or more articles on a non specific schedule. So I provide them with permanent contributor accounts to avoid the hassle of making them accounts and deleting them every single time. Now this is my problem:   1. Once they submit an article for review and I publish it, they have the option by default to edit it and make changes accordingly.   2. They also have the option to delete it. I am looking for such a feature or way that:   1. Every time they have to edit a post after it has been published, they have to submit it for review before changes are applied. It doesn't mean the post is taken off the website, the original post stays live on the website but the edit can only be applied after being accepted by an editor or admin.   2. It can't be deleted or taken offline by the contributor once it has been published or permission is required to delete or take it offline by admin or editor by the contributor. Can this be achieved? If not, what is closest thing I can do to it to safeguard my information just in case?


title: Form action redirect to the same page

text:
I'm making my own theme. In my theme I have a page that display custom post using a custom query. I added a form to this page. The form contain 2 comboboxes that contain values of meta data of my custom post. I want that when the user select values from this comboboxes and click the submit, Wordpress will show again the same page and will add the submit parameter to my custom query (something like filtering a table). The problem is that when clicking on the submit, Wordpress falling down to the index.php instead to my page. My form declaration is:               <form action='"<?php echo get_page_link(SHIURIM_PAGE)?> "' method='get'>";      Should I put something else in the action? Thank is advanced. My full page code:               <?php     /*     Template Name: Shiurim page     */          require 'search-form.php';     ?>          <?php get_header();           global $THEME_PATH;     global $IMAGES_PATH;          ?>          <link rel="stylesheet" type="text/css" href="<?php _e($THEME_PATH)?>/shiurim.css">
         <img src='<?php _e($IMAGES_PATH)?>/contact-header.jpg' alt="header picture" />

         <?php wp_title(); ?>

                    <?php          function getParam($paramName, $defaultValue) {             if ($_SERVER['REQUEST_METHOD'] === 'GET') {                 if (!empty($_GET[$paramName])) {                     return $_GET[$paramName];                 }             }             else {  // it's a post                 if (!empty($_POST[$paramName])) {                     return $_POST[$paramName];                 }             }             return $defaultValue;         }              $pageIndex = getParam('paged', 0);         $searchRav = getParam(SEARCH_RAV, 0);         $searchSidra = getParam(SEARCH_SIDRA, 0);         $searchText = getParam(SEARCH_TEXT, "");              $searchText = trim($searchText);              $queryArgs = array (             'post_type' => array( POST_TYPE_SHIUR ),             'orderby' => 'title',             'order'    => 'ASC',             'paged' => $pageIndex         );              $paginateSearchArgs = array();         $metaQuery = array();         if ($searchRav != 0) {             $metaQuery[] = array(                 'key' => POST_TYPE_RAV,                 'value' => $searchRav             );                  $paginateSearchArgs[SEARCH_RAV] = $searchRav;         }              if ($searchSidra != 0) {             $metaQuery[] = array(                 'key' => POST_TYPE_SIDRA,                 'value' => $searchSidra             );                  $paginateSearchArgs[SEARCH_SIDRA] = $searchSidra;         }              if (count($metaQuery) > 0) {             $queryArgs['meta_query'] = $metaQuery;         }              if (! empty($searchText)) {             $queryArgs['s'] = $searchText;                  $paginateSearchArgs[SEARCH_TEXT] = $searchText;         }          ?>
         <?php renderSearchFrom($searchRav, $searchSidra, $searchText); ?>

     <?php          //query_posts($queryArgs);         $shiurim_query = new WP_Query( $queryArgs );         global $wp_query;         // Put default query object in a temp variable         $tmp_query = $wp_query;         // Now wipe it out completely         $wp_query = null;         // Re-populate the global with our custom query         $wp_query = $shiurim_query;              $big = 999999999; // need an unlikely integer              echo paginate_links( array(             'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),             'format' => '?paged=%#%',             'current' => max( 1, get_query_var('paged') ),             'total' => $wp_query->max_num_pages,             'prev_text' => '<<',             'next_text' => '>>'         ) );     ?>
          <?php         $is_first = true;         if ( $shiurim_query->have_posts() ) : while ( $shiurim_query->have_posts() ) : $shiurim_query->the_post();          ?>                 <?php if (!$is_first) { ?>

                 <?php } ?>                      <?php                     $is_first = false;                          get_template_part( "content", "shiur-list" );                 ?>      <?php endwhile; else: ?>
<?php _e('Nothing is found'); ?>
          <?php           endif;     // Restore original query object     $wp_query = $tmp_query;     // Be kind; rewind     wp_reset_postdata();           ?>

          <?php get_footer(); ?>      search-form.php (I'm using it in the index.php as well).               <?php          /**      *  Search panel      */          function renderSearchFrom($searchRav = array(), $searchSidra = array(), $searchText = "") {         $rabanimList = getPostArrayResult(POST_TYPE_RAV);         $sdatorList = getPostArrayResult(POST_TYPE_SIDRA);                $html = "
";         $html .= "  <form action='" . get_page_link(SHIURIM_PAGE). "' method='post'>";         $html .= "      By rav";         $html .= "      <select name='search_rav'>";         $html .= "          <option value='0'>All ravs</option>";              foreach ($rabanimList as $rav) {             $isSelected = ' ';             if ($rav['id'] == $searchRav) {                 $isSelected = ' selected ';             }                  $html .= "<option value='" . $rav['id'] . "'" . $isSelected . ">" . $rav['title'] . "</option>";              }               $html .= "</select>";              $html .= "      By sidra";         $html .= "      <select name='search_sidra'>";         $html .= "          <option value='0'>All sidras</option>";              foreach ($sdatorList as $sidra) {             $isSelected = ' ';             if ($sidra['id'] == $searchSidra) {                 $isSelected = ' selected ';             }                  $html .= "<option value='" . $sidra['id'] . "'" . $isSelected . ">" . $sidra['title'] . "</option>";         }              $html .= "</select>";              $html .= "      Free text";         $html .= "      <input type='text' name='search_text' class='searchFreeText' value='" . $searchText . "'/>";              $html .= "      <input type='submit' value='Search' />";         $html .= "  </form>";         $html .= "
";              echo $html;     }          ?>


title: Pageview confusion

text: I'm running a Wordpress website and track my pageviews with a few tools like Google Analytics, Jet Pack, Urchin on hosting and per post with wp_pageviews plugin. If I take yesterday for example I get the following stats: **Pageviews Wednesday May 29th**   * Urchin: 9468    * Google Analytics: 755   * Jetpack Site Stats: 652   * wp_pageviews for one post: 1500 times viewed I'm confused, what to believe? I know GA and Jetpack depends on Javascript, but all stats are different... is it that unreliable?


title: Conflict with wp_homeurl, wp_siteurl and admin interface settings

text: I'm starting wordpress development, and learning the platform. Now I'm stuck with a strange issue. I have created a virtual host configuration that works as expected. I'm using xip.io for dns resolution, that also works as expected I can access wordpress application from other devices. The thing that puzzles me is that if I define WP_HOMEURL and WP_SITEURL variables to the same values that are set via admin->options -> general settings the whole thing breaks. Nothing works anymore, I have to go directly to the database to reset site_url field. The virtual host file               <VirtualHost *:80>         ServerAdmin webmaster@dummy-host.example_dot_com         DocumentRoot "C:/server/wp/wordpress"         ServerName theme.local         ServerAlias local.191.161.3.101.xip.io         ErrorLog "logs/test1.com-error.log"         CustomLog "logs/test1.example.com-access.log" common     </VirtualHost>      Settings in the admin UI               WordPress Address (URL) :  http://local.191.161.3.101.xip.io     Site Address (URL)  :  http://local.191.161.3.101.xip.io      I thought that those values are the same, and that it makes no difference how you define them (`wp-config.php` or via admin interface)? Obviusly I'm doing something wrong, but I can't see what is it.


title: Unable to set right time in admin and frontend template

text: When I run a simple php file called test.php (placed in the root of the wp installation) that contains something like that:               <?php echo date('H:i:s'); ?>      The result is right: `15:30:00` and the timezone is set also correctly to Europe/Prague which is UTC+2 time However, if I place the same line within my e.g. footer or sidebar or even index file of my template than the result is `13:30:00` which is UTC time. The same in my custom plugin in WP admin. the time is 2 hours late. The time in admin options is set correctly to UTC+2. What is funny that if I create a new post or page the time is correct 15:30:00. I don't get it. Any idea why this happens? I have the latest fresh WP installation. 3.5.1 CZ version without any installed plugins. **UPDATE:** I have tried using WP function **date_i18n()** like: `<?php echo date_i18n('H:i:s'); ?>` and it's working as expected. However: `<?php echo date('H:i:s'); ?>` and it's still not working right. But outside wordpress `date()` is working correctly. Why is that? Why is wordpress screwing up `date()` function ?


title: Can't access login screen, wp-login.php 404's

text: When i navigate to `/wp-admin/` i am redirected to `wp-login.php` with the wp- admin URL in the `redirect_to` parameter. Like this:               http://www.domain.com/wp-admin     ... goes to ...     http://www.domain.com/wp-login.php?redirect_to=http%3A%2F%2Fwww.domain.com%2Fwp-admin%2F&reauth=1      If i just navigate to `/wp-login.php/` i get an endless redirect loop. Things i've tried:   * Removing the .htaccess file in the root   * Renaming the `/wp-content/plugins/` folder (to check if any plugins are messing things up)   * Renaming all cookie keys in `wp-config.php`   * Changing permissions of the wp-login.php file to 755 Those are solutions i've found through other forums. I haven't had any success with either of them. Basically what happened is a few months ago i was editing the site theme, and everything was working then. I haven't logged in until today, and now that i tried logging in i was met by this error. Any other ideas?


title: Fix existing media names with accents

text: Today, I updated the version from a wordpress blog and migrate to another server. But, I noticed that most of the image names has accents/special characters in the name. This make the browser doesn't show the images anymore. Is there a plugin/function/command to sanitize all my existing media files, and update the image names in the posts too?


title: How can I add a new CSS class to a widget?

text: I want to assign a new CSS class to default widget `<ul>` in Page/Post creating page in WordPress. How can I do this? See the image below. ![enter image description here](http://i.stack.imgur.com/J1XTy.png)


title: Check if post was modified by editor different than post author

text: Is there a way to check if a post written by user X is modified by a different user (for example admin, or an editor)? What I want to achieve: I have a site where posts are submitted for publication (pending). An editor can publish the post as it is or publish the post after he does corrections. If corrections are made, I'd like to display it in some way ("This post has been published with corrections"). Even better for me would be to display the corrections too (like in a wiki history, or simply with highlights to the changed parts), but I guess a similar feature is not supported by wordpress.


title: Limit Loop to 5 Posts?

text: Heres my current loop:               <?php if ( ! empty ( $GLOBALS['post'] ) && is_single() && in_category( 'movies', $GLOBALS['post'] ) ) :     $movies = new Wp_Query('tag=movie-reviews');      while ( $movies->have_posts() ) :     $movies->the_post(); ?>          <?php get_template_part( 'sidebar-reviews', get_post_format() ); ?>     <?php endwhile; ?>     <?php else : ?>     <?php get_template_part( 'no-results', 'index' ); ?>     <?php endif; ?>


title: Getting Post Permalink Outside of Loop Not Working

text:
I'm trying to get post's permalinks outside of the loop via a wordress plugin. Nothing seems to be working. Here is the original code that does not link to any permalink.               public function get_comments_count($single){             if (isset($this->params['comments']) && $this->params['comments'] == 'yes'){                 return '
Comments
';             } else {             return null;             }         }      To get the comments linking to the permalink, I tried adding echo get_permalink within the href link, like so..               public function get_comments_count($single){             if (isset($this->params['comments']) && $this->params['comments'] == 'yes'){                 return '
<a href="<?php echo get_permalink($post->ID); ?>#disqus_thread">Comments
';             } else {             return null;             }         }      This just returned the link as mysite.com/< ? php echo get_permal... So, I then tried setting a function for permalink and putting it in the href link.. I did this like so...                   public function get_comments_count($single){                     $permalink = get_permalink($post->ID);             if (isset($this->params['comments']) && $this->params['comments'] == 'yes'){                 return '
Comments
';             } else {             return null;             }         }      Unfortunately, this did not work. It just returned the link as mysite.com/#disqus_thread without the actual permalink. I have no idea why this isn't working. :( Any help would truely be appreciated, and if you would like me to paste the full plugin code via pastebin, I gladfully will! Please help a bro out!! :)


title: Editing the Backend Uploader

text: So my boss wants me to edit the backend of his WP site so that he can add a video link from a site called vzaar, which hosts all of our content. I need to know where in the backend I can edit to allow this to happen. I dont need to know how to do it, just need to know what I'm looking for. Here is an image of where he wants the option ![enter image description here](http://i.stack.imgur.com/WesRy.png)


title: Showing a link with Javascript based on log-in status

text: <?php     if ( is_user_logged_in() ) {     echo '';     } else {     echo 'Entrar';     }     ?>      Hello, I'm trying to make this work but i'm not sure how to do the syntax.... any help would be great! thanks!


title: Get Posts in a Custom Post Type category

text: I have trouble in getting post in a custom post type category. I have code below but it doesnt work well. It still get posts in another category.               <?php         $query= null;         $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;         $args=array(             'post_type' => get_post_type(),             'post_status' => 'publish',             'paged' => $paged,             'post_type_cat' => 'featured', // get_post_type() will return post_type, I add _cat -> post_type_cat             //'orderby' => 'rand',             'posts_per_page' => 1,             'meta_query' => array(                 array(                     'key' => '_expiration_date',                     'value' => array(0, current_time('timestamp')),                     'compare' => 'BETWEEN'                     )),                 );         $query = new WP_Query($args);     ?>     <?php if ( $query->have_posts() ) : $query->the_post(); ?>     <?php get_template_part( 'template/featured' ); ?>     <?php else : ?>     <?php get_template_part( 'template/nofeatured' ); ?>     <?php endif; ?>     <?php wp_reset_query(); ?>      Can you help me? Thank you


title: Hacked Site - slow pageload due to external ip address being called

text: One of our customer approached us and told us that one of their wordpress sites (which we did not develop) had irregular long page loading times. After some research we discovered (and removed) two security holes on this page:   1. On the search page the user input was not being escaped, therefore allowing you to execute javascript   2. In one of the uploads folder of a plugin (wysija) we found malicious files (including *.c and *.sh files) Unfortunately, the page load times are still high. We've contacted the hosting provider and they told us that the site spawns php processes which attempt to call an external ip address and whenever this external server does not respond these processes don't stop and eventually there will be too many processes spawned and the site will crash. At this time we are unsure how to "repair" this site. Blocking the external ip on the server is only a workaround since apparently the ip address changes from time to time.


title: Multiple content sections on a custom post

text: I have a custom post type called Case Studies, which I am then pulling out and displaying all on one page. Each Case Study has a few standard sections, and I want a separate editor for each section. For pages with multiple sections, I have been using MultiEdit, which works fine. However, it only works on pages so it isn't an option for this. How would I do this for my custom post type? Or am I approaching the problem wrong?


title: Nginx rules for subdomain multisite install (Bedrock)

text: I'm trying to move an existing Bedrock based multisite instance to nginx and am having difficulty getting a set of nginx rules to mimic the original .htaccess. Bedrock places the crux of the files in a wp/ subdirectory, but the urls still need to be accessible from the root domain. The .htaccess is here as follows:               RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]          # add a trailing slash to /wp-admin     RewriteRule ^wp-admin$ wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule ^(wp-(content|admin|includes).*) wp/$1 [L]     RewriteRule ^(.*\.php)$ wp/$1 [L]     RewriteRule . index.php [L]      I need these at least as nginx conf rules or preferably nginx vhost rules.


title: Using pre_get_posts to rewrite search query to display posts from multiple taxonomies

text: This seems like it should be straightforward, but I'm stuck on it! If a user searches for 'alice', I would like to show them all posts with the custom taxonomy terms of 'bob' and 'carol', regardless of if those posts contain the string 'alice' in them or not. I'm able to set the query's tax_query so that it only shows posts with 'bob' and 'carol' as terms, but I can't reset the actual search query so that it is showing all posts, not just posts with 'alice' in them. This is the filter I'm using to change the tax_query:               if ( !$query->is_search )         return $query;          $taxquery = array(         'relation' => 'OR',         array(             'taxonomy' => 'people',             'field' => 'slug',             'terms' => array( 'bob' ),         ),         array(             'taxonomy' => 'people',             'field' => 'slug',             'terms' => array( 'carol' ),         )     );          $query->set( 'tax_query', $taxquery );     return $query;      but using this to set the search query doesn't work:               $queryvars = array(             's' => ''     );     $query->set( 'query_vars', $queryvars );


title: Setcookie works on admin but not front end

text: I have a simple function to set a cookie to the value of whatever parameter is attached. For example, if I visit http://example.com/?devsource=http://dev.example.com/ it should set the value of the devsourceurl cookie to http://dev.example.com/ This function works great in the WordPress admin, but I cannot get it to work on the front end. I even tried checking to see if headers were already sent at the init action and they weren't. Any ideas what could cause this? Here's the code:               function set_devsource_cookie() {         if ($_GET['devsource']) {             $value = $_GET['devsource'];             setcookie("devsourceurl", $value, time()+3600, COOKIEPATH, COOKIE_DOMAIN, false );             echo $_COOKIE["devsourceurl"]; /* echo cookie if set */         }     }     add_action('init', 'set_devsource_cookie', 0);      Thanks for any help!


title: Using taxonomies to filter content

text: I have a wordpress install with ALOT of pages. These all have specific terms, from a custom taxonomy attached to them. Is it possible to have a `<form>` send a query with multiple terms selected, and then have a page show all pages with one or more of the selected terms attached to them? so a url could be "domain.com/taxonomy/term1+term2+term3 or something similar. I don't need to cross multiple taxonomies, just multiple terms. Is there are template file that would be good for this? archive.php? And how would i send and retrieve these terms? Im currently using this code to build the form:                   <form method="get" class="filter-dropdown-form" action="">             <?php $modules = get_terms( 'modules' ); ?>             <?php foreach( $modules as $module ){ ?>                      <div class="filter-item">                     <input id="module<?php echo $module->term_id;?>" name="test" value="<?php echo $module->slug;?>" type="checkbox">                     <label for="module<?php echo $module->term_id;?>"><?php echo $module->name; ?> </label>                 </div>                  <?php } ?>         </form>      Any help is appreciated!


title: Changing Font-Size based on specific Font thru javascript

text: I am using an 'rtl' font (named as JNN) in horizontal menu bar, which is normal & readable at 18px where as the alternate available 'rtl' fonts (like Tahoma & Arial Unicode MS) on Windows are too much big at 18px. Due to this dissimilarity in 'font-width', If a visitor to my wordpress-site has no JNN font installed on his computer, the menu-bar will shown to him in Tahoma/'Arial Unicode MS' font and hence these fonts disturb the menu-bar- length due to high font-size. Is there any solution through javascript to check the "font-availibility" at the user's end, and if found use "Font-Size-A" and if not then use "Font- Size-B" ? Any help will be highly appreciated.


title: How to have changes made in media library to be reflected on posts/pages

text: I have recently invested a bunch of hours updating the alt text of all the images in a media library, only to realise that the changes are not reflected on posts/pages. Whoops! Is there any way to force these changes across? Or have I no choice but to edit each page manually? Hope someone has good news for me! Thanks


title: Tinymce and uploading local pictures

text: I would like to extend the capabilities of the wordpress editor while keeping the option of uploading local pictures (in the simplest way possible:upload => insert). I found a plugin which seems to be simple and nice - "JBimages" - but there are others too.   All of them are supposed to be dropped in the "plugins" folder of TinyMCE. The thing is I can't find any version of the original tinyMCE (the one having the "plugins" folder).   Wherever I go I find the "Advanced Tinymce" or the "Ultimate Tinymce" but not the original one. And none of these Tinymce's have a folder called "plugins" where I can drop the "JBimages" extension (or any other one). Just to be sure, I went to the TMCE website and took an old version of the plugin but it doesn't seem to work within wordpress 3.x What can I do to add this "upload picture" functionality to a wordpress Tinymce plugin, whatever the version? JBimages would be my first choice but if there is any free and simple solution out there which would achieve my purpose, I'll take it (as long as its straight forward and easy to use).


title: WordPress multi-site, developing locally and syncing live changes

text: I've been working on a local version of a WP multi-site. Since I have been doing this, some of the live sites have been updated with new content. I was wondering if there was a better process to syncing content changes to what I'm planning to do. Which is:   * Download a WordPress XML Export file from each site on the live multi-site network.    * Import the XML files locally   * Push the dev version live. Is there a plugin for example that allows you to Export and Import from all sites on the network automatically? I'm mainly just intrigued to see if anyone else has had this situation and find out what they did.


title: Some doubts about WordPress handle the horizontal main menu visualization

text:
I am pretty new in WP (I came from Joomla) and I have some doubt regarding how WordPress handles the main menu (I mean the horizontal menu in the header). As example I use this online test website: http://onofri.org/WP_BootStrap/ in this website I have install a theme (that use BootStrap CSS framework) and in the **Appearance > Menus** I have a menu called **Menu 1** that is correctly shown in the header (As you can see this menu contains the voices: **Home** , **Sample Page** , **Google** ) To show these voices I think that it use this code snippet take from the **header.php** theme file (Is it true?):                       <?php bloginfo('name'); ?>             <?php wp_nav_menu(                     array(                         'menu' => 'main-menu',                         'container_class' => 'nav-collapse collapse',                         'menu_class' => 'nav',                         'fallback_cb' => '',                         'menu_id' => 'main-menu',                         'walker' => new Bootstrapwp_Walker_Nav_Menu()                     )                 ); ?>      Ok, my doubt is related to he menu behavior in the others preinstalled theme. For example if I change theme using the preinstalled **Twenty Thirteen** theme I obtain this screenshot: ![enter image description here](http://i.stack.imgur.com/8A4G2.png) As you can see in the header I have a "menu" that show only the **Sample Page** voice and not also the other 2 voices that are in my **Menu 1** (Home and Google). Why? Looking in the **header.php** file of the **Twenty Thirteen** theme I can find this code snippet that I think represent the menu navabar:

<?php _e( 'Menu', 'twentythirteen' ); ?>
             <a class="screen-reader-text skip-link" href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentythirteen' ); ?>"><?php _e( 'Skip to content', 'twentythirteen' ); ?>             <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>             <?php get_search_form(); ?>
      I have similar behavior using all the others preinstalled theme. Why in these theme I can't see all the **Menu 1** voices as in my actual theme? what is the difference? Tnx Andrea


title: paypal buynow button integration with wordpress for digital download

text: I found this helpful tutorial about integrating paypal buynow button with wordpress using custom post type.                <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">      <input type="hidden" name="cmd" value="_cart">      <input type="hidden" name="business" value="example@example.com">      <input type="hidden" name="lc" value="GB">      <input type="hidden" name="item_name" value="<?php $meta_values = get_post_meta($post_id, 'product-name'); ?>">      <input type="hidden" name="item_number" value="<?php $meta_values = get_post_meta($post_id, 'product-reference'); ?>">      <input type="hidden" name="amount" value="<?php $meta_values = get_post_meta($post_id, 'product-value'); ?>">      <input type="hidden" name="currency_code" value="GBP">      <input type="hidden" name="button_subtype" value="products">      <input type="hidden" name="no_note" value="0">      <input type="hidden" name="add" value="1">     <input type="hidden" name="bn" value="PP-    ShopCartBF:btn_cart_LG.gif:NonHostedGuest">     <input type="image"   src="https://www.paypalobjects.com/en_GB/i/btn/btn_cart_LG.gif" border="0"   name="submit" alt="PayPal — The safer, easier way to pay online.">      <img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">     </form>      But I am wondering if there is an option to add a redirect for downloading the product/file after payment is completed? I wanna build a wordpress digital sale shop the simplest way without relying on plugins. However, is this method secured at all or will I be better off using an SSL/secured connection? Any help will be appreciated.


title: How to use wp_update_post with ajax on frontend

text: I've been working hard trying to implement a frontend post editor "sidebar" on each post when I'm logged in. You can see what is going on here with a test post: http://www.bennettfeely.com/test-post/. After I get it working it will be restricted so only users with permission will be able to access the frontend editor, of course. Here is the important part of the jQuery/Ajax I'm using currently:               var post_data = $("#editor-post-form").serialize();       .ajax({         type: 'POST',         url: '/wp-content/....../update.php',         data: post_data     });      update.php consists of:               <?php                         $post_id = $_POST['post_id'];             $post_title = $_POST['post_title'];             $post_content = $_POST['post_content'];                      $the_post = array();             $the_post['ID'] = $post_id;             $the_post['post_title'] = $post_title;             $the_post['post_content'] = $post_content;                  $post_id = wp_update_post($the_post);     ?>      Using the awesome powers of the Chrome inspector, update.php is sending back an Error 500 (Internal Service Error). The form data appears to be sent correctly however. I'm guessing whatever problem I'm having is probably caused by some noobish mistake i'm making. Any help would be greatly appreciated. I would gladly give some more information or could try to clarify something if needed. Thank you!!


title: Problem display

text: Hy I have this code:                   <?php          $id_film_array = get_post_meta(get_the_ID(),"info_film", true);         $id_film = $id_film_array[0];         $titlu_film = get_the_title($id_film);     ?>     <?php          $the_query = new WP_Query( array( 'p' => $id_film) );         while ( $the_query->have_posts() ) : $the_query->the_post();     ?>               <a href="<?php echo get_permalink($id_film); ?>"><?php echo $titlu_film; ?>               <?php         endwhile;        // Reset Post Data        wp_reset_postdata();     ?>      I recive an error if i do not have anithing select. How can i fix this. For example i do not want to select nothing for some post, in the page i do not want to retrive nothing. I use Custom Field, Relationship


title: comments_template form redirects back to single page

text: I placed a the `comments_template()` function on the archive page, so the comments, and the comment box is visible under every post. The problem is when I submit the form, wp redirects me to the single page of the post. What is the solution for this?


title: Most commented / popular posts and offset

text:
I am using this code to show 3 most popular posts based on number of comments :               <?php                 $pop_posts = 3;                     $popularposts = "SELECT $wpdb->posts.ID, $wpdb->posts.post_title,  COUNT($wpdb->comments.comment_post_ID) AS 'stammy' FROM $wpdb->posts, $wpdb->comments WHERE comment_approved = '1' AND $wpdb->posts.ID=$wpdb->comments.comment_post_ID AND post_status = 'publish' AND comment_status = 'open' GROUP BY $wpdb->comments.comment_post_ID ORDER BY stammy DESC LIMIT ".$pop_posts;                     $posts = $wpdb->get_results($popularposts);                     if($posts){                         foreach($posts as $post){                             $post_title = stripslashes($post->post_title);                             $guid = get_permalink($post->ID);                             $thumb = get_post_meta($post->ID,'_thumbnail_id',false);                             $thumb = wp_get_attachment_image_src($thumb[0], 'popular-posts-image', false);                             $thumb = $thumb[0];              ?>                                      <?php if ($thumb) { ?>                                     <img src="<?php echo $thumb; ?>" width=80 height=80 />                                 <?php } ?>
<a href="<?php echo $guid; ?>" title="<?php echo $post_title; ?>"><?php echo $post_title; ?>

                          <?php                              }                     }             ?>      but I want to use this code in two different places, so I want to offset the first 3 posts. Is there any way I can offset the three posts? thanks


title: How can I set a different specific header image on each page?

text: 1 am using WordPress 3.3.2 and Twenty Eleven 1.3. I would like to feature a different specific header image on each individual page, corresponding with the content of that page. At present I can get as far as uploading my own different header images, but it seems the only option is to set these to appear randomly on different pages, rather than specific ones I wish them to.


title: Update user meta using Ajax on front end?

text: I would like to update some user meta information from the front end of a WordPress page when the user clicks on a button. I am attempting to pass along a string of data, and then updating the field when the data is passed to the php file. This is the code I have, but the data is not being updated on the user profile page. **Ajax**               jQuery(document).on('click', ".removeFav", function() {              var item = '#'+jQuery(this).parent("div").attr("id");         jQuery(item).remove(item); //visually remove item from product list              // AJAX call to remove item         jQuery.ajax({             url: '<?php echo get_template_directory_uri(); ?>/my-product-delete.php', //using data-slug value to specify unique product id + data-category for tab category (so item isn't deleted across all tabs if there are duplicates)             type: 'post',             data: { 'action' : 'change_json_favoriteString', 'id' :  jQuery(this).parent("div").attr("data-slug") , 'category' :  jQuery(this).parent("div").attr("data-category") },             dataType: 'json',             success: function(data) {                  alert("Deleted");                 alert(JSON.stringify(data));             },              error: function(data){                 alert("error");             }         });     });      **my-product-delete.php**               <?php                   $thisProductID = $_GET['id'];         $thisProductCategory = $_GET['category'];              /* Get current user info */         get_currentuserinfo();               $currentUserID = $current_user->ID;              $currentUsersFavorites = $current_user->json_favorites;              $newJSONfavorites = 'http://wordpress.org'; // <= must create a dynamic variable to populate with new favorites json object         update_user_meta($currentUserID, 'json_favorites', $newJSONfavorites); // <= update users json favorites with new json object                    ?>


title: Update Specific Key Value in Complex `wp_options` object

text: This should b really easy but I can't find reference - easy points for someone! I have an option in my `wp_options` table, and need to set it via `update_option()`. I just can't find the correct syntax for doing something similar to the following where I update the key `object_key` in the option `my_plugin_settings` where this is an option in my `wp_options` table: ` update_option('my_plugin_settings[object_key]','new value'); ` How is it done correctly?


title: Do i need to keep register_post_type in functions.php?

text: I am creating several custom post types, do I need to keep the register_post_type calls in functions.php? I would assume that this would only need to be run the once then removed, or do I need to keep the calls there?


title: delete_post_meta() for whole CPT / multiple posts?

text: I'm cleaning up a theme and one of Custom Post Types has some odd, long gone custom fields. I want to delete them, unfortunately delete_post_meta() takes post->ID for an argument, while I want to perform this action on all the posts not only one. How should I do that? Using a loop? Let's say the CPT is called "custom_photos" and every single post there has these custom fields.


title: Get posts from 2 different categories

text:
I have a custom post (it's called "ait-dir-items") and 2 categories there. On category archive page, I need to get posts which belong to 2 categories.      get posts from 2 categories      Codition.   category1= "food" on "ait-dir-item-category" (food id is 6)   and   category2= "cate" on "ait-dir-item-category" (food id is 39)   and   post_type="ait-dir-items"      I have been trying 3 ways to solve this problem. None of them is working well. please advice me how I could fix it. ## 1st way `query_posts("cat=6, 39&showposts=5&post_type=ait-dir-item");   /*query_posts( array( post_type=>'ait-dir-item', 'category__and' => array(6,39), 'posts_per_page' => 12, 'orderby' => 'title', 'order' => 'DESC' ) );*/ while(have_posts()) : the_post(); echo $title = get_the_title(); echo $content = get_the_content(); endwhile; ` when I put "cat=6, 39" or "'category__and' => array(6,39)", no result found. ## 2nd way ` global $post;                   $tmp_post = $post;              $args = array(             'posts_per_page'  => 5,             'post_type' => 'ait-dir-item',             'category__and' => array(6, 39) // where 1, 2 is cat id             /*'tax_query' => array(                 array(                     'taxonomy' => 'ait-dir-item-special',                     'field' => 'id',                     'terms' => 39 // taxonomy id                 )             )*/         );         $myposts = get_posts( $args );         foreach( $myposts as $post ) :               $feat_image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );         $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'thumbnail_size' );         $url = $thumb['0'];         ?>
<img src="<? echo $url; ?>"/>"><?php the_title(); ?>         <?php endforeach; ?>         <?php $post = $tmp_post; ?>
      ` 3rd way : relation and AND * * * ` $custom_terms = get_terms('ait-dir-item-special'); $other_custom_terms = get_terms('ait-dir-item-category');               foreach ($custom_terms as $custom_term) {     foreach ($other_custom_terms as $other_custom_term) {             wp_reset_query();             $args = array('post_type' => 'ait-dir-item',                 'tax_query' => array(                   'relation' => 'AND',                     array(                     'taxonomy' => 'ait-dir-item-category',                     'field' => 'id',                     'terms' => 6                     ),                         array(                         'taxonomy' => 'ait-dir-item-special',                         'field' => 'id',                         'terms' => 39                         ),                     ),                      );                   $loop = new WP_Query($args);              if($loop->have_posts()) {                 echo '
'.$custom_term->name.'
';                      while($loop->have_posts()) : $loop->the_post();                     echo '
'.get_the_title().'
';                 endwhile;              }         }         }      ` I think I have little problems with these codes. it shows but duplicated and all item posts. how should I fix it? Thanks,


title: Processing shortcodes in groups (separated by line breaks)?

text: ## The Project I'm working on a plugin to resize and embed rows of images using shortcodes that will be converted into `<img>` tags. In most cases there will be multiple images per row, and the rows are separated by line breaks. Here's a simplified example of what 4 rows might look like in the text editor...               [img id="311409" w="1200" h="800"][img id="287556" w="900" h="750"]          [img id="511289" w="600" h="800"][img id="839905" w="850" h="850"][img id="214342" w="1150" h="1800"][img id="973537" w="450" h="300"]          [img id="223798" w="1600" h="900"]          [img id="592297" w="750" h="900"][img id="896732" w="800" h="600"][img id="722292" w="900" h="1100"]      The width and height shortcode attributes are the _original_ dimensions of each image, _not_ the display sizes. The plugin automatically resizes them (smaller) so that each image in the row is the same height and all the images in the row together fit the width of the page exactly. (This math is the easy part that I already have working.) ## The Problem When Wordpress comes across the first image shortcode in a row, it's expected that it will be replace by a real `<img>` tag at that point, but I don't yet know at what size it's supposed to be displayed. There is also no built-in way for the shortcode parser to know when it has reached a line-break. **I need to know how many image shortcodes are on a given line (in the "row") and use all of their dimensions together to calculate the desired size of each image _before_ I'm ready to replace the first shortcode in the row.** As far as I've been able to tell, Wordpress can only deal with each shortcode one at a time in the order they are found, and there doesn't seem to be an easy way to tell where the line breaks fall. ## Solution? Am I overlooking an easy solution? An ideal one would...   1. _**Leave the images easily separable_** -- using one tag per image so I can easily reorder them by dragging and dropping between rows, or even between posts (plus, as I mentioned in a comment below, my actual shortcodes are much more complex than my example and would be _extremely_ unwieldy if combined into one tag per row)   2. _**Use Wordpress' built-in shortcode support_** -- since that's the preferred method for plugins to embed content, and Wordpress has nice parsing tools already built-in for that purpose   3. _**Not require "parent" tags for each row of images_** -- to keep the code simple and flexible for future development   4. _**Remain as future-proof as possible_** -- e.g. if I wrote my own complex regex for this and overloaded `do_shortcode()` then there's a greater chance that this could break in the future as Wordpress evolves ## Compromise... After several hours of research I haven't been able to find anything that would meet all these criteria. If I have to compromise on these points, I would start from the bottom of that list. For example...   1. Rolling my own `do_shortcode()` and/or modifying the (very complex) regex pattern (defined in `get_shortcode_regex()`) -- **_these are the kinds of creative solutions that I am most interested in_**   2. Using parent tags to encapsulate each row, e.g. `[imgrow][img ...][img ...][/imgrow]` -- though that doesn't really answer the question as asked   3. Abandoning the shortcode tools altogether, e.g. implementing a broader custom filter using `add_filter()` -- which technically maintains the shortcode syntax but gives up all the nice tools (and at that point the answer to this question would simply be "it's not currently possible")


title: Leverage permalinks with AJAX

text: I'm trying to implement some AJAX to my theme, but there are a few things I cannot get my head (or Google) around. I have a custom post type named "Faculty" and a page displaying the featured image for each entry in the custom post type in a grid that links to /faculty/entry1, /faculty/entry2 etc. Instead of loading a new page with the content I'm trying to load the content above the grid using the admin-ajax.php file. But how can I implement this leveraging the current "pretty" permalinks? What I would like to achieve is that the user clicks the featured image and the url will change to /faculty/item2 and I will receive the content for item2 via AJAX. And if the user manually enters /faculty/item2 in the browser the same faculty page will load with the content from item2. I really hope the explanation makes sense - and that somebody can give me a pointer in the right direction. EDIT: This is an example of the functionality I'm looking for, just with the WordPress permalinks implemented: http://themewich.com/aware/


title: List all pages including archive

text: I'm creating a custom options page on my site. One of the options is controlling a box on the homepage and i'm trying to set the link for the item to any page on the site via a `select` menu. as of now I can list all the pages including my custom post types - what I'm trying to do is also have the custom post type archive page as a link as well as some sort of ordering in the list. So for example the select hierarchy should be something like this: Work - (Custom Post Type Archive) Matchbox - (Custom Post Type Page) Page - (Regular Page) My current code:               $sitePages= get_posts(array('post_type'=>array('page', 'work', 'people'), 'posts_per_page'=>-1, 'post_status'=>'publish', 'depth'=> 0));          $wp_cats = array();     foreach ($sitePages as $page_list ) {            $wp_cats[$page_list->ID] = $page_list->post_title;     }     array_unshift($wp_cats, " ");      and then a foreach on `$wp_cats` calls it back. any help would be greatly appreciated! _**_*UPDATE*** Based on Sven's answer ∨∨ I used the following code to output everything.               <select name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>">             <option value="">Choose A Page</option>             <?php              $post_types = array( 'page', 'work', 'people' );             $wp_cats = array();             foreach ( $post_types as $post_type ) {                  $pages = get_pages( array( 'post_type'=>$post_type, 'posts_per_page'=>-1, 'post_status'=>'publish', 'depth'=> 0 ) );                  $obj = get_post_type_object( $post_type );             // output custom post type archive with link             if ( $post_type !== 'page' ){             echo '<option value="' . get_post_type_archive_link( $post_type ) .'"';             if (get_option( $value['id'] ) == get_post_type_archive_link( $post_type )) { echo 'selected="selected"'; }             echo '>'. $obj->labels->singular_name . '</option>';             }             foreach ( $pages as $page ) {            $wp_cats[$page->ID] = $page->post_title;            // output posts with link            echo '<option value="' . get_permalink($page->ID).'" ';            if (get_option( $value['id'] ) == get_permalink($page->ID)) { echo 'selected="selected"'; }            echo '>   '. $page->post_title .'</option>';              }            }             ?>     </select>


title: Special 404 header page

text: I wonder if there is a specific way to create a custom 404 header template. This can be done for secondary page, but creating a header-404.php doesn't do the trick. Am I really supposed to create an if in the main header checking whether the is_404() returns true? Thanks Andrea


title: Deactivate a plugin on wp version

text:
I've creating a theme options page at the moment and was playing around with this function `deactivate_plugins()` I'm running wordpress 3.8.3 so running this code in my plugin should uninstall it. Questions 1.Am I using this function incorrectly? 2. Because the version 4.0 of Wordpress doesn't exist does the logic not work?                register_activation_hook( __FILE__, 'dw_deactivate_theme_options' ); // activate hook              function dw_deactivate_theme_options() {             if ( version_compare( get_bloginfo('version'), '4.0', '<') )  { // check the version                 deactivate_plugins( basename( __FILE__ ) ); // deactivate this plugin if the version is lower then 3.8             }         }      Full plugin code               <?php          /*     Plugin Name: Theme Settings     Plugin URI: xxx     Description: This Plugin will generate all of the theme options, Social Media, Logo, Google analytics.     Version: 0.0.1     Author: xxx     Author URI: xxx     License: GPL2     */          /*     Function Reference      plugins_url() - Full plugins directory URL (for example,http://example.com/wp - content/plugins )     register_activation_hook(); Hook to add settings before plugin activation 2nd parem is callback function               */          //Preset plugin functions          register_activation_hook( __FILE__, 'dw_deactivate_theme_options' ); // activate hook          function dw_deactivate_theme_options() {         if ( version_compare( get_bloginfo('version'), '4.0', '<') )  { // check the version             deactivate_plugins( basename( __FILE__ ) ); // deactivate this plugin if the version is lower then 3.8         }     }          add_action('admin_menu', 'dw_theme_options_create_menu');          function dw_theme_options_create_menu() {         //create custom top-level menu         add_menu_page('Theme Options', 'Theme Settings', 'manage_options', __FILE__, 'dw_theme_options_cb');     }          function dw_theme_options_cb() {         echo ''; // ?>
Theme Settings
         <?php echo get_bloginfo('version'); ?>     <?php } ?>


title: Need to have an archive widget which organizes and displays a custom post type using a custom date field

text: I found a handy plugin at http://www.redletterdesign.net/wp/cpt- archive/index.php for generating a calendar archive using a custom post type. My problem is I need it to organize these posts not by the post's publish date but by a custom date field (using Unix time). The custom post type is a custom event calendar which uses user-input (future) dates. Any idea as to how I would go about this?


title: Post interior margin in twenty eleven theme

text: I'm trying to customize the aspect of a single format post, in my case is "Link". I've added a different color background so they look different, editing the CSS as this:               .format-link .entry-content {         padding: 0;         font-style: italic;         background: #d7b5b5; //sfondo rosa     }      So they look like this: http://www.adessomilano.it/wordpress/category/ar/ I'm trying to add a margin between the color and the text in the way there's some free space (but with color background) on left and right side before the text. I've tried adding Margin and Padding values in the CSS but nothing happens, I think because the padding and the margin space take the white color instead of the pink... Can someone explain me? thanks a lot


title: Strange caching behaviour

text: I changed options in my theme (style settings, to keep it simple just say _switched color from blue to red_ ) and it seems nothing happened. After some trial and error I figured out that when I am logged in I **always** see the _blue_ theme. When I delete my cookies, I see the red theme until I sign up again - until I delete my cookies again. It doesn't change anything when I log in as another user. Logged in: _blue_ , Logged out: _red_ The settings I changed are commited to database. * * * I use the w3 total cache plugin. Caching for logged in users is **disabled**. Even when I clear all cache the behaviour don't change. When I disable the plugin or _delete_ the `../wp-content/cache` folder I always (logged in **and** out) see the old, blue theme. Additional: When I disabled the plugin I ahve to delete my cache/cookies to see the new,red theme again. I also disabled **all** plugins and checked the behaviour, it is still the same as described before.   Wordpress and all plugins are up-to-date. Okay I'm aware that it's unlikely to answer this question w/o more information. But I'm running out of ideas and hope you have some things I could check for errors.


title: Check if first paragraph is an image, then show custom code right after it?

text:
I would like to add some code in functions.php that does this:   * If the first paragraph contains an image, show my custom code right AFTER it. For example:

MY CUSTOM CODE

        * But if the first paragraph is text (i.e. NOT an image), show my custom code right BEFORE it.

MY CUSTOM CODE

This 1st paragraph contains text, not an image.

      How do I do it? An example code snippet is most welcome. **PS:** The custom code could also be an ad (e.g. Google Adsense).


title: Making a form for user to add new custom post with custom taxonomies and custom fields

text: ![enter image description here](http://i.stack.imgur.com/gwAIu.png) I want to ask that is there a way display all my custom taxonomies in a drop down menu with checkboxes so when the user check any taxonomy it will be slected and when the user click the submit button .the new post will be created with selected custom taxonomy. i know how to insert it in new post but i WANT TO KNOW ABOUT THE DROPDOWN WITH CHECKBOXES IN THE RED BOX


title: How the widget can be run by shortcode

text: I have my own widget, that uses WP_Widget class, and executes its code inside function in this class. Is there any ways to run this widget using shortcode inside post? This is how my widget structure looks like:               add_action( 'widgets_init', 'register_my_widget' );     function register_my_widget() {}     class My_Widget extends WP_Widget () {         function My_Widget() {}         function widget() {}         function update() {}         function form() {}     }      How can I add the shortcode for executing this widget?


title: How to get the group_id from the "groups_join_group" action in buddypress

text: I want to get the GROUP_creator_id when an user joins any GROUP. So if I got the `group_id` after immediately performing the the `groups_join_group` action by `add_action()` method.


title: Catch 404 after changing permalink structure from /%postname%/ to /%category%/%postname%/

text: I made a site some time ago and after some days some posts were indexed by search engines. Today I changed the permalink structure from `/%postname%/` to `/%category%/%postname%/`. After that, when people come to my site from search engines a `404 page not found error` appears. I want to change all old URLs to the new category base URL without any 404 error. How can I do it?   By the way, I use Yoast plugin.


title: Create Div Wrapper On 3rd Iteration Or When Query Loop Items Run Out

text:
I'm running into an issue.. I've written a code inside a loop so that it creates a new box every 3rd iteration in the loop. It does this nicely, however for example if I have 4 items in a full query of returned posts , it breaks on the 4th one because when it resets to 1 again (from creating the end div tags on the 3rd final iteration then it resets back to 1) it doesn't know to create and end to the 2nd box on the 4th post item. Is there a way so that if there is no more posts left in the query to create end div tag even there's only 1 left? If that makes sense..               <?php if($i%3 == 0){ ?>

Featured Accident Lawyers

     <?php } ?>                      <?php /*echo "$i" . "
"; */?>                 <div class="thumbnail-large box-<?php echo $i; ?>" style="float: left;">                     <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"> <img                     itemprop="image" src="<?php echo $PPT->Image($post->ID, "url", "&w=180&h=128"); ?>" class="listImage"                     alt="<?php the_title(); ?>" title="<?php the_title(); ?>"/>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>

                      <?php $i++; ?>          <?php if($i%3 == 0) {  ?>

          <?php } ?>          <?php if($i == 3){ ?>

<?php } ?>


title: Add quick edit fields without custom colum

text: This question is a follow up on that answer I wrote. Let's say I want to add something to the quick edit box for the _Posts_ post type list table. To do so, I have to add a custom column because of the following part in the `class-wp-posts-list-table.php` file in core:               foreach ( $columns as $column_name => $column_display_name ) {         if ( isset( $core_columns[$column_name] ) )             continue;         do_action( $bulk ? 'bulk_edit_custom_box' : 'quick_edit_custom_box', $column_name, $screen->post_type );     }      As you can see, the filter for custom quick/bulk edit fields won't trigger if there's no custom column registered. Now this, this and this answer suggest to either just add or add and then remove a dummy custom column. So I added a dummy custom column:               $pt = 'post';     add_filter( "manage_{$pt}_posts_columns", array( $this, 'addColDummy' ) );     # add_action( "manage_{$pt}_posts_custom_column", array( $this, 'removeColDummy' ), 10, 2 );     # add_filter( "manage_edit-{$pt}_columns", array( $this, 'remove' ) );      Problem now is: If I then remove the custom column again from within one of those two filters above, the custom code doesn't get triggered anymore. _Question:_ How can I remove the dummy column without removing the custom quick edit stuff again?


title: HTML5 Youtube wrapper works in jsfiddle but not in WP?

text: I've included few file src's and html into my webpage just as shown in jsfiddle. I put the stuff into php file, since wordpress texteditor tends to ruin code. The video doesn't work even in separate page template. Help? :/ Code on my website jsFiddle


title: Exclude a category of posts from all listings if user doesn't have a role

text: I have **some categories** that I'd like **to bulk exclude from all listings** (the loop on the main blog listing page, category listing pages, archives, etc.) and **to show them only to users with a specific role** (one specific category to only one specific role). Right now, as a temporary solution, I am using a code of @G. M. (see bellow) that disallow subscribers to see the content of posts from specified categories, but the posts are listed everywhere and users with different roles can see each other posts, that I want to avoid. Can you help me with a solution?               add_filter('template_include', 'restrict_by_category');          function check_user() {       $user = wp_get_current_user();       if ( ! $user->ID || in_array('subscriber', $user->roles) ) {         // user is not logged or is a subscriber         return false;       }       return true;     }          function restrict_by_category( $template ) {       if ( ! is_main_query() ) return $template; // only affect main query.       $allow = true;       $private_categories = array('reserved', 'personal'); // categories subscribers cannot see       if ( is_single() ) {         $cats = wp_get_object_terms( get_queried_object()->ID, 'category', array('fields' => 'slugs') ); // get the categories associated to the required post         if ( array_intersect( $private_categories, $cats ) ) {           // post has a reserved category, let's check user           $allow = check_user();         }       } elseif ( is_tax('category', $private_categories) ) {         // the archive for one of private categories is required, let's check user         $allow = check_user();       }       // if allowed include the required template, otherwise include the 'not-allowed' one       return $allow ? $template : get_template_directory() . '/not-allowed.php';     }


title: Resize an image on selection from media library

text:
i want the image(image1) that is uploaded by a user to be automatically resized to 360px width and 560px height once selected and image 2 to 280*510 once selected from the media library via the theme options page that i have created.How can this be achieved? Here is a screenshot of the admin panel.![enter image description here](http://i.stack.imgur.com/gyaYu.png) This is the code that that i am using in index.php:                     <?php $image1= get_option('director_image1', IMAGES.'/1.jpg'); ?>           <?php $image2= get_option('director_image2', IMAGES.'/2.jpg'); ?>           <img src="<?php print $image1; ?>"  />           <img src="<?php print $image2; ?>"  />      I have created a theme options page that retrieves the images from the media library. The code in function.php:               <?php require_once('theme-options.php'); ?>      And in theme-option.php:               <?php     // create custom plugin settings menu     add_action('admin_menu', 'director_create_menu');     function director_create_menu() {     //create new submenu     add_submenu_page( 'themes.php', ' Theme Options',     'Theme Options', 'administrator', __FILE__,     'director_settings_page');     //call register settings function     add_action( 'admin_init', 'director_register_settings' );     }     function director_register_settings() {          register_setting( 'director-settings-group', 'director_image1' );     register_setting( 'director-settings-group', 'director_image2' );}          function director_settings_page() {     ?>

Theme Settings
           <form id="landingOptions" method="post" action="options.php">             <?php settings_fields( 'director-settings-group' ); ?>
White iphone slides

             *Upload using the Media Uploader and paste the File URL below.      Image 1:	                            <input type="text" name="director_image1" value="<?php print get_option('director_image1'); ?>" />

Galaxy S3 slides

             Image 1:	                          <input type="text" name="director_image7" value="<?php print get_option('director_image7'); ?>" />

       </form>