Custom post type submenu sorted by specific meta_key & meta_value

I have a created a custom post type called "Events" using register_post_type. I am now trying to create a submenu within "Events" that will only show events sorted by a specific meta_key and meta_value. (Example: Only show events that have been marked as "priority.") I am using this code to create the "priority events" submenu, but the query continues to return **all** of my events instead of just the priority events:               function rt_priority_event_add_submenu() {          $sub_slug = 'edit.php?post_type=event&meta_key=event_priority&meta_value=true';     add_submenu_page('edit.php?post_type=event', 'Priority Events', 'Priority Events', 'manage_options', $sub_slug);       } Here is the Events custom post type is set up:               register_post_type( 'event', array(             'label' => 'Events',             'labels' => rt_ui_labels( 'Event', 'Events', 'redtri' ),             'public' => true,             'has_archive' => true,             'rewrite' => true,             'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail'),         ) );      I don't need any new fancy columns or anything - I just want to use the same columns already set up in Events. Thanks in advance, and please let me know if you need more information!


Creating a Mega Menu

Currently I am creating a theme based on BootStrap 3.0. And the design I came up with utilizes a Mega Menu Navigation. Right now I'm trying to add YAMM3 - Yet Another Mega Menu for Bootstrap 3, however I'm not used to doing anything but a simple drop down menu in WordPress. Can anyone guide me or push me in the right direction on where to get started? I have already created a Bootstrap 3 Theme, I'm just lost on how to add the Mega Menu correctly. Thank you EDIT: This is what I currently have, that only shows a regular BootStrap 3 responsive nav menu.                 class Cwd_wp_bootstrapwp_Walker_Nav_Menu extends Walker_Nav_Menu {          function display_element ($element, &$children_elements, $max_depth, $depth = 0, $args, &$output) {       // check, whether there are children for the given ID and append it to the element with a (new) ID       $element->hasChildren = isset($children_elements[$element->ID]) && !empty($children_elements[$element->ID]);            return parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);     }          // CHANGE .sub-menu INTO .dropdown-menu     function start_lvl(&$output, $depth) {       $indent = str_repeat("\t", $depth);       $output .= "\n$indent
";     }          function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) {       $item_html = '';       parent::start_el($item_html, $item, $depth, $args);       $output .= sprintf('%s', esc_html($item->description));            if (($item->hasChildren) && ($depth === 0)) {         $item_html = str_replace('<a', '<a class="dropdown-toggle" data-toggle="dropdown" data-target="#"', $item_html);         $item_html = str_replace('', ' ', $item_html);       }            $output .= $item_html;     }          }          function cwd_wp_bootstrapwp_nav_menu_css_class($classes, $item) {     // CHANGE .current-menu-item .current-menu-parent .current-menu-ancestor INTO .active     $classes = preg_replace('/(current(-menu-|[-_]page[-_])(item|parent|ancestor))/', 'active', $classes);          // Add the .dropdown class to the list items that have children     if ($item->hasChildren) {       $classes[] = 'dropdown';       //$classes[] = 'yamm-fw';     }          return $classes;     }     add_filter('nav_menu_css_class', 'cwd_wp_bootstrapwp_nav_menu_css_class', 10, 2);


Comment Follow-Up Notifier?

Hey guys. Is there a plugin out there that can easily notify a user of a follow up reply to their comment? I used to use subscribe to comments but it hasn't been updated since 2007. Also, I think I remember being the 'unsubscribe' process to be pretty tedious or confusing. I would like it if each email had an 'unsubscribe' link at the bottom which instantly unsubscribed the user from that notification thread. I would like to continue using the WordPress comment system. I don't want to substitute it for something else like disqus.


Sorting WordPress Posts via Custom Field Values?

Ok, so I'm using the **WPAlchemy class** to create custom field write panels in the write post page, and so far everything has gone great... However, there's one issue I can't seem to figure out. I'm trying to use the custom field values of "event dates" to sort events on a custom page template. I followed the instructions _"Query based on Custom Field and Sorted by Value"_ found in the codex to try and setup the custom query, but it doesn't seem to be working? Here's the code from the custom page template for the " _Events_ " page:               <?php     /*        Template Name: Events     */     get_header();     ?>

Upcoming Events

     <?php          $querystr = "       SELECT wposts.*        FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta       WHERE wposts.ID = wpostmeta.post_id        AND wpostmeta.meta_key = '_events_meta[event_date]'        AND wposts.post_type = 'post'            ORDER BY wpostmeta.meta_value DESC     ";     $pageposts = $wpdb->get_results($querystr, OBJECT);          ?>     <?php if ($pageposts): global $post; $cnt=0; foreach ($pageposts as $post): $cnt++; setup_postdata($post); ?>     <div id="article-<?php echo get_the_ID(); ?>" class="listingbox grid_3">
         <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><img src="<?php echo $events_metabox->get_the_value('event_thumbnail'); ?>" style="outline:1px solid #000" alt="<?php the_title_attribute(); ?>" /><?php $events_metabox->the_value('event_date'); ?>

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

         <?php the_excerpt(); ?>

     <?php if($cnt % 4 == 0) { ?>

     <?php } ?>     <?php endforeach; endif; ?>
     <?php get_footer(); ?>      It's like it's not picking up the custom field keys... The class I'm using to create these custom write panels stores them all as an array, hence the reason I've attempted to access them by using: `_events_meta[event_date]` Maybe that's the problem, but I don't know how to fix it if it is... Any ideas? * * * **EDIT:** Here's an image so you can see just how the custom fields are stored in the database. Hopefully that helps you figure out why on earth `_events_meta[event_date]` won't work in the query? ![Screenshot of PHPMyAdmin with an Insert Query for the WordPress database](http://staticloader.com/phpmyadmin.png)


how to use custom loop in the_content filter

Trying to use the the below code for my CPT 'state' like `add_filter('the_content', 'my_custom_loop');` but the trial and error is not getting me anywhere. I can't use a single-{post_type}.php since i am using a drag and drop theme headway. **Update** : exact code I am trying to use in a functionality plugin and it gives me a warning include-once with debug on or a blank white screen               function my_custom_loop() {     if( is_singular('state') && is_main_query() ) {     $taxonomy = 'state_cat';            $terms = get_the_terms($post->ID, $taxonomy);            if ($terms && ! is_wp_error($terms)) :                $terms_array = array();          foreach ($terms as $term) {       $terms_array[] = $term->slug;     }          $my_query = new WP_Query(       array(         'posts_per_page' => 100,         'post_type' => 'post',         'post__not_in' => array($post->ID),         'category__not_in' => 418,         'tax_query' => array(           array(             'taxonomy' => $taxonomy,             'field' => 'slug',        'include_children' => false,             'terms' => $terms_array           )         )       )     );      //Stores html in buffer      ob_start();      if($my_query->have_posts()) :                  while($my_query->have_posts()) : $my_query->the_post(); ?>

<?php the_post_thumbnail('thumbnail'); ?>

<?php the_title(); ?>

<?php the_excerpt(); ?>

       <?php endwhile; wp_reset_postdata();                   endif;            endif;      }      //get buffer contents      $output = ob_get_clean();           return $output;     }     add_filter('the_content', 'my_custom_loop');      Thank you for your time.


Showing Unpublished Posts to Logged-out Users?

We're working on a plugin where any logged-in user has the ability to submit a new "pitch", or standard post type with custom status of "pitch". Once the pitch is in the system, other logged-in users can vote on the idea, volunteer to participate, or comment on the story in progress. It was simple to list all unpublished posts on a single view by querying the database for posts with `post_status != 'publish'`. I'd like to set it up so both logged-in and unlogged-in visitors can click through on the title and view the post on a single view as well. Default WordPress behavior is to return a 404 unless you have sufficient permissions. I believe viewing permissions are handled in the query object, and I don't see a simple way to unset them. Any creative ideas? Thanks in advance.


Creating 301 Redirects for Post, Page, Category and Image URLs?

I fear this may be too much to ask here, so if so, please feel free to tell me of another place to learn. ### Help with Redirections I'm cleaning up a badly developed site and migrating wordpress from a subdirectory. I've spent hours trying to wrap my head around the logistics of redirections and regex. I think I'm getting a handle on it, but would really appreciate confirmation that I'm doing this right, and any advice on best practices. If anyone knows of any good tutorials with how-to examples, I'd appreciate that too. If anyone knows of _really_ simple plugins for this, I'd be extremely grateful. I've been looking at the Redirections plugin, but find it very confusing (headache!). In any case, my ideas below (sources are followed by => then target) are what I've gathered from the Redirections instructions and screenshots and other tutorials I've scoured. I'm pretty sure that they'd be applicable regardless of whether I put them directly in the .htaccess file or use Redirections or another plugin? So, here's what I'm trying to accomplish and how I think it needs to be done :   1. To move Wordpress from the subdirectory to the root:              /wp/(.*) => /$1        2. For all pages currently within subdirectories in the root, I want to delete and/or combine a bunch of pages into one top level page:              /products-directory/(.*) => /products-top-level-page            /about-directory/(.*) => /about-top-level-page            /services-directory/(.*) => /services-top-level-page          3. For a bunch of top-level pages matching a specific pattern, I want to direct them into specific categories, e.g. the file names all start with the same two words like this: same-word-variation-variation.html and I want them to keep their existing file names -- if I set my permalinks to end with `.html`, this will work, I believe:              /same-word(.*) => /newcategory/$1      How would I create the rule if I don't have permalinks ending in `.html`? (I think I saw ! is the "not" character, but not sure how to use here -- is it):              /same-word(.*) => /newcategory/$1!\.html        4. And then, once I have the specific pages identified and redirected as above, I'll be deleting all the rest (garbage) and want to send users to the home page (or maybe a random post?). So, 2 questions here:     1. How do I create the rule that says "for everything except the files already redirected as above, do this"     2. How would I stop that rule from applying to new pages and posts I create from now on? One idea is that by deleting, I'd be getting a 404 page not found, so I should create the rule for the 404 page itself? Is that what I want to do? As I've said, the site has been badly developed (with the client instructing people to just "throw up a page" with no regard for proper architecture, SEO, etc.) -- it has virtually no ranking or external / back links to worry about, but I want to understand the best approach from an SEO and proper development perspective.   5. Also, should I move existing images etc. into the wp-content directory or leave them in their existing sub-directory/ies? My inclination is to really go for a 'clean-sweep' - get rid of everything that seems untidy, but I'm not sure if this would be more work than it's worth… Thanks in advance for any and all guidance.


