Redirect URL to an existing page with query string or #! added on

I'm trying to make a photo gallery where the individual photos can be shared on Facebook and Twitter, and when you click the link, the photo that was shared will open in a lightbox automatically. Most lightbox plugins provide a deep-linking feature that provides this in the form of a #! after the URL. Unfortunately, both the Facebook (https://www.facebook.com/sharer/sharer.php?u=http://google.com) and Twitter (http://twitter.com/share?text=My%20Tweet&url=http://google.com) share boxes strip out all text after the #. This means that when you try to share a deep- linked lightbox photo, the link just brings you back to the gallery rather than opening that photo. The non-WordPress solution I came up with was to share a static URL and then use a RewriteRule to send them to the correct place. So for example, the user would share "example.com/gallery/123/" on Facebook, and when they went there they would be sent to "example.com/gallery/?photo=123". This would be parsed by Javascript to programmatically click on the correct image and open the lightbox. The RewriteRule I came up with:               RewriteRule ^gallery/(.*)/$ /gallery/?photo=$1 [R]      Does work fine on a static site, but not in WordPress, which is why I'm here! I'd prefer the URL to be /gallery/#!/123, but I know you can't add a #! with RewriteRule, so if anyone can think of a way to do that, it'd be even better!


Is there a way to show full images instead of thumbnails with facebook open graph?

