title: Local wordpress setup with SPAM in the incoming links dashboard section?

text: I am developing a website on my localhost and i just notice a bunch of incoming links in the dashboard's incoming links section, which doesn't look valid. When i visit the urls i don't see a reffer to my localhost/domain.com. the only plugin i had active was "Regenerate Thumbnails". I disabled the plugin but i can still see the links. How can i fix this? regards


title: Best way to include jQuery and fire with script at bottom of container

text: I'm going to be using a jQuery slider on my homepage only (not a WP plugin, but a third party). What I'd like to do is include jQuery, the plugin's jQuery script using a .js file, then include the script needed to fire the plugin right before the closing body tag. I'm a bit confused about how that works. I know WordPress comes with jQuery built in, so does that mean I don't need to include it again? Looking for best practices on this. I understand there are conflict issues that need to be prevented, etc. Thanks


title: How to remove div container in custom menu?

text:
all                      As per my html theme structure i do not want to add my menu

 under
.      I am using                <?php wp_nav_menu( array( 'menu_class' => 'tlm', 'theme_location' => 'primary-menu' ) ); ?>      By default this wrap my menu with div. like

Dashboard

Patients

Patients

Add Patients

Calender

Images

Support

Logout

      How to remove div container in custom menu ? as i can think there may be need some change in wp_nav_menu() function array.


title: wordpress plugin noob situation

text: Hay I am creating my first wordpress plugin. Everything is going well so far. I have been able to add a new navigation tab to the dashboard which links to a function which basicalliy uses 'include' to spit the content of a HTML page onto the wordpress admin area. Heres my code               add_action('admin_menu', 'rooms_menu');          function rooms_menu() {         add_menu_page('Rooms', 'Rooms', 'read', 'rooms-admin', 'show_hotel_dashboard', '' , 9);     }          function show_hotel_dashboard(){         include 'dashboard.html';     }      pretty straight forward, the dashboard.html page is a very simple html page. Now, heres my issue, within this dasboard.html page, how do i link some links to functions? Say i have a link which is               Do action      when i click that link it actually goes to do_action.php not the action within my plugin. Any ideas?


title: Changing the Order of Admin Menu Sections?

text: I am getting a bit frustrated over here after having spent a few hours trying to accomplish this fairly simple task without any luck. Essentially I have 5 custom post types which I created and all I want to do is show each of them in a specific order directly under the _"dashboard"_. From the WordPress documentation it seems that you can't really do this because the highest menu order seems to be "5". And above L I am guessing some expert reading this can show me the simple way that I can order the admin menu exactly the way I want to by utilizing the functions file and without utilizing a plugin (which I know exists). Please go ahead and try to create 5 separate post types and include them in a specific order directly under the dashboard... it seems this is not possible.??... is there some type of jquery hack to make this work that someone could share with me or preferably without utilizing jQuery?


title: Make the plugin directory recognize new version numbers

text: I updated readme.txt Stable Tag and tagged versions 0.2, 0.3 and latest 0.3.1 in SVN. After checkin, the new version is recognized only partly:   * On the dev-tab it links to the latest version (0.3.1) in the svn repository.   * The link-text still reads "0.1"   * The download button reads "Download Version 0.1"   * All other versions are listed under "other versions" Plugin: http://wordpress.org/plugins/geouri/developers/ **Question** : How to make the directory recognize version 0.3.1 ?


title: caption shortcode inserts blank paragraph

text: > [NOTE: Cross-posted from wordpress.org/support/topic/caption-shortcode- > inserts-blank-paragraph to see which site gets a better answer. :] I am setting up a new blog, no plugins yet. I inserted a photo in to a post, align right, with a caption. When I view the post in The zen light theme or the default theme I get a blank paragraph rendered above the image. Why is that and how can I change that? See: http://www.the99ers.net/2010/09/hello/ The relevant code reads: `<p><div id="attachment_19"` Basically, I am pretty sure I want to drop the outer `<p>` and just have the `<div>` float where it needs to go. Why is it doing what it is doing and how can I make it down what I want? Thanks! Sincerely, -danny


title: How to access my site using IP Address?

text: I would like to know how to access my website using Ip address instead of domain. Like 173.252.100.16 can used to access facebook. My Website is: www.jijojose.me Server have multiple websites hosted.


title: How to validate register settings array

text: I would like to know how to perform a proper validation with the `register_setting()` callback function. Here is a sample part of my code I want to work with:               register_setting( 'wpPart_options', 'wpPart_options', array( &$this, 'wpPartValidate_settings' ) );      `$this` is an array of objects. And here is the content of my `wpPartValidate_settings();` function.               public function wpPartValidate_settings( $input ) {             $options = get_option( 'wpPart_options' );        if ( check_admin_referer( 'wpPart_nonce_field', 'wpPart_nonce_verify_adm' ) ) {           return $input;        }          }      Since `$input` is an array, how can I perfom a proper validation on every input that comes to the validating function? I would like, for example, to perform a `strlen()` check on a text field :               if ( strlen( $input ) != 20 )        add_settings_error( 'wpPart_options', 'textField', __( 'TextField incomplete.', 'wpPart' ) , 'error' );


title: Splitting an Evolving Site into Multiple Sites, or Maintaining as One Site?

text: ## To Separate or Not to Separate...That is the Question? I currently have what I believe is a mistake in my site architecture. I initially built my two lines of business into the same site. Engineering/Design work and Equipment Liquidation. Learning the hard way I realize I need dedicated domains. I plan to use the same look and feel for both but have 2 separate domains/subdomains. The question is should I install a separate instance of WP for each or simply build it in the same structure with a different landing page and limited navigation between each. Obviously the latter is easier initially but I am concerned this would cause further difficulty later. Anyone have experience with this sort of situation? The theme I am using will support this but I am not convinced it is a good plan. Feel free to look at the site http://realitycramp.com, just be gentle in terms of criticism as it is a work in progress. **Amazed at the quality of contribution on this site.** MM/RC


title: Which modification to login only certain role?

text: I have created a special role in WP admin and now I would like to allow to login to certain frontend page only people with this role. How to do that? I still want be able to login for all people for other areas.


title: Maximum protection without using password/login

text: I want to hide my WordPress site (or any website) from the world and only allow certain users to enter. What's the best way of doing this without setting up user accounts and passwords? Or perhaps more precise, what's the maximum protection I can get without using accounts? Of course, I've chosen to block search engines under settings->privacy already. But I've thought about blocking people from linking directly to images and files, how can that be done? Is it by putting all the uploads (files/images) in a hidden folder somewhere outside of the WP structure? How do I do that? Thanks!


title: Why is the loop not empty on some 404s?

text: I came across a weird issue. Say you access a random url, three or more levels deep:               http://example.com/a/b/c     http://example.com/a/b/c/d     ...      Then `is_404()` is `true`. So far so good. But for some reason the last posts are queried.               $wp_query->request      is               SELECT SQL_CALC_FOUND_ROWS wp_posts.ID          FROM wp_posts          WHERE 1=1              AND wp_posts.post_type = 'post'              AND (                 wp_posts.post_status    = 'publish'                  OR wp_posts.post_status = 'private'                 )          ORDER BY wp_posts.post_date DESC          LIMIT 0, 5      Which then of course makes `have_posts()` return `true` and so on. Can someone explain this? What I found out so far: The reason that only kicks in at three or more levels deep is that before that WP looks for posts and attachments which somehow results in some other behaviour. It seems that even though WP recognises the request as a 404 at one point it then fetches the most recent posts. With the help from @kaiser and @G.M. I've tracked this down to somewhere from /wp-includes/class-wp.php:608


title: Change wordpress website into android app

text: I have recently joined a startup company as an android developer. Recently that company has made an e-commerce website in woocommerce a plugin in wordpress. Now customer want an android app for this site. I have analyzed database and files created by woocommerce . It is very complex and I could not understand that complex file and database structure. So please guide me how to use that same database for android app. And please tell is there any free or less expensive plugin available that convert website into android app.Help me please.


title: Transient api Caches confused

text:
This code works for page 1               <?php                 $paged1 = (get_query_var('paged')) ? get_query_var('paged') : 1;                 $recent1 = get_transient( 'recent1' );                                     if ( false === $recent1) {         $recent1 = new WP_Query ('cat=3&posts_per_page=5'.'&paged='.$paged1);         set_transient('recent1', $recent1, 60*60);         }         // do normal loop stuff         if ($recent1->have_posts()) : while ($recent1->have_posts()) : $recent1->the_post();         ?>
<a href="<?php the_permalink () ?>" rel="bookmark">
<?php the_title (); ?>
      <?php the_post_thumbnail(array(100,100), array('class' => 'alignleft')); ?>      <?php the_advanced_excerpt(); ?>      But there is a problem with pagination. Page 1 confused with page 2 or page 3 and etc. On page/2 there is content of page/1 or on the contrary. How to resolve this ?


title: wp_register_script Question

text: I need to add the following JS to the head, but I don't know how to add the "data-cfasync="false" " by using "wp_register_script" or "wp_enqueue_scripts". Please help!!               <script data-cfasync="false" type="text/javascript" src="http://use.typekit.com/YOUR-KIT-ID.js"></script>     <script data-cfasync="false" type="text/javascript">try{Typekit.load();}catch(e){}</script>


title: functions.php and conditional tags

text: I'm having the following issue:   some conditional tags do not work on the functions.php file. For example I'm trying to do the following:               if ( is_home() ) :         wp_enqueue_script('accordeon_setup', '/wp-content/themes/44db/js/scripts-accordeon.js');     endif;      and although the site produces no error I cannot see the script in the home page.   The same thing happens with the following conditional tag:               if ( $post->post_parent == '12' ) :      Is there something I'm missing?? Both conditional tags run at the bottom of the functions.php Thank you people !!!


title: Property value of null when value is assigned inside a method hooked to the wp action hook

