title: How To create ajaxed wp-pagenavi?

text: I'm using WordPress as a Facebook platform and have a page that shows posts from 2 different categories. Each category has it's own pagination using wp- pagenavi. In order to stay in Facebook I need the pagination links to load using ajax. I've seen this article which gives a nice clue about it, but would love to know if anyone had already solved this and has any leads. My main issue here (and this is stupid), I get that I need to call an ajax function with jQuery and pass it the specific category and the desired page number. I have no idea how to get the page number. But once again, if you have an already made solution - it will be much appreciated Currently I tried using this tutorial, the tab code can be seen here. as you can see pagination affects both categories :-(


title: 3 moderators to approve comment

text: Guys, I need to know how to do the following: When I receive a comment ... This comment must be approved by three moderators. To appear on the site. Anyone know how to do it or some plugin?


title: Listing Category 'child_of' by slug rather than ID

text: I want to list categories belonging to a parent. The problem is using category id's isn't useful and makes things harder to understand. Is there any easier way to list categories belonging to a parent, similar to the default way supplied in the WP codec?               <?php wp_list_categories('child_of=8'); ?> //what category is '8' ?!          <?php wp_list_categories('child_of=clients'); ?> //much nicer, but doesn't work      I would prefer to avoid using another query in the loop, but to make sense to other developers, I might have to.


title: Popular Post With Thumbnail?

text: Is there any plugin that allows you to use a custom field as the thumbnail to display the most popular post within the last day (24 hours)? I have found several plugins but none seem to have the capabilities that would allow me to add a custom field as the image or even a thumbnail at all.


title: $wpdb->query() multiple query support

text: Just bump into the issue that I can't execute multiple sql queries using the `$wpdb->query()`. Generated queries work fine directly in phpmyadmin so its something will the ezSQL class only. By design perhaps? I found this http://wordpress.org/support/topic/wpdb-gtquery-fails-when- multiple-update-statements-are-used which also says its by design. Can anyone confirm? ezSQL docs dont say anything about multiple queries support. If you have to do a bunch of queries mainly (INSERT/UPDATE/DELETE), any better way of doing them other than doing them one by one using `$wpdb->insert()` and like functions?


title: Wordpress native thickbox language

text: Is there any clean way (not overwriting wp-includes\js\thickbox\thickbox.js file) to translate english next/ prev/ image # of # and Close tooltip in Wordpress native Thickbox script?


title: Warning: preg_replace(): Compilation failed: unknown option bit(s) set at offset -1

text: I recently upgraded my dedicated server to Apache 2.4.6, MySQL 5.5.32, and PHP 5.4.21. Now on my website I get this error: > Warning: preg_replace(): Compilation failed: unknown option bit(s) set at > offset -1 in /home/champion/public_html/wp-includes/shortcodes.php on line > 295 Here is the code from shortcodes.php on line 295:               $text = preg_replace("/[\x{00a0}\x{200b}]+/u", " ", $text);      Is the preg_replace function not compatible with the new PHP 5.4.21?


title: How do I exclude posts by custom field value?

text: I need to exclude posts that have a custom field 'city' value of 'Melbourne'. After much searching I think the solution might consist of 2 parts. In functions.php : A function to get the post IDs for all posts which have a custom field 'city' value of 'Melbourne'. Then in my loop : Exclude these posts using the post_not_in argument, using the returned ids from the first loop? Is this the right approach? What is the correct code?


title: Display categories inline

text: how can I show the categories inline in a widget?? I already tried using the wp function wp_list_categories ('style = none') and using the php function str_replace to replace the tags br but without success. Thanks


title: Get Tags get_terms() - by user->ID ?

text: Is it possible to get tags for a specific user ID, i mean i want to get the tags list on author page where i want list the tags the author used to make his/her posts only - not want to get the full wordpress tag cloud ? Is this possible ?


title: How to write .htaccess dynamically?

text: I am trying to set permalink structure on theme activation. The following function included in function.php of theme.               // Executes function on theme activation     function myactivationfunction() {              global $wp_rewrite;         $wp_rewrite->set_permalink_structure( '/%category%/%postname%/' );         // register taxonomies/post types here         flush_rewrite_rules();          }     add_action("after_switch_theme", "myactivationfunction", 10 ,  2);      This code works correctly but value not writing into .htaccess or .htaccess not creating. How can i write .htaccess file dynamically? Any help would be greatly appreciated. Thanks


title: Wordpress installed on a Sub-directory