Comments numbering on multiple pages

I have a problem with the numbering of my comments when they extend to more than one page. On the new page the numbering starts from again from 1. Also, on page 2 the pingbacks/trackbacks don't appear anymore. This is the code I'm using in `comments.php`:               <?php if ( have_comments() ) : ?>
<?php comments_number('Niciun comentariu', 'Un comentariu', '% comentarii' );?> la: <?php the_title(); ?>

             <?php wp_list_comments(array(               'callback'=>'advanced_comment',               'style'=>'ol',               'type'=>'comment'               ));             ?>
         <?php            if ( $num = t5_count_pings() )             {         ?>
            <?php printf( _n( 'One pingback', '%d pingbacks', $num, 't5_theme' ), $num ); ?>

         <?php wp_list_comments(array (                 'type'     => 'pings',                 'style'    => 'ul',                 'callback' => 'list_pings'             ));         ?>
         <?php } ?>      And these are the functions I used in `functions.php`:               <?php function advanced_comment($comment, $args, $depth) {        $GLOBALS['comment'] = $comment; ?>     <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
          <?php echo get_avatar($comment,$size='48',$default='<path_to_url>' ); ?>            <div class="comment-meta"<a href="<?php the_author_meta( 'user_url'); ?>"><?php printf(__('%s'), get_comment_author_link()) ?>              a scris pe: <?php printf(__('%1$s at %2$s'), get_comment_date(),  get_comment_time()) ?><?php edit_comment_link(__('(Edit)'),'  ','') ?>

          <?php if ($comment->comment_approved == '0') : ?>            <?php _e('Your comment is awaiting moderation.') ?>
          <?php endif; ?>
               <?php comment_text() ?>

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

     <?php } ?>     <?php add_filter('get_comments_number', 'comment_count', 0);     function comment_count( $count ) {     if ( ! is_admin() ) {     global $id;     $comments_by_type = &separate_comments(get_comments('status=approve&post_id=' . $id));     return count($comments_by_type['comment']);     } else {     return $count;     }     }     ?>     <?php      /**      * Count amount of pingbacks + trackbacks for a post.      *      * @param int $post_id Post ID for comment query. Default is current post.      * @return int      */     function t5_count_pings( $post_id = NULL )     {         $pings    = 0;         $comments = FALSE;         if ( NULL !== $post_id )         {             $comments = get_comments(                 array (                     'post_id' => $post_id, # Note: post_ID will not work!                     'status'  => 'approve'                 )             );         }         elseif ( ! empty ( $GLOBALS['wp_query']->comments ) )         {             $comments = $GLOBALS['wp_query']->comments;         }         if ( ! $comments )             return 0;         foreach ( $comments as $c )             if ( in_array ( $c->comment_type, array ( 'pingback', 'trackback' ) ) )                 $pings += 1;          return $pings;     }     ?>      Problems: 1) Trackbacks and pingbacks don't appear on each page of comments. 2) The numbering of comments starts over on each new page.


How to migrate a local WP installation onto Digital Ocean

I'm not sure how many people have experience with Digital Ocean but they're like the new kid on the block for SSD cloud hosting. Anyways there entire model is to basically be a hosting solution for develops (much like AWS). I have created a droplet, accessed it via SFTP, and pointed my nameservers in their direction. However i feel utterly stupid when it comes to migrating a WP site from local to live. I just don't do it enough to ever feel proficient at it. So here i am wanting to approach the problem in the following order: 1) Backup DB and all files (I have backed up my DB with phpMyAdmin but don't have a solid solution for backing up files) 2) Updated wp-config file to reflect the new URL and i'm not sure much else needs to change if i keep my DB with the same name and password 3) Over right all of the new installed WP files on the server with my local versions 4) Do a find and replace on the DB to update any URL's I'm having a problem with step 1. I haven't found a good way to backup my files. I am interested in how to gzip my site locally and then ssh into my droplet and un-gzip, update the wp-config file and call it day. I've been tackling this issue for a week and half, unfortunately i don't have the time to site through one entire day otherwise i would've by now. Does anyone have any expertise on the matter or a bit of advice for this fool? Thanks.


Trying to change the url of a new site

I installed Wordpress a year ago and have been using it as a single user quite contentedly. Recently I was asked if I could let someone else setup a blog under my site. Multisite was the answer and aside from the current problem it works well. When I originally set it up I figured this day might come... so my structure is mydomain.com/blogs/myuser My intention was to have new user's blog at mydomain.com/blogs/newuser but instead it's turning up at mydomain.com/blogs/myuser/newuser I've seen a number of ideas floating about regarding renaming and database editing. I tried to manually move mydomain.com/blogs/myuser/newuser to mydomain.com/blogs/newuser but only recieved 404 errors after editing the database.


WooCommerce New customer email Hook?

I've created a sign up page for new customers to create an account. This is working fine but I would like to hook into WooCommerce `customer_new_account` inside `WooCommerce/Classes/Emails/class-wc-emails.php` to send the welcome email. Is there an existing hook I can use or what's the best way to do this. I don't want to create another welcome email function. Thanks. **Answer**               do_action('woocommerce_created_customer', $user_id, $new_customer_data, false);


Is there a way to prevent the Editor from modifying my HTML

Is there a way to prevent the Visual Editor from modifying my HTML when creating a post or a page? I know it has good intentions in doing what it does, but sometimes I'd prefer it not to touch my HTML, yet render the HTML in visual mode. Thank you! **Sample of code used in editor:**
             Team Demo of the New Shake Table

             May 17, 4-6pm

             Tech Exhibition in Oslo

June 5-9, Halle


If clauses in get_posts query

I am using the get_posts tag to get 4 random posts from a custom post type. However, I only want to get a post IF it has the $pic_url set. I´ve tried using...               if(!$pic_url) {continue;}      But that won´t work since i sometimes end up with displaying fewer than 4 posts (I allways want to display 4 posts).               $rand_posts = get_posts(array( 'numberposts' => 4, 'orderby' => 'rand', 'post_type' => 'ansatte', 'order' => 'ASC' ));         foreach( $rand_posts as $post ) :              $pic_url = get_post_meta($post->ID, 'employee_pic', true);              $name = get_post_meta($post->ID, 'employee_name', true);              $title = get_post_meta($post->ID, 'employee_title', true);              ?>

                 <img src="<?php if($pic_url) { echo $pic_url; } else { echo bloginfo('template_url') . '/images/default_profile_pic.png'; } ?>" />

<?php echo $name; ?>
                 <?php echo $title; ?>
         <?php endforeach;


WordPress stats: OWA plugin overhead in the future

I've found a really promising stats plugin, Open Web Analytics. It has everything I need, also, it is self-hosted, without tracking cookies. The only thing I'm getting worried about is the overhead both in performance both in database size. Does anyone have experience with this plugin?


Rewrite custom post type rss feed links

I am looking for a way to rewrite my custom post type feed located at `http://localhost:8888/feed/?post_type=post` to `http://localhost:8888/feed/portfolio` this post suggests using `http://localhost:8888/portfolio/feed/` which is not the main feed but the comments feed, any ideas? `http://localhost:8888/portfolio/feed` currently the above goes to comments as well.


Wordpress Theory Lesson - Image Columns within posts with alignment?

Trying to get my head round a request from a client, and thought I'd try to hivemind the solution a little bit. The client requires a two column post layout, with images down the right and text on the left. Now, that bit it relatively straight forward (he says, having not tried it yet), but the real trouble is the next requirement. The images in the left column need to align with the starts of paragraphs in the left column. I am struggling to figure this bit out. **--EDIT** - _More Info_ Each post might contain several paragraphs which may or may not have images that require aligning. The backend needs to be free from manual HTML, as the client wishes to maintain the site themselves.


Querying custom post type with 2 custom fields (date-range)

I've searched WP Codex and StackExchange and gotten some clues, but I can't get this query working. I have 2 custom fields associated with each exhibition in Y-m-d format: exstart-date being the start date of the exhibition and exend-date being the ending date. I can easily display upcoming exhibits and past exhibits, but I cannot get the meta_query right to display current exhibits (with a start date less than or equal to today AND end date greater than or equal to today). The code below displays nothing on the page. Help?               $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;     $today = date('Y-m-d', strtotime('-6 hours'));     query_posts(array(         'post_type' => 'exhibitions',          'posts_per_page' => 6,          'paged' => $paged,         'orderby' => 'title',         'order' => 'DESC',         'meta_query'=>array(             'relation'=>'AND',             array(                 'key' => 'exstart-date',                 'value' => $today,                 'compare' => '<=',                 'type' => 'CHAR'                 ),             array(                 'key' => 'exend-date',                 'value' => $today,                 'compare' => '>=',                 'type' => 'CHAR'                 )             )         ));     if (have_posts()) :     while (have_posts()) : the_post();


Creating a Post form outside of the Admin

I am merging Wordpress into a existing system and require our users to be able to make posts to a multi-site WP install. I have a database table that will link our own member to specific blog IDs and stuff, so there will be no need for user/logins as far as WP is concerned. What I really need to know is how to run certain WP functions outside of WP itself - on a completely different domain infact (but same server). I have tried simply including wp-load.php in our existing admin panel but as soon as I do it redirects to the main site - I assume because the domains do not match: domain1.com and domain2.com are both on the same server, domain1.com is the WP MU setup, on domain2.com in our own admin area I am including wp-load.php and as soon as I do it redirects me straight to the homepage of domain1.com. Is it even preferable to do it this way? I have seen a few examples where people have directly queried the WP database to insert posts. but if that's the case I have to ask myself why I am even using WP for this project at all?! I am thinking about using WP XMLRPC API but I need more power than that and don't wish to turn in on really.


Best Way to Add UnEditable HTML to Posts

I find myself more and more needing to use tables or divs inside my wordpress posts content. The problem I find with this is that one wrong backspace or newline, copy / paste has the possibility to throw off the whole code. Is there a best practices when it comes to adding html inside the content? Is there a way to make it so that the user cannot delete certain things inside posts content? For Example: On one of my websites I have an accordion. Each accordion content is seperated by `div class="accordContent"` but when the user adds a new line inside the current `accordContent` div, it ends the current div and creates a new one with the same class that throws off the code.


How to filter wp-auth-check-form

I'm wanting to filter the new inline login. I have a bespoke single sign-on that requires users to sign in through the front page login form. But, when the session times out in the admin area the wp-auth-check-form pops up and displays the standard login form. Does anyone know a way to disable this? I can't find anything in the docs yet. Thanks.


Template for Custom Post Types nested under normal pages (dtbaker 'wiki' pages)

I got stuck trying to display the custom type using dtbakers code (https://gist.github.com/dtbaker/5311512). I guess Im using the wrong single- custom.php This is the hypothetical url: wwww.example.com/casinos/microgaming/casino1 Where 'casinos' is a page, 'microgaming' is a child of 'casinos' and 'casino1' is a custom 'wiki' post that is also a child of 'microgaming'. Im basically using the same login as dtbaker for his example: Custom Post Type nest under a normal WordPress Page The permalink settings are set as day and name. Ive been using single- casinos.php as its the usual template for custom types. Not sure if this could be affecting but Ive got another 3 custom types using this dtbakers function, well Ive done the appropiate changes for each function in order to make them work. Could anyone guide me a little bit please? Dont know why the page keeps giving me a 404 error. Thanks Rocha


Disable comment moderation in multisite

I'm looking for a way to disable comment moderation in wordpress completely over the whole of multisite. This is important because my site requires users to log in to use it, and every new site has to have moderation (for the first comment by a user) turned off manually. I understand that this can be achieved in settings for each site, but I want to turn it off across the network.


Custom Post Order for a Custom Post Type

I need a custom WP-Query written that will display a list of paginated pages (custom post type) in a custom order. I have a custom post type called "courses" I have a custom post type called "events" The "courses" custom post type has a meta key called "course_id". The "events" custom post type has a meta key called "course_id". Currently, Im using code like the below to display a list of paginated "courses".               $args = array(         'post_type'=> 'courses',         'order'    => 'DESC'     );     query_posts( $args );          // The Loop     while ( have_posts() ) : the_post();         echo '<li>';         the_title();         echo '</li>';     endwhile;          // Reset Query     wp_reset_query();      What I would like to be able to do, is to display this same list of courses but ordered based on the number of related "events". Example:-               Course A -> course_id = A01     Course B -> course_id = B01     Course C -> course_id = C01          Event 01 -> course_id = A01     Event 02 -> course_id = A01     Event 03 -> course_id = B01     Event 04 -> course_id = B01     Event 05 -> course_id = B01     Event 06 -> course_id = C01      The custom WP Query will look at each "course" and course_id. It will then count the number of related "events" using the course_id as the unique key. The code would then output the "courses" as               Course B     Course A     Course C      or (if listed in ascending order):               Course C     Course A     Course B      To give you an idea of scale, there are likely to be about 200 different "courses". Each "course" is likely to have 20 - 200 "events" associated to it.


achieving login implementation without using sessions

Wordpress does not use sessions. I always wondered what mechanism does WP use to maintain a user state when user goes from page to page?


Get users with different roles and call function on each of them (user_meta)

First of all, I have a custom function in `functions.php` that gets some author information. This works on great on single posts with a single author.               <?php function the_author_box() { ?>

Over de auteur

<?php echo get_avatar(get_the_author_meta( 'ID' )); ?>

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

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

             <?php if ( get_the_author_meta( 'url' ) ) { ?>
                     <a href="<?php the_author_meta( 'url' ); ?>" title="De website van <?php the_author_meta( 'display_name' ); ?>">Website
                 <?php // a lot more metas ?>

         <?php     } ?>      But now I'm designing a custom page template to display the 'the_author_box' for every user who is either a contributor or an administrator. All on the same page. I figured I could get the users by doing so (borrowed from stackexchange). Build a new function:               function get_clients() {               $users = array();         $roles = array('author', 'contributor', 'administrator');              foreach ($roles as $role) :             $users_query = new WP_User_Query( array(                  'fields' => 'all_with_meta',                  'role' => $role,                  'orderby' => 'display_name'                 ) );             $results = $users_query->get_results();             if ($results) $users = array_merge($users, $results);         endforeach;              return $users;     }      Call the users, and execute the function for every user:               <?php     $users_array = get_clients();     foreach ($users_array as $user) {     $user->the_author_box();     ?>      But that doesn't work. I am guessing because it's still 'the author meta' that's called, and not the user's meta. How can I call a function for `$user->function()`. In other words, how can I get meta information from that user?


Make custom system url

Let's say my site is example.com I want to create example.com/portfolio without creating a page. I just want to execute some PHP code and display a bit of HTML. Is there any way to create "sytem urls" (opposite to "content url") ?


WP_Editor - Setting render location on page

I'm trying to include wp_editor in a settings page.               public function addEditor($content = '')     {                $editor_id = 'createposteditor';              $args = array(             'textarea_rows' => 15,             'teeny' => true,             'quicktags' => false,             'editor_class' => 'createpost-editor'         );              return wp_editor( $content, $editor_id, $args  );     }         and then I echo it out on the settings page:

Add content (optional)
             '. $poster->addEditor() .'
      My issue is, the editor always gets rendered at the top of the page, not from within the `<td>` as I require.


I have this code from home.php that will going to display a content from a page which has a custom post type of "about"               <?php            $post_status1  = 'publish';          $post_type1 = 'page';         $featucat = "about";         $featucount = "1";              $my_query = new WP_Query('post_status='. $post_status1 .'&post_type='. $post_type1.'');           if ($my_query->have_posts()){             while ($my_query->have_posts()) : $my_query->the_post();                      $front_values = get_post_custom_values('Homepage_Blog_01p', get_the_ID());                 foreach ( $front_values as $front_key => $result_value ) {                     if($result_value == 'about') {     ?>
                             <?php                             $description_values = get_post_custom_values('Description_Field', get_the_ID());                             foreach ( $description_values as $description_key => $description_value ) {                                 echo $description_value;                                  }                             ?>                             <a href="<?php the_permalink(); ?>" title="Read the whole post" class="rm">Read More
         <?php } } endwhile; } ?>      but unfortunately, I got this error               Warning: Invalid argument supplied for foreach() in D:\PROGRAM FILES\wamp\www\westchester\wp-content\themes\computerrepair\footer.php on line 22"      does anyone here could atleast point me where i get wrong? I tried organizing the brackets "{}" and also checking line 22 as the error pointed but I had no idea how to apply solutions. PS: let me know if you want to see the codes from functions.php that is relevant from the codes above.


Internal Links to Pages in PHP?

What is the best way of linking to WordPress pages with PHP? Considering that I move the page from a local server to a live server to another URL?               Read more       How could you replace this code with PHP linking to the WordPress page.               /wordpress/services


Have an html site but want to add an existing WordPress site to the back end.

I have an html site and an existing WP site with lot's of content. What I would like to do is tie the two together with the blog on back end. So in essence I would have the .html and then on the menu bar Blog that would take them to content there. Is it possible and not overly complicated? Anyone done this or have a simple step by step process? Kind regards


comments_number fails to print

I want to display the number of comments on a post using the template tag                           <?php comments_number( $zero, $one, $more ); ?>      However, for some reason this tag does nothing and it is not printed to the page. You can view an example of what I mean at http://blog.diginomics.com/bitcoins-innate-regulation/ Here is the full snippet of code for the 3 template tags: author, category, and comment:
                         <a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>" class="post-item">                                                          <?php the_author(); ?>                                                       <a href="<?php get_category_link( $category_id ); ?>" class="post-item">                                                          <?php the_category( '•' ); ?>                                                                                <a href="<?php comments_link(); ?>" class="post-item">                                                          <?php comments_number( $zero, $one, $more ); ?>
      Why are the comment numbers not showing, and as a side question, why is the category split into 2 sections and not styling as it should?


Add header and footer to WP backend

I want to add a header in the backstage in order to look more blend in like the frontend. Nothing much I want to add, just the header and footer is enough. The content section remains the original style. But I can't find an appropriate hook to this area. I tried to add get_header(); into admin-header.php and it works. However, I don't want to mess up with wp core files, so is there any way to add the files? **UPDATE** After months of resarching, I finally gave up this thought that adding frontend header and footer to the backend. Instead, I just use the frontend pages to become the user dashboard. Although, this involved a lot of work (I do it manually, not by a plugin), but it is more flexible. However, still thanks for the advices/suggestion.


Default taxonomy template in plugin, override in theme

Building off of this question/answer, I've sucessfully implemented the `single` view for my custom post types, but I'd also like to offer the same thing for taxonomies. I've looked through the docs and thought that is_taxonomy() would be perfect for filtering out exactly what taxonomy I'm on, but that's deprecated --> and it's replacement, taxonomy_exists(), doesn't necessarily seem like it would fit the bill. So, first question is, can I do the same thing for taxonomies as single-posts described in the question I referenced? (I'm using his question edit solution currently). And secondly, is `is_taxonomy` the way to go here? Really appreciate any insight. Thanks! **Update:** Is query the best way to check for the taxonomy?


Pagination stays on same page for post category

I have a custom taxonomy for a group of posts, and I also have a need to show these posts on a custom page template. I want to show one post at a time, with pagination, so that the user can click through them like a slide show. My template correctly grabs the right category and display one (the first) post, but when I try to click through the pagination, it sends me to the archives for the next post. I want to click "next" and be taken to the next post within the same page template. I've working with this solution, but I can't get it to work. Here's my code, as it is...               <body <?php body_class(); ?>>

                 <img src="<?php echo get_template_directory_uri(); ?>/img/share.png" alt="" />                      <?php if (have_posts()) :                                 while (have_posts()) :                                 the_post(); ?>
                                         <?php the_title('
', '
');                                         if (function_exists('dimox_breadcrumbs')) dimox_breadcrumbs(); ?>
                                     <?php endwhile;                             endif; ?>                 <?php include( TEMPLATEPATH . '/sidebar-right.php' ); ?>                      <?php                   query_posts( array( 'post_type' => 'fieldtrips', 'fieldtripcategory' => 'elementary-school-aquifer', 'order' => 'ASC', 'posts_per_page' => 1 ) );                   if ( have_posts() ) : while ( have_posts() ) : the_post();                 ?>
<?php the_title(); ?>
                   <?php the_content(); ?>                        <?php previous_post('« « %', '', 'yes'); ?> | <?php next_post('% » » ', '', 'yes'); ?>                      <?php endwhile; endif; wp_reset_query(); ?>

     <?php     get_footer();     ?>


Can a plugin deactivate itself?

We have a situation where a couple of our longstanding plugins (Google Analytics is one) are currently offering the option to " **Activate** " them. This figures, because Google Analytics traffic stopped dead a while back. So it seems as if it _did_ turn itself off. Is this possible? Can the plugin's original author issue an update or something which causes it to go wrong and deactivate? Or do we have to assume someone deactivated it by mistake?


I want to develop locally with Multisite, then migrate each site to separate remote WP installs

I use WordPress for the majority of my client work. I develop locally with MAMP and then move the sites to the remote server when its time to go live or show the client the progress. I just migrate the files via FTP and export/import the database with phpMyAdmin, tweak the url and wp-config.php settings, etc. This flow has been working fine, but lately I am tiring of having dozens of different WordPress installs on my local machine, having to go through the motions of setting up a new one every time, etc., and would like to streamline things by switching to Multisite. But I need to be able to export and move each site to its own separate remote server. I'm not ready to us Multisite for my live sites, though it is a tempting idea from a maintenance standpoint. Is the WordPress export function the best way to do this? I realize that I still have to move all of my media files if I do it this way. Does anyone know how Backup Buddy handles this? I've been thinking about throwing down for that service. Thanks!


E-mail Update - Validation

i want to know what is wrong with this code:               if ( !empty( $_POST['email'] ) ){             if (!is_email(esc_attr( $_POST['email'] )))                 $error[] = __('The Email you entered is not valid.  please try again.', 'profile');             elseif(email_exists(esc_attr( $_POST['email'] )) != $current_user->ID )                 $error[] = __('This email is already used by another user.  try a different one.', 'profile');             else{                 wp_update_user( array ('ID' => $current_user->ID, 'user_email' => esc_attr( $_POST['email'] )));             }         }      This is not working with me, i try several changes on it but without success. It keeps warning me the "This email is already used by another user." But it is not! Is like this code is not validating well. PS: I got this code from here: How to edit a user profile on the front end?


Share WordPress Database

Does the WordPress installation has to use an exclusive database? I'm building a website with custom pages, that access a MySQL database. But the site will also have a WordPress installation. Can I use the same database unique for WordPress and the custom pages?


Howto keep header image when changing theme

We have a setup where bloggers can and will have their theme changed. Is it possible to migrate the existing header image to the new theme ? I know how to override the header image with the add_filter, also know how to get the current header image. The issue here is to keep the header image when changing the theme. Is that possible ?


How to remove date, author and comment count from Chameleon search results page

I would like to remove the following from the search results page, I'm using the ET Chameleon theme which doesn't have a search.php file in the editor section. Any help greatly appreciated.               Posted by auscov on Feb 22, 2013 in | 0 comments


How to add Wordpress JS Script Links

Hi I do have a code here from my HTML. I just dont know/forgot on how to link scripts in wordpress...               <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>     <script>window.jQuery || document.write('<script src="js1.js?1"><\/script>')</script>     <script type="text/javascript" src="js2.js?1"></script>


What font does TwentyTweleve use? (not as simple as it sounds)

This initially sounds like a silly question but Im baffled. I downloaded and installed Wordpress with the default TwentyTwelve theme which looks great but I wanted to make a few tweaks. So I went into style.css and changed the css for name of the blog               .site-header h1 a, .site-header h2 a      When I added               font-style:italic      the font and text changed completely. I've attached a screenshot with an addition of font-size:80px just to make it a bit clearer to see. Its exactly the same page, and the only difference is the italic line, but somehow it has changed? I recognise the original is probably Open Sans, but what is the font when I make it italic (the second line) please? I need some rep points to upload images but here is a link: http://i.stack.imgur.com/sKdom.png Seems trivial - but the main difference is the lowercase 'a' and 'f' I've tried Firebug to try and work out what it is but all I can see is that its Open Sans??


Getting all post/page IDs related to a soon-to-be-deleted tag/cat

When deleting a tag, category or other term I would like to get the IDs of the posts that are related to the term before deletion. Wordpress uses wp_delete_term, which is found in taxonomy.php, to delete a term. In this function the earliest hook is "delete_term_taxonomy". However, it seems like the relationships are already deleted before this hook fires. I would like to make this query:               SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id = $id      This would normally return all the post ids related to a term (category/tag/etc). Is there any other hook I can use? Or maybe a hack?


Multiple URLS per post non-ascii

I am looking for some best practice / practical advise on a particular URL use case. I am finding myself using a lot of non-ASCII characters in my URLs. This doesn't really make it easy for users of ASCII computer keyboard layouts to input the URLs or copy the URLs from the browser bar (if they do then it looks like HTML `%CC%B1` crap). Example: when the following URL is copied from the browser URL bar `http://www.hughandbecky.org/2005/u̱t-Maꞌin` When it is pasted it looks like this: http://www.hughandbecky.org/2005/u%CC%B1t-ma%EA%9E%8Cin/ mostly because the underline of the `u` is really unicode character `combining macron below U+0331` and the `'` looking character is really a lowercase Saltillo unicode `latin small letter saltillo U+A78C` What I want to be able to do is allow is allow Americans using ASCII keyboards to type in things like `http://www.hughandbecky.org/2005/ut-main` or `http://www.hughandbecky.org/2005/ut-ma'in` (with `'` being a single quote this time) and be redirected to `http://www.hughandbecky.org/2005/u̱t-Maꞌin`. I know that I could use the plugin redirection and have used it in the past. But this has several drawbacks. Namely, the list could get rather long over time, and it is not managed on the post. So, I would like to manage this in the post's admin screen... Like managing a custom field. This way if I delete the post then it also deletes the additional URLs. I have seen this question `http://wordpress.org/support/topic/multiple-slugs-per-post-in-35` about multiple slugs for WordPress, and in a sense I guess I could conceptualize it that way... but there is no plugin for that either. _So, my question is really, what can be done about this kind of thing?_


No Network/Super admin after enabling Network

I've just successfully enabled networks in WP 3.2.1. However, at top right, I have **no Network Admin** under my (admin) username. If I go to /wp-admin/network, I receive " **You do not have sufficient permissions to access this page**."   * In my WP_Sitemeta table, **site_admins** is set to `a:2:{i:0;N;i:1;s:3:"My_Username";}`.    * **admin_user_id** in this table is blank.   * In, WP_Usermeta, **SL_capabilities** is set to `a:1:{s:13:"administrator";s:1:"1";}` for my admin username. I had disabled all plugins before install. **wp-config** contains the following:               define('WP_ALLOW_MULTISITE', true);     define('MULTISITE', true );     define('SUBDOMAIN_INSTALL', true );     $base = '/';     define('DOMAIN_CURRENT_SITE', 'www.superlogical.net' );     define('PATH_CURRENT_SITE', '/' );     define('SITE_ID_CURRENT_SITE', 1 );     define('BLOG_ID_CURRENT_SITE', 1 );      **Update** : I had another look at wp-config.php, and the entries above were not there. I don't know why. Adding them added "My Sites" to the top left under Dashboard. However, I have no ability to add a site, and I get the same error when visiting /wp-admin/network.


How to optimize multiple insert into wordpress database

I had main file with my plugin and the another file with sql command. In the second file I create two tables and write data to one of them. But I have problem with. In my private computer everything works good but on external server not. How can I optimize command below I have a 700 pieces insert like this:               $wpdb->insert(          $ow_table_adres,          array(              'id' => '',              'address' => 'test',              'kod' => '096-024',              'number' => '4'         )      );


$wpdb class updating meta_value using Ajax

I am trying to create a way to change the order of posts using a meta_key / meta_value that is updated using jQuery ui-sortable. I'm already using menu_order in the same way but need to create a way to preview the new order before saving the new menu_order values. My Ajax function that is not working:               function wnd_preview_item_order() {         global $wpdb;         $order = explode(',', $_POST['order']);         $counter = 0;         foreach ($order as $item_id) {             $wpdb->update($wpdb->postmeta, array( 'meta_key' => '_wnd_pre_order', 'meta_value' => $counter ), array( 'ID' => $item_id) );             $counter++;         }         die(1);     }     add_action('wp_ajax_item_sort', 'wnd_preview_item_order');     add_action('wp_ajax_nopriv_item_sort', 'wnd_preview_item_order');      I'm able to update the menu_order with no problems using a similar Ajax function but I'm stuck on changing the meta_key value. Sortable js: ### Update: I made some adjustments to the js to save the order on click.                   jQuery(document).ready(function($) {             $( "#<?php echo $catID; ?>-sortable" ).sortable({             cursor:'move',             items:'.lineitem',             placeholder:'sortable-placeholder',             tolerance: 'pointer',             forcePlaceholderSize: true,             helper: 'clone',             opacity: 0.65         });         $("#<?php echo $catID; ?>-save-order").bind( "click", function() {            $.post( ajaxurl, { action:'item_sort', order: $( "#<?php echo $catID; ?>-sortable" ).sortable('toArray').toString() },            function() {            $("#<?php echo $catID; ?>-ajax-response").html('

Post Order Updated

');            $("#<?php echo $catID; ?>-ajax-response div").delay(3000).hide("slow");         });            });          });      My Query to display the posts using the meta_value orderby:               $exclude =  $GLOBALS['current_id'];                 if ($count >= 4 ) : $ppp = 4; else : $ppp = 7; endif;                 $args = array(                 'cat' => $category->term_id,                 'meta_key'  => '_wnd_pre_order',                 'orderby'    => 'meta_value_num',                 'order'      => 'ASC',                 'post__not_in' => array($exclude),                 'posts_per_page' => $ppp             );             $cat_query = new WP_Query( $args );      ### Update: This is the Ajax function for changing the menu_order which does work:               function wnd_save_item_order() {          global $wpdb;         $order = explode(',', $_POST['order']);         $counter = 0;         foreach ($order as $item_id) {             $wpdb->update($wpdb->posts, array( 'menu_order' => $counter ), array( 'ID' => $item_id) );             $counter++;         }         die(1);     }


Order Admin sub-menu items?

I am adding items to a CPT Admin menu using `add_submenu_page` which works great, but they are added to the bottom of the sub-menu after the CPT options. I want to be able to have them on top , but I suppose this question can also apply to ordering all Admin based sub-menu items. What I tried ( not working, I tried several variations),               function custom_menu_order($menu_ord) {            if (!$menu_ord) return true;                 return array(                    'edit.php?post_type=page' =>array(                                           'edit.php?post_type=note',                                           'edit_pages',                                           'notes',                                           )                            );     }          add_filter('custom_menu_order', 'custom_menu_order');     add_filter('menu_order', 'custom_menu_order');      Would this be because `menu_order` filter does not take sub-menu's into account?


Add 'if exists' to filter

This almost perfectly fixed an issue I had: How do I add the featured image to the_content after the first paragraph? However, if there isn't a featured image, the code still outputs a blank `<img src alt title>` after the first paragraph, and creates a white space. Any ideas how I can change this code, so it checks **if** there's a featured image and if so, places it after the first paragraph - but if there isn't a featured image, doesn't do anything? Thanks so much in advance if you can help!


How do I duplicate a single wpmu site?

I'm looking for a method to copy a single wpmu site, pages, and content easily. I have not found any plugins that allow me to do this. My goal is to essentially have a template of pages and content that I can replicate. Any thoughts would be appreciated.


Does wordpress have a post hit counter?

Is there anyway to show in a template for a post, how many times that post has been viewed, like hits without some sort of plugin? It seems wordpress would have this built in, but I am unable to find any template tags for such a think in the documentation?


Fatal error when using '#' character as an admin menu link title

When I try to title an admin menu link `#` or `#`, I get a fatal error before the admin menu is loaded: > Fatal error: Cannot access empty property in /path/to/wp-includes/class-wp- > admin-bar.php on line 79 The error does not occur if I use an alphanumeric menu title like `My admin link`. This is the code I am using in functions.php:               function my_admin_bar_menu() {              global $wp_admin_bar;         if ( !is_super_admin() || !is_admin_bar_showing() )             return;              $wp_admin_bar->add_menu( array(         'title' => __( '#'),         'href' => admin_url('myurl.php')));          }          add_action('admin_bar_menu', 'my_admin_bar_menu');


what's different between _x() and _()

What's different between _x() and _(). For example: if a1 can translate as:   * a1 has meaning x1;   * a1 has meaning x2;  How _x() function to get value x1 or x2?


Changing sidebar.php and footer.php depending on URL

I posed a similar question a few days back, but perhaps I put the question a bit incorrectly. I would like my footer.php and sidebar.php to change depending on the URL. If URL contains /ru then show show ru-footer.php else show default footer (footer.php). The same should happen with the sidebar. If it is possible, could you lead me step by step. Thank you


Created a shortcode, using it twice (but differently) on a page but its just outputting the same one twice

I have created a little shortcode that allows a user to output a custom post type contents into another page: `[module name="foo"]` On a given page I have:               [module name="foo"]     [module name="bar"]      However what is output is just _foo_ twice. The relevant code:               <?php           // ASSUMING [module name="some-slug"]     function cpt_shortcode( $atts ){         $a = shortcode_atts( array(             'name' => 'something else',         ), $atts );              if( false === ( $shortcode_post = get_transient( 'shortcode_post' ) ) ) {                  $shortcode_post = new WP_Query( array(                 'post_type'     => 'module',                 'name'          => $a['name']             ));             set_transient( 'shortcode_post', $shortcode_post, 60*60*4 );              }             if ($shortcode_post->have_posts())                 while ($shortcode_post->have_posts()):                     $shortcode_post->the_post();                          // WHICH MODULE                     $moduleType = get_field('module_type');                     if($moduleType == 'basic'){                         include('module-basic.php');                     } elseif($moduleType == 'cta'){                         include('module-cta.php');                     } elseif($moduleType == 'grid'){                         include('module-grid.php');                     } elseif($moduleType == 'carousel'){                         include('module-carousel.php');                     }                 endwhile;             else                 $out = "No modules match your shortcode";             wp_reset_query();                   return html_entity_decode($out);          }     add_shortcode( 'module', 'cpt_shortcode' );               // KILL THE SHORTCODE TRANSIENT WHEN A NEW POST IS SAVED     function shortcode_delete_its_transients() {             delete_transient( 'shortcode_post' );     }          add_action( 'save_post', 'shortcode_delete_its_transients' );      Here is the gist.


wp_editor removes paragraph from custom meta box

I have created a custom meta box like so:               /*quote meta box*/     add_action('add_meta_boxes', 'quote_meta_box');     function quote_meta_box($post) {         global $post;         $post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ;         $blogPage = get_option('page_for_posts');              if($blogPage != $post_id) {             if($post_id != '8') {                 add_meta_box('quote_id', 'Quote', 'quote_meta_box_cb', 'page', 'normal', 'high');                }         }     }          function quote_meta_box_cb($post) {         global $post;              wp_nonce_field('quote_nonce', 'quote_meta_box_nonce');              $values = get_post_custom($post->ID);              $quote = get_post_meta($post->ID, 'quote_text', true);              $settings = array(             'textarea_rows' => 15         );              echo '
Quote
';         wp_editor($quote, 'quote-text', $settings);     }          function quote_save($post_id) {         if(defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;              if(!isset($_POST['quote_meta_box_nonce']) || !wp_verify_nonce($_POST['quote_meta_box_nonce'], 'quote_nonce')) return;         if(!current_user_can('edit_post')) return;              if(isset($_POST['quote-text'])) {             update_post_meta($post_id, 'quote_text', $_POST['quote-text']);         }     }     add_action('save_post', 'quote_save');      I am then calling this out on my template like:               <?php $quote = get_post_meta($post_id, 'quote_text', true); ?>     <?php echo $quote; ?>      I am trying to add a paragraph and a heading tag. Everytime i save the page wp_editor() strips out my p tags but keeps the h4 i use. can someone please help as i am pulling my hair out as i have no idea why it is doing this. Thanks Alex


Utilising posts with various post types & categories?

I need some advice on how to arrange my posts to make it user friendly in the back end. I've created lot's of websites using pages but this is the first time that the post area is quite comprehensive. I've got 4 different types of post - news, events, articles & opportunities. Firstly what's the best way to separate these? So in the cms the user can just see a list of all the news or all the events... i.e not everything post type in one big list. I'd usually use sub-pages but your not able to do this with posts. Secondly, each post type has several themes or sectors associated with it. So news maybe associated with biotechnology, financial or business. While events maybe associated with funding, networking or recruitment. **It's important that when the user creates the post that they don't see a long list of all these words, it has to separate out the words associated with news or events.** Thirdly, I need to utilise the tags section as is. So any keywords they may think can just be added as a tag. The biggest problem I've found is the second point. There doesn't seem any obvious way to stop it showing big lists of things associated with other post types. So on a news item it's not only showing all the news sectors it can be associated with, it's also showing all the events sectors, which is what I don't want. **UPDATE: If you look at the screenshot below. I've added the categories - news, events, articles, opportunities. I then added the sectors as sub categories of each one. It's just added them all in one big list. If the subcategories were indented then it would solve the problem!!** ![enter image description here](http://i.stack.imgur.com/C8kSV.png)


Wordpress - Update all existing posts at once

Is there a way to cycle through all existing, published posts on a WP site, that will replicate pushing the "update" button on every post one by one? This would be a one time event. I have a site with thousands of existing posts and there is no way I can go through and hit "update" on every single one of them. I've added a plugin that will display some new info on each post, but in order for it to work on existing posts, you have to "update" every single post individually. Thanks


Creating a post image to show in a gallery

Sorry if this title of question is not clear. I have create a custom post template with the help of this plugin Custom Content Type Manager With this plugin i create this ![enter image description here](http://i.stack.imgur.com/YhCp7.png), and i am at the **Second Level**. Particular, i want for each attachment post to be represented with the gallery. How can I accomplish this? Thanks in advance.


How to migrate the posts from an old custom legacy blog to a new WordPress website?

I have to migrate the posts of a very old custom legacy blog made in ASP (the posts are stored in a MySql table) into a new WordPress blog. So I need your help to find the smartest solution to do it, I rule out the idea of doing it manually because the number of posts that should be migrated is really high. So looking this ER schema: http://codex.wordpress.org/images/9/97/WP3.8-ERD.png I thought I could create a script that take a post from the post table of my old legacy blog and create a new record on the **wp_posts** wordpress post table of the new blog. Is it a good solution or exist something better? A WP plugin on something like this? Tnx


Trying to Display Number of Posts in Term

I am trying to display the number of posts within each of my custom taxonomy terms. I just need to show if there's 2, 3 10, etc # of posts within my terms. This is my code. Looking for a way to include it in this and still be able to style it individually.               <?php                  $libargs=array(                   'hide_empty'        => 0,                   'parent'        => 0,                   'taxonomy'      => 'industrygroups');                             $libcats=get_categories($libargs);                        foreach($libcats as $lc){                  echo '
';                     $termlink = get_term_link( $lc->slug, 'industrygroups' );                   ?>
 <a href="<?php echo $termlink; ?>">      <img class="img-responsive img-thumbnail" src="<?php the_field('taximage', 'industrygroups_'.$lc->term_id); ?>" />
                 <?php echo $lc->name; ?>
                          <?php the_field('basictext', 'industrygroups_'.$lc->term_id); ?>                       <?php   echo '
'; }?>


Strip <p> and <br> tags from a specific div

I don't know if its WordPress or TinyMCE but something always puts a crap load of paragraph and break tags everywhere which is incredibly annoying. I have a div with an ID of "hover" and I want to strip out all of the paragraph and break tags from ONLY within that div.               remove_filter( 'the_content', 'wpautop' );     remove_filter( 'the_excerpt', 'wpautop' );      The code above will strip them out of everywhere on the site.. I don't want that. I found this on another post:               function the_content_filter($content) {         $block = join("|",array("one_third", "team_member"));         $rep = preg_replace("/(<p>)?\[($block)(\s[^\]]+)?\](<\/p>|<br \/>)?/","[$2$3]",$content);         $rep = preg_replace("/(<p>)?\[\/($block)](<\/p>|<br \/>)?/","[/$2]",$rep);     return $rep;     }     add_filter("the_content", "the_content_filter");      Which I changed to:               function the_content_filter($content) {         return preg_replace("/(<p>)?\[(#hover)(\s[^\]]+)?\](<\/p>|<br \/>)?/","[$2$3]",$content);     }      But I can't get that to work. I just need to strip all the "p" and "br" tags from the #hover div. What am I doing wrong.


How to use Wordpress to embed a SoundCloud download link?

I'm trying to embed a download link for previews in a music site I'm building for a couple of friends. They are currently filling up the system with content and I'm using a SoundCloud iframe HTML5 code and secret link in a custom field to insert into the track's page: http://www.instrumentalbackgroundmusic.com/royalty-free-music/stutter-glitch- orchestral/ The 'download' link isn't appearing despite it being enabled in SoundCloud and visible on the SoundCloud page for the track: https://soundcloud.com/instrumentalbgm/stutter-glitch-orchestral Is there any way I can 'force' the download link to appear? I can't see anything in the SC API about modifying the HTML5 embed code to show the download button... Here's my current code for the embed using Advanced Custom fields:               <?php // Soundcloud preview     if(get_field('sc_preview')) :     echo '
' . get_field('sc_preview') . '
';     endif; ?>      And there's some embed code as an example:                     How do I embed the SoundCloud html5 widget and get the 'download' link to work in the widget? If it involves appending something to the URL of the track, is there a Wordpress function I can use to regex the embed code and add this info?


Custom media uploader not showing library

i am developing a plugin that allows upload an image. Actually the plugin works _fine_ it means, that if you upload an image, the image get set in the database, but, not show the images on the library, so, the user must upload the image all times... thats not good... I dont know why the library is not showing up the images... can anybody help me? Wordpress version 3.6.2 No addtional plugins installed               <script>     jQuery(document).ready(function($){              var custom_uploader;              $('#upload_image_button').click(function(e) {                  e.preventDefault();                  //If the uploader object has already been created, reopen the dialog             if (custom_uploader) {                 custom_uploader.open();                 return;             }                  //Extend the wp.media object             custom_uploader = wp.media.frames.file_frame = wp.media({                 title: 'Choose Image',                 button: {                     text: 'Choose Image'                 },                 multiple: false             });                  //When a file is selected, grab the URL and set it as the text field's value             custom_uploader.on('select', function() {                 attachment = custom_uploader.state().get('selection').first().toJSON();                 $('#upload_image').val(attachment.url);             });                  //Open the uploader dialog             custom_uploader.open();              });     });     </script>


How do I automatically put categories and their descriptions on a WP Page?

I am using a blog to keep track of citations I may want to use for a thesis. Each citation is a Post, authors are categories, which are parents to subcategories that are named for the titles of books or articles by that author. In the description of the book/article subcategories, I put the publishing information, e.g. “Penguin: London, 2007”. Let’s assume that a particular author category is called “Mill, John Stuart” (for whom there are four citations), the book subcategory “On Liberty” (for which there are two citations), and the description “Bantam Classic: London, 1993”. Now, I would like to add a Page that shows all the sources that I have gathered, automatically outputting HTML code like this:
Mill, John Stuart (4)

On Liberty. Bantam Classic: London, 1993. (2)
      This might just as well be done with
s, I’m really only interested in being able to format the output using CSS and having in on a Page. (It’s pretty much just the contents of a Categories widget, but on a Page, plus the category description.) How would I do this, and where would I have to put the relevant code so that it would be displayed on a specific Page? (WP 3.2.1, Graphene 1.4.1)


Change template dynamically

Is it possible to change the template loaded for a page, as it loads, without having to change the record in the database? I suspect it can be done with the `template_redirect` action, and the will probably have something to do with the template-loader.php file in the WP core, but I can't figure it out. Any pointers would be grand!!


Modify WordPress widgets Screen

I have been searching for some time on how to modify the Widgets Administration Screen, i'm attempting to add the sidebar id to the wrapper elements.   * **Current output:** (produced by wordpress)
        * **Desired output:**
      In researching i've come across Stephanie Leary's blog referencing the following ticket. I would like do the same(add sidebar ids to their respective wrappers) but from the **theme functions.php** , ie. without modifying **wp- admin/widgets.php**. If anyone know how it would be great! Thanks!


Is Wordpress a good option for this...?

I want to create 2 new sites. One will be a simple site with a few pages -- not really a blog, but I might add a blog to it at some point. The other site will be more like a blog -- with guest posts by a number of people, and it will probably have affiliate links -- possibly Amazon links. It might also have Google Ads, display ads. For both of these sites, I might want to add things, take things away, change things, etc -- I don't know exactly what I will want to do yet -- I want to have plenty of flexibility here. And I would like a quick way to make the sites look good visually. Is Wordpress a good option for these sites? (I have a dedicated server which is currently running a site in php (which I will keep as-is) and if I understand correctly, to use Wordpress, I'd add the domains for these 2 new sites to the server, download the Wordpress installation files from wordpress.org and then upload those files to my server.) So I want to check if Wordpress is a good option for these 2 sites and for what I want to accomplish...?


Is there a function to list all uploaded images? How can I add one?

Is there a PHP function that will return an array of all of my uploaded images? Or, failing that, how bout just my uploaded files? The end goal is to display a slideshow on my homepage: have it rotate through each image, one at a time. Almost like an animated gif, in an infinite loop/cycle.


delete custom post type using a submit form

here i'm trying on submitting to delete the post in process.. i've tried without the hidden input aswell as doing the if isset on the redirecting page when form's submit. all 3 ways failed.               if(isset($_POST['postType'])            && isset($_POST['idValue']))         {                  $post_type = $_POST['postType'];             $id_post = $_POST['idValue'];                                 $postInfo = array(                 'post_type' => $post_type,                 'ID' => $id_post             );                  wp_delete_post($postInfo, true);              }              if(isset($_GET['action']) && $_GET['action'] == "Supprimer")         {                  ?>

                              <form method="post" action="<?php echo add_query_arg( 'action', 'Deleted', $_SERVER['HTTP_REFERER']); ?>">
Êtes-vous sûr de vouloir supprimer

<?php the_field('titre') ?>
                             <input type="submit" name="delete" value="Continuer"/>                             <?php                                       $post_type = get_post_type( get_the_ID() );                                 $id_post = get_the_ID();                                  ?>                                      <input type="hidden" name="idValue" value="<?php echo $id_post; ?>" readonly />                                 <input type="hidden" name="postType" value="<?php echo $post_type; ?>" readonly />                              </form>
                     Fermer

                  <?php              }      Any tips ? Thx


How to order query by meta value added date

I have a movie trailers website. There are usually two or three trailers on the same page for a movie. I add trailer urls using multiple custom fields. When there is a second or third trailer I simply add it as a custom field and (as you know) there is no need to click Update Post. I was ordering posts by `Modified` date but I now need to order posts by meta value added date so the post will go up and visitors will know there is a newly added (second or third) trailer for the same movie. I first created the query below and it was working fine. It lists posts by `modified date` but as I told I don't click Update Post button any more as I was faced with some serious negative SEO issues.                   <?php $wp_query = new WP_Query( array( 'cat'=>'1', 'posts_per_page' => 20, 'order'=> 'DESC','orderby' => 'modified') );         while ($wp_query->have_posts()) : $wp_query->the_post(); ?>         <?php echo get_post_meta($post->ID, "trailer1", true); ?>
         <?php echo get_post_meta($post->ID, "trailer2", true); ?>
         <?php echo get_post_meta($post->ID, "trailer3", true); ?>         <?php endwhile; ?>      May be we first need to retrive the date that meta value added and order posts by that date? Thanks in advance for your help.


website is viewing as mobile, how do I turn this off?

I have just changed servers from a slow server to a faster server, and I notice that my website is now automatically showing as mobile view? This has not happened before. How do I turn this off or switch it back to normal website view? I'm working in wordpress - theme: Emporium   My website is: www.atadesigns.com Thank you for your help Annette


Create or Update Post Slug from Custom Fields

When i create or update a post, i want to create or update the slug (url) of my post from Custom Fields and not the title...! An idea ? Thank you !


How to get single post by one author?

I just want to get the most latest posts by an author. I am using get_posts at the moment but I notice it doesn't take an author argument, so how I can I specify my author?               $args = array( 'numberposts' => '1');     $posts=get_posts( $args );     foreach($posts as $post)     {                                    setup_postdata($post);         //do stuff     }


wordpress every page returning 500 error

I found out I was editing themes wrong, and that I should be using child themes, so I duplicated the theme I was using, and told it to inherit off of its parent. That's about the only thing I did, I was planning on going through and finding the code I didn't touch and removing those files, but I didn't get that far. After trying to enable my new child theme, every single page, including admin pages gave 500 errors. there is nothing in my log file. I've tried renaming the folder containing the parent theme to the child theme, in hopes that WordPress will load that, and not generate the errors anymore, but it didn't work. I've tried changing the content of style.css in the child theme to be the same as the parent theme, but that didn't work. I don't know what to do. Snippet from the child theme's style.css               /*     Theme Name: pitch-child     Author: me     Version: 1.0     License: GPL 3.0     License URI: http://www.gnu.org/copyleft/gpl.html     Description: Pitch is a simple, minimal business and portfolio theme. It uses custom post types to make it easy to add your content. Pitch also features a big bold slider to put your work front and center.     Tags: gray, two-columns, fixed-width, custom-background, custom-menu, featured-images, theme-options, threaded-comments, translation-ready     */      Ubuntu 12.10, Apache, Mysql,Wordpress also, nothing showing up in the console on the page that shows the 500 error. usually there is some sore of message about the 500 error there. the host hasn't completely stopped working. I was able to access an image. I think it has something to do with a dependent library all pages are using, that can't get accessed.


Correct Way To Show Custom Taxonomy for Image Attachments on Template File

I've created a custom taxonomy called imagetags using the following code:               // Register Custom Taxonomy     function custom_imagetags_taxonomy()  {     $labels = array(     'name'                       => _x( 'Image Tags', 'Taxonomy General Name', 'text_domain' ),     'singular_name'              => _x( 'Image Tag', 'Taxonomy Singular Name', 'text_domain' ),     'menu_name'                  => __( 'Image Tags', 'text_domain' ),     'all_items'                  => __( 'All Image Tags', 'text_domain' ),     'parent_item'                => __( 'Parent Image Tag', 'text_domain' ),     'parent_item_colon'          => __( 'Parent Image Tag:', 'text_domain' ),     'new_item_name'              => __( 'New Image Tag', 'text_domain' ),     'add_new_item'               => __( 'Add New Image Tag', 'text_domain' ),     'edit_item'                  => __( 'Edit Image Tag', 'text_domain' ),     'update_item'                => __( 'Update Image Tag', 'text_domain' ),     'separate_items_with_commas' => __( 'Separate Image Tags with Commas', 'text_domain' ),     'search_items'               => __( 'Search Image Tags', 'text_domain' ),     'add_or_remove_items'        => __( 'Add or Remove Image Tags', 'text_domain' ),     'choose_from_most_used'      => __( 'Choose From Popular Image Tags', 'text_domain' ),     );          $rewrite = array(     'slug'                       => 'imagetags',     'with_front'                 => true,     'hierarchical'               => false,     );          $args = array(     'labels'                     => $labels,     'hierarchical'               => false,     'public'                     => true,     'show_ui'                    => true,     'show_admin_column'          => true,     'show_in_nav_menus'          => true,     'show_tagcloud'              => true,     'rewrite'                    => $rewrite,     );          register_taxonomy( 'imagetags', 'attachment', $args );     }          // Hook into the 'init' action     add_action( 'init', 'custom_imagetags_taxonomy', 0 );      Now I'm trying to create a template page to show images that fit a particular imagetag. I started by naming a file taxonomy-imagetags.php I'm stuck on the type of loop to use. I've tried a few and nothing has worked. Would appreciate any help.


Check if password protected post is visible

Is there anyway of checking if a password protected post is visible / not visible? I want some thing that says this; If the post is password protected (that parts fine) and the correct password hasn't been entered, then show 'XXX', else show 'ZZZ'.


Check if a specific custom field exists?

Is it possible to check if a custom field exists for a given post within the loop? For example, I'm using functions like `get_post_meta($post->ID, 'Company', true);` preceded by a `<h4>` tag, but I'd like to check to make sure that there is a value for the custom field "Company" before writing the `<h4>`. Is this possible?


Wordpress.com XML feed to RSS 2.0 feed?

My company is currently developing a mobile application and is planning on feeding information into it via wordpress.com (due to financial constraints - not for profit organization), but we've run into a problem with the feed. The feeds on wordpress.com are XML and show up improperly in our app. Is there any way to convert this XML feed into an RSS 2.0 feed? I'm open to custom CSS designing on the wordpress site as well. Thanks! Andrew


Importing YouTube Videos As Posts - From Playlists

I've been looking for a way to import videos from YouTube as posts in regular intervals. Preferably daily, weekly is fine too. For the past hour I've been playing with this plug-in: http://www.ternstyle.us/products/plugins/wordpress/wordpress-automatic- youtube-video-posts It offers the ability to post videos to Wordpress as posts, but only from channels, not playlists. I'd like the playlist functionality to dynamically import videos from multiple users. Is there any way I can alter this plug-in, or create a hacked method of accomplishing this?


IP camera jpg stream to post

what are your ideas on grabbing an ip webcams jpg image (which is updated every few seconds) and automatically posting it via wordpress. What would be the best approach? Basically I would like to grab a jpg image, create a new post and create a post image from the webcam jpg found at a certain URL so you get a number of image-posts. Thanks, Andreas


can not call functions in function.php

In front-page.php I have the following code:                         Online:          <?php echo $cbMain->GetInfo()['Players'] . '/' . $cbMain->GetInfo()['MaxPlayers']; ?>           Which is a function in functions.php that calls from this script.It works perfectly. But once I move this code from `front-page.php` to `header.php`, I get the following error:'               Notice: Undefined variable: cbMain in C:\Users\...\header.php on line 102          Fatal error: Call to a member function GetInfo() on a non-object in C:\Users\...\header.php on line 102      In functions.php, I have this function for example:               function get_cbMain_Query() {       define( 'Main_SERVER_ADDR', '0.0.0.0');       define( 'Main_SERVER_PORT', 25565);       define( 'Main_TIMEOUT', 1 );            // require bloginfo('template_url') . 'inc/avatars/MinecraftQuery.class.php';       require_once __DIR__ . '/includes/mcQuery/MinecraftQuery.class.php';            Error_Reporting( E_ALL | E_STRICT );       Ini_Set( 'display_errors', true );            $Timer = MicroTime( true );       $Query = new MinecraftQuery( );            try       {         $Query->Connect( Main_SERVER_ADDR, Main_SERVER_PORT, Main_TIMEOUT );       }       catch( MinecraftQueryException $e )       {        // $Error = $e->getMessage();        // echo 'error.
'. $Error;       }       return $Query;     }      Then `$cbMain = get_cbMain_Query();` So I can use functions in my static front-page.php file, but once I move this script to header.php, it does not work and gives an error. How do I fix this?


Is it possible to get a user with just the password field?

I tried doing something like this:               $user = $wpdb->get_row('         SELECT *          FROM ' . $wpdb->users . '          WHERE user_pass = "' . wp_hash_password('password') . '"'     );      But the `wp_hash_password` function generates a different string from the one in the database, is it possible? What I'd like to do is have a custom form in my template that just asks for a password (think of it like the username/pwd screen to the WP admin area without the username) so I'd hash whatever the user inputs, compare it with my DB and if it matches take that user and log him in.


Limit the amount of menus someone can make

Working on a site of mine I was wondering if it would be possible to set/limit the amount of menus someone can make to '1' (and thereby disabling the current menu location features)? I've been looking at `nav-menus.php` and have noticed               $nav_menus = wp_get_nav_menus( array('orderby' => 'name') );     $menu_count = count( $nav_menus );      and know I am probably looking for a way to filter `wp_get_nav_menus`, but I'm not entirely sure if this would be the best way, or how to do this best. Could someone perhaps assist me with this?


Wordpress $GLOBALS and PHP $GLOBALS

Is the php $GLOBALS associative array over written in WordPress with the WordPress $GLOBALS? I have a piece of code that uses $GLOBALS['myvariablename'] to access a global variable. It works in php, but stops working when I bring the code to a WordPress environment. Is there a way to use $GLOBALS associative array? Or should I absolutely declare variables global before getting them in functions and using them? **Added Later:** My code: http://bharath.lohray.com/sources/redditGetVotes.phps I am trying to use the reddit API to fetch and display the popularity of my links on my wordpress blog. The global variables are for configuration information - like the reddit user name etc. I have documented my steps in my post here.


"Members only" section of a WordPress site - self signup and no backend access

I'm working on a site which is mostly static content and one main blog. Because of this, WordPress looks like the best option to construct this site. However, the client is now looking for the following feature:   * There needs to be a "members only" section, with sub-pages, containing some slightly sensitive information   * Users need to be able to request an account and have their email address verified   * After verification, the admin wants to manually say "yes" or "no" to each registration request before the users are added as members   * Members shouldn't ever have access to the backend, but should stay on the site after registerring and logging in Is there some plugin, or series of plugins, which makes this more straightforward? Does anyone have advice on how this is best set up? Thanks!


W3 Total Cache active but not working (solved)

# Update: Found the reason for the issue. The theme had this               add_action('init','ezgz_buffer');          function ezgz_buffer()     {         ob_start('ob_gzhandler');     }      The above code enables gzip-compression if the visitor's browser can handle it. # Actual Question: This is really really strange for me and I'm trying to figure out it for several hours. W3 Total Cache plugin is installed and active. Preview mode disabled. Page Cache, Minify and Object Cache enabled. Enabled "Degug mode" for Page Cache, Minify, Object Cache. Now I expect W3 Total cache to work and show debug log in page html but it doesn't :( Site is loading as if W3TC doesn't exist. Checks:   * .htaccess file is in place with all the rules needed for W3 Total cache. (Pretty permalinks are working.)   * W3 Total Cache plugin itself not showing any warning or error.   * No other cache plugin enabled.   * Also made sure I'm checking the correct site.   * Server: Apache 2.2.22, PHP 5.3.13 (Hosted in media temple)   * wp-config.php file has `define('WP_CACHE', true);`   * Theme has wp_header() in header.php and wp_footer() in footer.php Compatibility Test: Server Modules & Resources:               Plugin Version: 0.9.2.4     PHP Version: 5.3.13 (PHP5 required for Minify, Rackspace CloudFiles, Microsoft Azure support)     Web Server: Apache     FTP functions: Installed (required for Self-hosted (FTP) CDN support)     Multibyte String support: Installed (required for Rackspace Cloud Files support)     cURL extension: Installed (required for Amazon S3, Amazon CloudFront, Rackspace CloudFiles support)     zlib extension: Installed (required for compression support)     Opcode cache: Not installed     Memcache extension: Not installed     HTML Tidy extension: Not installed (required for HTML Tidy minifier suppport)     Mime type detection: Installed (Fileinfo) (required for CDN support)     Hash function: Installed (hash) (required for NetDNA purge support)     Safe mode: Off     Open basedir: On: /nfs:/tmp:/usr/local:/etc/apache2/gs-bin     zlib output compression: Off     set_time_limit: Available     mod_deflate: Not detected (required for Page Cache (enhanced mode) and Browser Cache)     mod_env: Not detected (required for Page Cache (enhanced mode) and Browser Cache)     mod_expires: Not detected (required for Page Cache (enhanced mode) and Browser Cache)     mod_headers: Not detected (required for Page Cache (enhanced mode) and Browser Cache)     mod_mime: Not detected (required for Page Cache (enhanced mode) and Browser Cache)     mod_rewrite: Not detected (required for Page Cache (enhanced mode) and Browser Cache)     mod_setenvif: Not detected (required for Page Cache (enhanced mode) and Browser Cache)      WordPress Resources               _______________________/.htaccess: OK     _______________________/wp-content: OK     _______________________/wp-content/uploads/2012/06: OK     Fancy permalinks: /%year%/%monthnum%/%postname%/     WP_CACHE define: Defined (true)     URL rewrite: Enabled     Network mode: No      Clicked "emtpy all caches" several times (even though it doesn't seem to work). No clue what so ever. I started it last night and I even thought its because I was sleepy. so took good sleep and still its the same, not just a dream.


WordPress hangs when I publish or update a post

I've been Googling this for a while: I was on 2.8 when this bug occurred, so first thing I did was finally upgrade to 3.1. It didn't fix anything. Next thing I did was disable all the "Update Services". Didn't fix. Then I tried disabling all plugins. Didn't fix. Occasionally it WILL post/publish/update, but only part of the post, leading me to believe all the data is not being submitted (?). Another interesting thing to note that has happened - around the same time this started happening, my admin password stopped working and I was unable to login. Email recovery wasn't working either. So I had to manually change my password using MySQL. Any suggestions? Another thing to note is that this "bug" appeared all of a sudden. I had not made any changes to WordPress in the interval since my last successful post, and when I started noticing the bug. EDIT: OH MY GOD I FINALLY GOT THIS EMAIL FROM HOSTGATOR, THE WORST WEB HOSTING COMPANY EVER: > This issue has been corrected. There was an iptables rule which had been > previously added due to a domain getting attacked on the server which wasnt > removed and was matching a part of the post you were making. I have removed > the rule and the post is not functioning correctly


Sidebar doesnt get updated?

I was trying to edit a theme by updating the style.css of it. But I also needed to add some manual html to the sidebar like ul li's . I maintained the order and updated the html od sidebar within the sidebar div, but I am not sure why wont the side bar get updated automatically. I am not sure if I also need to add this to the sidebar.php and where, why is the sidebar.php not catering to the whole of the sidebar div. Please help me.


Set minimum number of characters in the search

I would like to establish a minimum number of characters in the search. On sites that have many entries, spammers tend to type very short terms as "a" or "of", and the server collapses while trying to return the results. Therefore, I would like to establish the minimum number of characters for the search to be made, for example, three characters. Relevanssi plugin seems to do this. But I would do without using any plugins. Thanks in advance.


Can't get this jQuery snippet to work with Wordpress

I'm using this little gem from CSS Tricks to apply a class to elements once they appear in the viewport window, but it doesn't seem to be working with my WP based site...               (function($) {          $.fn.visible = function(partial) {            var $t            = $(this),           $w            = $(window),           viewTop       = $w.scrollTop(),           viewBottom    = viewTop + $w.height(),           _top          = $t.offset().top,           _bottom       = _top + $t.height(),           compareTop    = partial === true ? _bottom : _top,           compareBottom = partial === true ? _top : _bottom;          return ((compareBottom <= viewBottom) && (compareTop >= viewTop));          };          })(jQuery);          var win = $(window);     var allMods = $(".work-thumb");          allMods.each(function(i, el) {         var el = $(el);         if (el.visible(true)) {             el.addClass("already-visible");          }      });          win.scroll(function(event) {          allMods.each(function(i, el) {         var el = $(el);         if (el.visible(true)) {         el.addClass("come-in");      }      });          });      I can't for the life of me figure out what's going wrong. Anyone have any ideas?


Delete attachments from Front end

I am trying to make a simple media manager on the front end of my posts, as my site will have many authors. I want to give them the ability to delete any picture attachments that they have uploaded to their posts ( without having access to the media manager, because I want this to be mobile compatible). From my research online I came up with the following code which doesn't work. It displays the thumbnail along with the check box asking for the image to be deleted, but when I press submit, the page reloads and no change is seen ( the attachment has not been deleted). Can you guys help me to get this to work please?                <?php     $user_id = get_current_user_id();     if ( $user_id == $EM_Event->event_owner ){     ?>      <?php     if (isset($_POST['submit'])) {           $i = 1;        while ($i < 13) {                         if (isset($_POST['deleteimage'.$i])) {             $value = $_POST['deleteimage'.$i];             if ($value !== '') {                 wp_delete_attachment($value);             }                                }                    $i++;     }     }          $args = array(     'order'          => 'ASC',     'orderby'        => 'menu_order',     'post_type'      => 'attachment',     'post_parent'    => $post->ID,     'post_mime_type' => 'image',     'post_status'    => null,     'numberposts'    => -1,     );                   $images = get_posts( $args );     $imagenum=0;     foreach($images as $image):     $imagenum++;          ?>
         <?php echo wp_get_attachment_image($image->ID, 'thumbnail'); ?>
                     <?php echo $image->ID; ?>                     <?php echo '<input type="checkbox" name="deleteimage'.$imagenum. '"        value="'.$image->ID.'" />Delete Image'; ?>
            <?php endforeach; ?>             <form><input type="submit" value="click submit" name="submit" />    </form>       <?php } ?>


Can I open a Nextgen gallery into a lightbox from an album listing page

I am working with a slightly customized version of the album-compact.php template. I have pretty much just organized the look and feel. I haven't messed with anything else. I have an album listed on a page through the do_shortcode template tag, and want the gallery thumbnail to open a lightbox instead of a new page.

<a class="Link" href="<?php echo $gallery->pagelink ?>">                     <img class="Thumb" alt="<?php echo $gallery->title ?>" src="<?php echo $gallery->previewurl ?>"/>

<?php echo $gallery->galdesc ?>

                     <a class="Link event_archive_link palatino" href="<?php echo $gallery->pagelink ?>">                                             <?php echo $gallery->title ?>

      This does nothing at all. the site is at seattledesigndistrict.com/events/ any ideas?


Author template - separate custom post type by custom taxonomy term for $curauth

Basically I have a post type called photograph, I then have a Taxonomy group called "Subject" and several tax terms i.e. Abstract, freeze frame etc (Approx 18 in total) under that Taxonomy group. I then have a custom author template, where it displays the current authors posts (which are CPT's) and I am looking for a way to output the following for the current author:
Term 1

Photograph cpt, term 1, post 1

Photograph cpt, term 1, post 2

Photograph cpt, term 1, post 3

Term 2

Photograph cpt, term 2, post 1

Photograph cpt, term 2, post 2

Photograph cpt, term 2, post 3

              etc...      I am seriously desperate, and would very much appreciate any help or direction with this. Thanks in advance.


Prevent creating multiple image resizes in twentytwelve template

I am using wordpress twentytweleve template and I notice every time I upload an image it creates 3 different thumbnail sizes. In my media settings I have already set medium & large size to 0. It seems like when I use this theme it will create the 3 different thumbnail sizes but if I use my own custom theme it doesn't create those 3 different sizes. How can I fix this in twentytweleve template?


How to get user information to sub directory?

I have made a wordpress installation in a sub-directory (www.mysite.com/magazine) today. I have login and register option on the home page (www.mysite.com). But the problem is that the users who have registered on the main site, would not be able to login on the sub-directory(/magazine) since both installation have separate datbase. Is there any way so the user data of the main site can be saved into the sub-directory database as well (as they register) ?


How to get a RestFUL URL for a function?

I have a basic custom function which accept GET/POST requests, and process them upon request. Just simply (Lets say GET now):               function miccheck() {         echo "Hello, Mic Check 123! ". $_GET["specialguest"];     }     add_action( 'wp', 'miccheck' );      Then, simply i can call that function from URL as like:               http://www.example.com/?specialguest=JACKIE      Then the home page appeared with `Hello, Mic Check 123! JACKIE`.   All simiply. Then, now i want a specific entry point with RestFUL URL. Like:               http://www.example.com/miccheck/?specialguest=JACKIE     or either     http://www.example.com/miccheck/specialguest/JACKIE      Even the first one is ok, as long as i have a specific `/miccheck/` entry point. How to do it in Wordpress, please? CREATE A DIRECTORY IN DOC-ROOT? (JK!)


Editing new users address with woocommerce

I'm working on a mostly fresh install of WooCommerse. Al that has been done is payment testing on a dev server and site of the plugin in general with my custom fields already in place on the site. I however have noticed an error on the my account page. When a new user logs in their addressed block on the my account page is empty but there is an edit button. If the user clicks edit and tries to save this "new" address they get the following error:               Deprecated: Function ereg() is deprecated in /home/wptest/public_html/wp-content/plugins/woocommerce/classes/class-wc-validation.php on line 108          Warning: Cannot modify header information - headers already sent by (output started at /home/wptest/public_html/wp-content/plugins/woocommerce/classes/class-wc-validation.php:108) in /home/wptest/public_html/wp-includes/pluggable.php on line 875      This issue has also seemed to start happening with existing users that never had this issue (so all saving of addresses). this is on Wordpress v 3.6.1 It does appear to have started after someone updated from 3.5 So I'm going to see if i can backdate everything but on a copy of the site.


Render content after post title in wp-admin

I want a plugin to place custom content below the post title, and to the right of the permalink. However, I cannot find a specific action reference to hook into. The screenshot demonstrates the location idea. How this would be done in pre-3.5 Wordpress ? Is there a specific action reference? ![Location of rendered content](http://i.stack.imgur.com/PghQY.png)