text: In `my_method()` below, I'm assigning an array of post IDs to the property `$this->post_ids` which is to be used later on in my query args - see `process()`. If I hook `my_method()` to the `init` action hook, things work but if I hook `my_method()` to the `wp` action hook, things don't work. When `my_method()` is hooked to `wp`, doing `var_dump( $this->post_ids )` inside `process()` displays `null`. When `my_method()` is hooked to `init`, doing `var_dump( $this->post_ids )` inside `process()` displays `Array[15]`. -               public function __construct() {         // This works         add_action( 'init', array( $this, 'my_method' ) );              // This doesn't work.         add_action( 'wp', array( $this, 'my_method' ) );              add_action( 'wp_ajax_myaction', array( $this, 'process' ) );         add_action( 'wp_ajax_nopriv_myaction', array( $this, 'process' ) );     }      -               public function my_method() {         $this->post_ids = explode( ',', '69,70,71,72,73,80,86,89,90,91,92,93,94,96,169' );     }      -               public function process() {              $args = array(             'offset' => 10,             'post_type' => 'post',             'post__in' => $this->post_ids         );              $this->query = new WP_Query( $args );              // Process the query results here...     }      **Background info:** The `process()` method handles data sent via an AJAX request. After processing, it sends a response to the browser. For example: `echo json_encode( $response )` **My question:** Inside `process()`, why is the value of the `$this->post_ids` property:   * `null` when I hook `my_method()` to `wp`   * `Array[15]` when I hook `my_method()` to `init`? I don't understand why it is different. **Update:** The value of `$this->post_ids` is `null` only inside the `process()` method. Could this be because `process()` is running during an AJAX request?


title: problem of path with xml file

text: i'd like to import a flash audio player in my wordpress theme, the import of the file works fine because it shows up on screen, responds to the click on play/pause, but the sound does not start. edit : i found out the path has to be modified in the .as file, with the right path. Thanks sancho All the files are in : /Applications/MAMP/htdocs/wordpress/wp- content/themes/maVersion/ and the mp3 are in : /Applications/MAMP/htdocs/wordpress/wp- content/themes/maVersion/audio i'm in local, so i tried with the whole path (see the first line) or with a "normal" path (like the second line - i made 2 tests for both examples) :               <?xml version="1.0" encoding="utf-8"?>     <PLAYLIST>     <SONG URL="/Applications/MAMP/htdocs/wordpress/wp-content/themes/maVersion/audio/dance.mp3" TITLE="First Track - Dance" ARTIST="John Doe" />     <SONG URL="audio/audio.mp3" TITLE="Second Track" ARTIST="Random Singer"/>     <SONG URL="audio/dance.mp3" TITLE="Third Track" ARTIST="Super Generic Singer"/>     </PLAYLIST>      but still no sound. Does anybody know what the solution is? Thanks Paul


title: Formatting with <pre>

text: I'm building a site that doesn't want any styling applied to the entry- content, because it should keep the formatting of the text. Bizarly, it works on old entries, but new entries via the front-end system fail: `http://madebylars.nl/music/?page_id=373` ### Example: This one works:               http://madebylars.nl/music/?tab=the-tallest-man-on-earth-love-is-all      This one doesn't:               http://madebylars.nl/music/?tab=the-tallest-man-on-earth-like-the-wheel      They both look fine in the WordPress back-end, but only one of them looks nice on the front-end. Any thoughts on how to fix this? I'm already wrapping the whole text in `<pre>` tags and stripping wp-content of html-tags. This is the styling I use (on both!):               pre {         background: none;          font: 13px "Courier 10 Pitch", Courier, monospace;         line-height: 1.5;         margin-bottom: 1.625em;         overflow: auto;         padding: 0.75em 1.625em;         display: block;         font-family: monospace;         white-space: pre-wrap;         letter-spacing: normal;         word-wrap: break-word;         word-spacing: normal;         word-break: normal;         margin: 1em 0px;     }


title: Include Custom Post Type Archive in wp_list_pages

text:
I am wondering how to include a custom post type archive in wp_list_pages. If there were a page ID, I could simply attach that page to the list using the 'include' argument. I know that there is a 'post_type' argument as well... but that will only list the posts, not the archive, and I need this link to be inserted alongside pages. Is there any way for me to pull this off? Here is the code I'm using:               $parentID    = get_top_parent_id($post->ID);     $parentTitle = get_the_title($parentID);     $parentLink  = get_permalink($parentID);          $args = array(         'child_of' => $parentID     );          $pages = get_pages($args);          if ($pages) {              $pageIDs = array();              foreach ($pages as $page) {             $pageIDs[] = $page->ID;         }              $args = array(             'title_li' => '',             'include' => $parentID . ',' . implode(",", $pageIDs)         );              wp_list_pages($args);          }      **UPDATE** Since it seemed like I wasn't going to be able to solve this the way I wanted to, I ended up taking a different approach. I found the question "Display a portion/ branch of the menu tree using wp_nav_menu()" and Rarst's answer is pretty amazing. Below is my little bit of code for creating the sidebar menu that I needed (I use WPML - hence the ICL_object):               <?php     /*      * PAGE SIDEBAR      *     */          $parentID   = get_top_parent_id($post->ID);     $parentLink = get_permalink($parentID);          if ( is_singular( 'custom_post_type_NAME' ) ) {         $cptParentID = icl_object_id( 77, 'page', false );         $parentTitle = get_the_title($cptParentID);     } else {         $parentTitle = get_the_title($parentID);     }          $navArgs = array(         'menu'    => 51,         'submenu' => $parentTitle,         'items_wrap' => '%3$s',         'container' => false     );          ?>

                 <a href="<?php echo $parentLink; ?>" class="widget-title" title="<?php echo $parentTitle; ?>"><?php echo $parentTitle; ?>

                     <?php wp_nav_menu($navArgs); ?>


title: tax_query: What to pass when I want to have all terms?

text: …               $args = array(         'post_type' => 'wr_event',         'posts_per_page' => -1,         'meta_key' => 'event_date',         'orderby' => 'meta_value_num',         'order' => $order,         'meta_value' => $yesterday,         'meta_compare' => $compare,         if ( is_null($cat) )             'tax_query' => array(                 array(                     'taxonomy'  => 'event_type',                     'field'     => 'slug',                     'terms'     => $cat,                     'operator'  => 'IN'                     ),                )     );      I'm confused, what do I pass in order to get all posts from all terms? Right now I can for instance pass `sports` in order to get all sports-events, but how do I get all events? I know I could just get rid of the `tax_query()` however I'm using this as a param, where I can pass along a certain tax or if not, i want all posts.


title: Restrict query_posts by Date?

text:
To display the most popular posts based on page views I am using this code (source):               <?php         query_posts('meta_key=post_views_count&orderby=meta_value_num&order=DESC');         if (have_posts()) : while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
         <?php         endwhile; endif;         wp_reset_query();     ?>      I would like to restrict the query to return posts from a certin date (i.e. the last seven days) and I am unsure how I would achieve this.


title: Loops in category description

text: I would like your help to find how to do a thing I need: I have some posts, for example:   * Article Title: Banana   * Article Title: Orange   * Article Title: Lemon   * Article Title: Strawberry All this articles need to have breadcrumb like this: Home > Fruits > #Title# In the "Fruits" category page I would like to create something like this: # Yellow Fruits (and a list of all articles about fruits that are yellow) # Orange Fruits (and a list of all articles about fruits that are orange) # Red Fruits (and a list of all articles about fruits that are red) To do this, I think in the description of category I should write manually the titles (Yellow Fruits, Orange Fruits, Red Fruits), and under each title I should put a loop to put all articles that have a specific tag (for example to the article called "Banana" I will give a tag "yellow"). Do you think it can work? do you have other ideas? Thank you very much


**PROBLEM:** I'am trying to prevent execution of default WordPress query for custom category template. I have found a possible solution, but looks like it preventing execution of all post queries:               function _cancel_query( $query ) {         if ( !is_admin() && !is_feed() && is_search() ) {             $query = false;         }         return $query;     }     add_action( 'posts_request', '_cancel_query' );      Source: http://vadimk.com/2010/05/11/disable-wordpress-search-query/ '@query->is_main_query()' won't work with 'posts_request' action. Is there any elegant way to prevent ONLY default WordPress query, allowing my code to handle getting posts, without performing useless operations? **WHY:** _I have to get featured posts, then fixed amount of normal posts without duplicate content, which implies that post query relies on featured query results, because there is no guarantee that in post query i find enough featured posts to populate featured box. And after all that i will have to add AJAX pagination - still without duplicate content._ **EDIT #2:** If you trying to perform WP_Query in 'pre_get_posts' as Rarst suggested (How to prevent execution of default query, while preserving ability to use WP_Query in template?): "pre_get_posts runs before WP_Query has been setup. Some template tags and conditional functions that rely on WP_Query will not work. For example, is_front_page() will not work, although is_home()will work. In such cases, you will need to work directly with the query vars, which are passed to the pre_get_posts hook as an argument ($query in examples on this page)." Source: https://codex.wordpress.org/Class_Reference/WP_Query WP_Query will be initialized at this stage, before main query, and to avoid result like this ( check out log ) you have to wrap it :               if ($query->is_main_query()) {         $args = array();         $query = new WP_Query( $args );     }      **LOG:**               [30-Apr-2013 17:07:12 UTC] PHP Fatal error:  Maximum function nesting level of '100' reached, aborting! in C:\Users\serwis\Dropbox\www\XYZ\wp-includes\functions.php on line 2769          [30-Apr-2013 17:07:12 UTC] PHP Stack trace:          [30-Apr-2013 17:07:12 UTC] PHP   1. {main}() C:\Users\serwis\Dropbox\www\XYZ\index.php:0          [30-Apr-2013 17:07:12 UTC] PHP   2. require() C:\Users\serwis\Dropbox\www\XYZ\index.php:17          [30-Apr-2013 17:07:12 UTC] PHP   3. wp() C:\Users\serwis\Dropbox\www\XYZ\wp-blog-header.php:14          [30-Apr-2013 17:07:12 UTC] PHP   4. WP->main() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\functions.php:779          [30-Apr-2013 17:07:12 UTC] PHP   5. WP->query_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\class-wp.php:549          [30-Apr-2013 17:07:12 UTC] PHP   6. WP_Query->query() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\class-wp.php:485          [30-Apr-2013 17:07:12 UTC] PHP   7. WP_Query->get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:2972          [30-Apr-2013 17:07:12 UTC] PHP   8. do_action_ref_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:1924          [30-Apr-2013 17:07:12 UTC] PHP   9. call_user_func_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  10. gs_pre_get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  11. WP_Query->__construct() C:\Users\serwis\Dropbox\www\XYZ\wp-content\themes\roots-XYZ\lib\custom.php:14          [30-Apr-2013 17:07:12 UTC] PHP  12. WP_Query->query() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:3059          [30-Apr-2013 17:07:12 UTC] PHP  13. WP_Query->get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:2972          [30-Apr-2013 17:07:12 UTC] PHP  14. do_action_ref_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:1924          [30-Apr-2013 17:07:12 UTC] PHP  15. call_user_func_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  16. gs_pre_get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  17. WP_Query->__construct() C:\Users\serwis\Dropbox\www\XYZ\wp-content\themes\roots-XYZ\lib\custom.php:14          [30-Apr-2013 17:07:12 UTC] PHP  18. WP_Query->query() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:3059          [30-Apr-2013 17:07:12 UTC] PHP  19. WP_Query->get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:2972          [30-Apr-2013 17:07:12 UTC] PHP  20. do_action_ref_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:1924          [30-Apr-2013 17:07:12 UTC] PHP  21. call_user_func_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  22. gs_pre_get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  23. WP_Query->__construct() C:\Users\serwis\Dropbox\www\XYZ\wp-content\themes\roots-XYZ\lib\custom.php:14          [30-Apr-2013 17:07:12 UTC] PHP  24. WP_Query->query() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:3059          [30-Apr-2013 17:07:12 UTC] PHP  25. WP_Query->get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:2972          [30-Apr-2013 17:07:12 UTC] PHP  26. do_action_ref_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:1924          [30-Apr-2013 17:07:12 UTC] PHP  27. call_user_func_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  28. gs_pre_get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  29. WP_Query->__construct() C:\Users\serwis\Dropbox\www\XYZ\wp-content\themes\roots-XYZ\lib\custom.php:14          [30-Apr-2013 17:07:12 UTC] PHP  30. WP_Query->query() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:3059          [30-Apr-2013 17:07:12 UTC] PHP  31. WP_Query->get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:2972          [30-Apr-2013 17:07:12 UTC] PHP  32. do_action_ref_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:1924          [30-Apr-2013 17:07:12 UTC] PHP  33. call_user_func_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  34. gs_pre_get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  35. WP_Query->__construct() C:\Users\serwis\Dropbox\www\XYZ\wp-content\themes\roots-XYZ\lib\custom.php:14          [30-Apr-2013 17:07:12 UTC] PHP  36. WP_Query->query() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:3059          [30-Apr-2013 17:07:12 UTC] PHP  37. WP_Query->get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:2972          [30-Apr-2013 17:07:12 UTC] PHP  38. do_action_ref_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:1924          [30-Apr-2013 17:07:12 UTC] PHP  39. call_user_func_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  40. gs_pre_get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  41. WP_Query->__construct() C:\Users\serwis\Dropbox\www\XYZ\wp-content\themes\roots-XYZ\lib\custom.php:14          [30-Apr-2013 17:07:12 UTC] PHP  42. WP_Query->query() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:3059          [30-Apr-2013 17:07:12 UTC] PHP  43. WP_Query->get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:2972          [30-Apr-2013 17:07:12 UTC] PHP  44. do_action_ref_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:1924          [30-Apr-2013 17:07:12 UTC] PHP  45. call_user_func_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  46. gs_pre_get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  47. WP_Query->__construct() C:\Users\serwis\Dropbox\www\XYZ\wp-content\themes\roots-XYZ\lib\custom.php:14          [30-Apr-2013 17:07:12 UTC] PHP  48. WP_Query->query() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:3059          [30-Apr-2013 17:07:12 UTC] PHP  49. WP_Query->get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:2972          [30-Apr-2013 17:07:12 UTC] PHP  50. do_action_ref_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:1924          [30-Apr-2013 17:07:12 UTC] PHP  51. call_user_func_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  52. gs_pre_get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  53. WP_Query->__construct() C:\Users\serwis\Dropbox\www\XYZ\wp-content\themes\roots-XYZ\lib\custom.php:14          [30-Apr-2013 17:07:12 UTC] PHP  54. WP_Query->query() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:3059          [30-Apr-2013 17:07:12 UTC] PHP  55. WP_Query->get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:2972          [30-Apr-2013 17:07:12 UTC] PHP  56. do_action_ref_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:1924          [30-Apr-2013 17:07:12 UTC] PHP  57. call_user_func_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  58. gs_pre_get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  59. WP_Query->__construct() C:\Users\serwis\Dropbox\www\XYZ\wp-content\themes\roots-XYZ\lib\custom.php:14          [30-Apr-2013 17:07:12 UTC] PHP  60. WP_Query->query() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:3059          [30-Apr-2013 17:07:12 UTC] PHP  61. WP_Query->get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:2972          [30-Apr-2013 17:07:12 UTC] PHP  62. do_action_ref_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:1924          [30-Apr-2013 17:07:12 UTC] PHP  63. call_user_func_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  64. gs_pre_get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  65. WP_Query->__construct() C:\Users\serwis\Dropbox\www\XYZ\wp-content\themes\roots-XYZ\lib\custom.php:14          [30-Apr-2013 17:07:12 UTC] PHP  66. WP_Query->query() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:3059          [30-Apr-2013 17:07:12 UTC] PHP  67. WP_Query->get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:2972          [30-Apr-2013 17:07:12 UTC] PHP  68. do_action_ref_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:1924          [30-Apr-2013 17:07:12 UTC] PHP  69. call_user_func_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  70. gs_pre_get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  71. WP_Query->__construct() C:\Users\serwis\Dropbox\www\XYZ\wp-content\themes\roots-XYZ\lib\custom.php:14          [30-Apr-2013 17:07:12 UTC] PHP  72. WP_Query->query() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:3059          [30-Apr-2013 17:07:12 UTC] PHP  73. WP_Query->get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:2972          [30-Apr-2013 17:07:12 UTC] PHP  74. do_action_ref_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:1924          [30-Apr-2013 17:07:12 UTC] PHP  75. call_user_func_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  76. gs_pre_get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  77. WP_Query->__construct() C:\Users\serwis\Dropbox\www\XYZ\wp-content\themes\roots-XYZ\lib\custom.php:14          [30-Apr-2013 17:07:12 UTC] PHP  78. WP_Query->query() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:3059          [30-Apr-2013 17:07:12 UTC] PHP  79. WP_Query->get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:2972          [30-Apr-2013 17:07:12 UTC] PHP  80. do_action_ref_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:1924          [30-Apr-2013 17:07:12 UTC] PHP  81. call_user_func_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  82. gs_pre_get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  83. WP_Query->__construct() C:\Users\serwis\Dropbox\www\XYZ\wp-content\themes\roots-XYZ\lib\custom.php:14          [30-Apr-2013 17:07:12 UTC] PHP  84. WP_Query->query() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:3059          [30-Apr-2013 17:07:12 UTC] PHP  85. WP_Query->get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:2972          [30-Apr-2013 17:07:12 UTC] PHP  86. do_action_ref_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:1924          [30-Apr-2013 17:07:12 UTC] PHP  87. call_user_func_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  88. gs_pre_get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  89. WP_Query->__construct() C:\Users\serwis\Dropbox\www\XYZ\wp-content\themes\roots-XYZ\lib\custom.php:14          [30-Apr-2013 17:07:12 UTC] PHP  90. WP_Query->query() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:3059          [30-Apr-2013 17:07:12 UTC] PHP  91. WP_Query->get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:2972          [30-Apr-2013 17:07:12 UTC] PHP  92. do_action_ref_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:1924          [30-Apr-2013 17:07:12 UTC] PHP  93. call_user_func_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  94. gs_pre_get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  95. WP_Query->__construct() C:\Users\serwis\Dropbox\www\XYZ\wp-content\themes\roots-XYZ\lib\custom.php:14          [30-Apr-2013 17:07:12 UTC] PHP  96. WP_Query->query() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:3059          [30-Apr-2013 17:07:12 UTC] PHP  97. WP_Query->get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:2972          [30-Apr-2013 17:07:12 UTC] PHP  98. WP_Query->parse_query() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:1922          [30-Apr-2013 17:07:12 UTC] PHP  99. absint() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:1442


title: Function call via ajax – can't figure it out?

text: In my header.php file I've got …               <script type="text/javascript">         var ajaxurl = "<?php echo admin_url( 'admin-ajax.php', 'relative' );?>";     </script>      In my functions.php file I've got …               add_action('wp_ajax_get_event_list', 'get_event_list');     add_action('wp_ajax_nopriv_get_event_list', 'get_event_list');          function get_event_list( $latest = true, $order = 'ASC', $return = false, $year = NULL, $cat = NULL ) {              // Stuff of the function          }      In my script.js file I've got …               $('#year-filter .inactive').click(function(e) {         e.preventDefault();         console.log(ajaxurl); // http://mydomain.com/wp-admin/admin-ajax.php               $.ajax({             type: 'GET',             url: ajaxurl,             data: {                  action: 'get_event_list',                 year: '2012', //param year                 cat: 'vortraege' //param category             },             dataType: 'html',             timeout: 300,             success: function(data){                 console.log('Ajax success');             },             error: function(xhr, type){                 console.log('Ajax error');                 console.log(xhr + " " + type)             }         });     });      I currently get the following error in my console > http://mydomain.com/wp-admin/admin-ajax.php > > Ajax error > > [object XMLHttpRequest] timeout


title: Walker_Nav_Menu exeption

text: I'm currently working on a WordPress site and whenever in the admin I go the Appearance > Menus page I get the following error:               ErrorException: Runtime Notice: Declaration of Walker_Nav_Menu_Edit::start_lvl() should be compatible with that of Walker_Nav_Menu::start_lvl() in wp-admin/includes/nav-menu.php line 203      It seems like some sort of PHP compatibility issue. I'm running PHP 5.3.10 on my local dev machine. What would be the best way to remedy this problem?


title: resetting permalinks after changing page names

text: After a lengthy staging time, many page categories, pages within pages, need to be retitled. This made a mess of my link structure and now I'm having a real hard time try to figure out how to reset all of the different links. If you had made a page, then created 15 pages within that page as a structure, then another 15 pages in each of those pages, then retitled the first page – how do you edit the link structure? I'm stumped.


title: delete unattached images on post submit

text: I have given permission to the users to register on my blog and add the contents (posts). Blog post will allow only 3 images to be inserted (please see the screenshot below) achieved by using custom fields plugin. **EDIT:** below screenshot taken from add new post page. which is for upload the images. ![screenshot](http://i.stack.imgur.com/yK8Dn.png) **Problem:** Few users are uploading multiple images by using any one of Add Image buttons shown above, then they are finalizing 3 images from uploaded images to attach with the post. I found one user has uploaded 20 images and then used 3 images from those to attach to the post. So unnecessarily it's increasing the images in the server directory. **Seeking solution for:** When user clicks on Submit for Review button, unattached images should be removed from his account only. Please suggest me the function which I can add in to function.php of my theme **EDIT:** Amount of images are restricted by providing 3 upload buttons, so the user can select only 3 images to attach to the post (above screenshot). But in this case users are using those buttons to upload multiple images (say 20 images) but using only 3 images from those to attach to the post. So I require a function/filter to clear the unattached images (remaining 17 images), which I can run on Submit post action in function.php.


title: RSS feed for dynamic set of custom taxonomies terms

text: I've got a CPT called 'Job' and three different taxonomies associated with it: location, type (permanent/contract) and expertise. I've got a filter on the website that allows to search for jobs of specific expertise of specific type in a certain location: http://www.grovelands.co.uk/roles-we-offer I'd like to create a RSS feed where a visitor can choose a specific set of taxonomy terms (location, type, expertise) to subscribe to. **For example** , a visitor 1 would like to sign up for jobs in 'corporate development' expertise of all types in London are. Visitor 2 wants to sign up 'Risk and Regulation' expertise of 'contract' type in Scotland only. Is such a dynamic RSS possible to create and how to? I would hugely appreciate any tips and hints. Many thanks, Dasha


title: plugin how to find code and edit it in a template file?

text: I'd like to add an id to each permalink from a plugin. Jquery just returns the same id for each link. Is there another way I can do this?               add_action('add id for each loop', 'test');     function test() {     ?>               <?php          }      It works fine if I add it to the template directly so is there a way I can find the code from a plugin and add/edit into content.php (custom? loop) template file?               // add the id     <a href="<?php the_permalink(); ?>"><?php the_title(); ?>     // result     <a href="<?php the_permalink(); ?>" id="<?php the_ID(); ?>"><?php the_title(); ?>


title: Excluding specific widgets from default sidebar class

text:
I have two sidebars using the `register_sidebars` function that display each widget as a list item with a class of `.box`:               <?php if(function_exists('register_sidebars')){          register_sidebars(2, array(         'name'=>'sidebar%d',         'id'  =>'sidebar',         'before_widget'=>'
',         'after_widget'=>'
',         'before_title'=>'
',         'after_title'=>'
',     ));     }     ?>      So the output goes something like:

Lorem ipsum

Blogroll

Example

      What I need is a conditional function so that any Links widget (or one with a class of `.xoxo`) in the sidebars will not get a class of `.box` because I want to style those and only those differently, and in a way that I can simply change certain styles from inside of `.box`. The main problem is that I don't know what function or variables to target with a filter. The codex doesn't do a good job of classifying less-used global variables and I can't see anything in the Filter Reference that looks like it should help.


title: White Space on translated strings lost

text: This is really crazy – I've done it before but now the whitespaces in placeholders in my translation strings are lost. For example this is translation of my pot:               This entry was posted in %1$s and tagged %2$s. Bookmark the permalink.      I translated it (german) to this               Dieser Beitrag wurde gepostet in %1$s und hat die Tags %2$s. Bookmarke den permalink.      Just a standard translation of the _Underscore_ Theme. But all tags and categories are combined without a whitespace. I just get               [...]Blog,Blog,Blog[...]      And because of that the whole stuff doesn't do any line breaks just a massive line of links ...


title: Setup A Default Featured Image

text: I'm trying to setup a default fallback featured image on my website to ensure consistency with images being displayed for every post, even when an image is not embedded in the post. I've tried a number of plugins - Default Post Thumb and Default Thumb, however neither of these seemed to work. I'm using WP 3.4 and the Suffusion Theme 4.2.2 on the site which can be seen at http://www.aliveradio.net/ I'm not very capable at editing basecode and would prefer to work with plugins, however if anyone could help with code alterations I'd be happy to give it a go. Thank-you in advance for any help you can provide.


title: add_rewrite_rule and template redirect not working

text: I have the following pairs:               add_rewrite_rule('^questions/ask/?','index.php?pagename=ask','top');     if(is_page('ask')){             $tname = 'add-question.php';             if(file_exists(TEMPLATEPATH.'/'.$tname)){                 $returntemplate = TEMPLATEPATH.'/'.$tname;             }else{                 $returntemplate = $plugindir.'/default-template/'.$tname;             }             ahaali_do_theme_redirect($returntemplate);      and:               add_rewrite_rule('^questions/ed/([^/]*)/?','index.php?pagename=ed&id=$matches[1]','top');     if(is_page('ed')){                 $tname = 'edit-question.php';                 if(file_exists(TEMPLATEPATH.'/'.$tname)){                     $returntemplate = TEMPLATEPATH.'/'.$tname;                 }else{                     $returntemplate = $plugindir.'/default-template/'.$tname;                 }                 ahaali_do_theme_redirect($returntemplate);             }      Now what happens is the following: The first rule and template redirect works while the second one does not. I have added in the header of my theme               print_r($wp->query_vars);       the result is:               Array ( [pagename] => ed [id] => 10 )       So the rule itself works but the template redirect does not. Any idea why?


title: Category URL Management

text: When you keep the category base ( that is you don't remove it by a plug in) WordPress does allow you to browse to your 2 level deep category in two different ways as the example below would demonstrate it. say, your category has a top level item "MULTIMEDIA" and a child under it called VIDEO. Visually, we are talking about a situation like this; ## Category taxonomy               multimedia         video         audio     topics         science         politics       Well, you may get to that child (video) in the following 2 different ways; yoursite.com/category/multimedia/video or yoursite.com/category/video The point here is that WP brings you to the exact same page, regardless of which URL has been used, and there are no redirects here neither, so both URL's remain on the visitor's browser as is just like it was requested at the first place. And with either URL, the resulting content is identical. That's a hateful situation by Google. Google punishes such sites cause your web site got the _same exact content_ appearing under 2 different URL's. ( This is of course when you happen to use both URLs. ) Sure, Nobody would want to do that deliberarely but sometimes you end up with that. And this question is all about that case. Let's say, you wanted to pick the simpler URL for your VIDEO category and you want to stick to that only. Basically, you want the URL to be yoursite.com/category/video This is easy to achieve when you use the custom menu feature that comes with WordPress where you can specify a URL for that particular custom menu item of yours. So, when visitors click on the VIDEO link on the custom menu, they end up coming to yoursite.com/category/video No problems so far... But as soon as they pick a post out of that category, and they end up coming to a post where the post's meta data displays things like "CATEGORIZED in" or "TAGGED by" etc, they will be exposed to the alternative URL for that VIDEO category. So, if a user clicks on the VIDEO link in the "Categorized in" area, the URL that they will end up with would be yoursite.com/category/multimedia/video And with that, there goes your SEO ranking. My question is what techniques do you use here so WordPress always and always use one single URL, the URL you defined in the custom menu. I thought, category slugs could do this, but when I checked it, slug feature allows me to change only the category term in the URL, not the path to it. If it were to give me a choice like video slug: /category/video I would be done. But that choice is not available at this moment. When you do that, you end up with the following slug instead categoryvideo That's because / is not a valid character for a slug. Please suggest an alternative way to tell WordPress to stick to /category/video at all times. Before suggesting the obvious, ( well, just skip the 'multimedia' and make the 'video' a top level cat. ), let me say that that suggestion won't work for our situation.


title: Meta boxes not displayed, data isn't being saved

text: As the title says, I have a problem in functions.php (I assume it's in there) which causes custom fields to not be displayed on the new/edit post page, and when I add the meta box myself and save the data by updating the post, the data disappears. However, if I save the data by clicking the Update button for the meta box itself (and do not click the post Update button), the data is saved and displayed properly. I have posted the code in functions.php here.


title: Custom post template for particular category

text: Here is my issue: I have one parent category with many sub-categories below it, e.g.               Category        Sub category             sub-sub category......             sub-sub category......             sub-sub category......             sub-sub category......             sub-sub category......             ........      I used the WP dTree plugin to show the categories as a tree. Now I want that when I click any `sub-sub category......` that it shows all the posts in that category in one custom post template. I know how to make post template and I know when I make any post if the template file is defined the post will show that template. However I have a lot of `"sub-sub category......"` categories which contain many posts so it's hard to always define template for each post. If there's any way to display all the posts in a `sub-sub category......` category in one custom template, then please share with me... Below is an example of what I'm trying to do: ![Example of what I'm trying to do](http://i.stack.imgur.com/w5woS.gif)


title: Issue with custom plugin

text:
I created an audio player in HTML5/Flash with the help of the SoundManager2 API. Now I want to add it to Wordpress as a plugin, so that you don't need programming skills to customize the player. The plugin should just modify a few values in the HTML and the JavaScript and then echo the div with the audio player on the Homepage as a permanent div. Since I didn't really knew how to program plugins I followed the step-by-steps in the book "Professional WordPress : Design and Development". But I have to say that I'm really stuck because the Wordpress dashboard doesn't seem to show anything after activating the plugin besides "Audio player's ID" on the widget tab in "Appearance". Here is my code :               <?php      /*     Plugin Name: Frontpage audio player     Description: Audio player     Version: 0.1     */          register_activation_hook(__FILE__, 'audio_player_install');     function audio_player_install() {            function custom_dependencies() {       ?>         <link rel="stylesheet" type="text/css" href="style-min.css" />                                    <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" />                         <?php       }       add_action('wp_head', 'custom_dependencies');     }          register_deactivation_hook(__FILE__, 'audio-player-uninstall');     function audio_player_uninstall() {       //do something     }          add_action('widgets_init', 'audio_player_register_widgets');     function audio_player_register_widgets() {       register_widget('audio_player_widget');     }          class audio_player_widget extends WP_Widget {       function audio_player_widget() {         $widget_ops = array(           'classname' => 'audio-player-widget',           'description' => 'Displays the audio player on the front page.',         );         $this->WP_Widget('audio_player_id', "Audio player's ID", $widget_ops);       }            function form($instance) {         $defaults = array(           "file_Path" => 'audio/test.mp3',           "background_Ring_color" => '#000',           "loading_Ring_color" => '#000',           "playing_Ring_color" => '#ffd700',           "equalizer_Data_color" => '#ff8C00',         );         $instance = wp_parse_args((array)$instance, $defaults);         $file_Path = strip_tags($instance['file_Path']);         $bg_RingClr = strip_tags($instance['background_Ring_color']);         $loading_RingClr = strip_tags($instance['loading_Ring_color']);         $playing_RingClr = strip_tags($instance['playing_Ring_color']);         $equalizer_DataClr = strip_tags($instance['equalizer_Data_color']);     ?>

Frontpage Audio player settings :
            <form method="POST" action="options.php">         <?php settings_fields('audio_settings_group'); ?>

             Name of the file you want to play : 	                          (You also have to specify the audio file's extension. eg : ".mp3", ".wav", ".ogg")
             (If no file is specified, it will play the last created file by default)                          <input type="text" name="audio-File-url"              value="<?php echo esc_attr('audio-File-url'); ?>" />

             Ring background color : 	             <input type="text" name="background-Ring-color"              value="<?php echo esc_attr('background-Ring-color'); ?>" />	             Default color is "#000".

             Ring color while loading : 	             <input type="text" name="loading-Ring-color"              value="<?php echo esc_attr('loading-Ring-color'); ?>" />	             Default color is "#000".

             Ring color of already played sound : 	             <input type="text" name="playing-Ring-color"              value="<?php echo esc_attr('playing-Ring-color'); ?>" />	             Default color is "#ffd700".

             Equalizer (sound wave graph) color : 	             <input type="text" name="equalizer-Data-color"              value="<?php echo esc_attr('equalizer-Data-color'); ?>" />	             Default color is "#ff8C00".

           <input type="submit" class="button-primary" value="Save Changes" />
       </form>
          <?php            }            function update($new_instance, $old_instance) {         $instance = $old_instance;         $file_Path = strip_tags($new_instance['file_Path']);         $bg_RingClr = strip_tags($new_instance['background_Ring_color']);         $loading_RingClr = strip_tags($new_instance['loading_Ring_color']);         $playing_RingClr = strip_tags($new_instance['playing_Ring_color']);         $equalizer_DataClr = strip_tags($new_instance['equalizer_Data_color']);              return $instance;       }            function widget($args, $instance) {         extract($args);              echo $before_widget;              $file_Path = strip_tags($instance['file_Path']);         $bg_RingClr = strip_tags($instance['background_Ring_color']);         $loading_RingClr = strip_tags($instance['loading_Ring_color']);         $playing_RingClr = strip_tags($instance['playing_Ring_color']);         $equalizer_DataClr = strip_tags($instance['equalizer_Data_color']);              ?>

             <a class="audio-file" href="<?php echo $file_Path ?>">

              <?php         echo $after_widget;       }     }     ?>      Thanks in advance for your help !


title: create a front end post page template withTinyMCE,

text: there are alot of front end posting suggestion with wp insert post but is it posible to create a front end post submision with TinyMCE, and similiar editor


title: Drupal is going Symfony. Would WordPress benefit from doing the same?

text: If WordPress would do the same, would it lose much in performance?


title: Moving Share Buttons from a Plugin

text: I'm using the Share and Follow plugin on my site. I like it for the most part, but the "interactive share buttons" - the ones that appear at the front of the post - are on the first line of my post. This might be OK, except that it shoves the images that are at the beginning of the majority of my posts out of alignment (on both my main page and individual posts). I would much prefer that the buttons appear under the title, but before the first line of content in my post. But because it's a plugin, I can't figure out how to change where the buttons appear.


title: Custom ReCaptcha Login

text:
I'm trying to add ReCaptcha to my login page. I know there are many many plugins by per request I cannot use plugins. So far so good, I'm able to add the Captcha to my login but unable to show errors. It will error out on me when I enter the wrong password, but if I enter the right password and do not enter the Captcha I get no errors (which I should get a Captcha not filled error). So the only time my `captcha_errors` function fires is when user name / password is wrong. How do I get my login form to check the ReCaptcha before checking the login credentials?               do_action('login_head');          // this function adds captcha to the login form     function addCaptcha() {         if( session_id() == "" )             @session_start();              if (isset( $_SESSION["recaptcha_response_field"] ))              unset( $_SESSION["recaptcha_response_field"] );              ?>

                     <textarea name='recaptcha_challenge_field' rows='3' cols='40'></textarea>                     <input type='hidden' value='manual_challenge' name='recaptcha_response_field'/>

         <?php          return true;     }          function verifyCaptcha($pageid) {         $result = false;         if( session_id() == "" )             @session_start();              $pvk = 'prvk';              if (!empty($pvk) && isset($_POST['recaptcha_response_field'])) {             if(!function_exists('recaptcha_check_answer')) {                 require_once 'recaptchalib.php';             }             $resp = recaptcha_check_answer($pvk, $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field']);             $result = $resp->is_valid;         }         if(!$result)             return $_SERVER["REQUEST_URI"];         else             return admin_url();     }               // this function checks captcha posted with a login     function captcha_errors( $errors ) {         if ( isset( $_SESSION['cptch_error'] ) )             unset( $_SESSION['cptch_error'] );              // return $errros.'TEST';              if ("" ==  $_REQUEST['recaptcha_response_field'] ) {                 return $errors.''. __( 'ERROR', 'captcha' ) .': '. __( 'Please fill out The Cpatcha.', 'captcha' );         }              if ( isset( $_REQUEST['recaptcha_response_field'] ) && verifyCaptcha()) {             // captcha was matched                               } else {             return $errors.''. __( 'ERROR', 'captcha' ) .': '. __( 'Please enter a valid CAPTCHA value.', 'captcha' );         }         return( $errors );     }                         add_action( 'login_form', 'addCaptcha' );     add_filter( 'login_redirect', 'verifyCaptcha', 10, 3 );       add_filter( 'login_errors', captcha_errors);


title: Shortcodes: Return different based on atts

text:
I have the following shortcode for pullquotes:               //Pullquote shortcode     function pullQuotes($atts, $content = null) {     extract(shortcode_atts(array(         "author" => ''     ), $atts));     return '
'.$content.'
' . $author . '

';     }     add_shortcode("pullquote", "pullQuotes");      Basically I dont want the paragraph containing the $author attribute to be returned if there is no author set (ie: the default '' value). Any ideas?


title: Syndicate posts to another blog?

text: i want to import one blog to another but have that constantly happneing. i.e. when i blog on one site i want it to appear on the other? thanks


title: Can I license my WordPress Theme under the GPL 3.0?

text: I notice that WordPress uses the GPL 2+ license. Can I release my free theme under GPL 3.0, since that's the most current version? Would it create compatibility issues? Thanks!


title: Ajax template: how to handle head section

text: I know it's _easy stuff_ , but I'm new to this and I can't understand which is the best approach. ## Background The template I'm working on is a dual theme Desktop/Mobile, UA Sniffing based. _Now_ I just added responsiveness through enquire.js and ajax and everithing changed: I'm struggling in getting things to work properly, is the first time I'm dealing with ajax. ## Scenario My template is _dynamically loaded through ajax_ in fact if you try to resize the width of the window below 1080px, the mobile template will show up. (it will show up on every mobile device too but this is not important for us atm) So, responsiveness has been implemented with the help of enquire.js and ajax calls (see code below). Originally, the template was static so at the moment, the whole section is still conditionally loaded through if statements in functions.php. (e.g. the video script should just load on certain pages of the desktop version) ## Issues   1. The mobile template -which has been styled with the mobile.css stylesheet- doesn't seem to have any effect. Should I change the way stylesheets and scripts are loaded due to the new ajax/enquire thing?   2. the content i.e. the_content(), doesn't show up. Why? And how to load it in my scenario? found! -- document.write(data) was owerwriting everything! I added $("body").append(data); instead ## Follows the code **functions.php**                   //Load Stylesheet     function add_desktop_styles() {         wp_register_style('reset', get_template_directory_uri().'/reset.css');              wp_register_style('style', get_template_directory_uri().'/style.css', array('reset') );         wp_enqueue_style('style');              //$mobile = mobile_device_detect();         //if ($mobile==true) {         if (wp_is_mobile()) {             wp_register_style('mobile', get_template_directory_uri().'/mobile.css', array('reset') );             wp_enqueue_style('mobile');         }     }     add_action('wp_head', 'add_desktop_styles', '1');                    //UA Sniffing     function devicecontrol() {             require_once('_/inc/mobile_device_detect.php');     }     add_action('wp_loaded', 'devicecontrol', '2');                    //AJAX     function your_function_name() {         wp_enqueue_script( 'function', get_template_directory_uri().'/_/js/my_js_stuff.js', array('jquery','enquire'), true);         wp_localize_script( 'function', 'my_ajax_script', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );     }     add_action('template_redirect', 'your_function_name');          function get_mobile_template()     {         include('templates/pages/homepage-phone.php');         die();     }     add_action("wp_ajax_nopriv_get_mobile_template", "get_mobile_template");     add_action("wp_ajax_get_mobile_template", "get_mobile_template");          function get_desktop_template()     {         if (!wp_is_mobile()) {             include('templates/pages/homepage-computer.php');         } else {             include('templates/pages/homepage-phone.php');         }         die();     }     add_action("wp_ajax_nopriv_get_desktop_template", "get_desktop_template");     add_action("wp_ajax_get_desktop_template", "get_desktop_template");                    //jQuery     if ( !function_exists( 'core_mods' ) ) {         function core_mods() {             if ( !is_admin() ) {                 wp_deregister_script( 'jquery' );                 wp_register_script( 'jquery', ( "//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ), false);                 wp_enqueue_script( 'jquery' );             }         }         add_action( 'wp_enqueue_scripts', 'core_mods','2' );     }                    //Scripts Mobile     function add_mobile_scripts() {         wp_register_style('video-css', get_template_directory_uri().'/_/js/videojs/video-js.css');         wp_enqueue_style('video-css');         wp_register_script( 'video-js', get_template_directory_uri().'/_/js/videojs/video.js', null, false );         wp_enqueue_script( 'video-js' );     }     function isMobile() {         //$mobile = mobile_device_detect();         ///if ($mobile==true)         if (wp_is_mobile()) {             add_mobile_scripts();         }     }     add_action( 'wp_enqueue_scripts', 'isMobile', '1' );                    //Scripts Desktop     function addSlide() {         /*wp_register_script( 'modernizr', get_template_directory_uri().'/_/js/modernizr.js', null, false );         wp_enqueue_script( 'modernizr' );*/         wp_register_script( 'enquire', get_template_directory_uri().'/_/js/enquire.min.js', null, false );         wp_enqueue_script( 'enquire' );         wp_register_script( 'jwplayer', get_template_directory_uri().'/_/js/jwplayer.js', null, false );         wp_enqueue_script( 'jwplayer' );         wp_register_script( 'bootstrap', get_template_directory_uri().'/_/js/bootstrap.js', array('jquery'), false );         wp_enqueue_script( 'bootstrap' );         wp_register_script( 'spk_slide', get_template_directory_uri().'/_/js/slides.js', array('jquery'), false );         wp_enqueue_script( 'spk_slide' );     }                    // Slider just on front page     function isSlideshowPage() {       if ( is_front_page()         || is_page('Bankkaufmann')         || is_page('Hochschulabsolvent')         || is_page('Professional')         || is_page('Die Prüfungsstellen')         || is_page('Von Beruf Verbandsprüfer')) {             addSlide();         }     }     add_action( 'wp_enqueue_scripts', 'isSlideshowPage' );      **Js script** this script at the moment loads on all pages, I will wrap it and call it from the page-template later               enquire.register("screen and (max-width:1080px)", {              // OPTIONAL         // If supplied, triggered when a media query matches.         match : function() {             jQuery.ajax({                 url: my_ajax_script.ajaxurl,                 data: ({action : 'get_mobile_template'}),                 success: function(data) {                 document.write(data);                 }             });         },              unmatch : function() {$("body").empty();},              // OPTIONAL         // If supplied, triggered once, when the handler is registered.         setup : function() {},              // OPTIONAL, defaults to false         // If set to true, defers execution of the setup function         // until the first time the media query is matched         deferSetup : true,              // OPTIONAL         // If supplied, triggered when handler is unregistered.         // Place cleanup code here         destroy : function() {}          });          enquire.register("screen and (min-width:1081px)", {              // OPTIONAL         // If supplied, triggered when a media query matches.         match : function() {             jQuery.ajax({                 url: my_ajax_script.ajaxurl,                 data: ({action : 'get_desktop_template'}),                 success: function(data) {                 document.write(data);                 }             });         },              unmatch : function() {$("body").empty();},              // OPTIONAL         // If supplied, triggered once, when the handler is registered.         setup : function() {},              // OPTIONAL, defaults to false         // If set to true, defers execution of the setup function         // until the first time the media query is matched         deferSetup : true,              // OPTIONAL         // If supplied, triggered when handler is unregistered.         // Place cleanup code here         destroy : function() {}          });


title: How to control Facebook share information for the front page?

text: Is there a way to prove information to Facebook so I can control what the title and description information is that comes up when pasting the front page of my blog on facebook? Right now, it seems to grab a random post... not the latest... for th information. I'd prefer to either set the information myself for the front page OR insure that it shows information from my 1st/featured post. How can I get control over this? (again, this isn't related to a "like" button, or anything... but posting the root URL straight to a Facebook status. Sharing the whole site, not a post.)


title: Redirect to post after submission with Gravity Forms?

text: How do I redirect to a post after submission with gravity forms. It gives you the option to put in query string values but when I add `{post_id}/{Video Title:1}` I get `mysite.com/?123/name+of+post` and it just goes back to the homepage. My permalink structure is `post_id/postname` and `{Video Title:1}` equals the post name but it uses plus sings instead of dashes. What am I doing wrong?


title: why is $wpdb->update() causing a DB error from within wp_set_password()

text: I have a page-template for my custom theme that enables the user to reset their password from the front-end. I'm calling wp_set_password() and everything runs but the password is not changed in the DB. When I turn on $wpdb->show_errors() I get the following:               WordPress database error: []     UPDATE `wp_users` SET `user_pass` = '$P$BohZQNR7x.6IVoyG1LGH4Wv3xeycd70' WHERE `ID` = 9      the error happens inside wp_set_password() here:               function wp_set_password( $password, $user_id ) {             global $wpdb;             $hash = wp_hash_password( trim( $password ) );             $wpdb->update($wpdb->users, array('user_pass' => $hash, 'user_activatio\     n_key' => ''), array('ID' => $user_id) );                                                    wp_cache_delete($user_id, 'users');          }      This code is wp-includes/pluggable.php... I'm guessing that there is something _really_ obvious that I'm not understanding. I hope someone can clue me in... **[EDIT]:** after looking at this question I tried the suggestion listed there and discovered that update() is returning '1' which indicates that it successfully updated one row which is what it should be doing. But how come the DB is not being updated when I inspect it with phpmyadmin? **[EDIT 2]:** I am also using RedBeanPHP together with this template to access the same database. When I comment out the code to connect to the DB, then the update effects the DB. So perhaps this is a MySQL question and not a wordpress question? When does RedBeanPHP having a DB handle to the DB stop WPDB from updating the DB?? Sorry if this is the wrong place for the question. I would in general like an idea of how to debug this type of problem. Thanks!


title: Custom Post Type Date Based Archive URL rewrite

text: > **Possible Duplicate:**   >  custom post types, wp_get_archives and add_rewrite_rule I have a custom post type called "course" and I would like to create a date based archive similar to the default post archives which look like mysite.com/2012/05. I want to use urls like mysite.com/ **course** /2012/05. How can I do this using the WordPress rewrite API? While avoiding plugins. This solution is very close How to give a CPT (custom post type) a date based url but I would like to avoid using a query var if possible and stick with the year/month based urls.


title: How to add thumbnails to posts and pages automatically in a uniformed fixed elegant way?

text: please i am wondering if there was a plugin or hack that enables me to append a nice looking thumbnail for each post or page i publish on my blog. Currently, i am able to add the featured images but appending those images to my posts using the below code is not getting me any tidy results.               <?php     if ( has_post_thumbnail() ) {     the_post_thumbnail();     }  ?>      I am mainly looking for something simple that would fix those thumbnails automatically and uniformly in my posts or pages without adding them manually and adjusting their sizes and positions within the text one by one. As if i have 500+ posts, i have to repeat the process 500 times spending long hours adjusting each single image in my posts which is literally very time consuming. At the moment i have them set already as featured images but not displayed inside the posts or pages. ## Please check the below picture for an example of a tidy thumbnail: ![enter image description here](http://i.stack.imgur.com/3XmKw.jpg) Thanks in advance for your help! any suggestions are greatly appreciate it.


title: How to map permalinks with accented letters to sanitized slugs?

text: To keep legacy entries on a blog hosted on TypePad on sync with a new WordPress installation... How do I map this permalink with accented letters:               domain.com/no-es-fácil-alejarse-de-la-política      to this clean WP permalink without accented letter:               domain.com/no-es-facil-alejarse-de-la-politica      What is the best way to accomplish this?


title: Why is my custom loop not filtering correctly nor paginating?

text: Hopefully someone can help me with this as I've been struggling for a few days. I've built a form on a page that lets users filter Events by custom taxonomies Type, Period and Duration. These are working individually i.e. the filter shows all posts with either Type=x or Period=y but not combined. Can anyone see why? Here's my code in Pastie I'm also trying to figure out how to paginate my results for my custom loop, but can't figure out why it's not working? Any help massively appreciated. Thanks osu **EDIT** Ok, for some reason, I can't use the array method to pass my variables to query_posts() and I'm assuming this is because with the plugin Query Multiple Taxonomies which I need installed for this to work, it only works with the method 'post_type=event&fttype=daily' etc. Here's my new code which is working: http://www.pastie.org/1586564 HOWEVER, even though the pagination is working when you first visit the page, after you submit the form, the pagination stops working. So, nearly nearly there, but I need some help with the last part if anyone can be so kind? Thanks osu


title: After creating hierarchical post type, still not getting any way to set parent

text: After creating a custom post type like below, I still dont get any option to set the parent of the post, am I missing something?               register_post_type(       'projects',       array(         'labels' => array(           'name' => 'Projects',           'singular_name' => 'Project'         ),         'public' => true,         'capability_type' => 'post',         'supports' => array('title', 'editor', 'thumbnail', 'excerpt', 'comments'),         'hierarchical' => true,         'menu_position' => 5       )     );      ![](http://imgur.com/m224s.jpg)


title: Multiple TinyMCE Editors in one Admin Page

text: Please could someone give me an idiots guide to adding more than one TinyMCE editor to a page editor page please. I am creating my own wordpress theme and the multiple editors are an essential part of the website. I would like to know what code I need to add and where I add it for the editors to appear in the Editor side and the code needed to output the code to the live website. I have searched online for the answer but can not understand the ones that I have found. I have only just started learning PHP. Any help will be gratefully appreciated! Andi


title: Hook into create_category

text: I'm trying to in some way hook into when a new category is created. What I would like to do is to see the term and slug that was created and log them/email them. I have tried to hook in to create_category(). That only gives me an ID, not the term and slug. Would be great if someone could lead me on the right track.


title: Get_template_part inside a folder

text: So I've the following code in order to search for templates inside a custom theme I'm working on:               <?php $my_theme = wp_get_theme();     get_template_part( 'masthead',  $my_theme->Template); ?>      Basically what it does, is that it does a search for a file called "masthead- themename.php". If that file does not exists, then it looks for a file called "masthead.php". This works as expected. However, I would to have something that searches for the file inside of a folder called "templates" as a first option and if not, then search for the template name in the theme's root folder. I tried this               <?php $my_theme = wp_get_theme();     get_template_part( 'templates/masthead',  $my_theme->Template); ?>      But this only works if the file exists in the template's folder. If the file exists in the root's theme folder, it does not recognize it. Any ideas? Thanks!


title: Add auto increment value to custom meta

text: I have a custom meta "code" in my CPT. How can I make it so that it has a number that will auto increment every time the admin publishes a post? My solution is to add a table in the database that is "code". Every time the user publishes a post, it will add 1 to the code table. Then I will use a script to append the code from the db to the meta. But it does not seem to add in the db. Please present alternative/better solutions.


title: Combine the results of two loops

text: I currently have these 2 loops running on a single page               $related = p2p_type( 'artist_to_song' )->my_get_related( get_queried_object() );     $features = p2p_type( 'song_to_feature' )->my_get_related( get_queried_object() );               if ( $related->have_posts() ) :         while ( $related->have_posts() ) : $related->the_post();           //content        endwhile;        wp_reset_postdata();                                  endif;          if ( $features->have_posts() ) :         while ( $features->have_posts() ) : $features->the_post();           //content        endwhile;        wp_reset_postdata();                                  endif;      Is it possible to combine the results of these loops into one so that all the posts are listed in chronological order as opposed to the results of `$related` being followed by `$features`.


title: User Roles Not Sticking

text: I have added a custom user role of super_poster, basically they make 20 posts and once they hit $postlimit get auto-moved back down to contributer level, the moving down and post counting works ok, my problem is that the wp system adds the user into "none" instead of into contributer role               if ($count_posts >= $postlimit) {         $current_user->remove_role( 'super_poster' );         $current_user->add_role( 'contributer' );            }      contributer is set for new user default on sign-up, so the situation i have is in wp-admin user edit page i can see the newly moved (into contributer from super poster) has still got "additional capabilities of contributer" however user role dropdown says --No role for this site -- wp-admin users page shows the super_poster as in user group "none" what gives?


title: How i will get the images of highest scored users?

text: I am using a Q/A plugin for the user scores, I have function like below, I want to take the images of the highest scored users, how can I get the images of the highest users, and I want to display it in home page with the images and score with separate boxes , like StackOverflow, for running this query do I need `add_filter()`. Where do I add this code?               function the_top_qa_users(){         global $wpdb;              $user_ids = $wpdb->get_col("SELECT DISTINCT user_id         FROM $wpdb->usermeta         WHERE meta_key = '_qa_rep'         AND meta_value IS NOT NULL         ORDER BY meta_value DESC         LIMIT 0 , 5");              foreach($user_ids as $id){             the_qa_user_link($id);             echo '<br/>';         }          }


title: Post and Page Inheritance to subsites in a WordPress Network

text: I have to develop a multi-country, multi-lingual website. One country may have multiple languages. I have setup a WordPress Network and created subsites for each country like following.               abc.com/ > Global Website     abc.com/usa > USA Website     abc.com/fra > France Website      I am detecting Countries through Geo Location API and forcefully redirect them to their own country's website. Each country has their own set of languages e.g. France will have English and French with French as default language. I decided to use PolyLang for language translations. It works fine.               abc.com/fra/ > default french website     abc.com/fra/en > english translation of the french website.      The issue I am facing is I have duplicate english contents in every sub site. Is there anyway we can avoid duplicates and english version of subsites uses the english pages/posts from global site. Ideally, Admin should be able to select which one goes to sub site and which one does not. There is an event section too, that can have global events as well as local/country level events. I can think of following solutions and their drawbacks   1. ThreeWP Broadcast plugin. This plugin broadcast page/posts to other sites on selection. Seems to be an excellent choice but duplicates the content what I am avoiding. Morover, I am not sure how it will work with PolyLang translations.   2. Adding 'template_redirect' or 'wp' action, if subsite cant find a slug, and same slug is available in global site it should be populated and avoid 404. We also need to Intercept or override WP_Query calls to run same query on global site and return the results. About PolyLang, I am not sure how it will work. I guess, it can be sorted out. This approach is complicated and may end up no-where.  Anyone have any better solution? A plugin, or idea that can solve this interesting mystery? I believe, its a common scenario for a multinational company. So, There has to be a viable solution to this.


title: Shortcode won't execute

text: I've created a shortcode using my limited knowledge, google, and stackexchange to do so. But when I load the page, it loads above the page contents and appears as html text.               (shortocode text)     -------     page contents appearing normally      As I've said, I have limited (Zero) knowledge of this type of coding and I'm unable to find out which part/what isn't working. I've attached a compacted version of the code I've used, with less content being displayed in the shortcode function.               // Add Shortcode     function p_formatage( $atts , $content = null ) {              // Attributes         extract( shortcode_atts(             array(                 'postid' => '',                 'ptitle' => '',                 'pimage' => '',             ), $atts )         );              $postid = $atts['postid'];         $ptitle = $atts['ptitle'];         $pimage = $atts['pimage'];              // Post title         $p-ptitle = if ( empty( $ptitle ) ) {         echo "Whoops! Looks like went wrong here!";         }         else {           if ( $postid == true ) {          echo "' . $ptitle . '";          }          else {           echo "' . $ptitle . '";          }         }              $p-beta = if ( empty( $pimage) ) {         echo "$ptitle";         }         else {          echo "";         }             $pclass = if ( $postid ) {         echo "$p-ptitle";         }         else {          echo "$p-beta";         }              // Output         $output = {             echo "$pclass";         }              return $output;     }          add_shortcode( 'p-fmt', 'p_formatage' );


title: How to track a users progress through pages by inserting data into Wordpress Database?

text: My website users can learn British Sign Language through Video Tuts, Quizzes and games etc. I would like to track the users progress through the pages of the course and add that data to a Wordpress Database. The course structure from the first page is roughly like this: Stage 1 intro --> (next page) Video tut --> Quiz --> Quiz page 2 --> Exam --> Stage 2 intro.. etc I was thinking about inserting/updating an integer or string (that represents progress) on a 'save & next' page button through PHP. This would increase the number or change the string in the users database and allow me to track which pages they have worked through and display it in other parts of the site (account page, next to username, course page etc). It would also allow me to restrict access until they have completed prerequisites (if I were to ever want to do that). Could someone give me a brief explanation on how to do this or suggest an alternative? I am familiar with PHP and mysql but my skills aren't quite adequate enough to execute something like this safely. Thank you.


title: how to add limit records in wordpress query

text: I have this query which is returning the all records from database whose type is equal to 'quote2'. No I want to know how to limit the record. I mean I just want to show last 10 records added in the database. I am new in wordpress and want to learn syntax of my required query.               global $wpdb;      $querystr = "select $wpdb->posts.*      FROM $wpdb->posts     WHERE $wpdb->posts.post_type = 'quote2'     ";


title: Nested wp_query loop doesn't show connected posts

text:
I have have a wp_query loop nested in another wp_query loop. The first loop queries the latest movies. The second loop queries the persons connected to each movie from the first loop (movies and persons are connected with the Posts2Posts plugin). Seperately both loops work fine, but put together only the first loop shows the movies and the second loop doesn't show the connected performers. What's wrong with the nested loop? Thanks!

Latest Movies
         <?php // LOOP 1             $args = array(                  'orderby' => 'cf-release-date',                 'order'=> 'desc',                 'post_type' => 'movie'                 );             $the_query = new WP_Query( $args ); ?>                   <?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
                 <a href="<?php the_permalink(); ?>"><img src="<?php echo types_render_field("cf-movie-dvd-cover", array(output=>"raw"));?>">
<a class="title-link" href="<?php the_permalink(); ?>"><?php the_title(); ?>

                     <?php                         // LOOP 2: Find connected PERSONS                         $connected = new WP_Query( array(                            'connected_type' => 'movies_to_persons',                           'connected_items' => get_queried_object(),                           'connected_meta' => array(                                 array(                                     'value' => 'actor',                                 )                             ),                           'nopaging' => true,                             'orderby' => 'title',                           'order' => 'asc'                         ) );                              // Display connected PERSONS                         if ( $connected->have_posts() ) :                     ?>
Featuring:
                              <?php while ( $connected->have_posts() ) : $connected->the_post(); ?>                             <a href="<?php the_permalink(); ?>"><?php the_title(); ?>                         <?php endwhile; ?>                          <?php                          // Prevent weirdness                         wp_reset_postdata();                              endif;                     ?>

              <?php endwhile; else: ?>
Sorry, there are no Movies to display
              <?php endif; ?>


title: Jetpack plugin - 'posts_per_page' not overriding 'Blog pages show at most' option, also different values for different post types?

text: I have Jetpack installed and I have got Infinite Scroll working on my theme but `posts_per_page` is having no effect, the number of posts initially shown and loaded is my "Blogs show at most" number in Settings -> Reading which is 5.               function mytheme_render_infinite_scroll() {         while ( have_posts() ) : the_post();                 if ('mytheme_custom_post_type' == get_post_type()) :                     get_template_part( 'content', 'archive-custom' );                 else :                     get_template_part( 'content', get_post_format() );                 endif;         endwhile;     }          function mytheme_jetpack_setup() {         add_theme_support( 'infinite-scroll', array(             'container'      => 'content',             'footer_widgets' => 'footer-widgets',             'type'           => 'click',             'render'         => 'mytheme_render_infinite_scroll',             'wrapper'        => true,             'posts_per_page' => '15'         ) );     }      I am also rendering a different content template depending on what the current post type is using the `mytheme_render_infinite_scroll` function above. It would be great if I could set the `posts_per_page` value to be different depending on post type too, eg. have 5 posts per page show on a Blog archive but have 15 posts per page show on an archive page of `mytheme_custom_post_type`. I am not sure how to do this, my attempt would be:               function mytheme_render_infinite_scroll() {         while ( have_posts() ) : the_post();                 if ('mytheme_custom_post_type' == get_post_type()) :                     get_template_part( 'content', 'archive-custom' );                 else :                     get_template_part( 'content', get_post_format() );                 endif;         endwhile;     }          function mytheme_infinite_scroll_posts_per_page()         while ( have_posts() ) : the_post();             if ('mytheme_custom_post_type' == get_post_type()) :                 return 15;             else :                 return 5;             endif;     endwhile;          function mytheme_jetpack_setup() {         add_theme_support( 'infinite-scroll', array(             'container'      => 'content',             'footer_widgets' => 'footer-widgets',             'type'           => 'click',             'render'         => 'mytheme_render_infinite_scroll',             'wrapper'        => true,             'posts_per_page' => 'mytheme_infinite_scroll_posts_per_page'         ) );     }     add_action( 'after_setup_theme', 'mytheme_jetpack_setup' );      ... but I have no idea if this would work, Jetpack is probably not set up to handle this! Can't test it either because as I said above the `posts_per_page` argument isn't having any effect. The Jetpack support doc is here: http://jetpack.me/support/infinite-scroll/ **EDIT:** I've done some testing and the conclusion I've come to is Jetpack is built so that the `posts_per_page` argument only has an effect if the `type` is not set as `click`. I can't find this specifically stated in any documentation so I may be wrong but I've got `posts_per_page` working with `'type' => 'scroll'` but not with `'type' => 'click'`


title: Show Custom Post Type values in Wordpress grid view

text:
I have created a custom post type in WordPress as shown in figure.      ![enter image description here](http://i.stack.imgur.com/71Di2.png) What i want is to show the values eneterd in this custom post in the grid view of admin panel. Now the admin panel is only showing the Post title, date and comment images but i want to show the Pair2,buy sell and activity fields values as entered in my custom post . I have searched alot but couldn't find any solution. How should i go about it in WordPress? ![enter image description here](http://i.stack.imgur.com/ukG7R.png)      **EDIT**   Here is how i am making my custom post                  <?php     if( ! function_exists( 'quote_create_post_type' ) ) :       function quote_create_post_type() {         $labels = array(           'name' => __( 'ForexPair' ),           'singular_name' => __( 'ForexPair' ),           'add_new' => __( 'Add Pair Entry' ),           'all_items' => __( 'All Pairs' ),           'add_new_item' => __( 'Add Pair' ),           'edit_item' => __( 'Edit Pair' ),           'new_item' => __( 'New Pair' ),           'view_item' => __( 'View Pair' ),           'search_items' => __( 'Search Pairs' ),           'not_found' => __( 'No pair found' ),           'not_found_in_trash' => __( 'No pair found in trash' ),           'parent_item_colon' => __( 'Parent pair' )           //'menu_name' => default to 'name'         );         $args = array(           'labels' => $labels,           'public' => true,           'has_archive' => true,           'publicly_queryable' => true,           'query_var' => true,           'rewrite' => true,           'capability_type' => 'post',           'hierarchical' => false,           'supports' => array(             'title'           ),           'register_meta_box_cb' => 'quote_add_post_type_metabox'         );         register_post_type( 'quote', $args );         //flush_rewrite_rules();            }       add_action( 'init', 'quote_create_post_type' );                 function quote_add_post_type_metabox() { // add the meta box         //add_meta_box( 'quote_metabox', 'quote_metabox', 'quote', 'normal' );         add_meta_box( 'quote_metabox', 'Pair Entries', 'quote_metabox', 'quote', 'normal' );       }                 function quote_metabox() {         global $post;         // Noncename needed to verify where the data originated         echo '<input type="hidden" name="quote_post_noncename" id="quote_post_noncename" value="' . wp_create_nonce( plugin_basename(__FILE__) ) . '" />';              // Get the data if its already been entered         $quote_post_entryprice = get_post_meta($post->ID, '_quote_post_entryprice', true);         $quote_post_stoploss = get_post_meta($post->ID, '_quote_post_stoploss', true);         $quote_post_pairname = get_post_meta($post->ID, '_quote_post_pairname', true);         $quote_post_buysell = get_post_meta($post->ID, '_quote_post_buysell', true);         $quote_post_activity = get_post_meta($post->ID, '_quote_post_activity', true);         $quote_post_takeprofit = get_post_meta($post->ID, '_quote_post_takeprofit', true);         // Echo out the field         ?>        <link rel="stylesheet" href="http://gripforex.com/wp-content/themes/Forsy/select2.css" />

                  Pair:                   <select name="quote_post_pairname" id="e1" style="width:144px;">       <option value="AUD/CAD" <?php if($quote_post_pairname=="AUD/CAD") echo "selected"; ?> >AUD/CAD</option>       <option value="AUD/CHF" <?php if($quote_post_pairname=="AUD/CHF") echo "selected"; ?> >AUD/CHF</option>                      </select>

             Buy Sell               <select name="quote_post_buysell" id="e2" style="width:144px;">                 <option value="Buy" <?php if($quote_post_buysell=="Buy") echo "selected"; ?> >Buy</option>                 <option value="Sell" <?php if($quote_post_buysell=="Sell") echo "selected"; ?> >Sell</option>               </select>

             Activity               <select name="quote_post_activity" id="e3" style="width:144px;">                 <option value="Get Ready" <?php if($quote_post_activity=="Get Ready") echo "selected"; ?> >Get Ready</option>                 <option value="Active" <?php if($quote_post_activity=="Active") echo "selected"; ?> >Active</option>               </select>

             Entry Price
               <input type="text" name="quote_post_entryprice" class="widefat" value="<?php echo $quote_post_entryprice; ?>">

Stop Loss
               <input type="text" name="quote_post_stoploss" value="<?php echo $quote_post_stoploss; ?>" class="widefat" />

Take Profit
               <input type="text" name="quote_post_takeprofit" value="<?php echo $quote_post_takeprofit; ?>" class="widefat" />

       <?php       }                 function quote_post_save_meta( $post_id, $post ) { // save the data              if( !wp_verify_nonce( $_POST['quote_post_noncename'], plugin_basename(__FILE__) ) ) {           return $post->ID;         }              // is the user allowed to edit the post or page?         if( ! current_user_can( 'edit_post', $post->ID )){           return $post->ID;         }              $quote_post_meta['_quote_post_entryprice'] = $_POST['quote_post_entryprice'];         $quote_post_meta['_quote_post_stoploss'] = $_POST['quote_post_stoploss'];         $quote_post_meta['_quote_post_pairname'] = $_POST['quote_post_pairname'];         $quote_post_meta['_quote_post_buysell'] = $_POST['quote_post_buysell'];         $quote_post_meta['_quote_post_activity'] = $_POST['quote_post_activity'];         $quote_post_meta['_quote_post_takeprofit'] = $_POST['quote_post_takeprofit'];         // add values as custom fields         foreach( $quote_post_meta as $key => $value ) { // cycle through the $quote_post_meta array           // if( $post->post_type == 'revision' ) return; // don't store custom data twice           $value = implode(',', (array)$value); // if $value is an array, make it a CSV (unlikely)           if( get_post_meta( $post->ID, $key, FALSE ) ) { // if the custom field already has a value             update_post_meta($post->ID, $key, $value);           } else { // if the custom field doesn't have a value             add_post_meta( $post->ID, $key, $value );           }           if( !$value ) { // delete if blank             delete_post_meta( $post->ID, $key );           }         }       }       add_action( 'save_post', 'quote_post_save_meta', 1, 2 ); // save the custom fields     endif; // end of function_exists()               if( ! function_exists( 'view_quotes_posts' ) ) : // output       function view_quotes_posts( $num = 4, $do_shortcode = 1, $strip_shortcodes = 0 ) {              $args = array(           'numberposts'     => $num,           'offset'          => 0,           //'category'        => ,           'orderby'         => 'menu_order, post_date', // post_date, rand           'order'           => 'DESC',                'post_type'       => 'quote',                'post_status'     => 'publish',           'suppress_filters' => true,         );              $posts = get_posts( $args );         global $wpdb;           $querystr = "select $wpdb->posts.*          FROM $wpdb->posts       WHERE $wpdb->posts.post_type = 'quote'       ";                   $html = '

Pair	Action	Status	Entry Price	Stop Loss	Take Profit
';         foreach ( $posts as $post ) {           $meta_entryprice = get_post_meta( $post->ID, '_quote_post_entryprice', true );           $meta_stoploss = get_post_meta( $post->ID, '_quote_post_stoploss', true );           $meta_pairname = get_post_meta( $post->ID, '_quote_post_pairname', true );           $meta_buysell = get_post_meta( $post->ID, '_quote_post_buysell', true );           $meta_activity = get_post_meta( $post->ID, '_quote_post_activity', true );           $meta_takeprofit = get_post_meta( $post->ID, '_quote_post_takeprofit', true );                     $html.='
';           $html .= '                    '.$meta_pairname.'	               '.$meta_buysell.'	               '.$meta_activity.'	               '.$meta_entryprice.'	                    '.$meta_stoploss.'	                    '.$meta_takeprofit.'	             ';           $html.='
';         }         $html .="
";         $html = '
'.$html.'
';         return $html;       }     endif;      ?>


title: Has anyone tried putting PHP ActiveRecord on Wordpress?

text: I have worked with Ruby on Rails and I was looking for some code that did something close to the wonderfull RoR's ActiveRecord. I stepped by this site. Its PHP-ActiveRecord! I found it amazing, and it was exactly what I was looking for, but I didn't find anyone trying to use it on WordPress, so I got a little scared. Any experiences you could share? My first idea was to require the library in functions.php and create a child theme with the models inside a folder. What I really don't know is how it's going to deal with the tables in the database it can't mess with. Well, I'll wait your impressions.