text: I've already read this and followed the steps, however I can't get it work yet.   * My Wordpress URL: `http://mydomain.com/web` (this is where it's installed)   * My Site URL: `http://mydomain.com` I've copied `index.php` and `.htaccess` to /public_html which is the root directory. /.index.php               <?php     define('WP_USE_THEMES', true);     require( dirname( __FILE__ ) . 'web/wp-blog-header.php' );      /web/index.php               <?php     define('WP_USE_THEMES', true);     require( dirname( __FILE__ ) . 'wp-blog-header.php' );      /.htaccess (the same as /web/.htaccess)               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /web/     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /web/index.php [L]     </IfModule>     # END WordPress      I can still access to my admin page on `http://mydomain.com/web/wp-admin`, but Wordpress content media isn't recognized yet because I once changed "wp- content" folder name to "media" (using iThemes Security plugin) and this to `wp-config.php` /web/wp-config.php               <?php     define( 'WP_CONTENT_URL', 'http://mydomain.com/web/media' );     define( 'WP_CONTENT_DIR', dirname(__FILE__) . '/web/media' );      So, media (plugins, themes, language) isn't recognized. I've tried with `http://mydomain.com/wp-admin` and it doesn't redirects me to `http://mydomain.com/web/wp-admin` either.


title: Getting 'SELECT + FROM comments...' in comment notification email

text: I just got a notification from my installation of Wordpress that someone has posted a comment there is no text in the comment area apart from the following: Comment: SELECT * FROM comments ORDER BY RAND() LIMIT 0, 100 The comment is showing up in the WP dashboard with the same message. Previous comments today seem to be okay. This is a new installation of WP (3.5.2) but with imported data from a previous WP (3.4.2) installation. Also got these errors in the Error Log today but not sure it's connected: [11-Oct-2013 09:52:26 UTC] PHP Fatal error: Out of memory (allocated 2359296) (tried to allocate 122880 bytes) in /home/--/public_html/--/wp-includes/class- wp.php on line 230 [11-Oct-2013 09:52:26 UTC] PHP Fatal error: Out of memory (allocated 16515072) (tried to allocate 122880 bytes) in /home/--/public_html/--/wp-includes/media.php on line 1420 [11-Oct-2013 09:52:26 UTC] PHP Fatal error: Out of memory (allocated 24641536) (tried to allocate 30720 bytes) in /home/--/public_html/--/wp-includes/default- widgets.php on line 320 [11-Oct-2013 09:52:26 UTC] PHP Fatal error: Out of memory (allocated 11796480) (tried to allocate 30720 bytes) in /home/--/public_html/--/wp-includes/comment.php on line 1677 [11-Oct-2013 09:52:26 UTC] PHP Fatal error: Out of memory (allocated 13107200) (tried to allocate 30720 bytes) in /home/--/public_html/--/wp-includes/kses.php on line 923 [11-Oct-2013 09:52:26 UTC] PHP Fatal error: Out of memory (allocated 5242880) (tried to allocate 30720 bytes) in /home/--/public_html/--/wp- includes/formatting.php on line 2779 [11-Oct-2013 09:52:26 UTC] PHP Fatal error: Out of memory (allocated 19922944) (tried to allocate 30720 bytes) in /home/--/public_html/--/wp-content/plugins/required-foundation-tooltip- shortcode/required-foundation-tooltip-shortcode.php on line 136 Why would it do this? And do I need to fix something? Thanks for your help in advance. Cheers, Tracy S.


title: My Infinite Scrolling plugin is not working, despite filling in the parameters correctly

text: I'm using the plugin "Infinite Scroll" (v2.6.2), but it's not working with my theme despite me filling in the parameters correctly. These are the parameters I am using: Content Selector: `#main-post`   Navigation Selector: `#main-menu`   Next Selector: `div.navigation a:first`   Item Selector: `#main-post li.post` I created a jfiddle so you can see the HTML and CSS, and verify if the parameters are correct.


title: Call to undefined function add_menu_page() on theme activation

text: I am attempting to activate a theme that works perfectly on one WordPress install. I have matched the plugins installed up and copied the theme over but when I go to activate it I get...               Fatal error: Call to undefined function add_menu_page()       It points to the following line as being the cause of the error....               add_action('admin_menu', 'register_custom_menu');          function register_custom_menu() {     add_menu_page('Design', 'Design', 'delete_others_posts', '/nav-menus.php', '', get_stylesheet_directory_uri() . '/img/tv.png', '5.1' );     add_submenu_page( '/nav-menus.php', 'Widgets', 'Widgets', 'delete_others_posts', '/widgets.php', '' );     add_submenu_page( '/nav-menus.php', 'Nav Menu', 'Nav Menu', 'delete_others_posts', '/nav-menus.php', '' );     add_submenu_page( '/nav-menus.php', 'Event Options', 'Event Options', 'delete_others_posts', '/admin.php?page=mytheme-options', '' );     }      Can anyone see where I am going wrong?


title: How important is it to enqueue a theme's stylesheet?

text: I have trawled the net looking for an answer to this, but for some reason all I can find are actual examples, but without that particular explanation, which is clear say in the case of scripts. Can someone explain to me why it's important/advantageous to enqueue styles when developing a theme, rather than just using `<link rel=stylesheet>` in header.php. Also, what about the theme's default stylesheet, should that be enqueued too?


title: Fixing custom rewrite rule

text: I am following the WP Example. I know my rewrite rule is being added into wordpress, so I just need to fix the actual rule. So here is my current code:               add_filter('rewrite_rules_array','mcs_TextbookRewriteRules');     add_filter('query_vars','mcs_insertTextbookQueryVars');          // Adding a new rule     function mcs_TextbookRewriteRules($rules) {         $newrules = array();         $newrules['textbook/(cantonese|mandarin)/([C|M]K?[0-9]+)/([0-9]+)$'] = 'index.php?pagename=textbook/$matches[1]/?cls=$matches[2]&ch=$matches[3]';         //$newrules['textbook/(cantonese|mandarin)/([C|M]K?[0-9]+)/([0-9]+)$'] = 'textbook/$matches[1]/index.php?cls=$matches[2]&ch=$matches[3]';         return $newrules + $rules;     }          // Adding the id var so that WP recognizes it         function mcs_insertTextbookQueryVars($vars) {         array_push($vars, 'cls');         array_push($vars, 'ch');         return $vars;     }      I want to map `http://localhost/wordpress/textbook/cantonese/CK1/6` to `http://localhost/wordpress/textbook/cantonese/?cls=CK1&ch=6`


title: Different banner on home page

text: How can I have one larger banner on the home page, but a smaller banner on all other pages. My home page is actually a page (as opposed to a post). But I'm thinking the banner is too big (and the newness/cuteness of it is warn off to see it over and over on every page). http://NealWalters.com P.S. - Someone with enough points, please add "banner" as a tag!


title: gform_after_submission content appears immediately after <body>, not in post body

text:
I have the following function that successfully uses form fields (IDs 13 and 18) from a Gravity Form (ID 18) as parameters within wp_query. This displays a list of posts with specific taxonomy terms that match those chosen in the form:               add_action("gform_after_submission_18", "set_post_content", 10, 2);     function set_post_content($entry, $form){              //getting post         $post = get_post($entry["post_id"]);         $concern = $entry[13];         $sensitivity = $entry[18];              $loop = new WP_Query( array(              'post_type' => 'recommended',                 'tax_query' => array(             'relation' => 'AND',             array(                 'taxonomy' => 'concern',                 'field' => 'slug',                 'terms' => $concern             ),             array(                 'taxonomy' => 'sensitivity',                 'field' => 'slug',                 'terms' => $sensitivity             )             ),                  'orderby' => 'title',             'posts_per_page' => '-1',              'order' => 'ASC'           )         ); ?>          //THIS BIT DISPLAYS THE CORRECT LOOP BUT IT APPEARS IMMEDIATELY AFTER  RATHER THAN IN THE POST CONTENT
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<?php the_title(); ?>
        <?php endwhile; ?>
        <?php                //THIS BIT DISPLAYS THE CHOSEN FORM FIELD INSIDE MY POST CONTENT - WRONG CONTENT, RTIGHT POSITION      $post->post_content =      "
" .      $concern .      "
 sensitivity: " .      $sensitivity .      "
"     ;           }      The problem is that this is being inserted immediately after the 'body' tag rather than into the post body. How do I move this to where it should be?! I could well be going about this all wrong and I'm stumped


title: wordpress get_post_meta give only first value

text: I made one custome post in that there is one _custom field_ call **_as_roomname**. I create total 5 custom post and I want to retrive all it's name but I get only first value.               function postlogo(){     global $post;     $counting = 1;     $count = 1;     $args = array( 'post_type' => 'casino', 'posts_per_page' => 5 );     $rPosts = new WP_Query($args);          while ($rPosts->have_posts()) : $rPosts->the_post();?>     <h1><?php echo get_post_meta(get_the_id(), '_as_roomname', true);?> Review </h1><?php     $count = $count + 1;         endwhile;     }       **Output**               Casino.com Review     Casino.com Review     Casino.com Review     Casino.com Review     Casino.com Review      I want this unique name from all post but it give me only first value. How will I get that I don't know.


title: Organizing by super-categories (or nested categories)?

text: Suppose I want to blog about three somewhat unrelated main topics: Money, Languages, and Information-Technology on the same blog. How should I organize things for the best user experience? How does would such a structure affect the default menu structure at the top So far I found this: Category-manager and researching further. Apparently Category-Manager is a plug-in, I'm installing it now.


title: Wordpress variables and memory

text: When checking get_defined_vars() on an empty template file my theme loads over 70000 lines of output. Before even including elements on a page all of this is loaded.   1. Is this correct?    2. Is there any way to reduce it or remove unnecessary variables?   3. Do all wp_rewrite rules have to be available for every page load?


title: List all pages and children in separate ul

text:
I've been trying to do this all weekend, I'm going round in circles now. I want to list all pages and their children in separate ul's The page setup is like this                   HOME        ABOUT         CONTACT                     Who we are    Where we are                      What we do    How to find us                     How we do it        I want to output it like this

Home

About

Who we are

What we do

How we do it

Contact

Where we are

How to find us

      This will give me the top pages in separate ul's                   <?php           $args = array(             'sort_column' => 'menu_order',             'parent' => 0,           );           $pages = get_pages($args);           foreach($pages as $page){             ?>

                 <?php                              echo $page->post_title;                         ?>

             <?php           }              ?>      I'm now trying to add the child pages to the ul I'm thinking something like this but this gives me all the pages in each ul                   <?php           $args = array(             'sort_column' => 'menu_order',             'parent' => 0,           );           $pages = get_pages($args);           foreach($pages as $page){             ?>

                 <?php                              echo $page->post_title;                             wp_list_pages('title_li=&depth=0&child_of'.$page->ID.'');                         ?>

             <?php           }              ?>              Is there a way to say all children of this page. Any help would be greatly appreciated.


title: Empty paragraphs around figure and figcaption tags when using markdown

text:
I'm using WP 3.8 and Markdown on Save Improved plugin and have following code for outputing HTML5 tags when inserting images via Media Uploader:               function html5_insert_image($html, $id, $caption, $title, $align, $url, $size, $alt) {       $src  = wp_get_attachment_image_src( $id, $size, false );       $html5 = "
";       $html5 .= "";       if ($caption) {         $html5 .= "
$caption
";       }       $html5 .= "
";       return $html5;     }     add_filter( 'image_send_to_editor', 'html5_insert_image', 10, 9 );      And in editor output is fine, but on publish my code looks like this:

caption_txt

      If I put `div` wrapper around `figure` then there are no empty paragraphs but I'm wondering why figure and figcaption aren't recognized as block elements? Also, this doesn't happen with wp-markdown plugin so it seems it's not markdown problem since both plugins use same parser. When combining HTML and markdown in other ways, output is fine so I think that's not the issue.


title: How do I safely change the name of a custom post type?

text: I made a custom post type called 'portfolio' but I want to change it to 'projects'. What would be the exact steps I need to take in order to safely change the name and prevent the custom post type posts from disappearing in the dashboard? Note: There are already posts in `portfolio` so I can't just switch out `portfolio` with `projects`.               /* Register Portfolio Post Type */     add_action('init', 'create_portfolio');          function create_portfolio() {              $labels = array(             'name' => __('Portfolio', 'post type general name'),             'singular_name' => __('Project', 'post type singular name'),             'add_new' => __('Add New', 'portfolio item'),             'add_new_item' => __('Add New Project'),             'edit_item' => __('Edit Project'),             'new_item' => __('New Project'),             'view_item' => __('View Project'),             'search_items' => __('Search Projects'),             'not_found' =>  __('Nothing found'),             'not_found_in_trash' => __('Nothing found in Trash'),             'parent_item_colon' => ''         );              $args = array(             'labels' => $labels,             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,             'query_var' => true,             'rewrite' => true,             'capability_type' => 'post',             'hierarchical' => false,             'menu_position' => null,             'supports' => array('title','editor','thumbnail')           );               register_post_type( 'portfolio' , $args );     }          /* Register Skills Taxonomy */     register_taxonomy("Skills", array("portfolio"), array("hierarchical" => true, "label" => "Skills", "singular_label" => "Skill", "rewrite" => true));          /* Add Fields */     add_action("admin_init", "add_portfolio_fields");          function add_portfolio_fields(){         add_meta_box("website_url", "Website URL", "website_url", "portfolio", "side", "low");         add_meta_box("view_more", "View More", "view_more", "portfolio", "side", "low");         add_meta_box("screenshot_name", "Screenshot Name", "screenshot_name", "portfolio", "side", "low");         add_meta_box("thumbnail_name", "Thumbnail Name", "thumbnail_name", "portfolio", "side", "low");         add_meta_box("thumbnail_alt", "Thumbnail Alt", "thumbnail_alt", "portfolio", "side", "low");     }          function website_url(){         global $post;         $custom = get_post_custom($post->ID);         $website_url = $custom["website_url"][0];         ?>         Website URL:         <input size="50" name="website_url" value="<?php echo $website_url; ?>" />         <?php     }          function view_more() {         global $post;         $custom = get_post_custom($post->ID);         $view_more = $custom["view_more"][0];         ?>         View More:         <input size="50" name="view_more" value="<?php echo $view_more; ?>" />         <?php     }          function screenshot_name() {         global $post;         $custom = get_post_custom($post->ID);         $screenshot_name = $custom["screenshot_name"][0];         ?>         Screenshot Name:         <input name="screenshot_name" value="<?php echo $screenshot_name; ?>" />         <?php     }          function thumbnail_name() {         global $post;         $custom = get_post_custom($post->ID);         $thumbnail_name = $custom["thumbnail_name"][0];         ?>         Thumbnail Name:         <input name="thumbnail_name" value="<?php echo $thumbnail_name; ?>" />         <?php     }          function thumbnail_alt() {         global $post;         $custom = get_post_custom($post->ID);         $thumbnail_alt = $custom["thumbnail_alt"][0];         ?>         Thumbnail Alt:         <input name="thumbnail_alt" value="<?php echo $thumbnail_alt; ?>" />         <?php     }          add_action('save_post', 'save_portfolio_details');          function save_portfolio_details(){         global $post;              update_post_meta($post->ID, "website_url", $_POST["website_url"]);         update_post_meta($post->ID, "view_more", $_POST["view_more"]);         update_post_meta($post->ID, "screenshot_name", $_POST["screenshot_name"]);         update_post_meta($post->ID, "thumbnail_name", $_POST["thumbnail_name"]);         update_post_meta($post->ID, "thumbnail_alt", $_POST["thumbnail_alt"]);     }          /* Custom Columns */     add_action("manage_posts_custom_column",  "portfolio_custom_columns");     add_filter("manage_edit-portfolio_columns", "portfolio_edit_columns");          function portfolio_edit_columns($columns){         $columns = array(             "cb" => "<input type=\"checkbox\" />",             "title" => "Project Title",             "description" => "Description",         );              return $columns;     }          function portfolio_custom_columns($column){         global $post;              switch ($column) {             case "description":             the_excerpt();             break;         }     }


title: Should I put my plugin javascript inline?

text: I have a small bit of (localised) Javascript bundled with a plugin. Currently it's in a non-minified .js file, called at via enqueue_scripts. Given that this script will likely run on every page, should I minify it or output it so it's inline in the page?


title: Getting error “The package could not be installed. PCLZIP_ERR_BAD_FORMAT ”

text: i am newbie in wordpress. i have created my own plugin and it's working fine for me... now i have created rar/zip file my plugin folder... i am uploading my plugin .rar file in my another wordpress project... it's giving error               The package could not be installed. PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir Record signature      through FTP it's working fine in my all wordpress projects... but i want to make it uploadable. my plugin file structure is :-- /mypluging_dir                **--images---**       **--css--**      **--pluginfile.php--**      **--abc.php--**      **--xyz.php--**      i am using xampp 3.2.1 and my wordpress version is 3.7.1 Any help will be appreciate.. Thanks in advance


title: Structuring a product catalogue in Wordpress

text: I am trying to create a product based content managed website in Wordpress (by clients request). I have created a custom post type where all the products reside, aptly named 'Products'. The products must be shown in different categories as illustrated by the attached image. Being new to Wordpress I am struggling with how to put this together and would like some advice. Is it best to create a bunch of categories with corresponding pages. When the link is clicked I then somehow filter all the posts in that category? Just a little advice on how the best way to achieve this if possible. Many thanks in advance. ![Wordpress menu showing catalogue structure](http://i.stack.imgur.com/9Ossz.jpg)


title: How can I implement an Add to Collection function on my Image Gallery to be downloaded later?

text: I am building a WordPress Image Gallery like a Stock Photo Gallery for internal office use. I am using the Media Gallery to upload files and then using the image gallery to display the photos. It's working all well with four download options which you can choose. The problem I'm having is that I want to collect those images with a click of a button so that I can keep them and then later on, download them as a zip file. It'll make life easer for users to do this instead of downloading individuals photos. This is kinda like istock or shutterstock **Add to Lightbox feature**. I've seen a plugin which is the closes to what I want. It's called, Add to favorites. But it just gives you a list of titles in a widget. I don't want users to register into the site therefore just using cookies is enough so that whenever they close the browser, the collections reset. I dug into HTML5 local storage and jquery cookie but this seems kinda hardcore for me. I also thought of a shopping cart plugin but I don't need the paypal or whatever payments because I just want people to collect and download with an ease. Is there any way I can do this? Is there a kind of plugin which I can use?


title: Save HTML formatted data to post meta using add_post_meta()

text: Array     (         [post] => Array             (                 [jw_objective] => Exposure to end to end development of various applications; right from requirement analysis to system study, designing, coding, testing, de-bugging, documentation and implementation. Adept in handling the design and coding functions                 [postid] => 363                 [jw_fullname] => Pradeep                 [jw_email] => pradeepsk88@gmail.com                 [jw_phone] => 9952149811                 [jw_website] => www.por.com                 [jw_address1] => 83, VGP Nagar East                 [jw_address2] => T Nagar                 [jw_address3] => Chennai, India 605602                 [jw_title] => Senior Web Developer                 [jw_cname] => TPF Software Solutions                 [jw_startdate] => Dec 2010                 [jw_enddate] => Present                 [jw_desc] => This is my responsibilites in this job                 [jw_qualifications] => Certiﬁed Public Accountant (CPA)                             Certiﬁed Management Accountant (CMA)                             Certiﬁed Financial Manager (CFM)                             Certiﬁed Fraud Examiner (CFE)                             Certiﬁed Financial Planner (CFP)                             Certiﬁed Internal Auditor (CIA)                             Enrolled Agent (EA)                             Certiﬁed Government Financial Manager (CGFM)                                                                                [jw_educname] => B.E                 [jw_eduiname] => Arunai College of Engineering                 [jw_edustartdate] => May 2005                 [jw_eduenddate] => May 2009                 [jw_edudesc] => This is a riduculous thing happened in my life,                  [jw_interest] => These are my interests                 [jw_referance] => This Is my referance             )              )      This is the array I iterate through, and add it to the `wp_postmeta` through the following foreach loop               foreach ($_POST AS $key => $value) {         add_post_meta($pid, $key, $value, true);     }       The information is posted from a custom form. The problem I have is the HTML tags like `<b>` and `<i>` are automatically stripped off when entering the database. The HTML is generated from a jquery wysiwyg editor But the information is saved successfully. Is there any way to save postmeta with the HTML tags?


title: How To Set Custom Post Type Title Without Supports

text: So, I asked this question differently in another thread but it was more of an advice type question so it really didn't render any useful responses. I believe I can word it better and should help some of you decipher what I am trying to accomplish and possibly help someone else once we collaborate on a solution. I have a custom post type that is using very limited Supports (described here) values because I only need the meta-box values for my custom post type. It doesn't make sense for my type to include a title and content. Code below:               register_post_type( 'athlete',             array(                 'labels' => array(                     'name' => 'Athletes',                     'singular_name' => 'Athlete',                     'add_new' => 'Add New',                     'add_new_item' => 'Add New Athlete',                     'edit' => 'Edit',                     'edit_item' => 'Edit Athlete',                     'new_item' => 'New Athlete',                     'view' => 'View',                     'view_item' => 'View Athlete',                     'search_items' => 'Search Athletes',                     'not_found' => 'No Athletes found',                     'not_found_in_trash' => 'No Athletes found in Trash',                     'parent' => 'Parent Athlete'                 ),                      'public' => true,                 'menu_position' => 15,                 'supports' => array( 'thumbnail' ),                 'taxonomies' => array( '' ),                 'has_archive' => true             )         );      As you can see, I only need the thumbnail supports option because the rest of my post type will be meta-boxes (not including in this question). The problem is, when I save an Athlete, I have two problems, I do not know how to display my meta-box values in the Athlete list (as columns in the grid) and I do not know how to set the Title value as it always sets it to "Auto-Generated" which is not preferred. If the Title will be a field that is searchable, I would prefer to set the value to [First Name]+[Last Name]. Can anyone help with these two issues and explain if I am going to run into any problems by using a custom post type as opposed to using custom database tables and a custom UI to manage my object?


title: WP Super Cache unable to locate cache file for only the homepage

text: I have WP Super Cache working perfectly on all pages of my blog except for the homepage. I'm using the PHP caching method (mod-rewrite is not compatible with my specific configuration with suPHP). I've monitored the debug log and cache folder and can see _that the cache file is created successfully_ , but when its reloaded wp-super-cache cannot find it and recreates it. A big clue seem to be that if I load the index.php file directly it works i.e. www.site.com/blog/ <--- **Cannot find cache file** www.site.com/blog/index.php <--- **Able to find cache file (caching works!)** Im using the following permalink structure; **www.site.com/blog/%postname%** The .htaccess file is standard for the permalink structure               <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /blog/     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /blog/index.php [L]     </IfModule>      I'm using the following DirectoryIndex directive in my virtual machine config.               DirectoryIndex index.php      I've tried everything I can think of to resolve this including using the inotify package to monitor real-time file system activity to see what file name its looking for but it didn't help. Any assistance would be greatly appreciated.


title: How to Reload the Dashboard After Clicking Update in Quick-Edit?

text: How can I refresh the `wp-admin/edit.php` page after a user clicks **Update** in the _Quick-edit_ form?


title: Trouble getting wordpress working after moving servers

text: So I have 17 wordpress sites that I am moving from Server A to Server B. All the sites have been up and running on Server A for over 2 years, no recent changes (ie, no new plugins, no new themes) to any of them. I have moved all the files and all the databases to Server B. All good. Created MySQL users, gave permissions, all good. Problem: Some sites work, some sites don't. The sites that don't work are just a blank white page. Sometimes I can login to the admin, sometimes I can't. Problem: Some sites have plugin errors (didn't exist before move) The sites that don't work often have a bunch of PHP errors related to various plugins that prevents the site from loading. The sites that work, work as if they were never moved. Any ideas of whats going on?


title: Privilege to recover trashed posts

text: I can't seem to find which built in privilege is required for recovering a trashed post. Would it be `delete_posts`, which is as its name suggests, can move items into the trash and remove them completely, or `edit_posts` or `publish_posts`..? I aim to have something like, when an admin trashes a post of a lesser role, that lesser role should not be able to recover it. I don't want to add a new capability.


title: Theme-Option-Panel: Select List of Pages, Childpages and Posts

text: I just can't solve this problem: in the **wp dashboard** I want the user to have the **option** of selecting between all **pages, sub-pages and posts** (also custom-post-types) for displaying them in special content-boxes at the home. This is what I got, unfortunately sub-pages(childs) and posts are not working… I am thankful for any kind of advice!                   function getTopArticlePosts($options, $currentPost)     {       $ret = '<option value="">Select Article</option>';       foreach($options as $option) {         $selected = ($option[0] == $currentPost) ? ' selected' : '';         $ret .= '<option value="'.$option[0].'"'.$selected.'>'.$option[1].'</option>';       }            return $ret;     }     function my_settings()     {           $pages = array_merge(         get_pages(),         get_posts(array('post_type' => 'post')),         get_posts(array('post_type' => 'books')),         get_posts(array('post_type' => 'ebooks'))       );           $childpages = array_merge(         get_pages()       );            $options = array();       $otheroptions = array();       foreach($pages as $page) {         if(!has_post_thumbnail($page->ID)) {           $otheroptions[] = array($page->ID, $page->post_title);         } else {           $options[] = array($page->ID, $page->post_title);         }       }          ?>


title: Create a new different blog layout

text:
I'm not native English, so I use a translator. It may be that the phrases are not correct all I'm trying to create a new template to display blog posts differently. For example, I want the image of the post to larger. So I copied and pasted the contents of the index.php page and changed the image size. I then created the page, leaving the fields blank and selecting my template. I then go to Option Reading, check "static page" and selects the new page. Unfortunately, it does not work because the page displayed is : One blank blog article, instead of all items with the bigger picture. What might be the problem? Here is my page index.php                   <?php get_header();         global $redux_demo; ?>              <div class="body container" <?php echo 'style="font-family:'.$redux_demo['body_font_family']['font-family'].';">';?>

                                                          <?php                              $args = array(                                         'post_type'      => 'slide' ,                                         'orderby'        => 'menu_order' ,                                      );                                  $slides = new WP_Query( $args );                                  if ( $slides->have_posts() ) : $count=1; ?>

                                         <?php while ( $slides ->have_posts() ) : $slides->the_post(); ?>                                         <div class="item <?php if($count=="1"){echo 'active';}?> ">                                             <?php add_image_size( 'category-thumbs', 670, 400 ); ?>                                             <?php the_post_thumbnail( 'category-thumbs' ); ?>

<?php the_title(); ?>

<?php the_content(); ?>

                                         <?php $count++; endwhile; ?>
                                                                      ‹                                   ›

                                 <?php endif; ?>                                   <?php if(have_posts()) : ?>                             <?php while(have_posts()) : the_post(); ?>
                                 <?php if ($redux_demo['enable_post_category'] == 1) { ?>
<?php foreach((get_the_category()) as $category) {echo $category->cat_name . ' ';}?>
<?php } ?>                                 <div class="post" id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?>

                                         <?php add_image_size( 'medium-thumb', 350, 200);?>                                         <?php the_post_thumbnail( 'medium-thumb' ); ?>                                          <?php setup_postdata ($post);                                        if ($post->post_content = $post->post_excerpt)                                            the_content();                                        else                                         {                                            the_excerpt();                                            ?>                                     <?php  } ?>

                                             <?php the_time('j F Y') ?> <?php the_author() ?><?php $posttags = get_the_tags(); if($posttags){?> <?php } the_tags('',', ','') ?><?php comments_popup_link('0', '1', '%','pull-right'); ?>

                                       <?php endwhile; ?>
                                     <?php theme_pagination(); ?>
                             <?php else : ?>
Désolé, mais vous cherchez quelque chose qui ne se trouve pas ici .
                             <?php include (TEMPLATEPATH . "/searchform.php"); ?>                         <?php endif; ?>

                         <?php get_sidebar(); ?>

                 <?php get_footer(); ?>                          and my blog-large.php page.                   <?php     /*     Template Name: [Blog] Large Thumb     */      get_header();             global $redux_demo; ?>                  <div class="body container" <?php echo 'style="font-family:'.$redux_demo['body_font_family']['font-family'].';">';?>

                                                                  <?php                                  $args = array(                                             'post_type'      => 'slide' ,                                             'orderby'        => 'menu_order' ,                                          );                                      $slides = new WP_Query( $args );                                      if ( $slides->have_posts() ) : $count=1; ?>

                                             <?php while ( $slides ->have_posts() ) : $slides->the_post(); ?>                                             <div class="item <?php if($count=="1"){echo 'active';}?> ">                                                 <?php add_image_size( 'category-thumbs', 670, 400 ); ?>                                                 <?php the_post_thumbnail( 'category-thumbs' ); ?>

<?php the_title(); ?>

<?php the_content(); ?>

                                             <?php $count++; endwhile; ?>
                                                                              ‹                                       ›

                                     <?php endif; ?>                                       <?php if(have_posts()) : ?>                                 <?php while(have_posts()) : the_post(); ?>
                                     <?php if ($redux_demo['enable_post_category'] == 1) { ?>
<?php foreach((get_the_category()) as $category) {echo $category->cat_name . ' ';}?>
<?php } ?>                                     <div class="post" id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?>

                                             <?php add_image_size( 'large', 550, 200);?>                                             <?php the_post_thumbnail('large', array('class' => 'post-image')); ?>                                              <?php setup_postdata ($post);                                            if ($post->post_content = $post->post_excerpt)                                                the_content();                                            else                                             {                                                the_excerpt();                                                ?>                                         <?php  } ?>

                                                 <?php the_time('j F Y') ?> <?php the_author() ?><?php $posttags = get_the_tags(); if($posttags){?> <?php } the_tags('',', ','') ?><?php comments_popup_link('0', '1', '%','pull-right'); ?>

                                           <?php endwhile; ?>
                                         <?php theme_pagination(); ?>
                                 <?php else : ?>
Désolé, mais vous cherchez quelque chose qui ne se trouve pas ici .
                                 <?php include (TEMPLATEPATH . "/searchform.php"); ?>                             <?php endif; ?>

                             <?php get_sidebar(); ?>

                     <?php get_footer(); ?>


title: Display user's total comment count outside The Loop

text: How do I display a user's total comment count outside The Loop? I use this code to display comment count **inside the loop** :                   <?php         global $wpdb;         $user_id = $post->post_author;         $where = 'WHERE comment_approved = 1 AND user_id = ' . $user_id ;         $comment_count = $wpdb->get_var(             "SELECT COUNT( * ) AS total         FROM {$wpdb->comments}         {$where}     ");         echo 'Comments: <strong>' . $comment_count . '</strong>';         ?>      That works perfectly inside the loop. In an attempt to make that code work outside the loop, I changed `$user_id = $post->post_author;` to `$user_id = get_the_author_meta( 'ID' );` but it did not work. The closest that I have been is with this code:                                           <?php                                 global $wpdb;                                 $where = 'WHERE comment_approved = 1 AND user_id <> 0';                                 $comment_counts = (array) $wpdb->get_results("                                     SELECT user_id, COUNT( * ) AS total                                     FROM {$wpdb->comments}                                     {$where}                                     GROUP BY user_id                                     ", object);                                 foreach ( $comment_counts as $count ) {                                     $user = get_userdata($count->user_id);                                     echo 'Comments: ' . $count->total . '                                     ';                                 }                                 ?>      However, this echos comment count for all users, like this: "Comments: 28 Comments: 11 Comments: 55" etc What code can I use to **show the user's comment count outside the loop**?


title: Set Custom Post feature image as og:image

text:
I am trying to set the Featured image as the `og:image` I have tried various ways and plugins (Yoast) but finding it hard to get my head around this. The issue is that it isn't picking up the feature image at all instead it is picking up the images in the content. This is my current pages code for the single blog post. This is the part which i need to be able to get when sharing the blog post to Facebook rather then the content images.
             <?php if( get_field('featured_image') ): ?>             <?php $featuredImage = get_field('featured_image'); ?>             <img rel="image_src" src="<?php echo $featuredImage['url']; ?>" alt="">             <?php else: ?>                          <?php endif; ?>
      It does do this weird thing when a blog post hasn't got any images in the content it then picks up the feature images and images in the sidebar. I also ran the Facebook debugger but again it is only picking up the contents imagery. I did find this snippet that targets the featured image but i have a feeling because mine is a custom post it may not be picking it up.               <meta property="og:image" content="<?php $post_thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID),'large'); echo $post_thumbnail[0]; ?>" />      Any suggestions would be great. If you need anything else, let me know.


title: Archive list with only years and months

text:
I'm trying to show the archive list like that

Year

Month

Month

Month

Year

Month

      and so on, with the relative link only on the month. I tried different solutions as the CG Archive plugin ( http://wordpress.pastebin.ca/209160 ) and that's the only kind of plugin I can use since I need to place the php output wherever I want and the other plugins/widgets I found doesn't let me do that. The problem is that it doesn't show anything at all! Do you know any alternative solutions to accomplis that? Really thanks in advance and sorry for my poor english.


title: Grab values from the query string to fill in hidden fields in ninja forms

text: I've added a custom page template where I pull out a list of available jobs from the database. The page displaying the jobs is called `jobs`. I'm using the `Ninja forms` plugin to add a form on a page called `apply.php`, which has fields for a job application. Now for each job title offered on the jobs page, I want it to be a link that the user can click on to apply, and be redirected to `apply.php`, where I can grab the job id and save in a hidden field on `apply.php`. This is so that when I save the applicant's submission, I can get it saved together with the job they applied to. I've added the link alright - as follows:               ?page_id=18&jid=2      where 18 is the id of the apply page, the page that I've got the ninja form on. But how can I grab the jid from the query string and use it in the ninja form fields?


title: Navigation menus not showing because of custom post type filter

text: I use this filter to show content from all custom post types in tags archive page               function tagFilter($query) {         $post_type = $_GET['type'];         if (is_tag()){             if (!$post_type) {                 $post_type = 'any';             }             $query->set('post_type', $post_type);         }         return $query;     };     add_filter('pre_get_posts','tagFilter');      but somehow it stops the `wp_nav_menu` function and navigation menus do not appear in tags archive pages. I can't figure out where is the conflict between the two. Any ideas?


title: What happens if I delete all the rows that represents a post revision from the posts table into WordPress database?

text: I have the following doubt related to the **posts** table of the WordPress database. I see that when I create a new post in this table are automatically created 2 new rows.               32  1   2014-08-16 15:07:22 2014-08-16 15:07:22 TEST REVISION   TEST REVISION       inherit open    open        31-revision-v1          2014-08-16 15:07:22 2014-08-16 15:07:22     31  http://localhost/wordpressAsper/2014/08/16/31-revi...   0   revision        0          31  1   2014-08-16 15:07:22 2014-08-16 15:07:22 TEST REVISION   TEST REVISION       publish open    open        test-revision           2014-08-16 15:07:22 2014-08-16 15:07:22     0   http://localhost/wordpressAsper/?p=31   0   post        0      I know that the one having 32 as ID is the post revision while the one having 31 as ID is the published post. For some reason I need to delete all the posts revision from my databse. If I delete all the revision of all posts can I have some kind of problem with the post of my blog? Or it still work using only the published post?


title: comment_karma. Archived info on using it is outof date

text: Using the tentyfourteen theme, how would I go about using comment_karma to change the displayed order of comments? There is a solution posted on several sites (inc here, Sort comments by karma) but I cant figure it out at all. Based on experience I would have to conclude that the information is out of date (2011) or am I totally wrong? I have spent an entire day trying to figure this one thing out.


title: Show post titles only on the homepage

text: Is there any way to show a list of all posts without any preview of the content on the homepage?


title: append links with unique number string

text: I am in the process of developing a WordPress theme for a news site that delivers the news in bitesized chunks with the story regally updated with new content. What I am having trouble with is this: Next to each update I would like a number, so the first post will be 1, then the next update will be 2 and so on. I would also like these numbers to be links with a unique number string at the end of the normal URL so for instance if the URL was `example.com/NSA-hacks- merkels-cell-phone` the second update would be `example.com/NSA-hacks-merkels- cell-phone/123456` so that that update can be easily shared. Is any of this possible? any help that the community can give me on this would be very much appreciated.


title: Creating wordpress user registration form

text: I am having a form page called Test Form with this form :               <div id="container">     <form action="wp-content/themes/max-magazine/TestForm.php" method="post" name="myForm">     User <input type="text"  name="uname" />     Email  <input id="email" type="text" name="uemail" />     Password  <input type="password"  name="upass" />     <input type="submit" value="Submit" /></form>     </div>      And in backend am having a php file named TestForm.php               <?php      function create_account(){     $user = 'AccountID';     $pass = 'AccountPassword';     $email = 'email@domain.com';     if ( !username_exists( $user )  && !email_exists( $email ) ) {         $user_id = wp_create_user( $user, $pass, $email );         $user = new WP_User( $user_id );         $user->set_role( 'contributor' );     }      }     add_action('init','create_account');     ?>      Now if this function is defined in function.php then it works fine and create the user but same function in TestForm.php does not work. Please help Also I will be fetching data from form like this :               <?php     $user = $_POST['uname'];     $pass = $_POST['upass'];     $email = $_POST['uemail'];     ?>


title: Short code for Venues

text: I am using the Event Organiser plug in and I am trying to setup the "venues." In the post my client and I would like a little more information on the venue to appear, I found the short code for the Google Map, but there is no other information. When I click on the location nothing happens.   Is there a short code to post more information on the Venue?


title: How to access the post meta of a post that has just been published?

text: I am using the hook `publish_post` to run my code where I need the post meta of the just published post. But the post meta value I am looking for is somehow not available at this point of execution. On checking the `wp_postmeta` table, I found that my meta key value hasn't been created yet. Also, I want this to work for a post published for the first time. Is there any other hook that can give me access to it?               function push_notification($post_id)      {          $ref_ids = get_post_meta($post_id,'ref_id');               if($ref_ids)          {              //my code goes here          }      }           add_action('publish_post','push_notification');


title: Insert retrieved image into another table?

text: I am retrieving one image from a table name "user_templates" after retrieving ,I have to insert that retrieved image into another table name "ca_woocommerce_order_items" but I am not able to insert image in ca_woocommerce_order_items" table.I am using woo commerce plugin and following function I written in function.php.                function insertimage() {                  echo $item_id;           echo "hi";           global $wpdb;           $result = $wpdb->get_results ( "SELECT * FROM user_templates  where id= ".$_SESSION['user_te']);           foreach ( $result as $print )             $img_post=$print->BgImageName;           echo $img_post;               $ca_woocommerce_order_items  =  $wpdb->prefix . 'ca';          $wpdb->insert($ca_woocommerce_order_items , array('BgImageName' => 'sdfsd'));           echo "success";           exit;         }


title: Get all woocommerce comments/reviews

text: What I need to achieve is to get all comments from all products in Woocommerce. This is not getting me ANY comments at all...               <?php $comments = get_comments( array( 'post_type' => 'product') ); ?>      However               <?php $comments = get_comments( array( 'post_id' => '4169') );      Gets me comments for particular product ID. How to query ALL comments? Thanks in advance.


title: Check if user is logged in using JQuery

text: I want to execute custom jquery code which shows login dialog to user if he clicks a button and he is not logged in. How could I do that?


title: How to set up php,javascript and css to allow for our finished product to be displayed within a page?

text: hey wordpress experts, We have coded a table using php, javascript and css which pulls up information from a text file and displays it in the browser. We have everything working as desired when we set up our files on a local server. However, we are trying to integrate our finished product into a page on a wordpress website. We are using the "CSS & javascript toolbox" plugin to make a php&javascript code block and a css code block and applying it to the page in question. However, I understand that pages are stored in sql tables so this makes it hard for me to figure out how I can access the code on the server and where to put the text file on the server so that the table is displayed on the page in question and works as desired. ![Picture of our table](http://i.stack.imgur.com/iv4qZ.jpg)


title: htaccess has broken my site

text: I made a small addition to the htaccess file and it broke my site (I'm certain there were no errors, however). So I deleted what I added and 24 hours later the site is still broken. I've disabled the htaccess file altogether. replaced the wp-admin and wp- includes moved all the themes off the server only leaving the default. turned on debugging and no errors are produced I only get the white screen of death. I'm not sure what else to do at this point.


title: remove missing image attachments

text: Best way to programatically remove attachments that are missing images? I ask because after using a caching plugin, I have images that have been input in the database as attachments that don't actually exist. These usually take the form of xxxx.1jpg, where xxxx.jpg is a valid. Sometimes this number is a 2 or a 21. ![bonus image attachment](http://i.stack.imgur.com/lxqmI.png) I guess it would be better to just remove "duplicate" bad images. I think it might be good to have other types of missing images remain, so they could be corrected. Ideas?


title: Different Subdomain changes page content

text: I know it seems to be a strange ask here but hear me out. I have a client who has several subdomains for different countries, such as us.example.com and uk.example.com. I want to change one or two pages of a wordpress website when there is a certain subdomain entered. Before anyone asks I have mentioned having the different options selectable in the main site but they would rather have it this way. I could always just have another wordpress install, or put it under a multi- site but if one can do it this way that would be great. Thanks in advance!


title: Modify featured image path to amazon s3

text: I have uploaded my images to amazon s3. There are some Featured images. Inorder to modify their path, I run the update scripts to change the path of wp_posts.guid. But the image still points to the old path. How can I change the featured image url so as to point to amazon s3 path? thanks


title: Default content for a new site in multi site

text: I'm building a network with multi-site.   When create a new site, I want some data for site: category, tag, post, active plugin... also create as default data. Who can show me how to do? Write a plugin and add data as I want, direct modification function create?


title: How to leverage hefty memory actions from programmatically creating nav menus

text: I'm working on a plugin right now and hitting a wall. Long story short, part of the plugin process is to construct a dynamic nav menu. This nav menu can get rather large, and I'm finding that it seems to be taking up too much memory and causing a white screen. (some of the loads that succeeded took 84MB of memory and over 4K queries). The code for creating the nav menu items looks something like this (note, this is NOT the exact code, it's formatted just to give you the general idea of what's going on):               // Cycle through each item and create the nav menu item accordingly     /// Probably around 80 or so nav menu items will be output from this array     foreach ( $menus as ... ) {              // ...              $ID = wp_update_nav_menu_item( $this->menu_ID, 0, $args );              if ( ! is_wp_error( $ID ) ) {             // About 5 post meta items             foreach ( $custom_meta as $meta_name => $meta_value ) {                 update_post_meta( $ID, $meta_name, $meta_value );             }         }              // If there are submenus, cycle through them         if ( $submenus ) {                  foreach ( $submenus as ... ) {                      // ...                      // $args contains $ID as the parent item ID                 $submenu_ID = wp_update_nav_menu_item( $this->menu_ID, 0, $args );                      if ( ! is_wp_error( $submenu_ID ) ) {                     // About 5 post meta items                     foreach ( $custom_meta as $meta_name => $meta_value ) {                         update_post_meta( $submenu_ID, $meta_name, $meta_value );                     }                 }             }         }     }      So as you can see, there is a LOT of wp_update_nav_menu_item()'s and a lot of update_post_meta()'s. That's a lot of queries and a lot of processing. My question is... what's the best method for trying to leverage a task like this? How can I split it up without the user having to refresh a bunch of times or something? AJAX? CRON? Something else? I'm so lost.


title: how rewrite is working in wordpress

text: I have installed a plugin called marketpress. And it have a url as `http://www.mydomain.com/store/shopping-cart/shipping/` Now i just want to know which php page it refers to. In **my db** and found there is a row in **wp_options** table with the key **rewrite_rules** and it have               [store/shopping-cart/?$] => index.php?pagename=cart     [store/shopping-cart/([^/]+)/?$] => index.php?pagename=cart&checkoutstep=$matches[1]      so as per my url the link will be as like `index.php?pagename=cart&checkoutstep=shipping` If the url is like this **which php page the wordpress will look for?** Basically i am a cakephp developer. So all i think is for a controller and action something like that. Can someone explain me how can i find the how the wordpress will refer tot he dependent php page base on the url? **Which page i should refer if ?pagename=cart is passed is passed** My english may poor. But i hope you guys understand what i am trying to ask :\


title: Display Posts by Views (Popular Posts Widget)

text:
I am trying to display the most popular posts based off of this, but I don't think it is working properly. When you view a post it seems to add 1 view to each of them, not just the unique ID.               <?php          class SEM_Podcast_Widget extends WP_Widget     {            protected $defaults;              public function __construct()         {             // Set the default widget settings             $this->defaults = array(                 'title'         => '',                 'showdate'      => '1',                 'posts_cat'     => '',                 'postid'        => '',                 'showsummary'   => 1,                 'showfeatured'  => 1,                 'featuretype'   => 'latest'             );                  // Widget settings             $widget_ops = array(             'classname' => 'featuredpodcast',   // CSS classname for widget div             'description' => 'Displays the latest / featured podcast with excerpt and player.'  // Description shown in the WP Admin on the widgets page             );                  // Widget control settings             $control_ops = array(             'id_base' => 'featured-podcast',             'width' => 250,             'height' => 250             );                  // Create the widget             $this->WP_Widget('featured-podcast', 'SEM Geeks Featured Podcast Widget', $widget_ops, $control_ops);         }                   // prints the form on the widgets page         public function form ($instance)         {                  // Merge with defaults             $instance = wp_parse_args((array) $instance, $this->defaults);         ?>
             <label for="<?php echo $this->get_field_id('title'); ?>">Title:             <input type="text" name="<?php echo $this->get_field_name('title') ?>" id="<?php echo $this->get_field_id('title') ?> " value="<?php echo $instance['title'] ?>" size="25">

             <label for="<?php echo $this->get_field_id('showdate'); ?>">Date:             <input type="checkbox" name="<?php echo $this->get_field_name('showdate') ?>" id="<?php echo $this->get_field_id('showdate') ?> " value="1" <?php checked($instance['showdate']) ?>>

             <label for="<?php echo $this->get_field_id('showsummary'); ?>">Show Summary:             <input type="checkbox" name="<?php echo $this->get_field_name('showsummary') ?>" id="<?php echo $this->get_field_id('showsummary') ?> " value="1" <?php checked($instance['showsummary']) ?>>

         <label for="<?php echo $this->get_field_id('posts_cat'); ?>">Podcast Category:         <?php             $categories_args = array(                 'name'            => $this->get_field_name('posts_cat'),                 'selected'        => $instance['posts_cat'],                 'orderby'         => 'Name',                 'hierarchical'    => 1,                 'show_option_all' => 'All Categories',                 'hide_empty'      => '0'             );             wp_dropdown_categories( $categories_args ); ?>
              <fieldset>             <legend>Select which podcast episode you would like to display:</legend>
                 <input type="radio" name="<?php echo $this->get_field_name('featuretype'); ?>" id="<?php echo $this->get_field_id('featuretype'); ?>_val1" value="latest" <?php checked($instance['featuretype'], 'latest'); ?>/>                 <label for="<?php echo $this->get_field_id('featuretype'); ?>_val1">Latest Podcast from Category
                 <input type="radio" name="<?php echo $this->get_field_name( 'featuretype' ); ?>" id="<?php echo $this->get_field_id('featuretype'); ?>_val2" value="featured" <?php checked($instance['featuretype'], 'featured'); ?>/>                 <label for="<?php echo $this->get_field_id('featuretype'); ?>_val2">Featured Podcast (set id below)
                      <label for="<?php echo $this->get_field_id('postid'); ?>">Featured Post's ID:                 <input type="text" name="<?php echo $this->get_field_name('postid') ?>" id="<?php echo $this->get_field_id('postid') ?> " value="<?php echo $instance['postid'] ?>" size="5">
         </fieldset>                   <?php                    echo '
';                  if (function_exists('powerpress_init'))                   echo ' PowerPress is installed.
';                  echo '
';                  echo '
Widget Shortcode: [featuredpodcast]
';         }                   // used when the user saves their widget options         public function update ($new_instance, $old_instance)         {             $instance = $old_instance;                  $instance['title'] = strip_tags($new_instance['title']);             $instance['showdate'] = $new_instance['showdate'];             $instance['posts_cat'] = $new_instance['posts_cat'];             $instance['postid'] = $new_instance['postid'];             $instance['showsummary'] = $new_instance['showsummary'];             $instance['showfeatured'] = $new_instance['showfeatured'];             $instance['featuretype'] = $new_instance['featuretype'];                  return $instance;         }                   // used when the sidebar calls in the widget         public function widget ($args, $instance)         {             extract($args);                  // Merge with defaults             $instance = wp_parse_args((array) $instance, $this->defaults);                  echo $before_widget;                  if (!empty($instance['title']))                 echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;                  // retrieve post information from database             if ($instance['featuretype'] == 'featured')             {                 $query_args = array(                     'post_type' => 'post',                     'cat'       => $instance['posts_cat'],                     'showposts' => '3',                     'ignore_sticky_posts' => true,                      'meta_key' => 'post_views_count',                      'orderby' => 'meta_value_num',                      'order' => 'DESC'                      );             }             else             {                 $query_args = array(                     'post_type' => 'post',                     'cat'       => $instance['posts_cat'],                     'showposts' => '3',                     'ignore_sticky_posts' => true,                      'meta_key' => 'post_views_count',                      'orderby' => 'meta_value_num',                      'order' => 'DESC'                      );             }                            $featured_post = new WP_Query($query_args);                      echo '';                  if ($featured_post->have_posts())             {                 while ($featured_post->have_posts())                 {                     $featured_post->the_post();                     observePostViews(get_the_ID());                          echo '
';                          if ($instance['showdate'])                          echo '';                         echo get_the_date('m.d.Y', $post->ID);                         echo '';                          // Show hyperlinked post title                     printf('
%s
', get_permalink(), the_title_attribute('echo=0'), get_the_title());                          // If selected, show excerpt from the post                     if ($instance['showsummary'])                         the_excerpt(); // Show excerpt from the post                          echo '';                          if ($instance['playerwidth'] > 0)                         $output_text = do_shortcode('[powerpress width="' . $instance['playerwidth'] . '"px]');                     else                         $output_text = do_shortcode('[powerpress]');                          echo $output_text;                     echo '';                          // printf('[Read More...]', get_permalink());                          echo '
';                      }                          echo '
';                          echo '';                     echo "VIEW MORE PODCASTS";                     echo '';                          echo '';                     echo '';                     echo '
';                     echo '';             }                  echo $after_widget;             wp_reset_query();         }     }               // Hook the widget up to WordPres     add_action('widgets_init', create_function('', 'return register_widget("SEM_Podcast_Widget");'));


title: pluggable function in theme, to be overridden by plugin

text: Is it possible to add a function in functions.php like this:               // ACF         if ( !function_exists('get_field') ) {             function get_field() {                 return false;             }         }      and then let plugins that creates that function override my theme function? In this case I'm using Advanced Custom Fields, and id like to have a fail-safe, that won't create "function does not exist" errors, in case the plugin gets deactivated. So i'd like my theme to have a fallback for that same function. Im assuming i might need to hook in somewhere, but I'm don't really know when. If i do what i've done above then it won't allow me to activate Advanced Custom Fields, because now the functions already exists (in my theme). Thanks


title: Polls with respective comments?

text: I am using wp-polls plugin. It's working fine. Instead I need some more things in this which are :   1. I want to use comments with each poll. (I think this can be possible when adding A New Poll, A New Page will generate) so I can get comments on that Poll via that Page.   2. When I click on Polls Archive link then all Polls are visible it's fine but I want to see their respective comments on that Polls Archive Page.   3. How to get latest Poll with it's comments ? Please give me any solution either with this plugin or any other way to manage the Polls with respective comments.


title: Taxonomy archive 404ing (not term archive)

text: I may have just dug too deep into WordPress lately that I am not able to free my head & don't get this working as supposed to do. I want a simple taxonomy archive listing all taxonomy terms (not a term's archive), while it only 404s on my end. This is how it is set up: I have a CPT **'travel'** and a taxonomy called **'actions'** that classify different kind of travel options (e.g. by bike, sailing etc.). Term archives (with a taxonomy-actions.php template) work just fine. The URL is like www.domain.com/actions/by-bike. However, when I try to pull the taxonomy archive, which should then be located at www.domain.com/actions, I get a 404. Is there something basic I am missing or doing wrong? Isn't the taxonomy-actions.php supposed to be used for the taxonomy archive in the first place?


title: Running WP Cron on specific local time

text: The scenario is to run insert_post function every midnight (00:00) of local time. Must run daily on weekday.               function add_daily_task(){         if((date('l', time()) != 'Saturday') || (date('l', time()) != 'Sunday')){              // insert post         }     }          if(!wp_next_scheduled( 'add_daily_task_schedule')){         wp_schedule_event(time(), 'daily', 'add_daily_task_schedule');         // how should change time() to meet my local schedule?     }          add_action('add_daily_task_schedule', 'add_daily_task');


title: Twenty Twelve Calender Widget post titles creating disturbance

text: In my modified Twenty Twelve theme, when I'm hovering onto the calender widget's date, there is a acronym-like balloon showing that date's post titles. Thing really is an anchor title:                       23     	      So when I'm hovering onto date 23, it's echoing like an acronym:               23     ---------------      post title 1      post title 2     ---------------      Problem is: My client doesn't want this. If I can modify the default calendar widget, then I can delete the anchor title, and it will solve the problem. But I can't edit the default calendar widget.   * **QUESTION 1:** HOW TO EDIT WORDPRESS DEFAULT CALENDAR WIDGET? Otherwise, I can make CSS for the specific title like this one. I did this like:               a[title]:hover:after {       content: attr(title);       display: none;     }      and/or               a[title]:hover:after {           content: attr(title);           visibility: hidden;         }      But failed. So, alternatively, the second question can be:   * **QUESTION 2:** HOW TO HIDE THE ANCHOR TITLE USING CSS? Thanks in advance.


title: Custom Post Type - Duplicate Page Slugs

text: I have 2 custom post type registered in my functions file, **sectors** and **projects**. There are pages with the same name and hence URL in both post type. My problem is that WordPress wont allow the same URL's for a page, these URL's are a requirement so need to find a fix. Example: **Sectors**   * Apples (apples)   * Oranges (oranges)   * Bananas (bananas) **Projects**   * Apples (apples-2)   * Oranges (oranges-2)   * Bananas (bananas-2) **Code**               register_post_type( 'Sectors',         array(             'labels' => array(                 'name' => __( 'Sectors' ),                 'singular_name' => __( 'Sector' )             ),         'public' => true,         'rewrite' => array('slug' => 'sector'),         'has_archive' => false,         'hierarchical' => true,         'capability_type' => 'page',         'supports' => array('title','editor','thumbnail','page-attributes'),         'menu_icon' => get_template_directory_uri().'/images/wordpress/cpt-sectors.png'         )     );          register_post_type( 'Projects',         array(             'labels' => array(                 'name' => __( 'Projects' ),                 'singular_name' => __( 'Project' )             ),         'public' => true,         'rewrite' => array('slug' => 'project'),         'has_archive' => false,         'hierarchical' => true,         'capability_type' => 'page',         'supports' => array('title','editor','thumbnail','page-attributes'),         'menu_icon' => get_template_directory_uri().'/images/wordpress/cpt-projects.png'         )     );      I need a way for this to work, and I am hoping there is a simple answer that I have missed in my hours of Googling. Note: Please refrain from just posting "This cant be done" or any elongated/messy solutions like hacking the core. There must be a way for WordPress to allow this.


title: Post meta not appear in admin edit menu for custom post type

text: I have a custom post type 'Vehicles' within I have a taxonomy 'cars'. Also a front end adding from a html form. After the form is send, here is a sample what actually is happening. My idea is to hook my custom fields/post meta boxes to admin edit area of that specific post type. Any ideas?               if(isset($_REQUEST['cars'])){ // checking which form is coming from post array              $make = $_POST['make']; // getting the field from the form and pass it to a variable         $new_post = array( // collecting the information about the new post                  'post_title'    =>   $title,                  'post_content'  =>   $description,                  'tax_input' =>   array('types' => array('cars')),                    'post_status'   =>   'pending',                            'post_type' =>   'vehicles'                    );                $pid = wp_insert_post($new_post); // pass the array data from above to the function that actually save the post           wp_set_object_terms($pid, 'cars', 'types', true); // setting the taxonomy for that specific post                add_post_meta($pid, 'car_make', $make, true); // adding the meta information about the post. THIS IS WHAT I WANT TO APPEAR IN ADMIN EDIT MENU               }


title: wp_insert_post() Callback?

text: After I added a post by wp_insert_post(); Any callback after I added ? I need permalink of added post. I have idea only search by title and post-type (I use custom post-type in my case), But any better function ?


title: Modify / Rewrite single template url structure

text: Is it possible to add the post category name to the the WordPress single template url structure if i am not using category pages to build the site menu? from www.domain.com/single-post-title to www.domain.com/category-name/post-title I am using a custom page template that is loading posts from a specific category. Would I have to edit the urls in the .htaccess file, or is it possible to do this using WP_Rewrite?


title: Adding an image and background colour to confirmation email

text: When a user registers for my site they get an email showing them their username and password but I would like to know how I can add a background color and image to these emails. I use the WP Register Plus Redux plugin to register users by the way. I've tried using CSS. This is the code that I tried:               body {background-color:#b0c4de;}


title: Is it good practice to search for custom posts based on custom field values?

text: I am building a theme for a local roofing company and we need to implement a solution for users to be able to search through custom posts and find what they're looking for based on custom field values. For example, a user should be able to select that they are looking for all posts that match:   * roofColor = green   * roofType = shingles   * roofCity = chicago   * etc.. There will be hundreds of projects (custom post entries) to search through. I'm interested in best practices here. **Is it okay to be using custom fields for my custom posts in this example** and to search for posts that have the matching custom field values? I have heard that the way wordpress stores values like this in the db would make it inefficient or slow, so **I'm wondering if it would be better to build my own database to handle the special values for each roofing project?** Thank you for your time and insight, it's greatly appreciated!


title: How can I get plugin meta data without knowing the plugin folder?

text: I am looking to get meta data about an installed plugin from another plugin. Theoretically, to get the version, I could do:               $data = get_plugin_data( 'expected_plugin_folder_name');     $version = $data['version'];      But, this wouldn't work if the end user had changed the name of the plugin that I'm looking to get the meta data on was installed in. I think the solution is to search in the array returned from `get_plugins()`. The sticky part is the array keys are named for the path, relative to the plugin directory of the plugin file, which brings me back to the same issue as before--the end-user might have changed the directory name of the plugin. Is there anyway to get the meta data without having to specify the plugin folder? Possibly by specifying slug, uri, name, etc...


title: Using Foundation 5 off-canvas-menu with Wordpress

text:
I am trying to integrate Zurb Foundation 5 into a Wordpress theme. I can get it working fine but I'm puzzled by a seeming issue which make it unworkable in Wordpress. Please see this code for making the off-canvas menu work, and following the code I outline my question:

Foundation

Foundation

The Psychohistorians

Users

Hari Seldon

      It seems that all of the page content must be wrapped inside that element near the end - **which is all wrapped up inside the "off-canvas-wrap"**. If this is so, how does the modular nature of wordpress code work? The entire page would need to be in the header.php, with no modularity. I feel I must be missing something. Really hope someone can help. Best wishes, Andrew.


title: Trying to map a PURL like url to a page

text: I'm trying to map a path such as               /BigOffer12345      to an actual page such that the numeric part is passed as an argument.               /Offers/BigOffer/?id=12345      The id passed in will ultimately be used to generate custom content pulled from a remote source (similar to a purl service). I've been looking into Rewrite, but I'm new to WordPress and I think I'm getting stuck on some basics. Does something like this need to happen in a plugin or is there another interface to get this into WordPress?


title: Search for featured image, then for first image, then for video thumbnail

text: I want wordpress to use featured image to create thumbnail. If there is not, then first image of the post. If not, video thumbnail. Can anyone help me modifying the code? Thanks in advance.               USED CODE     function get_attachment_id_from_src( $image_src ) {     global $wpdb;     $query = "SELECT ID FROM {$wpdb->posts} WHERE guid='$image_src'";     $id = $wpdb->get_var($query);     return $id;     }          add_filter( 'post_thumbnail_html', 'my_post_image_html', 10, 5 );          function my_post_image_html( $html, $post_id, $post_thumbnail_id, $size, $attr ) {     if( '' == $html ) {         global $post, $posts;         ob_start();         ob_end_clean();         $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);         $first_img = $matches [1] [0];         if ( empty( $first_img ) ){             $image_id = 129; // default image ID         }         else {             $image_id = get_attachment_id_from_src($first_img);         }         $html = wp_get_attachment_image( $image_id, $size, false, $attr );     }     return $html;     }


title: Wordpress 3.5 grab first image from gallery

text: I'm noticing that adding a gallery to a page now just lists the ID's of images, slightly different to before, and reordering the images just amends the order of the ID's listed in the gallery short-code. So this...               [gallery order="DESC" link="file" columns="4"]      It's now this...               [gallery ids="3439,3440,3444,3443,3445,3453,3457,3458,3456,3461,3452,3468,3467,3470,3464,3459,3463,3462,3460,3466,3454,3450,3449,3448,3451,3447,3446,3442,3441,3438,3471,3469"]      Which is fine, and old galleries created in previous versions still appear to work. My problem is I have a summary page grabbing the first image of every child page. The code is something like this....                                                                           $args = array(                                                                 'post_type' => 'attachment',                                                                 'post_parent' => $page->ID,                                                                 'orderby' => 'menu_order ID',                                                                 'order'=> 'asc',                                                                 'numberposts' => 1,                                                                 );                                                             $attachments = get_posts($args);      This now doesn't work (I'm guessing because gallery order is now based on the ID's) Any way to fix it? Thanks


title: What is the p parameter in a get_posts() parameter array?

text: I've seen code that looks like this: `get_posts(array('p' => $thumbnail_id, 'post_type' => 'attachment'));` What is the definition of the p parameter and is it documented anywhere? I can't find anything about it on the Codex page for get_posts().


title: Add Google+ Badge to Posts - Specific to Author

text: I want to add a Google+ author badge to the posts/reviews on my website. This would normally be a simple integration of the code that Google provides: https://developers.google.com/+/web/badge/ However, we have multiple authors so I need to pull out the relevant Google+ link from the admin, depending on who the author of the post is. The URl is currently stored under the "Google Profile URL" field in any user's WP user profile. This is not a default field, but I have used a Google+ plugin that lets you store a user's Google+ profile address as part of their Wordpress user profile. This is the plugin: http://helpforwp.com/plugins/google-author-link/ The main feature that I'll be using from the plugin is how it inserts a new field into user profile information in Wordpress - it's this field that I want to pull information from. Can anyone help me do this? Thanks.


title: Selecting related posts

text:
I am displaying related posts with the below code:

You may also be interested in...

     <?php     $posts = get_posts('numberposts=4&orderby=rand&category='. $category->term_id      . '&exclude=' . $current_post);     foreach($posts as $post) :     $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ));     ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
<img          src="<?php echo esc_url( $image[0] ); ?>" alt="View more info" />
     <?php endforeach; ?><?php endforeach; ?>

       ...but I want to make sure it displays posts even if no others in the same catagory...so something like               if (less than 4 related posts) {          display any other posts from other catagories     }      Thanks for your help.


title: Calling custom profile fields?

text: I've hidden and created various profile fields using the following code:               function my_user_contactmethods($user_contactmethods) {          // You can get rid of ones you don't want     unset($user_contactmethods['jabber']);     unset($user_contactmethods['yim']);     unset($user_contactmethods['aim']);     unset($user_contactmethods['googleplus']);     unset($user_contactmethods['url']);     unset($user_contactmethods['twitter']);          // And add any news ones. The array key is the meta key name, the text     // is however you want it labelled -- keep the key name the same as you have in gf map.          $user_contactmethods['I work for...'] = __('I work for...');          // etc for each field you want to appear          return $user_contactmethods;          }          add_filter( 'user_contactmethods', 'my_user_contactmethods');      I'm then trying to call the custom field using the following:               <?php echo get_user_meta($current_user->ID,'I work for...',true);?>      This doesn't show anything, can someone point me in the right direction?


title: Manipulating Media uploader

text: Ok. Going to try and explain this as best as I can, so bare with me. Anyway, I'm trying to include the default media uploader as a part of my plugin. Currently, I've successfully managed to use the filter `attachment_fields_to_edit` to hide most of the input fields, leaving only the title & alternate text fields, alongside a custom submit button. When clicked, this button gets the images URL and places it into a `div` on the parent page. Anyway, so here is my problem. Everything regarding the uploader itself is functioning how I want it to, but currently the filter is applying itself to the media uploader in posts, pages, the media library, etc. I only want the alternative fields & custom button to show within my plugin, but not elsewhere. I've tried everything, but I cannot get it to work. I managed to apply my own query to the media-upload.php URL, and that way I could make the alternative fields only show within my plugin on the thickbox 'library' tab, but when uploading a new image the default fields were showing because Wordpress uses an alternative file to upload the image; async-upload.php. Here is the entire function: http://pastebin.com/5vpecMvL Just some information on the various functions: `riva_slider_pro_info()` is a function that returns an array of values. `riva_slider_pro_uri( $search )` gets $_SERVER[ 'REQUEST_URI' ] and stores it in a variable, search its for the $search parameter and return true or false. In the 'libary' tab within the media uploader thickbox, it is returning `true` because I have passed a additional query onto the media-upload.php URL (for example, 'media-upload.php?post_id=0$slideshow=true&type=image&TB_iframe=1'). BUT, it is returning `false` after the user has just uploaded a new image within the same thickbox, because it uses the async-upload.php file instead. Not sure how I could pass the query onto this URL, if it would be possible to make it work that way. I realise this may be hard to follow, but I've tried my best to explain it. I'm literally pulling my hair out over this one and spent a ridiculous amount of time trying to figure it out. Appreciate any comments or suggestions, or ideally a solution! Thanks in advance.


title: Author Link Not Displaying

text:
I have used this with "echo" as its outside the loop i believe to the author of the post as a link, however its not displaying as a link?
Random Posts By You

     <?php     $args = array( 'numberposts' => 5, 'orderby' => 'date' );     $rand_posts = get_posts( $args );     foreach( $rand_posts as $post ) : ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
     Written by:      <?php echo the_author_link(); ?>     <?php endforeach; ?>      Can someone advise?


title: show_option_none not working in meta box

text: I have the following code going into a meta box:               function multi_author($post, $box)     {     $currentAuthors = esc_attr(get_post_meta($post->ID, 'multiAuthors', true));     if ($currentAuthors) {         $authors = explode(',', $currentAuthors);     }     $y = 1;     for ($x = 0; $x <= 3; $x++) {         $output .= "Author #{$y}: " . wp_dropdown_users(array(                     'show_option_none' => '-- Select --',                     'echo' => 0,                     'name' => 'author' . $y,                     'selected' => $authors[$x],                     'who' => 'authors'                 )) . "<br/>";         $y++;     }          echo $output;     }      If I place this code into a front end facing page, everything works as expected. When this code is in a meta box, the 'show_option_none' tag is ignored and everything else works as planned. Wordpress version 3.1.3 is being used. Any guesses as to why this is happening?


title: retrieve post slug by post_tags taxonomy

text:
My scenario: I have a part of a site which retrieves all post_tags terms for a specific category the code:                               query_posts('category_name='. $category[0]->cat_name);                     if (have_posts()) : while (have_posts()) : the_post();                         $posttags = get_the_tags();                         if ($posttags) {                             foreach($posttags as $tag) {                                 $all_tags_arr[] = $tag -> name;                              }                         }                     endwhile; endif;                                $tags_arr = array_unique($all_tags_arr);                           foreach ($tags_arr as $cat_by_tag) {                         $output_promotion .= '
cat_name . '/' . ????? . '/">'. $cat_by_tag .'
';                     }                          echo $output_promotion;      This all works fine, the code retrieves all post_tags and removes duplicates. I'm stuck now with the post slug. What I want is: retrieve post slug by post_tag term. Example: Post title: ABC Post post slug: abc-post Tag in that post: ABC Tag I need something like this:               ABC Tag      Anyone can help? Thanks in advance!


title: qTranslate get content by language

text: How do you get the content by id and by specific language? I need to display two specific language content in a page, regardless of the session's language. So far, this is my progress: this works fine for getting the content by id of the active language:               <?php $id=47; $post = get_page($id); $content = apply_filters('the_content', $post->post_content); echo $content;  ?>      How to apply a specific language to the filter? Thanks for the help. Sziro


title: How do I list the next 7 days and any events (cpt) contained in those days

text: I need to list the next seven days no matter what day it is. If its monday, it starts with today and lists 7 days, if its friday it starts with today and lists 7 days from today. Next I need to show any events for that day. IF there are no events for a given day it simply lists a default graphic. I am going to make a featured event for a each day and eventually set it up so that it just shows that one but for now I just want to list the next 7 days and any events contained within them. I have two piece that don't fit together very well. First:               <?php $cur_day = 'current_day'; $last = 'last';     $date = date('o-m-d'); $ts = strtotime($date); $dow = date('w', $ts);      for ($i=0; $i<7; $i++, $ts+=86400){ ?>      This will list each of the next 7 days starting with today.                $event_query = new WP_Query(             array(                'post_type'   => 'event',        // only query events               'meta_key'    => 'event-date',  // load up the event_date meta               'orderby'     => 'meta_value',               'order'       => 'asc',         // ascending, so earlier events first               'meta_query'  => array(                  array(         // restrict posts based on meta values                   'key'     => 'event-date',  // which meta to query                   'value'   => $event_date,  // value for comparison                   'compare' => '=',          // method of comparison                   'type'    => 'NUMERIC'         // datatype, we don't want to compare the string values                 ) // meta_query is an array of query ites                ) // end meta_query array               ) // end array             ); // close WP_Query constructor call      This lists the next seven days but doesn't do well with the events... I am looking to duplicate this: http://www3.dmagazine.com/events with cpt's thanks PLEASE HELP


title: Display all custom post type posts and order them by an optional meta_key

text: I have a custom post type (CPT) called `property`. I have registered a featured property `metabox`for it as explained in this question "How do I create a featured post within a custom post type?". So a featured property has got `meta_key='property_featured'` and `meta_value=on`. What I would like to do is to display **all** `property` posts, but order them by `meta_key='property_featured'`. So that featured properties will appear first in the list on the first page. Similar behavior as `Sticky Posts` functionality. And all the rest `property` posts will be ordered by date created. Also, I need to make sure that pagination is working correctly - treating all the `property` posts alltogether. I use custom pagination code explained here. (Hope that makes sense). I have tried to specify arguments for WP_Query. However, if I specify:               'meta_key' => 'property_featured',     'orderby' => 'meta_value'      then **only** `property` posts with that key are displayed as opposite to **all** `property` posts. If I delete `meta_key` from arguments then the query doesn't know what to sort them by.   How do I display all the `property` posts, making sure that `featured` ones appear first and all other `property` posts order by published date? Many thanks, Dasha


title: Modernizr and WordPress - How can I add a CSS class to the html element?

text: The instructions for implementing Modernizr state that I should add `class="no-js"` to the `<html>` element. Is there a way to do this in WordPress using a hook or filter? If at all possible, I'd prefer to do this without editing the theme files.


title: How to show total view count across all posts for an author

text: I'm using wp-postviews to track views for posts by authors on my site. It stores the view count in the post meta field `$views`. I'd want to show on their profile a total count of views for all their posts combined. How to do that?


title: BLOG_ID_CURRENT_SITE vs. SITE_ID_CURRENT_SITE in WordPress Multisite?

text: I've been trying to figure out why we have the constants `BLOG_ID_CURRENT_SITE` and `SITE_ID_CURRENT_SITE` _(vs. hardcoding them to be equal to`1`)_, what exactly the differences are, and when either of them will not equal 1? Any insight will be appreciated. Thanks in advance.