I am using the facebook plugin. I want the thumbnail to be a full image without the thick grey excerpt box below it. (just like if I were to post the image to facebook directly. My posts are image-only, without titles, so I want my followers to see the entire image. I am hoping to do this using open graph meta tags.....but if It isnt possible, can someone please tell me if there is a plugin that will automatically post the full featured image to facebook once the post is published on my wordpress blog. Thanks so much in advance. option 2: Or Even if I could just remove the grey box below the image, i could resize the image to show all of the text. I do not need the excerpt box. its wasted space below my image. take a look: https://www.facebook.com/pages/Illquotes/415928135179118?ref=hl


New Table vs Post / Comment Meta

I am working on theme where I am adding vote functionality to comments and posts. What should I use, meta tables or create a new table?


wp postviews turned to zero

About: wp postviews plugin. A few hours ago, out of the blue, all the post views of our blog show '0 views', though the number of views run into the hundreds for many posts. We have no idea how this came about. Where are the counts for the views per post stored in the database? How can we restore the views for each post/article (I am no specialist)? Surely they are not deleted? I could not find a solution in the WP-Postviews plugin files or documentation. We would very much like to restore the views as they were, so our students can see the response to their posts. Thanks a lot for any help! HP Note: Our 'hosting company' offers no help.


Amending PHP for Wordpress Theme

I have downloaded the following theme (http://demo.fabthemes.com/xenastore/) and i need a little help amending the index page. At the moment it lists every product that i have created on the front page - what i would like is for it to only display a select few from a a certain "department" (they don't use categories) - say Featured. Below the 'Slider' and 'Deals' The code is here but i am unsure which part to amend to only display that department and not everything on the site               <?php get_header(); ?>          <?php get_template_part( 'slider' ); ?>               <?php if (of_get_option('w2f_deal_show')== "1") { ?>

<?php echo of_get_option('w2f_lbanner_head'); ?>

<?php echo of_get_option('w2f_lbanner_text'); ?>

<?php echo of_get_option('w2f_mbanner_head'); ?>

<?php echo of_get_option('w2f_mbanner_text'); ?>

<?php echo of_get_option('w2f_rbanner_head'); ?>

<?php echo of_get_option('w2f_rbanner_text'); ?>

         <?php } ?>
         <?php         $temp = $wp_query;         $wp_query= null;         $wp_query = new WP_Query();         $wp_query->query('post_type=product&paged='.$paged);         ?>         <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>

<a href="<?php the_permalink() ?>">   <?php the_post_thumbnail( 'product_panel', array('class' => 'impanel') ); ?>

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

<?php echo get_the_term_list( $post->ID, 'department', '', ', ', '' ); ?>

<?php wpe_excerpt('wpe_excerptlength_aside', ''); ?>

                     <?php echo get_post_meta($post->ID, 'WTF_price', true) ?>                      <a href="<?php the_permalink() ?>"> More Info

              <?php endwhile; ?>         <?php getpagenavi(); ?>         <?php $wp_query = null; $wp_query = $temp;?>
               <?php get_footer(); ?>      Thank you in advance for your help


get_posts() and filters

I've added a custom filter function for `the_posts` filter in a plugin.               add_filter('the_posts', 'posts_filter');     function posts_filter() { … }      This works pretty well in the main loop, that means the posts are filtered in the way I defined in the `posts_filter` function. But I am calling `get_posts()` within an ajax request to get some posts. And there the filters aren't working. `query_posts()` or custom `wp_query` don't work too. So the question is: How can I get posts beside the main loop which are filtered by `the_posts` filter?


get_page_children() return only titles

I'm using the following code to get a list of all the pages that are children of my project page and display them in a Recent Projects section of my template's footer element. I've noticed that the `get_page_children()` method returns everything about that page - `post_author`, `post_date`, `post_content`, `post_title`, etc. Is there a way to limit this so that it only returns the `post_title`? Otherwise it is creating unnecessary overhead in querying all these other properties that aren't being rendered in the footer. Also, is there a way to limit the number of objects returned? I only want the most recent four ordered by date descending.
Recent Projects

         <?php         // Set up the objects needed         $my_wp_query = new WP_Query();         $all_wp_pages = $my_wp_query->query(array('post_type' => 'page'));              // Get the page as an Object         $projects =  get_page_by_title('Projects');              // Filter through all pages and find Portfolio's children         $projects_children = get_page_children( $projects->ID, $all_wp_pages );              // echo what we get back from WP to the browser         foreach ($projects_children as $project):         ?>
                 <a href="<?php echo get_permalink($project); ?>"><?php echo var_dump($project);//echo $project->post_title; ?>
         <?php endforeach; ?>


How to access data in wordpress database externally using php

I want to share data in specific wordpress database tables with an iOS app. The client wants data entry via wordpress form plugins which create their own tables in the wp database. The plugins I've looked at don't have APIs themselves and examples of wordpress REST APIs all use AJAX which I'm not familiar with and/or can only access info in wordpress posts or user data. Is there a way to do this via php that doesn't involve accessing the database directly? I fear changes in database structure with updates could break the app.


Wordpress .htaccess file gives issues with subdirectory

I have a WordPress installation in the root and a subdirectory, which contains a `index.html` file. This file doesn't give me proper display as what it is supposed to when I access it. But when I rename the `.htaccess` file on root (WordPress main installation), this index file in the subdirectory shows up as it is supposed to. But this makes WordPress non functional. I have no `.htaccess` file in my subfolder. These are the contents of my `.htaccess`:               ## EXPIRES CACHING ##     <IfModule mod_expires.c>     ExpiresActive On     ExpiresByType image/jpg "access 1 year"     ExpiresByType image/jpeg "access 1 year"     ExpiresByType image/gif "access 1 year"     ExpiresByType image/png "access 1 year"     ExpiresByType text/css "access 1 month"     ExpiresByType application/pdf "access 1 month"     ExpiresByType text/x-javascript "access 1 month"     ExpiresByType application/x-shockwave-flash "access 1 month"     ExpiresByType image/x-icon "access 1 year"     ExpiresDefault "access 2 days"     </IfModule>     ## EXPIRES CACHING ##     # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress


Roles and Capabilities in Custom Post Types

Is there a way to create one role with one capability and apply it to some of the custom post types? What I am doing right now is ending up with applying capabilities to all of the posts.. creating role:               $wp_roles->add_role( 'member', 'Paid Membership', array(     'has_paid' => true,     'has_registered' => true     ) );      creating a custom post type (i use a class but you ll get the idea)               AN_Posts::AddPostType( static::post_type, array( 'Group', 'Groups', 'groups' ), array( 'description' => 'A user group',      'map_meta_cap' => true,      'capability_type' => 'an_group',      'capabilities' => array( 'read_post' => 'has_registered',     ) ) );      check permission               if ( is_single() && ! current_user_can( 'read_post', $post->ID ) )         $wp_query->is_404 = true;      Any ideas where i am doing it wrong? Thanks!


deleted users still show in count?

I noticed that deleted users still show in the **count** of the users admin screen. On one blog I deleted 9 users only leaving the admin but it stil shows 9 in the count. In the physical database they are no longer present in the wp_users and wp_users_metadata so.... i guess that the counter is uhm... somewhere else in the database and I set it tot 1 manually in the database?? **update / fix** I notice that the records **wp_capabilities** and **wp_user_level** do not get deleted in the **wp_usermeta** table after deletion after I deleted those 2 records manually in the database the count was back to 1


A good plugin/plugin set for a sports team site?

Looking for a good plugin or group of plugins to handle fixtures, leagues and results. It needs to handle:   * Fixtures    * Results   * League   * Tables   * Cup routes Any tips would be gratefully received.----


Free swf files hosting for wordpress blog

Picasa and Flickr provide Photo service. Is there any service for swf files so that i could share and use swf file in my blog? I don't like to upload swf on my wordpress hosting. I believe Google, Microsoft and Yahoo services only.


Placing Admin Post Metaboxes in Tabs

I am looking for what code one would need to add into the functions.php file which would allow specific metaboxes to show up in tags instead of within their individual metaboxes. Can anyone help with this?


Can i categorise my meta box?

I have this code               <?php     $prefix = 'wtf_';          $meta_box = array(         'id' => 'propertybox',         'title' => 'Property listing details',         'page' => 'listings',         'context' => 'normal',         'priority' => 'high',         'fields' => array(                 array(                 'name' => 'Propert ID number',                 'desc' => 'Enter a property ID number, if any ',                 'id' => $prefix . 'pid',                 'type' => 'text',                 'std' => ''             ),                       array(                 'name' => 'Bath',                 'desc' => 'Number of bathrooms.',                 'id' => $prefix . 'bath',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'An',                 'desc' => 'Anul constructiei',                 'id' => $prefix . 'an',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Etaj',                 'desc' => 'Etajul',                 'id' => $prefix . 'etaj',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Balcone',                 'desc' => 'Numar balcoane',                 'id' => $prefix . 'balcon',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Parcare',                 'desc' => 'Numar locuri de parcare',                 'id' => $prefix . 'parcare',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Suprafata totala',                 'desc' => 'Suprafata totala a terenului (Casa/vila)',                 'id' => $prefix . 'suprafatatotala',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Front stradal',                 'desc' => 'Suprafata front stradal',                 'id' => $prefix . 'front',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Suprafata curte libera ',                 'desc' => 'Suprafata curte libera ',                 'id' => $prefix . 'suprafatacurte',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Amprenta casei ',                 'desc' => 'Suprafata amprentei  ',                 'id' => $prefix . 'amprenta',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Regim inaltime',                 'desc' => 'Regim inaltime  ',                 'id' => $prefix . 'inaltime',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Certificat urbanism ',                 'desc' => 'certificat urbanism',                 'id' => $prefix . 'certificat',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Asking price',                 'desc' => 'Enter the actual asking price ',                 'id' => $prefix . 'price',                 'type' => 'text',                 'std' => ''             )                   ),          );               add_action('admin_menu', 'mytheme_add_box');          // Add meta box     function mytheme_add_box() {         global $meta_box;              add_meta_box($meta_box['id'], $meta_box['title'], 'mytheme_show_box', $meta_box['page'], $meta_box['context'], $meta_box['priority']);     }          // Callback function to show fields in meta box     function mytheme_show_box() {         global $meta_box, $post;              // Use nonce for verification         echo '<input type="hidden" name="mytheme_meta_box_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />';              echo '
';              foreach ($meta_box['fields'] as $field) {             // get current post meta data             $meta = get_post_meta($post->ID, $field['id'], true);                  echo '
',                     '', $field['name'], '	',                     '';             switch ($field['type']) {                 case 'text':                     echo '<input type="text" name="', $field['id'], '" id="', $field['id'], '" value="', $meta ? $meta : $field['std'], '" size="30" style="width:97%" />',                         '
', $field['desc'];                     break;                 case 'textarea':                     echo '<textarea class="theEditor" name="', $field['id'], '" id="', $field['id'], '" cols="60" rows="4" style="width:97%">', $meta ? $meta : $field['std'], '</textarea>',                         '
', $field['desc'];                          break;                 case 'select':                     echo '<select name="', $field['id'], '" id="', $field['id'], '">';                     foreach ($field['options'] as $option) {                         echo '<option', $meta == $option ? ' selected="selected"' : '', '>', $option, '</option>';                     }                     echo '</select>',                     '
', $field['desc'];                     break;                 case 'radio':                     foreach ($field['options'] as $option) {                         echo '<input type="radio" name="', $field['id'], '" value="', $option['value'], '"', $meta == $option['value'] ? ' checked="checked"' : '', ' />', $option['name'];                     }                     break;                 case 'checkbox':                     echo '<input type="checkbox" name="', $field['id'], '" id="', $field['id'], '"', $meta ? ' checked="checked"' : '', ' />';                     break;             }             echo    '',                 '
';         }              echo '
';     }          add_action('save_post', 'mytheme_save_data');          // Save data from meta box     function mytheme_save_data($post_id) {         global $meta_box;              // verify nonce         if (!wp_verify_nonce($_POST['mytheme_meta_box_nonce'], basename(__FILE__))) {             return $post_id;         }              // check autosave         if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {             return $post_id;         }              // check permissions         if ('page' == $_POST['post_type']) {             if (!current_user_can('edit_page', $post_id)) {                 return $post_id;             }         } elseif (!current_user_can('edit_post', $post_id)) {             return $post_id;         }              foreach ($meta_box['fields'] as $field) {             $old = get_post_meta($post_id, $field['id'], true);             $new = $_POST[$field['id']];                  if ($new && $new != $old) {                 update_post_meta($post_id, $field['id'], $new);             } elseif ('' == $new && $old) {                 delete_post_meta($post_id, $field['id'], $old);             }         }     }          ?>      I want the first 3(propert id number, bath, an ) to be categorise in property listing and the others in Mansion listing detalis ![enter image description here](http://i.stack.imgur.com/YG8Pi.jpg) I have done this : but it would not show the first box now the propertybox it is showing just the mansionbox               <?php     $prefix = 'wtf_';          $meta_box = array(         'id' => 'propertybox',         'title' => 'Property listing details',         'page' => 'listings',         'context' => 'normal',         'priority' => 'high',         'fields' => array(                 array(                 'name' => 'Propert ID number',                 'desc' => 'Enter a property ID number, if any ',                 'id' => $prefix . 'pid',                 'type' => 'text',                 'std' => ''             ),                       array(                 'name' => 'Bath',                 'desc' => 'Number of bathrooms.',                 'id' => $prefix . 'bath',                 'type' => 'text',                 'std' => ''             ),         ),          );          $meta_box = array(         'id' => 'mansionbox',         'title' => 'mansion listing details',         'page' => 'listings',         'context' => 'normal',         'priority' => 'high',         'fields' => array(                   array(                 'name' => 'An',                 'desc' => 'Anul constructiei',                 'id' => $prefix . 'an',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Etaj',                 'desc' => 'Etajul',                 'id' => $prefix . 'etaj',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Balcone',                 'desc' => 'Numar balcoane',                 'id' => $prefix . 'balcon',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Parcare',                 'desc' => 'Numar locuri de parcare',                 'id' => $prefix . 'parcare',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Suprafata totala',                 'desc' => 'Suprafata totala a terenului (Casa/vila)',                 'id' => $prefix . 'suprafatatotala',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Front stradal',                 'desc' => 'Suprafata front stradal',                 'id' => $prefix . 'front',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Suprafata curte libera ',                 'desc' => 'Suprafata curte libera ',                 'id' => $prefix . 'suprafatacurte',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Amprenta casei ',                 'desc' => 'Suprafata amprentei  ',                 'id' => $prefix . 'amprenta',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Regim inaltime',                 'desc' => 'Regim inaltime  ',                 'id' => $prefix . 'inaltime',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Certificat urbanism ',                 'desc' => 'certificat urbanism',                 'id' => $prefix . 'certificat',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Asking price',                 'desc' => 'Enter the actual asking price ',                 'id' => $prefix . 'price',                 'type' => 'text',                 'std' => ''             )                   ),          );


Using URL parameters, list posts from category and custom taxonomy

For example, `http://example.com/?cat=6&tag=books` lists posts that belong to category ID 6 and tagged 'books' (i.e. posts that satisfy both conditions). Similarly, `http://example.com/feed/?cat=6&tag=books` does the same for feeds. Now, lets say that my blog has a custom taxonomy called 'edition', with terms 'usa', 'uk', 'china', and so on, under it. The URL `http://example.com/?edition=usa,china` lists posts that belong to both editions 'usa' and 'china'. And `http://example.com/category/cars/?edition=usa` lists those posts from category 'Cars' **that also belong to** the custom taxonomy term 'usa'. ## The problem I use the code below in my functions.php:               add_filter('pre_get_posts','better_editions_archive');     function better_editions_archive( $better_editions_query ) {              /* Looks like this line needs to be changed, not sure how */         if ( $better_editions_query->is_tax( 'edition' ) && $better_editions_query->is_main_query() ) {                  $better_editions_terms = get_terms( 'edition', array( 'fields' => 'ids' ) );             $better_editions_query->set( 'post_type', array( 'post' ) );             $better_editions_query->set( 'tax_query',                 array(                     'relation' => 'OR',                     array(                         'taxonomy' => 'edition',                         'field' => 'id',                         'terms' => $better_editions_terms,                         'operator' => 'NOT IN'                     )                 )             );              }              return $better_editions_query;     }      The code makes sure that if a post is unassigned to any _Edition_ (i.e. if a post is not assigned to any term that belongs to the custom taxonomy 'edition'), the post is shown/listed under all term archives/feeds of the custom taxonomy 'edition'. Now, `http://example.com/category/cars/?edition=usa` only lists posts that belong to the category 'cars' **and specifically marked** 'usa' (a term belonging to the custom taxonomy 'edition'). It doesn't show those posts that aren't assigned to any term in the custom taxonomy 'edition'. How do I fix this? ( **PS:** Setting default terms for posts isn't an option, as we may add more editions later on.) * * * ## Solved but... I've worked out a solution which you can see as an answer to this question. The bounty still stands, so feel free. :)


Create Mashable Follow-like Facebook, Twitter login/connect?

Hi want to ask if anyone can share an idea on how Mashable registration works? Basically the only option you have to register to their site is by Facebook or Twitter, after you login to one of them it automatically create a wp_user. No more Wordpress login/Regs needed. I know many plugins like _Simple Facebook/Twitter/Google connect *_ are available, but i haven't found any plugin related to this one like Mashable have. If anyone can help me on this that will be great. [*] : Simple Facebook Connect, Simple Twitter Connect, Simple Google Connect — by Otto


blog posts sorting doesnt work while using get_query_var

I'm trying to show the latest posts using the `get_query_var` function. The function filters the posts according to their category. When I'm displaying the posts on the page they appear unsorted although I've added the `$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;`   `$args=array(`   `'category__in'=>array( $cat),`   `'order' => ASC,`   `'caller_get_posts' => 1,`   `'paged'=>$paged,`   `'orderby' => date,`   `);`   `query_posts($args);` How can I sort properly?


Creating post content from external web scraper via JSON or RPC

I'm looking for a way to post content from a web scraper external to our Wordpress site to post content its scraped into our site. Right now, I have the scraped content formatted into JSON. Could I somehow use the JSON API to post that json formatted data into a WP site, or would I need to use the XML- RPC approach? **Edit:** I'm actually trying to help a scattershot writing community by bringing together various poems and stories published over twenty different websites run by the writers individually. They would like a site showcasing their work as a whole. No spamming is taking place here.... The scraper, which is written in Python (using a framework called Scrapy), can output what it scrapes in JSON. Let's say, I have a title and description and those are outputted as title: Story Name and description: This story is about this. I want to then post those two bits of data into Wordpress, on a different server, as a post type of Story. I'm asking, since my research shows that the XML-RPC methodology may be old, if the newer JSON API supports this and where I could find a good example. I've been looking for examples but so far haven't found any. Edit: So it seems that coupled with the downvotes and the fact that I failed to identify myself as a non-spammer, this thread might be going the way of many threads in the open source community...however, for the sake of anyone trying to go down the same path as me, who are simply looking for working examples of how to use the JSON API to post content, I did find this discussion. So far I've been able to create a nonce, which is hopeful. now I think I need to write a controller for my next step so I can actually post content of type post: http://wordpress.org/support/topic/plugin-json-api-how-to-add-a-comment-or- post This is the url I tried after generating a nonce for myself... I got an error: http://mysite.com/?json=post.create_posts&nonce='5d3f89d00e'&title='testingpost'&content='this%20is%20mypost%20stuff'&status=publish Which currently returns: {"status":"error","error":"Unknown controller 'post'."}


How go give $value to wp_query

Probly easy question but just cant seem to find whats wrong. I cant build a query based on a search when i use ' ' but not when i use a alrdy declared variable. This works               $query2 = new WP_Query( 's='motorkap met' );      while( $query2->have_posts() ) {                 $query2->the_post();     echo the_title();?> </br> <?php     }      This doesnt for some reason.... I cant seem to find how to pass the already declared variable               $zoekterm = removeCommonWords('motorkap met');           $query2 = new WP_Query( 's=$zoekterm' );      while( $query2->have_posts() ) {                 $query2->the_post();     echo the_title();?> </br>      }      Very stupid I know but been searching for over 2 hours alrdy :( must be passing it wrong somehow tried everything from echo, to just $zoekterm to 's='$zoekterm' ' etc...


Removing Wordpress Plugin Menu Item for a specific user

I want to remove certain dashboard menu times for a specific user. Now this menu consist of plugin menu items as well. One particular plugin I want to hide from the user is Contact Form 7. Here is the code added to the functions.php file to hide the menu items:               function remove_menus()     {         global $menu;         global $current_user;         get_currentuserinfo();         if($current_user->user_login == 'brian')         {             $restricted = array(__('Media'),                                 __('Links'),                                 __('Pages'),                                 __('Comments'),                                 __('Appearance'),                                 __('Plugins'),                                 __('Users'),                                 __('Tools'),                                 __('Settings'),                         __('WPCF7')  //this does not work             );             end ($menu);             while (prev($menu)){                 $value = explode(' ',$menu[key($menu)][0]);                 if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}             }// end while         }// end if     }     add_action('admin_menu', 'remove_menus');       Now everything listed in the code above here is hidden, except for the Contact Form 7 Plugin menu. How do I call the correct plugin name? Thanks


pagination custom post type on CP page

I know that there are a lot of topics on this question and I've read a lot of them and tried different things. But pagination is still not working. I think it has something to do with the permalink settings. **The situation** I have a custom post type called artists which I link to events. On the artist page I show all the events the artist is linked to (they're linked using the posts 2 posts plugin). I'd like to paginate these events. Let's use ACDC as an example artist. The pagination is showing, and the links point to `root/artist/acdc/page/#` where # is the page number. If I click on page 2 for example I'm not going to `root/artists/acdc/page/2`. The page does seem to load, but I end up at the same URL showing the first 3 posts (`roots/artists/acdc`). So I don't get a 404. When I go to `root/artists/acdc?page=2`, the URL becomes `root/artists/acdc/2/`, but it still displays the 3 posts from page 1. This happens when `'format'` is set to `'/page/%#%'` in `paginate_links`. If I then hover the pagination link for page 3, the link becomes `root/artists/acdc/2/page/3`... **My settings**   * Permalink custom structure: `/%category%/%postname%/`   * I'm using the roots theme which does apply some rewrites, but I as far as I can see there are not rewrites for the permalinks / page structure **Stuf I've already tried**   * Changed 'show maximum of' setting in WP settings from 10 to 1   * Changed `'paged'` to `'page'` in `$paged`   * Going to the URL `root/artists/acdc/page/2`, no luck as described above   * Going to the URL `root/artists/acdc?page=2`, no luck and weird behavior as described above   * Changed `'format'` in `paginate_links` to `'?page=%#%'` **My code (which is on the artist custom post type template but will eventually be stored in functions.php**               $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;          $args = array(         'connected_type' => 'artists_to_events',         'connected_items' => get_queried_object(),         'post_type' => 'events',         'post_status' => 'publish',         'posts_per_page' => 3,         'paged' => $paged,         'meta_key' => 'custom_date',         'orderby'=> 'meta_value',         'order' => 'ASC'     );          $query = new WP_Query($args);          $big = 99999999;          echo paginate_links(array(         'base' => str_replace($big, '%#%', get_pagenum_link($big)),         'format' => '/page/%#%',         'total' => $query->max_num_pages,         'current' => max(1, get_query_var('paged')),         'show_all' => false,         'end_size' => 2,         'mid_size' => 3,         'prev_next' => true,         'prev_text' => 'Vorige',         'next_text' => 'Volgende',         'type' => 'list'     ));      Because of the weird URL behaviour I don't really know where the problem lies. Any ideas?


Path to image in js with wp_localize_script

I'm trying to implement animated svg icons into my Wordpress theme. All's is great, except I can't figure out how to put proper url for svg images in this js file:               var svgIconConfig = {         plus : {              url : 'svg/plus.svg',             animation : [                 {                      el : 'path:nth-child(1)',                      animProperties : {                          from : { val : '{"transform" : "r0 32 32", "opacity" : 1}' },                          to : { val : '{"transform" : "r180 32 32", "opacity" : 0}' }                     }                  },                 {                      el : 'path:nth-child(2)',                      animProperties : {                          from : { val : '{"transform" : "r0 32 32"}' },                          to : { val : '{"transform" : "r180 32 32"}' }                     }                  }             ]         }     };      Here is what I've tried: in functions.php               function svgicons_config() {       wp_register_script('svgicons-config', get_template_directory_uri() . '/js/svgicons-config.js', array(), '1.0.0', 'true'); // Custom scripts       wp_enqueue_script('svgicons-config');     }          $svg_path = array( 'template_url' => get_bloginfo('template_url') );     wp_localize_script( 'svgicons-config', 'svg_path', $svg_path );          add_action('init', 'svgicons_config');      And in svgicons-config.js:               url : 'svg_path.template_url+"/svg/plus.svg"',      and few more variations of this. But no luck. I'm almost sure that I'm making some stupid mistake in this part..


What could a hacker do with my wp-config.php

I am trying to secure my wordpress blog. I read some posts on the web that I should change my `table_prefix` and hide my `wp-config.php`. However, I do not get it? What could an attacker do with my `wp-config.php`? I mean there are my db configurations, but the attacker needs my `DB_HOST` for example, which is not that easy to get, in order to connect to my db?(In my case its: `define('DB_HOST', 'localhost');`, which the attacker could not use to connect to my db) Or am I missing sth? I really appreciate your reply!


Why wold sending headers (for a csv download) throw a Page Not Found error?

I'm writing a plugin to download some data into a csv file (from the admin section of my wordpress site.) I've tried two different methods to customize the headers and prevent the wp- admin template from being loaded. One uses the admin_post_ hook. CSV export: link above a list table get permission problem The other uses the admin_init hook: Headers already sent error with CSV export plugin In both cases I get a Page Not Found message (contained within the frontend template of my website.) Strangely, in my method which generates the csv content (referenced by the hooks mentioned above), if I comment out the csv headers and csv content, and just echo "hello" -that will work fine. Unfortuantely, I need more than a 'hello'.               public function print_data()     {         if($_POST['gvt_get_data'])         {             ini_set('memory_limit', '-1');             include __DIR__.'/views/spreadsheet_view.php';             include __DIR__.'/models/gvt2013.php';                  $model = new gvt2013;             $info = $model->get_info();                  $view = new Spreadsheet_View($info);             echo "hello";             //$view->print_sheet();             exit();         }     }      There seems to be something about sending the csv headers which triggers a File Not Found response from Wordpress. Thoughts? Here's the static function which adds the actions:               public static function init()     {         add_action( 'admin_menu', array(self::instance(), '_setup') );         add_action('admin_init', array(self::instance(), 'print_data'));          }


Permalinks is not working in my wordpress setup

I am newbie to wordpress. I have created a site using wordpress and WAMP stack. In my Apache i have enabled **mode_rewrite** , so my site is showing permalinks perfectly. Now i have hosting provider of .NET and IIS server. So when i migrated my site to live server it is working fine without permalinks. But when i type using raw url like www.example.com/?p=12 it is working fine. So how can i make it work with IIS just like Apached did.. Is there anything in IIS like **mode_rewrite** in Apache


Google Language Translator - Manage Translation

I installed Google Language Translator wordpress plugin. How can I manage it's translation (https://translate.google.com/manager/website). I can manage the translation if not using a plugin, but instead manually adding the code provided by google translate. Thanks


Remove post title in catogory page

Read all the posts and forums on the internet, but all the solutions didn't work. My quotation page is here. I try to remove the page title because I already put it under as a quote.So no you see it doubled and we don't want that. Does anybody know how I can do that, the theme is: Novita.


Is it ok to delete empty meta values

I'm using database peek http://wordpress.org/plugins/database-peek/ to show my database structure and have noticed that wp_postmeta has 95073 rows in it. I noticed that a large part of them have empty values in it. Most of these are caused by a plugin that has custom fields with no meta data in it so it seems to be storing these with no value. It seems to me that they are not needed. Is it possible or more importantly, smart to get rid of these? I've optimized the database and thought that it may fix the problem but it does not which makes me think that maybe it could be dangerous for me to delete them. If it is ok to do, how could I do it? Would a sql command be the best way to do it and if so, what would the command be? Thanks!


Rename category part the permalink without .htaccess

I have pretty permalinks that look like this: http://mysite.com/category/my-blog-post/ I want to rename "category" into "company-news", to make it look like this: http://mysite.com/company-news/my-blog-post/ I know I could use .htaccess file for that, but it would mess with the PageRank. Is there an alternative solution?


Change the text on the Publish button

Is there a way to change the text of the publish button on a custom post type to say some different? For example, Save instead of Publish. And also remove the draft button?


How Do I Add Next and Previous Links On Single Custom Post Type Only?

I'd like to add next and previous post links on single posts which use a custom post type. Prefer links only work for the posts assigned to the custom post type. How would i add it to this:               function wpsites_npp_navigation_links() {     if( 'portfolio_post_type' == get_post_type() ) {?>     <?php previous_post('« « %', 'Previous', 'no'); ?>      | <?php next_post('% » » ', 'Next', 'no'); ?>     <?php     } }          add_action('genesis_after_post_content', 'wpsites_npp_navigation_links', 5 );      Worked this out myself. Here's the solution for HTML 5 enabled Genesis child themes. Change to the old hook if you haven't added child theme support for HTML 5. Example: From genesis_entry_footer to genesis_after_post               function wpsites_npp_navigation_links() {     if( 'portfolio' == get_post_type() ) {?>     <?php previous_post('« « %', 'Previous', 'no'); ?>      | <?php next_post('% » » ', 'Next', 'no'); ?>     <?php     } }          add_action('genesis_entry_footer', 'wpsites_npp_navigation_links', 5 );


Image popup in a lightbox / overlay from the backend 3.5 admin area (plugin)

Is there a built in way within the backend admin area to have an image show in a popup/lightbox? I built a plugin with help images and want them to show when clicked in a popup overlay / lightbox.


Ordering custom posts by meta field date

I've tried every combination of examples here on the boards and nothing seems to get me what I need. I have an events post type with multiple fields in a custom meta box, one of which is a date field that saves in the form yyyymmdd. I need to query only the events that occur today and in the future, and sort in ASC order by date field. This will be used in a custom post type archive page. Metabox function:               function events_metabox() {     global $post;     $typename = 'events';          $meta = get_post_meta($post->ID, $typename, true);          $date = ( !empty( $meta['date'] ) ) ? $meta['date'] : '';     $start = ( !empty( $meta['start'] ) ) ? $meta['start'] : '';     $end = ( !empty( $meta['end'] ) ) ? $meta['end'] : '';     $location = ( !empty( $meta['location'] ) ) ? $meta['location'] : '';     $form = ( !empty( $meta['form'] ) ) ? $meta['form'] : '';          wp_nonce_field( $typename, $typename . "-nonce" );     ?>
         <label for="<?php echo $typename; ?>_address">Location:         <textarea id="<?php echo $typename; ?>_address" name="<?php echo $typename; ?>[location]" class="widefat"><?php echo $location; ?></textarea>         Event location.

         <label for="<?php echo $typename; ?>_phone">Event Date:         <input type="text" id="<?php echo $typename; ?>_date" name="<?php echo $typename; ?>[date]" value="<?php echo $date; ?>" />         Event date.

         <label for="<?php echo $typename; ?>_email">Start Time:         <input type="text" id="<?php echo $typename; ?>_start" name="<?php echo $typename; ?>[start]" value="<?php echo $start; ?>" />         Start time of event.

         <label for="<?php echo $typename; ?>_email">End Time:         <textarea id="<?php echo $typename; ?>_end" name="<?php echo $typename; ?>[end]"><?php echo $end; ?></textarea>         End time of event.

         <label for="<?php echo $typename; ?>_form">Web Form:         <textarea id="<?php echo $typename; ?>_form" name="<?php echo $typename; ?>[form]" class="widefat"><?php echo $form; ?></textarea>         Web Form.
     <?php } ?>      Function saving the custom meta fields:               function events_save_meta($post_id, $post) {     $typename = 'events';     $id = $post->ID;              if(!isset($_POST[$typename])){         return $id;     }          $meta = $_POST[$typename];          if (!wp_verify_nonce($_POST[$typename . "-nonce"], $typename)) return $id;          if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )         return $id;          if( $typename != $_POST['post_type'] )         return $id;          update_post_meta($id, $typename, $meta);     }      Post Query:                $args = array(      'post_type'   => 'events',      'meta_key' => 'date',      'orderby' => 'meta_value_num',      'order' => 'ASC',      'meta_query' => array(       array(          'key' => 'date',          'value' => date('Ymd'),          'compare' => '>=',          'type' => 'NUMERIC'       )      )     );          $events_query = new WP_Query( $args );


How to order posts in wp_query by a meta_value of the corresponding author

Is it possible to order posts retrieved via `WP_Query` according to a meta value of the corresponding **post author**? Use case: I have premium subscribers and basic subscribers. I want the posts of the premium subscribers to appear before the posts of the basic subscribers in a search result page. One way to solve this, would be to add a `meta_key` to the **post** , indicating the author's subscriber status, but I would have to update all posts of a user everytime this user's status changes. Is there a way to make this work by referring to the user meta values directly?               $args = array(                 'post_status' => 'publish',                 'post_type' => 'listing',                 'meta_key' => '???', // how can I refer to the meta_key of the author of a post ?                 'orderby' => '???',                 'order' => 'DESC'             );          $query = new WP_Query($args);


Horizontal Navigation

![Wordpress horizontal line menu](http://i.stack.imgur.com/b3jhi.jpg) Hi. I been fighting with this problem for couple of weeks now. Trying various approaches. From CSS styling to a custom walker. I want to render each level as its own element. The navigation menu(defined in Appearence/Menu in Admin) consists of both Pages, Posts and WooCommerce products and categories. When I'm on the homepage, I want to see LEVEL 1 Menu Objects. When I navigate to a LEVEL 1 page I wan't to show it's Children (LEVEL 2) in its own UL beneath the Top UL. If I navigate to a Child of LEVEL 1(level 2 object) I want to render its children as its own UL. The picture attached shows this scenario where all the levels are shown. This, in the best of worlds, should not be dependent upon a specific number of levels though. This should be a basic thing to accomplish but I fail horrendously - I'm new to WP / PHP ( coming from the .NET world ) Please help. Anything goes, pointer to a plugin, pure code, things to try ...


Pass the post ID

Okay what I am trying to do is run JavaScript of the user is not logged in! I have been given the following script by the maker of "Restrict Content Pro" (The plugin I am using)               function pw_rcp_add_login_script() {          global $post;          if( ! rcp_is_paid_content() ) {         return;     }          if( rcp_is_active() ) {         return;     }          ?>     <script type="text/javascript">     jQuery(document).read(function($) {         // Replace this with code to open login modal         $('#id_of_modal').open();     });     </script>     <?php     }     add_action( 'wp_footer', 'pw_rcp_add_login_script' );      Now he has said "You will need to pass the post ID of the current page to that function." Can anyone help me with this? Thanks Aled


How to count posts of a category and of a category limited by a tag

I have two urls, and I want to know how many posts will be displayed there, when I click them. The goal is to show the visitor in the navigation of those urls, how many postings are found there. As far as I can analyze those urls I would say it's about a category and then about a category and a tag. But pleas tell me if I am wrong. Here are the two Urls, which actually end up in a blog-roll page (pseudo code):               http://site_url()/category/<category-name>/     and     http://site_url()/category/<category-name>/<tag-name>      while `category` is the string `"category"` Is my question somehow clear? Do I have to use `count_posts()` function?


Loading jQuery With Two Fallbacks

CSS-Tricks suggests this code to load jQuery. However, I'm curious if anybody has done the same thing in functions.php with **two fallbacks: the Microsoft hosted jQuery being the first option and locally hosted jQuery being the second** , that is, in the case the Google library decides not to load/crashes/gets eaten by a polar bear/etc.               if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11);     function my_jquery_enqueue() {        wp_deregister_script('jquery');        wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js", false, null);        wp_enqueue_script('jquery');     }


Generate excerpt (respecting <!--more--> if it's there) "by hand"

I have a post archive page that's loaded by AJAX so I am manually retrieving the posts via `WP_Query` and then manually displaying `$post->post_content`, etc. The problem is that I'm not using The Loop, so `<!--more-->` in the content is not being parsed. I can manually write code to manually figure out an excerpt, but that seems like a lot when it's already in WP. Is there a way I can pass a raw blog post (retrieved from the database) to Wordpress, and have it give me back an excerpt? I need to tap into the existing functionality, where WP pulls the excerpt from the 'excerpt' field on the post, or it would generate it by looking for the `<!--more-->` break, or failing all else, it would take the first 55 words.


Getting grandchildren of a post with a specified custom taxonomy?

I have an hierarchical custom post type called **Geographies** , wherein each Geography is assigned to a custom taxonomy (`geographytype`): Area, Country, Region or City. The hierarchy is set as follows:               Area ¬          Country ¬                  Region                  City      As an example: The city of Boston is a child of United States, which in turn is a child of Americas. I want to be able to get children and/or grandchildren of a Geography, _and_ specify its `geographytype` - for example, if I'm viewing **Americas** , I want to get all the cities, including **Boston**. However, it seems like I can only do one or the other. If I use get_pages(), I can get all children and grandchildren by specifying the `parent` parameter, but I can't specify a `geographytype`, so I just get everything. Conversely, if I use WP_Query() I can specify my `geographytype` using the `tax_query` parameter, but it won't give me grandchildren; I can only get _direct_ children using the `post_parent` parameter. I want to be able to do both: get children _and_ grandchildren, _with_ a specified custom taxonomy.


WP 3.5 and Galleries - how to count images?

I'm trying to figure out how to count and display the number of images in a gallery with WP 3.5. I was following an old post on Ottopress, querying the DB for attachments but it seems the galleries are now contained in shortcodes. Is it possible to extract the shortcode from the post and count the IDs? What is the best way to accomplish this?


Main menu not appearing on category pages

Im creating a theme based on blankslate/Bootstrap and having an issue with the main nav appearing on category pages (seems to appear everywhere else ok.). In header.php:               <div class="collapse navbar-collapse" id="navbar-collapse-1">                           <?php                           wp_nav_menu( array(                           'menu'              => 'primary',                           'theme_location'    => 'primary',                           'depth'             => 2,                           'menu_class'        => 'nav navbar-nav',                           'fallback_cb'       => 'wp_bootstrap_navwalker::fallback',                           'walker'            => new wp_bootstrap_navwalker())                           );                           ?>      In Functions.php               // Register Custom Navigation Walker     require_once('wp_bootstrap_navwalker.php');     register_nav_menus( array(     'primary' => __( 'Primary Menu', 'themename' ),     ) );      Any help or pointers would be appreciated


Custom entry_date function

I want to make a custom entry_date function based on the one found in twenty- thirteen. I just want to have the day, the month and the year in separate `<span>`s I don't understand why what I want to achieve will not work. The date is printed but not inside the `<a href="">` tag. What am I doing wrong? My code is:               $date = sprintf( '<time class="entry-date" datetime="%3$s">%4$s%5$s%6$s</time>',         esc_url( get_permalink() ),         esc_attr( sprintf( __( 'Permalink to %s', 'lyod' ), the_title_attribute( 'echo=0' ) ) ),         esc_attr( get_the_date( 'c' ) ),         esc_attr( the_time(d)),         esc_attr( the_time(M)),         esc_attr( the_time(Y))     );      For the record, here is Twenty-Thirteen function:               $date = sprintf( '<time class="entry-date" datetime="%3$s">%4$s</time>',         esc_url( get_permalink() ),         esc_attr( sprintf( __( 'Permalink to %s', 'twentythirteen' ), the_title_attribute( 'echo=0' ) ) ),         esc_attr( get_the_date( 'c' ) ),         esc_html( sprintf( $format_prefix, get_post_format_string( get_post_format() ), get_the_date() ) )     );      Thank you in advance for the help!


Location of core code for database connection and get_header

I understand WP well enough to create a custom theme at a basic level, but have no experience with the core code. I've also just finished a book on basic php and mysql coding. I'd like to look 'under the hood' of WP to try and put those together. Can someone tell me:   * Where to find the files that code for the WP-Mysql connection? (as in, `mysqli_connect` ...)   * Where to find the files that code for the `get_header()` function? (which I assume will have something like `include(header.php)` ) Thanks!


Query multiple meta key values for template

I am using this template: http://demo.undsgn.com/studiofolio/front-page/ I tried to make some modifications because I need the homepage template to display an excerpt beneath each thumbnail. I copied the template called `front-page.php`, renamed it to `front-page-excerpt.php` and made my modifications and it worked. The problem is there is a framework behind it that controls which template is shown on the homepage. The framework is: http://aquagraphite.com/2011/09/slightly-modded-options-framework/ In the backend it looks like this: ![enter image description here](http://i.stack.imgur.com/yv0xS.png) ![enter image description here](http://i.stack.imgur.com/a38qS.png) In the backend my new template isn't showing up, and I think I found the problem. The template is called in the backend options panel like this:                   $querystr = "         SELECT $wpdb->posts.*          FROM $wpdb->posts, $wpdb->postmeta         WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id          AND $wpdb->postmeta.meta_key = '_wp_page_template'          AND $wpdb->postmeta.meta_value = 'templates/front-page.php'          AND $wpdb->posts.post_status = 'publish'          AND $wpdb->posts.post_type = 'page'";              $pageposts = $wpdb->get_results($querystr, OBJECT);      When I change it to:                       AND $wpdb->postmeta.meta_value = 'templates/front-page-excerpt.php'      My modified templates show up, but the original templates are not displayed. I tried to put both in it like this:                   $querystr = "           SELECT $wpdb->posts.*          FROM $wpdb->posts, $wpdb->postmeta, $wpdb->postmeta AS mt1         WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id               AND $wpdb->postmeta.meta_key = '_wp_page_template'            AND $wpdb->postmeta.meta_value = 'templates/front-page.php'         AND mt1.meta_key = '_wp_page_template'         AND mt1.meta_value = 'templates/front-page-excerpt.php'              AND $wpdb->posts.post_status = 'publish'          AND $wpdb->posts.post_type = 'page'";              $pageposts = $wpdb->get_results($querystr, OBJECT);      It doesn't work at all. What am I doing wrong?


Remove specific administrator's capability

I've created two administrator users X and Y. And now I need to remove capability of 'edit_plugins' from user Y. I've searched and found, http://goo.gl/LttuvX               $user = new WP_User( 'Y' );     $user->remove_cap('edit_plugins');      But it is not working please let me know how to do it. Previously I've created new role with same capability as administrator, but in plugins we create menus like `add_menu_page(..,capability => 'administrator',..);` so new role fails to access plugin pages.


wp_insert_post featured image from library

I know there are a lot of posts about it, but I don't want to upload a URL image to the library, I already have the image in the library and its IP. How can I use it with `wp_insert_post`?


Getting value from database table depending on field value

I am using a plugin called formidable which is similar to Gravity Forms in terms of purpose. I have two fields of interest. The first field loads up all the values in the `Town` column of my `wp_locations` table. Using the code below.               function frm_populate_posts_town($values, $field){         if($field->id == 800){ //change 125 to the ID of the field to populate         global $wpdb;         $towns =$wpdb->get_results("SELECT Town FROM wp_locations");         $values['options'] = array();          foreach ($towns as $town) {               $values['options'][$town->Town] = $town->Town;          }              }         return $values;     }      The second field is a hidden field that automatically selects the value in the 'County' Column depending on the value of the first field. (btw `$_POST['item_meta'][802]` represents the hidden field               add_filter('frm_validate_field_entry', 'my_custom_validation_town', 8, 3);          function my_custom_validation_town($errors, $posted_field, $posted_value){         if($posted_field->id == 802){ //change 25 to the ID of the hidden field             $town_b = $_POST['item_meta'][800];//Gets the value from the first field             global $wpdb;                  $query = "SELECT County FROM wp_locations WHERE Town = $town_b";             $the_county = $wpdb->get_var($query);                    $_POST['item_meta'][802] = $the_county;          }         return $errors;     }      The second does not work. ## EDIT I found out that I need to use the action hook frm_after_create_entry and then add a Javascript in order to do 'Text calculations' which is one of the functions the plugin has. Unfortunately I do not know how to add the SQL query as a variable using the value of `#field_800` e.g:               "SELECT County FROM wp_locations WHERE Town =`#field_800`"               <script type="text/javascript">       jQuery(document).ready(function($){     $('#field_800').change(function(){           var val1 = $("#field_800").val();//How can I add mySQL here           $("#field_802").val(val1);     });     });     </script>


Ajax WP Query Search Filter

Everything is working great with this Plugin. http://wordpress.org/plugins/ajax-wp-query-search-filter/ I created a search form. When i click submit Search button it displays the results in default format with post thumbnail, then title ,then excerpt By this default function                  function ajax_result($arg, $id,$pagenumber){            $apiclass = new ajaxwpqsfclass();               // The Query             $query = new WP_Query( $arg );             $html ='';             // The Loop         if ( $query->have_posts() ) {             $html .= '
'.__('Search Results :', 'AjWPQSF' ).'
';             while ( $query->have_posts() ) {                 $query->the_post();                     $html .= '
'.the_post_thumbnail('event-home-thumb').'';                     $html .= '
'.get_the_title().'
';                     $html .= '';                     $html .= '
';                  }                  $html .= $apiclass->ajax_pagination($pagenumber,$query->max_num_pages, 4, $id);          } else {                     $html .= __( 'Nothing Found', 'AjWPQSF' );                 }                 /* Restore original Post Data */                 wp_reset_postdata();                  return $html;        }          But I want to display result in other way. I want to show results using my `search.php`.


make permalink go to a custom single.php file

hope somebody can help me with this because I am struggling for a while. I want to use two single.php on my website, one to display the regular posts and another to display some products that I will style different then the posts. I duplicated the single.php and named it products.php but I cannot figure out how to make the permalink grab my products.php and not the single.php. Please, is there a way to accomplish this? Thank you very much!


Parse wordpress blog data using json api and ajax

I have seen lots of responses to how to extract data from wordpress blog posts using the json api plugin. Many uses $.getJSON, $.ajax, .responseData.feed.entries, success function() etc. What is the correct way to parse JSON API datas from wordpress, post the result to a content div page in a jQuery mobile listview. I have the following codes but unable to get the intended result: ### HTML               <!DOCTYPE html>                   <meta charset="utf-8">                       <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">                       <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />

Sysads Posts

Home

Disclaimer

                .js:               $( document).ready(function (){         url = 'http://hopexxx.com/category/daily-devotion/feed/' ;         $.ajax({             type: "GET",             url: document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=1000&callback=?&q=' + encodeURIComponent(url),             dataType: 'json',             error: function(){                 alert( 'Unable to load feed, Incorrect path or invalid feed' );             },             success: function(data ){                 var postlist = data.responseData.feed.entries;                 var html = '
' ;                 for (var i = 0 ; i < 10 ; i++) {                     var entry = postlist[i];                     html += '
';                     html += '';                     html += '
' + entry.title + '
' ;                     html += '
' + entry.author + '
' ;                     html += '
' + entry.publishedDate + '
';                     html += '
' + entry.contentSnippet + '
';                     html += '';                     html += '
';                 }                 html += '
';                 $( "#postlist" ).append(html);                $( "#postlist ul[data-role=listview]" ).listview();                  }});         });      I hope my question is not outside the site rule.


Can WordPress handle following functionalities?

Now i am planning a development of a new web site and searching for a CMS. I know WP not bad, but never tried to build a complex community information site using this engine. Among basic requirements there are following, i would call them "community":   - user-panel (user profile with settings, history of activity etc)   - users possibility to rate topics/comment/post   - posts output according to those ratings   - site log in/register via Facebook/Twitter account etc Are there any popular, stabe extensions that could handle those "community" needs without deep rebuilding of engine? _I know that all of those features can more or less be made using CMS with some extension such as Joomla, Drupal and LiveStreet, but in this project i want to exclude them._


Creating tabs shortcode

Tab 1

The Second Tab

Tab C

Configurations

This example has the animation disabled, so tab-switching is instantaneous. It also sets the active class names to custom names for more control over CSS stylization.

Heading 2

Stuff from the second tab.

Heading 3

More stuff from the last tab.

      http://codex.wordpress.org/Shortcode_API I'm trying to set a shortcode for tabs in wrodpress without js but php is not my strong point. I really need help with this. Thanks in advance ! **Edit:** Ok i've found helpful example. I decided to share with it. > **Answer**               $tabs_divs = '';          function tabs_group($atts, $content = null ) {         global $tabs_divs;              $tabs_divs = '';              $output = '

'.do_shortcode($content).'
';         $output.= '
'.$tabs_divs.'
';              return $output;       }                 function tab($atts, $content = null) {           global $tabs_divs;              extract(shortcode_atts(array(               'id' => '',             'title' => '',          ), $atts));                if(empty($id))             $id = 'side-tab'.rand(100,999);              $output = '
                 '.$title.'
         ';              $tabs_divs.= '
'.$content.'
';              return $output;     }          add_shortcode('tabs', 'tabs_group');     add_shortcode('tab', 'tab');


How to change image's author via a function when using GravityForms uploader?

I am wondering if there is a way to manually change the author of images. I am using Gravity Forms which sets the post author to the current user but does not set them as the author of the images they upload. I figure there might be a way to add a function which finds the current user and then sets the author of the images they upload to that user.


Custom post type and taxonomy slug issue

I'm working with custom post types in WordPress and have a question about slugs. Let's say that we need to create custom post type Quiz with taxonomy Quiz Category. I've used the following code:               // Create and register custom post type quiz     function create_posttype_quiz() {         $labels = array(             'name'               => _x( 'Quiz', 'post type general name' ),             'singular_name'      => _x( 'Quiz', 'post type singular name' ),             'add_new'            => _x( 'Add New', 'quiz' ),             'add_new_item'       => __( 'Add New Quiz' ),             'edit_item'          => __( 'Edit Quiz' ),             'new_item'           => __( 'New Quiz' ),             'all_items'          => __( 'All Quiz' ),             'view_item'          => __( 'View Quiz' ),             'search_items'       => __( 'Search Quiz' ),             'not_found'          => __( 'No quiz found' ),             'not_found_in_trash' => __( 'No quiz found in the Trash' ),              'parent_item_colon'  => '',             'menu_name'          => 'Quizzes'         );         $args = array(             'labels'        => $labels,             'description'   => 'Holds our quiz and quiz specific data',             'public'        => true,             'menu_position' => 5,             'supports'      => array( 'title', 'editor' ),             'has_archive'   => true,             'rewrite' => array('slug' => 'quiz'),             'show_ui'             => true,             'show_in_menu'        => true,             'show_in_nav_menus'   => true,              );              register_post_type( 'quiz', $args );         }     add_action( 'init', 'create_posttype_quiz' );          // Create and register quiz categories     function create_taxonomies_quiz() {         $labels = array(             'name'              => _x( 'Quiz Categories', 'taxonomy general name' ),             'singular_name'     => _x( 'Quiz Category', 'taxonomy singular name' ),             'search_items'      => __( 'Search Quiz Categories' ),             'all_items'         => __( 'All Quiz Categories' ),             'parent_item'       => __( 'Parent Quiz Category' ),             'parent_item_colon' => __( 'Parent Quiz Category:' ),             'edit_item'         => __( 'Edit Quiz Category' ),              'update_item'       => __( 'Update Quiz Category' ),             'add_new_item'      => __( 'Add New Quiz Category' ),             'new_item_name'     => __( 'New Quiz Category' ),             'menu_name'         => __( 'Quiz Categories' ),         );         $args = array(             'labels' => $labels,             'hierarchical' => true,             //'show_admin_column'=> true,             'rewrite' => array('hierarchical'=>true, 'slug'=>'quizzes', 'with_front'=>false),         );         register_taxonomy( 'quiz_category', 'quiz', $args );     }     add_action( 'init', 'create_taxonomies_quiz', 0 );      Everything works fine, I'm able to create and edit quizzes, add them to quiz categories etc. Also, I can access quizzes on frontend, e.g. site.com/quiz/sample-quiz-one, site.com/quiz/sample-quiz-two... and list quizzes in quiz categories, e.g. site.com/quizzes/category-one, site.com/quizzes/category-two... The problem is that I can't list quizzes under **site.com/quizzes** but at **site.com/quiz** instead. ( **site.com/quizzes** will create page not found error). Basically, I would like to be able to:   * access a single quiz at url: **site.com/quiz/sample-quiz-one**   * list all quizzes at **site.com/quizzes** rather than **site.com/quiz**. Is it possible to achieve this without htaccess or any other redirection, but using the code above (maybe some args I'm not aware of)?


theme functions (hooks)

This question was already asked in WordPress, but there was no answer for it. Just wanted to try in this forum if anyone knows about it because i have also same question. > want to edit my theme having jquery slidebar, how do i go to that script?, > its showing up "$theme->hook('content_before');" in content div tag.can > anyone help please? My Theme index.php contains below
              <?php $theme->hook('main_before'); ?>
                  <?php $theme->hook('content_before'); ?>                  <?php                  if (have_posts()) : while (have_posts()) : the_post();                     /**                      * The default post formatting from the post.php template file will be used.                      * If you want to customize the post formatting for your homepage:                      *                       *   - Create a new file: post-homepage.php                      *   - Copy/Paste the content of post.php to post-homepage.php                      *   - Edit and customize the post-homepage.php file for your needs.                      *                       * Learn more about the get_template_part() function: http://codex.wordpress.org/Function_Reference/get_template_part                      */                          get_template_part('post', 'homepage');                      endwhile;                      else :                     get_template_part('post', 'noresults');                 endif;                       get_template_part('navigation');             ?>                  <?php $theme->hook('content_after'); ?>
              <?php get_sidebars(); ?>              <?php $theme->hook('main_after'); ?>


Remove Custom Taxonomy Metabox from Custom Post Type Screen

I have two hierarchical custom taxonomies, each on a corresponding custom post type. I would like to remove the metabox for each on the post type's edit screen. I have read remove custom taxonomy metabox form custom post type and How do you remove a Category-style (hierarchical) taxonomy metabox? but I'm still stuck. The function I'm using is:               function remove_taxonomies_metaboxes() {         remove_meta_box( 'partner_typediv', 'partners', 'normal' );         remove_meta_box( 'person_typediv', 'people', 'normal' );     }     add_action( 'admin_menu' , 'remove_taxonomies_metaboxes' );      I unprefixed the post_types and custom_taxonomies, but that's it. I've tried using the `admin_menu` hook and the `add_meta_boxes` hook recommended by the Codex. I've tried both `normal` and `side` for the third parameter. The above function is located in an `mu-plugins` file below the function that registers the post types and taxonomies. * * * EDIT: It was a typo in the register_taxonomy function. I'm a horrible person. Thanks for everyone for the help. I still learned some stuff!


How to disable the "Post Lock/Edit Lock"?

I want to disable this just for one Post Type, as it doesn't really matters if there's another user editing it (the main content editing area is Ajaxified and non-admins can only see that). ![enter image description here](http://i.stack.imgur.com/JIKlb.png) I looked at the core functions but couldn't find an entry point. From the function `wp_set_post_lock` I'm guessing that I'd have to intercept the `get_post_meta`, but is there an _official_ way to do it? And there's a second lock that doesn't seem to be affected by the filter `wp_check_post_lock_window` (as shown by birgire, here in an Answer). I've tried `remove_filter( 'heartbeat_received', 'wp_refresh_post_lock', 10, 3 );` at various points but it keeps beating without respecting `remove_filter`. ![enter image description here](http://i.stack.imgur.com/L2eLk.png)


Footer in middle of page in different browers

For some reason whenever I add a widget to the footer of my site, it moves to the center of the page - but only in Chrome and Safari. Firefox the footer stays put at the bottom. The only way I can think to change this is to increase the padding-top size. This puts the footer back at the bottom and looks fine in Safari and Chrome, but obviously looks terrible in Firefox. What am I doing wrong? Site link Footer.php -

          <?php if( is_front_page() ) {      echo do_shortcode('[responsive_column_widgets]');     }     ?>
          <?php wp_footer(); ?>                          Style.css -               #footer{     margin-top: -90px; /* negative value of footer height. this need to be  */     height: 100px;     clear:both;     padding-top:20px;     margin: 10px;     text-align: center;     color:#fff;     }     #footer img {     padding:3px;      margin:3px;     }


How to exclude categories from recent posts, recent comments & category widgets?

I use the bellow function (thanks to @helgatheviking!) to exclude categories from the wordpress loop. It works very well - posts of selected categories are excluded from the loop on the main blog listing page, from category listing pages and from archives, **but not** from Recent Posts and not from Recent Comments in sidebar. How can be extended the action of this code also on them?               add_action('pre_get_posts', 'wpa_31553' );          function wpa_31553( $wp_query ) {              //$wp_query is passed by reference.  we don't need to return anything. whatever changes made inside this function will automatically effect the global variable              $excluded = array(272);  //made it an array in case you need to exclude more than one              // only exclude on the front end         if( !is_admin() ) {             set_query_var('category__not_in', $excluded);             //which is merely the more elegant way to write:             //$wp_query->set('category__not_in', $excluded);         }     }      **UPDATE:** A small clarification, the excluded categories have not disappeared also from the Categories widget. Just disappeared all posts from these categories when I open them with a mouse click. I would like that they disappear also from the Categories widget.


Customized wp_new_user_notification

Customized wp_new_user_notification I'm kind of inexperienced with it comes to editing Wordpress functions, yet i'm currently trying to customize `wp_new_user_notification` in order to personalize the email that administrators and users receive once they register. I'm aware there's some plugins that allow this kind of customization, but I would rather spend some more time on a problem and try to learn/understand it, rather than just install a plugin. Hence, I've placed this function in my `functions.php`, and I believe I'm supposed to add one or more filters, such as:               add_filter('myfunction', 'wp_new_user_notification', ?, ?)      or maybe not. I've read and attempted to follow several tips/tutorials/questions (such as for example), but no matter what I do, I keep receiving emails with standard text/contents (as if my functions is not being considered by Wordpress). Can anyone help me solve this problem? Thanks in advance!


Post by email is not working

I'd like to post to my **Wordpress** blog through the **Post by email** feature. All emails sent via Gmail are arriving but from some other email clients they not. (Gmail is not my default client - just used for testing) What could cause this problem? Is it possible that the email needs to be sent through SMTP with authentication? Thank you.


Redirecting deleted posts url to another WordPress install

On a WordPress site `http://www.example.com/` (MAIN SITE) there are 540000+ posts. I want to reduce number of posts to enhance site speed. I've installed new WordPress at `http://www.example.com/business-consultants/` (NEWSITE) and here I moved from MAIN SITE 3135 posts tagged 'Business Consultants'. Currently, I've set 301 redirect on MAIN SITE to redirect posts tagged 'Business Consultants' to the new WordPress install, that is               {MAIN_SITE}/{slug} => {NEW_SITE}/business-consultants/{slug}      What I do is checking post tag, and if 'business-consultants' is present, redirect request to new the new site using `wp_safe_redirect()`. The problem is that to make redirect works I need the post are actually available in MAIN SITE, what I'm looking for is a solution to make redirect work even if posts tagged 'Business Consultants' are deleted from main site.


wp_logout action not working

I'm trying to remove some cookies set to control persistent login when the user specifically wants to log out of a website. I thought it would be as simple as:               function remove_user_cookie() {              unset($_COOKIE['woai']);         unset($_COOKIE['woak']);          }     add_action('wp_logout', 'remove_user_cookie');      I've also tried:               function remove_user_cookie() {              if( $_GET['action'] == 'logout' ) :                  unset($_COOKIE['woai']);             unset($_COOKIE['woak']);              endif;          }     add_action('wp_logout', 'remove_user_cookie');      However, the users cookies remain in place, so they keep getting logged back in automatically. I'm not sure if the wp_logout action just isn't working, or if it's clashing with my code that logs the user in automatically. Right now, I have this in the header.php:               <?php if( !is_user_logged_in() ) :              // check if user has cookies         if ( isset($_COOKIE['woai']) && isset($_COOKIE['woak']) ) :                  $args = array(                 'meta_key' => 'login_key',                 'meta_value' => $_COOKIE['woak'],                 'meta_compare' => '=',                 'fields' => 'ID',                 'include' => $_COOKIE['woai']             );             $user_query = new WP_User_Query($args);                  if( $user_query->results[0] != '' || $user_query->results[0] != NULL ) :                      // get user id and login name                 $user_id = $user_query->results[0];                 $user_login = get_user_by( 'id', $user_id );                      // log the user in                 wp_set_current_user( $user_id, $user_login->user_login );                 wp_set_auth_cookie( $user_id );                      do_action( 'wp_login', $user_login->user_login );                  endif;              endif; // end if cookies          endif; ?>      And when the user is logged in, they get a new key set with this:               function set_user_cookie($user_login) {              // if they have cookies, delete them         if ( isset($_COOKIE['woai']) && isset($_COOKIE['woak']) ) :             unset($_COOKIE['woai']);             unset($_COOKIE['woak']);         endif;              $user_id = get_user_by( 'login', $user_login );              // generate new key for user         $salt = wp_generate_password(20); // 20 character "random" string         $key = sha1($salt . $email . uniqid(time(), true));              // set new cookies         setcookie("woai", $user_id->ID, time()+31536000);  /* expire in 1 year */         setcookie("woak", $key, time()+31536000);  /* expire in 1 year */              // update the db         update_field('field_53c3de9cd031e', $key, 'user_'.$user_id->ID.'');          }     add_action('wp_login', 'set_user_cookie', 10, 1);


Allow AJAX call to other roles than admin

On my website, registered users (subscriber role) can send drafts and, if admins validate them, they are published. I'm trying to add a tag box to frontend editor used to send new posts. To implement the autocomplete feature I'm making an AJAX call to this URL:               http://example.com/wp-admin/admin-ajax.php?action=ajax-tag-search&tax=post_tag      That works great for an administrator user, but it doesn't work for subscribers. Does anyone know any way to achieve this without calling to `admin-ajax.php`?


If User is NOT Logged in and Page ID is not 6 - Redirect to Login

I am trying to redirect users based on the following...   * If Role = Customer & Page Is NOT ID 6 Then Redirect To Checkout   * If Not Logged in & Page Is Not ID 6 then redirect to login   * User role = member and Page ID is 6 redirect to home page              //If Role = Customer & Page Is ID 6 Then Redirect To Checkout     if ( user_can( $current_user, "customer" ) && ! is_page( 6 ) )      {     wp_redirect(home_url().'/checkout');     exit;     }          elseif ( ! is_page ( 6 ) )     {     //If Not Logged in & Page Is Not ID 6 then redirect to login     auth_redirect();     }               elseif ( user_can( $current_user, "member" ) && is_page( 6 ) )     {     // User role = member and Page ID is 6 redirect to home page     wp_redirect(home_url());     exit;     }     ?>      Which as far as I can see should work, but its not, it gives me a blank page. The script is being run from header.php and is the first thing in the PHP file. The first rule - If Role = Customer & Page Is ID 6 Then Redirect To Checkout works correctly and they are redirected to the checkout page. The second rule prevents anybody from logging in The third rule works correctly Am I doing something wrong?


Some Javascript and CSS not being compressed

Most of my site is being compressed by mod_deflate but there are still several JS & CSS files that are not. I cannot for the life of me figure out why these files are exempt. Thank you for any insight! The files in question can be seen via a PageSpeed Insights query: http://developers.google.com/speed/pagespeed/insights/?url=www.limbsaver.com&tab=desktop My .htaccess file is here: http://pastebin.com/0nFd5rPt


if there is only one post in the category, directly open

I have a few categories. in each of them, I have only one post. by clicking on a category, I have to click on that single post to enter. I wish, by clicking on the category, enter directly in that one post. This method avoids having to click two times in the post. Any suggestions for what I have to use code in archive.php?


Windows Live Writer inconsistent with Media Library

I'm considering moving my existing blog from DasBlog to WordPress. While doing some tests to see if I did like the platform I ran into following problem: I'm using Windows Live Writer to write my blog posts. I'm used to add the pictures on the original size and remove the default link (to the full size picture). When I publish this post to WordPress, some pictures end up in the picture library and others don't, even in the same post. It would be nice to have a consistent way of storing my pictures. Preferably without the use of the media library, as I don't see the use of it (yet?) and it gives unwanted links and records in the posts table.


How can I make my Blog category unindexed in Google?

My Blog posts can break my SEO, as they're not about the themes my website discusses. So how do I avoid this?


How to manage multiple wordpress project with shared code base

I need to build several highly customized WordPress instances beyond look and feel changes. For example, in one of the instances, any categories with children need to display in its own dropdown on the post edit page. I can not use multi-site setup as each instances may need to be highly customized. I would also like to have these individual projects to share the same base code, i.e. standard WordPress installation with some shared logic like security patches, caching, and so on. Currently, I have the following layout in my source control:               root         +---wordpress_base         +---project1         +---project2      wordpress_base contains the wordpress source tree. project1 and project2 contains only the files that are changed for customization. During deployment, my ant script will combine wordpress_base with the custom code from a specific project. Is this a good way to manage mutliple WordPress source code? I have no expertise in php/wordpress development. Feel free to let me know what I am doing is stupid and suggest the right approach.


Removing categories, Comments etc from posts?

im wondering if there is a way to completely remove this feature from my website as i have no need to categorise any of my posts - i plan to post projects in pages from my left sidebar with a static front page. I am really new to this and read that i may need to edit the theme (Editor is my current one, though there's nothing there yet so willing to change if there is a theme with an easier way to do it) I am not at all familiar with coding and went to the editor page to have a look after reading a way to remove categories, comments etc, but would have NO idea at all where to type the changes. I removed author, comments, tags, comments and dates from the screen options on my posts page but it still appears on my (currently test) first post. As i say i'm just getting started, am very novice at this and want to make sure things will look as i want them to before i start making pages and posts. Thanks so much for any help :)


Incoming URL variables to custom metabox

Is it possible to take values from an incoming URL variable and write it to a custom meta box? My client has something like the following for a URL (marketing purposes): http://somesite.com/this-page/?phone=5551112222&unique_id=1234 They want to be able to capture the phone and unique id and write them to a custom meta box and then output that custom meta to a page. Basically, they want to be able to create a handful of marketing landing pages without having to create one for every phone number (plentiful) and unique id they have. I think they're more interested in dynamically writing the phone on the page and the unique id into Gravity forms (which I have figured out). Or, if I'm thinking about this in the wrong way, please point me in the right direction. TIA!


Filter front page posts by category

I have three categories (news, pics, vids), but I have all of them showing up on my front page. I would just like the front page to have the news category (and possibly uncategorized category) to show. What is the best way to do this? Plugin? Or a piece of code on the front page?


wordpress wp_enqueue_script() not working

I'm trying to add this social-network button:               Add in Svejo           to my blog posts. But loading this in every post would really slow my page so I've try to implement it with **wp_enqueue_script()** inside my **functions.php**               function socialNetworks(){         $opentag = '
';         $closetag = '
';              $socials['svejonet'] =             'Add in Svejo'.             wp_enqueue_script( 'none', 'http://svejo.net/javascripts/svejo-button.js', array(), false, true);              echo $opentag;         foreach ( $socials as $key=>$val ){            echo '
'.$val.'
';         }         echo $closetag;        }      However the script does not load.   Appreciate any help.


How to use pre_get_posts?

I am having a problem with the custom category template pagination and i search and read that using pre_get_posts fix the pagination problem. I read the pre_get_posts information in the WordPress Codex but i didn't understand how to use it.               <?php     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $args = array(                 'post_type' => 'post',                 'meta_key' => 'hmeromhnia_lhkshs',                 'orderby' => 'meta_value_num',                 'order' => 'ASC',                 'posts_per_page' => 9,                 'paged' => $paged                 );               // get results     query_posts( $args );?>          <?php if ( have_posts() ) : ?>     <?php while ( have_posts() ) : the_post(); ?>          // The Loop          <?php endwhile;?>     <?php endif; ?>          <?php if ($wp_query->max_num_pages > 1) tie_pagenavi(); ?>          <?php wp_reset_query();  // Restore global post data stomped by the_post(). ?>      This is the code i use for the query and the pagination doesn't work. I can't understand where and when to insert the pre_get_posts. Generally don't know how to use it. Please help me!


How to preview a page instead of a category?

Is it possible to make the code below preview a page instead of a latest category post?

Gift Vouchers

        <?php     //The Query     query_posts('posts_per_page=1&cat=7');     //The Loop     if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>        <?php if ( has_post_thumbnail()) the_post_thumbnail('medium-thumbnail'); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
     <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_time('F jS, Y') ?>
<a rel="bookmark" href="<?php the_permalink(); ?>"><?php echo strip_tags(get_the_excerpt());?>

     <?php endwhile; else: ?>
Sorry, no posts matched your criteria.
     <?php endif;     //Reset Query     wp_reset_query();     ?>
      Thanks,


How to rename a custom field?

I have 3000 posts with that custom field name 'refer' and i need to change it to 'ref' for theme needs, instead of doing it manually i need a query or technique to change them all. **Question 1**   I am trying to rename a custom field, from 'refer' to ref. what is the query needed to rename a custom filed. it would be better if its done using function.php(instead of doing in phpmyadmin). **Question 2**   I also have a lot of unwanted custom fields which are need to be deleted, how should i go about. help me out guys.


When to use actions and when to use filters

I'm trying to understand where to use filters and where to use actions. Suppose I have a query in a plugin, which later add on modules might modify to change the results of the query, thus modifying the arguments. Would this be an ideal implementation of this concept, or should I be using actions here? // Function to display list of pages               function get_page_list() {         $pages_args = array(             'post_type' => 'page',             'posts_per_page' => '1'         );           $pages_query = new WP_Query( apply_filters( 'myfilter', $pages_args ) );                   if( $pages_query->have_posts() ) {             while ( $pages_query->have_posts() ) : $pages_query->the_post();                   echo get_the_title();             endwhile;             // Reset Post Data             wp_reset_postdata();         }                    else echo 'no results found';                           }     add_action( 'wp_footer', 'get_page_list', 1);                function change_page_to_post( $pages_args ) {         $pages_args = array(             'post_type' => 'post',             'posts_per_page' => '1'         );           return $pages_args;     }     add_filter('myfilter', 'change_page_to_post');


Can't login to my admin area

I don't know what did I change, other than creating a new ftp account because the other one wasn't working with my ftp client. Now when I go to the login page, it doesn't accept my correct wp password, and this happens in the url: http://www.ieltsonlinecourses.com/wp- login.php?redirect_to=http://www.ieltsonlinecourses.com/wp- admin/profile.php&reauth=1 I haven't set any redirection of any kind. Please help me out, I can't login back to my own site! Thanks, Capex.


image in my post disappeared after I upload website to remote server

Before I upload my website to server, I created post with images which are uploaded to media, their url are, for example: http://localhost:40952/wp- content/uploads/2011/09/study_in-En.gif After I uploaded website to server, the link to the images in the post is not updated, therefore, the images are disappeared in post. Is there anyway I can update the images link automatically? It is very painful to go and fix every link url. Thanks.


Delete Categories and Tags from frontend

There is a function to generate post delete link from frontend: `get_delete_post_link( $id );` Are there any functions to generate categories and tags delete link on frontend? I have been looking for a core function for a while and couldn't find any. I tried to delete a tag using wp_nonce_url() without any success:               <a href="<?php echo wp_nonce_url('http://localhost/todo/wp-admin/edit-tags.php?action=delete&taxonomy=post_tag&tag_ID=2');?>">Delete Tag      When I click the link I get "Are you sure you want to do this?" and below that "Please Try Again" the nonce url generates fine. and needless to say I am logged in as admin. But I am still not able to delete the tag. Any help would be much appreciated. Thanks


Multisite with entirely different domains?

Just trying the multisite feature for the first time. The primary hostname is blog.domain1.com. When trying to create multiple sites, it only allows me to create XXXXX.blog.domain1.com. But what I really want is blog.domain2.com, blog.domain3.com, etc. All on the same Apache instance, same database, same IP. Is that doable directly with WP? I could try some Apache rewrite wizardry, but it just seems ugly. Any suggestions?


How do I create shortcodes for my wordpress themes?

I have seen many professional wordpress themes for sale that have shortcodes built in with which you could easily make posts like this:               [alert_box]This is an alert box which based on this short-code automatically     switches the CSS so it is easier than messing with classes every time[/alert_box]      How can I do this? I know that it requires you to add something to the functions.php, though I haven't been able to figure out how. Thank you, any help is appreciated.


How to parse row results from $wpdb -> get_results

I have the following:               $query = 'SELECT * FROM wp_pod_tbl_add_questions WHERE id LIKE '. $id;                                                  $row = $wpdb -> get_results($query);      How do I get the columns named 'id' and 'name' from $row?


Remove border attribute from Pin It Button image to pass HTML5 validation

I am using the Pinterest "Pin It" Button plugin http://pinterestplugin.com which uses this code on my blog pages:               <img border="0" class="pib-count-img" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" />      `border="0"` is causing my blog to fail HTML5 validation. I keep getting the error: 'The border attribute is obsolete. Consider specifying img { border: 0; } in CSS instead.' How can I remove the `border` attribute from the image used for the Pin It button so that my blog pages pass HTML5 validation?


Using password protection to load different page elements?

I have a page that is password protected, and I wish to removed some parts of the theme, and add others. Can I do that? Is there a check I can do in the theme files to see if a user has entered the password or not?


I am extending Walker_Nav_Menu: How can I get the number of children elements of the current item?

I am trying to extend the Walker_Nav_Menu walker to make some changes to the way WP outputs menus. The method I have to override is start_el, so I created my Walker and copied the base method:               <?php     class myCustom_Walker_Nav_Menu extends Walker_Nav_Menu {         function start_el(&$output, $item, $depth, $args) {             global $wp_query;             $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';                  $class_names = $value = '';                  $classes = empty( $item->classes ) ? array() : (array) $item->classes;             $classes[] = 'menu-item-' . $item->ID;                  $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );             $class_names = ' class="' . esc_attr( $class_names ) . '"';                  $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );             $id = strlen( $id ) ? ' id="' . esc_attr( $id ) . '"' : '';                  $output .= $indent . '<li' . $id . $value . $class_names .'>';                  $attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->attr_title ) .'"' : '';             $attributes .= ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) .'"' : '';             $attributes .= ! empty( $item->xfn )        ? ' rel="'    . esc_attr( $item->xfn        ) .'"' : '';             $attributes .= ! empty( $item->url )        ? ' href="'   . esc_attr( $item->url        ) .'"' : '';                  $item_output = $args->before;             $item_output .= '<a'. $attributes .'>';             $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;             $item_output .= '</a>';             $item_output .= $args->after;                  $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );         }     }       ?>      My problem is that I dont seem able to get the children for the current item ($item). Can somebody help me?


Can't call Javascript function - scope?

I get a method not defined error when trying to call a function loaded with `wp_enqueue_script` from `site.js`. I'm guessing it's because of scope caused by the jQuery ready wrappers? How do I get around that? **site.js** (loaded in `head`)               jQuery(document).ready(function($) {       $(window).load(function() { // wait until everything has loaded         doSomething(); // results in face palm       });     });      **my-script.js** (loaded in footer)               jQuery(document).ready(function($) {            function doSomething() {         alert("Time for a coffee break!");       }     });      **functions.php**               wp_register_script( 'my-script', get_template_directory_uri().'/js/my-script.js', array( 'jquery' ), '', true );     wp_enqueue_script( 'my-script' );     // Pass in PHP variables     wp_localize_script( 'my-script', 'my_script', localize_post_vars() );