title: Popular posts by view with Jetpack

text: I'm using Jetpack to retrieve the number of views for each blog post. Is there a way to use this to generate a call to the most viewed posts and list them? I've been wanting to do that for a long time now and I've looked into various plugins, but I'd prefer to hardcode this. Is there a way to write a code so that I could utilize the view count provided by Jetpack? I looked at similar questions here, but none of them has been answered. A few commenters suggested plugins, but those have been abandoned by now. I couldn't find any up-to-date information. Right now I'm only calling the "view count" within my single.php like that:               <?php print_page_views(get_the_ID('')); ?>       For that I'm using a plugin called "Post 'n Page Views" that requires Jetpack. I tried looking for the plugin in the Wordpress Dabatase, but it doesn't seem to exist anymore. I really would appreciate any kind of advice or updated information on this. Thank you so much!


title: How to display popular posts in page?

text:
I'm trying to create a "Start here" page on my blog. I use a template for that, but the content for it is created using the "add new page" wizzard in Wordpress. I know how I can display the most discussed posts (with most comments), but php doesn't work in pages. Of course I just can paste the code into the page template instead, but look at the following:               <?php     /*       Template Name: Test Layout     */     ?>          <?php get_header(); ?>

     <?php     $pc = new WP_Query('orderby=comment_count&ignore_sticky_posts=1&posts_per_page=6'); ?>     <?php while ($pc->have_posts()) : $pc->the_post(); ?>
     <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?>
     <?php endwhile; ?>
               <?php the_content(); ?>
          <?php get_footer(); ?>      This is my template. I use "the content" so that everything I write via the "page wizard" will be in there. I don't want to copy and paste everything into the template itself for various reasons, so I need to find a way to make this work with the code above. If I call the popular posts below "the content" it works without any problem. If I call it before it (like in the code above), the actual content of my page won't show up and instead the last blog post in the list of popular posts will be displayed. I hope you were able to understand the issue.


title: Trouble with pretty permailnks buddypress .htaccess custom posttypes

text: I have a buddypress/bbpress website that also has multiple additional custom post types. After adding each new custom post type I would update permalink settings to correct the 404 not found occuring with that post type. However this would not work unless I deactivated buddypress first then updated permalinks then reactivated buddypress. I am almost doen with the website and one page that displays the "classifieds custom post type creatded by WPMU Dev "classifieds" plugin is still 404ing. The "My Classified" page works along with individual classifieds. All other pages work. If I set wordpress permalinks to default then the page works. Has any one lese heard of .htaccess problems with only one page in wordpress?


title: unexpected '$mm' (T_VARIABLE) in wp-includes/functions.php

text: I have a few Wordpress sites and all are down: > An unexpected condition was encountered while the server was attempting to > fulfill the request. Error code: 500 When I look at the apache log, there are errors (for different sites):               [Mon Apr 15 04:00:28 2013] [error] [client ...] PHP Parse error:  syntax error, unexpected '$mm' (T_VARIABLE) in /var/www/SITEA/html/wp-includes/functions.php on line 192, referer: http:...     [Mon Apr 15 04:00:55 2013] [error] [client ...] PHP Parse error:  syntax error, unexpected '$mm' (T_VARIABLE) in /var/www/SITEB/html/blog/wp-includes/functions.php on line 183     [Mon Apr 15 04:01:42 2013] [error] [client ...] PHP Parse error:  syntax error, unexpected '$mm' (T_VARIABLE) in /var/www/SITEC/html/wp-includes/functions.php on line 203      How can I fix the error? Or is it related to the recent wordpress attack?


title: How To Add Memory?

text: I just installed wordpress on WAMP localhost win8. However at the very end of the wordpress installation a little box popped up saying something about there being no disk space, which I regret not screenshotting before hitting OK. I cannot upload media of any kind as there is no space, and the preview of wordpress available doesn't appear anything like the tutorial said it would. Tutorial said this: ![enter image description here](http://i.stack.imgur.com/HT8ec.jpg) Actually looks like this: ![enter image description here](http://i.stack.imgur.com/3YALg.png) I have tried messing with php.ini max file size to no avail. in case you are wondering I am following this tutorial: http://sixrevisions.com/tutorials/web-development-tutorials/using-xampp-for- local-wordpress-theme-development/


title: Comment notification not working

text: I use a different theme named Team Talk (Premium). Since I use this theme, I don't receive the new comment notification by email. I don't know where to look at but I found this in my new theme :               function get_content_html_for_comment($comment){         $comment_html  = "";         // Get the comment data         //switch on the output buffer         ob_start();         // Allow the email to the author to be sent         wp_notify_postauthor($comment_ID, $comment->comment_type);         $max_depth = get_option('thread_comments_depth');         $args = array ('max_depth' => $max_depth);         //render the content to the output buffer         //call _ht_comment          echo _ht_comment($comment, $args, $this->calculate_comment_depth($comment));         //the content will now be in the buffer, so get that         $comment_html = ob_get_contents();         //restore buffer         ob_end_clean();         return $comment_html;      So, it seems to allow to receive notification but it doesn't work.


title: get_template_part() to render single page Theme

text: I´m developing a single page theme and want to render all pages with their respective templates on a single page. I know I could make a query and write the markup for the respective page, but I prefer separate all templates in files. What I want is to make the loop and load the template-*.php file for each page. Is that possible? To clarify this a little bit, below follows an example of what I want:               $query = new WP_Query();      $wp_query->query('post_type=page');     while ($wp_query->have_posts()) : $wp_query->the_post();         get_template_part('templates', 'template_slug');     endwhile;      and in the while loop output not only the content, but the content in teh right markup. Any help is more than appreciated!


title: Wordpress MU sunrise dropin for remote domain

text: I've been digging around for days hoping to stumble onto an answer. Wordpress.org isn't getting any bites and I've seen several users post responses to other related sunrise dropin solutions so here goes. My research concludes that sunrise dropins are most likely the way to go about this. Details: One VPS running apache using cPanel accounts. domain1.com is on account1 and serves both Wordpress SA and WHMCS domain2.com is on account2 and serves WPMU with many websites I would like domain1.com to pull from the WPMU on domain2.com so I can utilize the networks plugins and hard work I've put into it without migrating the account. I don't know if this gets me any closer but I figured out how to get domain1.com to pull from domain2.com/wp-config I would like to keep domain1.com intact with account 1, however the primary website localized on account 2 and the MU network. I figured out I can change the values in domain1.co/ wp-config.php to use domain2.com/wp-config.php which is a huge step toward what I want.               domain1.com/wp-config.php     define( 'BLOCK_LOAD', true );     echo ( file_get_contents( 'http://domain2.com/wp-config.php' ));     echo ( file_get_contents( 'http://domain2.com/wp-includes/wp-db.php' ));     $wpdb = new wpdb( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);      This effectively loads the configuration from domain2.com for domain1.com. The next step is defining the site ID as mapping domain1.com within domain2.com network doesn't work. I'm not sure how to go about making this work but I understand the basic principle of what needs to happen. domain1.com queries the database and returns wp_ID for which I intend to use. Now I need to figure out how I can get domain1.com to reference it's site ID in the WPMU database. I've seen some pretty sweet tricks with sunrise dropins and dealing with domain related customizations so I hope I am one step closer to a solution!   * Here's my question as posted on Wordpress.org


title: Problem using wp_mail function

text: I have a form whose message is composed from multiple input fields when submitted. I got this form working as simple php document but when I'm trying to use the form within a wordpress page it doesn't work. And I've switched to wp_mail function. Anyone has any idea? Thank you               <?php     $errors = array();     $missing = array();          if (isset($_POST['send'])) {         $to = 'mail@yahoo.com';         $subject = 'Form';         $expected = array('name', 'email', 'pick_up_adress', 'drop_off_adress', 'phone', 'pick_date', 'pick_time', 'type');         $required = array('name', 'email', 'pick_up_adress', 'drop_off_adress', 'phone', 'pick_date', 'pick_time', 'type');         $headers = "From: Metro<email@example.com>\r\n";         $headers .= 'Content-Type: text/plain; charset=utf-8';              if ($mailSent) {             header('Location: after_form.php');             exit;         }     }          // Array proccesing     $mailSent = false;      if (!$suspect && !$missing && !$errors) {         $message = '';              foreach($expected as $item) {             if (isset(${$item}) && !empty(${$item})) {                 $val = ${$item};             } else {                 $val = 'Not selected';             }                  if (is_array($val)) {                 $val = implode(', ', $val);             }                  $item = str_replace(array('_', '-'), ' ', $item);             $message .= ucfirst($item).": $val\r\n\r\n";         }              $message = wordwrap($message, 70);              // simple php doc $mailSent = mail($to, $subject, $message, $headers);          $mailSent = wp_mail($to, $subject, $message, $headers);              if (!$mailSent) {             $errors['mailfail'] = true;         }     }     ?>


title: Creating custom Insert Media page

text: I'm writing a plugin, that has the basically the same functionality as Insert Media page in "Add media" popup. The only difference mine has to use web service for browsing media. I already read about `media_upload_tabs` and managed to create a tab. Now I'd like to have the **exact** same layout as Insert media tab, but unfortunately my media tab is an iframe (ugly) and doesn't have any CSS styles (or JS) attached. How can I print required CSS styles (I think I'll rewrite the JS part in Angular) in my tab? I've tried to enqueue some basic styles but couldn't find how to print them or how they are named. EDIT: As requested, some code, changed a bit to hide the name of the plugin First for adding custom tab:               function something_upload_tab( $tabs ) {         $tabs['something'] = 'something';         return $tabs;     }     add_filter( 'media_upload_tabs', 'something_upload_tab' );      Then for displaying the tab:               function something_upload_tab_content() {         require('views/something.php');     }     add_action('media_upload_something','something_upload_tab_content');       `views/something.php` is is a bunch of HTML copied from Insert Media tab. It isn't important except for one line (or a few more maybe) I am missing to put there proper styling for WordPress admin panel.


title: How to add nofollow to wp_nav_menu

text: I need to add an option in my theme options panel to set a specific custom menu's links all to nofollow. Does wp_nav_menu() allow this or does it require a custom walker to manually ad rel="nofollow"?


title: Thumbnails and Lightbox

text: As mentioned on wordpress.org, it is possible to link a thumbnail to its larger self.                <?php       if ( has_post_thumbnail()) {        $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large');        echo '';        the_post_thumbnail('thumbnail');        echo '';      }      ?>      But I can't find how to make this link modifiable by plugins. I'm using Simple Lightbox but I regularly had to change in the last years. Currently I get a link to the larger image, I would like to see it in lightbox like all the other images in articles. I don't feel satisfied with the other answers on stackexchange. They say that we should add manually "rel=lightbox" in the templates For the moment I added to function.php               function CJG_add_lightbox_to_achor(){         return 'rel="slb"';     }


title: Post classes in the loop are being changed in certain themes

text:
Certain themes don't use the default post class structure in the loop ie
      Spacing.ca, for example, doesn't use this structure. The posts in their loop use the following tag structure:
      The result is that you cannot add classes to these sorts of posts in the main loop using:               add_filter('post_class', 'my_post_class')      I'd like to be able to add classes to specific posts in the loop given specific criteria (via a plugin im making) and can do it if themes use the standard structure first mentioned, but cannot do it if the theme uses the less typical structure in the 2nd code snippet. Any thoughts on how I could add classes to posts when the theme uses the 2nd code snippet? Thanks


title: Link Forms on Wordpress

text: On our Wordpress site, we have a form that consists of a series of (radio button style) questions. Depending on which answer the user provides to a particular question, we'd like to show the user a different form. That is, we would like to link multiple forms to our one main form. Is this possible? If so, can someone explain how to do this, or point me to any kind of resource that might help? I am very new to Wordpress.


title: menu items toggle and display on screen size reduction

text: I am working with a child of Twenty Twelve. I made my own images to act as menu li backgrounds. When I reduce the screen width by moving my browser window in, the menu items seem to toggle automatically. I have never fiddled with any of the CSS or JS for this behavior. The resulting dropped-down list overlays the other menu items and makes them unreadable. Not to mention, I don't want the behavior in the first place. Is there such thing as auto-toggling?


title: Generate HTTPS Urls in multisite

text:
I have a plugin that allow my users in multisite to generate simple urls like http://example.com/user/?my_url=2DD0B8183 but i want to include the https instead http ...               echo '
';         echo '
<input type="text" class="url" value="' .get_option('home'). '/?my_url=' . $download["code"] . '" onclick="this.select();" />
';         exit();       }      I tried               echo '
<input type="text" class="url" value="https://' .get_blogaddress_by_id( $user_info->primary_blog ) . '?my_url=' . $download["code"] . '" onclick="this.select();" />
';      but i get `https://http://example.com/user/?my_url=C4785825B` I have already forced ssl/https for entire my network via .htaccess               RewriteEngine On     RewriteCond %{HTTPS} !=on     RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]


title: Hide pages from google and visitors

text: I have wordpress site where i have few custom type pages. I load the content of those pages with jquery load. But I dont want that those pages are directly visible. So if user goes to http://www.domain.com/work/project-name it wouldnt be visible. Or atleast that search bots wouldnt index these pages that are under /work/ I use single.php for the html for the page. What could I do? Just deny search bots to go with robots.txt? Could I somehow deny users to go there too but still keep that jquery load works normally. Thanks!


title: Problem uploading images

text: Multisite 3.4.1 wordpress I redirected wp-admin with htaccess rules, and renamed wp-content and plugins with via wp-config http://codex.wordpress.org/Editing_wp-config.php#Moving_wp- content now I can no longer upload images. when I try to upload an image it starts crunching but then either has an http error or says are you sure that you want to do this but then does not let me upload the image. **this is in .htacess**                RewriteEngine On      RewriteBase /      RewriteRule ^login$ wp-login.php      RewriteRule ^index\.php$ - [L]           # uploaded files      RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]           # add a trailing slash to /wp-admin      RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]           RewriteRule ^([_0-9a-zA-Z-]+/)?private-admin/?$ $1private-admin/index.php?wdeb_on [R=301,L]      RewriteRule ^private-admin(.*)$ wp-admin$1           RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin/([_0-9a-zA-Z-]+).php\?(.*)$ $1private-admin/$2\.php\?$3 [R=301,L]                RewriteCond %{REQUEST_FILENAME} -f [OR]      RewriteCond %{REQUEST_FILENAME} -d      RewriteRule ^ - [L]      RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]      RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]      RewriteRule . index.php [L]      **This is in wp-config** /* Changes to redirect wp-admin to private-admin folder */                $redirect_url=$_SERVER['REQUEST_URI'];      if(preg_match('/wp-admin/i', $redirect_url)) header('Location:    '.str_replace('wp-admin', 'private-admin', $redirect_url));          /** Change name of wp-config and plugins */      define( 'WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/private-content' );      define( 'WP_CONTENT_URL', 'http://mysite.com/private-content');      define( 'WP_PLUGIN_DIR', $_SERVER['DOCUMENT_ROOT'] . '/private-content/resources' );      define( 'WP_PLUGIN_URL', 'http://mysite.com/private-content/resources');      define( 'PLUGINDIR', $_SERVER['DOCUMENT_ROOT'] . '/private-content/resources' );      This is the image url path in network> settings>Sites>/>image upload path: private-content/uploads Suggestions on how I can fix this? Thanks.


title: Modified loop-single-forum.php to work inside of a sidebar Widget, not working on some site pages

text: So I took `loop-single-forum.php`, copied it and renamed it, fixed it so the site is calling the copy and then removed what I did not need from it to place it in a sidebar widget. It works beautifully on every screen on the site. Except for two and I can't figure out why. IF you're on the Topic's List Page the widget shows Nothing at all in the Categories Tab and then IF you're in an actual Topic it shows the **"Oh bother! No forums found"**. Looking to figure out what I could have left out in the code as I'm honestly using the existing code minus a few bits that I didn't need. `loop-single-forum.php` \-                   <?php                  /**             * Forums Loop - Single Forum             *             * @package bbPress             * @subpackage Theme             */              ?>              <tr id="bbp-forum-<?php bbp_forum_id(); ?>" <?php bbp_forum_class(); ?>>                                        <?php do_action( 'bbp_theme_before_forum_title' ); ?>                      <a class="bbp-forum-title" href="<?php bbp_forum_permalink(); ?>" title="<?php bbp_forum_title(); ?>"><?php bbp_forum_title(); ?>                      <?php do_action( 'bbp_theme_after_forum_title' ); ?>


title: How do you change the visual editor's background color?

text: I have a Wordpress site in which the background color is black and the text is white. The site is fine, but it's a pain trying to edit content in the visual editor as the background is white (same color as the text). I end up having to tell users to use the HTML view or write up the content in black color text and then at the end just select all the text and flip it to white (in which case many of them freak out and think their text is now deleted!) **How do I change the background color of the editor to black (or any other color) so that the content can be readable if the text color is to be white?**


title: How to print the excuted sql right after its execution

text: I am searching for a way by which i can print the executed sql query just after the :               $wpdb->query(                     $wpdb->prepare("INSERT                                      INTO tbl_watchprosite SET                                      keywords=%s,url_to_post=%s,description=%s,                                     date_captured=%s,crawl_id=%d,                                     image_main=%s,images=%s,brand=%s,                                     series=%s,model=%s,condition=%s,box=%s,                                     papers=%s,year=%s,case_size=%s,status=%s,listed=%s,                                     asking_price=%s,retail_price=%s,payment_info=%s,forum_id=%d",                                     $this->getForumSettings()->search_meta,$element->href,$post_meta['description'],current_time('mysql'),$cid,$post_meta['image_main'],$images,$post_meta[0],$post_meta[1],$post_meta[2],$post_meta[3],$post_meta[4],$post_meta[5],$post_meta[6],$post_meta[7],$status,$post_meta[9],$post_meta[10],$post_meta[11],$this->getForumSettings()->ID)                 );      This would be great if i can see what values are going in the query. Thanks


title: Default Paypal Support in Custom Product of Easy Digital Download

text: I created the product as purchasing different discount code with different denominations as `$5 or $10 or $100 . . .` I did these with my own supporting gateway as paypal. But I want to use the default gateway of paypal which is already in easy digital download. I am not sure how to do this in easy digital download. Right now i am using the shortcode to display the product.Reason I am taught about is I am creating the paypal integration to the custom product but in easy digital download which is already there, so that's the reason i try to integrate into the custom product. Any suggestion would be great. Thanks, vicky


title: Limit amount of results returned

text: How can I limit the amount of results returned?               $images = $wpdb->get_col("         SELECT ID FROM $wpdb->posts         WHERE post_type = 'attachment'         AND ID in ($meta)         ORDER BY menu_order ASC     ");


title: Turn Off Auto Update for Single Plugin

text: I have a plugin that I know I never want to update. I am aware that this is NOT best practice, but in this case it must be done. Is there any way to stop WordPress from prompting me to auto-update a particular plugin (but still alert as normal for all other plugins).


title: Default category got deleted. How to get it back as ID=1?

text: I have a plugin that expects there to be a default "uncategorized" category with ID=1. I've inadvertantly deleted the uncategorized category. Is it possible to recreate the category as ID=1? When I look at a default WP install, I see that the table "wp_terms" has uncategorized as the first record with id 1. It also appears that the "wp_term_relationships" and "wp_term_taxonomy" tables are in play in this regard. How would one go about recreating this category?


title: Read more link isn't working with custom query

text:
Trying to show the latest post with a `featured` tag. The query is working fine but it always shows all the content.. not the content before the more link which is all I want. Here is my code.               $query = new WP_Query('numberposts=1&orderby=date&tag=featured');          // The loop!     if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>

By <?php the_author(); ?> on <?php the_time('j F Y') ?>

<a href="<?php the_permalink() ?>#comments" rel="bookmark" title="Link to <?php the_title_attribute(); ?>"><?php comments_number( 'Remove' ); ?>

         <?php the_content('Read More'); ?>
               <?php endwhile; else: ?>
Sorry, no posts are featured.
          <?php endif; ?>      In the editor I definitely have the `<!--more-->` link but it always shows ALL the content. What am I doing wrong?


title: Is this a job for WP MultiSite with domain mapping plugin?

text: I'm helping some folks convert an apartment management company's website from a custom CMS to Wordpress. We're pretty far along in the process and I just need to figure out how to get this request to work. Let's say that the company's main url is www.apartments.com and each of the 15 properties has a detail page like:   * www.apartments.com/property/oak-court   * www.apartments.com/property/pine-grove and so on. These use a custom post type called Property They also own domains for each property like:   * www.oakcourtapartments.com   * www.pinegroveapartments.com They want these domains to go an "apartment microsite" which is just a single page that looks like the detail page on the main site but with some caveats:   * This is NOT just redirecting the user. The url is to remain oakcourtapartments.com etc.   * The body copy, title tag and meta tags should be different from the page on the main site so it isn't an SEO conflict.   * Editing both detail and micro should be done in the same place. If the editor updated the hero image for Oak Court the change is reflected on both the detail page and the microsite on the front end. I have custom fields on the Property post type like "microsite body", "microsite title" and also the various meta tabs so the editors can work as needed. Would MultiSite help me here? How about the domain mapping plugin. I'm just not really sure how to tie everything together to make it work... if it even can work.


title: Adding more onto an esc_url

text: I have an esc_url that creates a link to buddypress profiles depending on the author of the post which returns like this http://www.mywebsite.com/members/username/ I want to make it so it returns "posts" at the end of the url too like so, http://www.mywebsite.com/members/username/posts The code I have.               esc_url( bp_core_get_userlink( get_the_author_meta( 'ID' ), $no_anchor = false, $just_link = true )),      I tried placing the following               && 'posts'     || 'posts'      after the               bp_core_get_userlink( get_the_author_meta( 'ID' )      and other parts of the code line but my PHP isn't great so I'm not sure exactly how && and || works. Worth a try though. Thanks for the help in advance :)


title: How to hook watchdog script for existence of a WP page?

text: I would like to have a watchdog script which checks the (un)availability of a certain DB entry, namely a certain WP page. The script itself is absolutely independent from WP and not difficult, but I don't know how where I hook this script into WP. It should be called with every website visit.


title: Database solutions for a commenting plugin?

text: (I'm new to this and am aware that my questions are vague and kind of suck, please bear with me.) My plugin, a commenting platform, is in the directory. Currently, it doesn't have it's own database. Can anyone offer some insight into how they may implement their own, customized database? Any examples, articles, opinions welcome :)


title: Should I delete automatically-created files before installing WordPress?

text: I'm switching a site from OpenCart to WooCommerce. I'm trying to figure out what I should delete from `public_html` and what I shouldn't. Below are the files I'm unsure about. Some of them were there before I installed OpenCart (years ago), but I can't tell which ones. Is it ok to delete all of them or should I keep some?               400.shtml     401.shtml     403.shtml     404.shtml     500.shtml     500.php     cgi-bin (empty folder)     default.html (empty)     error-log     php.ini


title: Disable new WP3.5 Media Picker

text: I've got a compatibility issue with the new media picker in WP 3.5 and a plugin I have to use. Until the plugin is updated with a patch, I'd like to simply disable the new media picker, and fall back to the old-school one that was before WP 3.5. Is this possible setting a constant, or using a filter somehow?


title: How to display some selected user meta data on a specific page with a shortcode?

text: I need to display on some specific pages some selected user meta data (not all), for some users. On the Wordpress Codex page for the `get_user_meta()` function we have this example (user_id = 9):               <?php       $all_meta_for_user = get_user_meta( 9 );       print_r( $all_meta_for_user );     ?>      The results of this example:               Array ( [first_name] => Array ( [0] => Tom ) [last_name] => Array ( [0] => Auger) [nickname] => Array ( [0] => tomauger ) [description] => etc.... )      And a **Note** (shortened): > ... you may want to run a simple array_map() on the results of > get_user_meta() in order to take only the first index of each result (this > emulating what the $single argument does when $key is provided:               if( $all_meta_for_user = get_user_meta( $user_id ) )          $all_meta_for_user = array_map( function( $a ){ return $a[0]; }, get_user_meta( $user_id ) );            print_r( $all_meta_for_user );      The result:               Array ( [first_name] => Tom [last_name] => Auger [nickname] => tomauger [description] => etc.... )      **My question is:** How to put this in a function that will display, for example, the user last and first names with a shortcode (but really I need more user meta data)? What I mean? On a specific page we put a shortcode with the user ID and the related function must return the meta data for each selected key of this user. Is this possible? Can anyone help me?


title: Check if user is in a group of another site within multisite network

text: I'm using Woocommerce + the groups plugin on my main site to promote users to a 'Premium' group upon purchasing items which works great. If a user on the main site then browses to the second site within my network, I can no longer check to see if they're within the 'Premium' group. On my main site, I can use this code:               <?php          $user_id = get_current_user_id();         $group = Groups_Group::read_by_name( 'Premium' );         if ( Groups_User_Group::read( $user_id, $group->group_id ) ) {      ?>              Premium content here!          <?php } ?>      But this does not work on the subsite. Is there anyway I can check to see if the user is in a group on my main site FROM a subsite?


title: Problem with wp_update_post

text: I'm trying to write a plugin that creates a page if a box is checked (value 1) and if the post id doesn't already exist. If the post id does already exist, then I want to update the post with whatever changes have been made. I have the creating post (as page) part working just fine. However, when I try to do run the wp_update_post I get this error: **array_merge() [function.array-merge]: Argument #1 is not an array in /home/wpovernight/wpovernight.com/wp-includes/post.php on line 2996** Since the error is concerning post.php, I'm guessing this issue is with array on wp_update_post, but I'm not sure what I'm doing wrong. It all looks fine to me. Here's my code:               //Check if page exists     $page_check_404 = get_page_by_title($page_title_404);     // Checks if box is checked     if ($activate_404_page == 1) {                 $ss_404_page = array(                 'post_title'    => $page_title_404,                 'post_content'  => $ss_404_page_content,                 'post_status'   => 'publish',                 'post_author'   => 1,                 'post_type'     => 'page'                 );                 // If page doesn't exist, create it                 if(!isset($page_check_404->ID)){                 $ss_404_post_id = wp_insert_post( $ss_404_page );                 }                 //if page does exist, edit it                 if(isset($page_check_404->ID)){                     $ss_404_page_update = array(                     'post_title'    => $page_title_404,                     'ID'            => $ss_404_post_id,                     'post_content'  => $ss_404_page_content,                     'post_status'   => 'publish',                     'post_author'   => 1,                     'post_type'     => 'page'                     );                 wp_update_post( $ss_404_page_update );                 }        }


title: How to Run Code Before a New Site is Created on MultiSite for Validation

text: I'd like to run some custom validation code on attempts to create new sites on my MultiSite environment, particularly the /wp-admin/network/site-new.php page. I've explored site-new.php, and have found zero instances of do_action() and the only filter is for subdirectory_reserved_names. I imagine I could write some overly general code that runs on something like every admin_init, check to see if this is the site-new page, see if the $_POST['action'] is set and equals 'site-new', verify the nonce, etc... but that really doesn't seem like it could be the best / proper way. Any suggestions on how to add my own custom validation code before a new site is actually created? Note that the hook wpmu_validate_blog_signup is available for when users are using the public-facing signup form, so validation against THAT form is pretty straightforward. It appears, though, that there is no easy way to do similar validation for sites created from the Network dashboard.


title: Audio tags around Mp3 URL in content

text: I have an audio player than uses the following syntax to display its player: `[audio src="http://somedomain.com/wp-content/uploads/2013/01/songtitle.mp3"]` The thing is, I'm pretty sure I can show the user how to copy the url and paste it in the post, but how can I search the content for a `.mp3` link and then put `[audio src="` in front of it and `"]` at the end of it?


title: How to implement default comment section in theme template?

text:
My home.php is associated with my blog page, as opposed to rest of site which is just a cms. I want my blog page to render the comments ability, an archive of older posts, tags, blogroll, etc. Right now, this is what I have in my home.php:               <?php     /*     Template Name: Home     */     ?>     <?php get_header(); ?>     <?php         $blog_query = new WP_Query;         $blog_query->query( 'post_type=post' );     ?>
          <?php echo "Blog updated daily" ?>          <?php if( $blog_query->have_posts() ) : ?>              <?php while( $blog_query->have_posts() ) : $blog_query->the_post(); ?>
             <h2 id="post-<?php the_ID(); ?>"><?php the_title();?>
             <?php the_content(); ?>
              <?php endwhile; ?>          <?php endif; ?>          <?php wp_reset_query(); ?>
     <?php get_footer(); ?>      Problem is obviously, this just rendering the posts, but not the comment section or anything else. How can I inherit the wordpress defaults so that it will display the comment section and so forth? Right now If i was to remove that code above, the page would be blank.


title: Changing wp-content to other name? Multisite set up

text: Is there an easy way to change the words `wp-content` that show in the source code to `xyz-content` without breaking my site?   I want to do it for branding purposes. I tried:   1. Url rewriting but the original `wp-content` still shows in the source code.   2. Doing a site download, find and replace and then re-upload but it takes over 24 hours with my server.    3. The plugin Real-Time Find and Replace changes the words from `wp-content` to `xyz-content` quickly, but the css etc does not load.  Is there another way to do this?


title: Redirect home resets (qtranslate) language

text: I'm developing a website for a product (audio speaker) I'm launching and I'm experiencing an issue I can't resolve (on my own ;) ). I've added this code to `functions.php` to disable dashboard access for subscribers.               add_action('admin_init', 'no_mo_dashboard');     function no_mo_dashboard() {         if (!current_user_can('manage_options') && $_SERVER['DOING_AJAX'] != '/wp-admin/admin-ajax.php') {             wp_redirect(home_url()); exit;         }     }           It works like a charm except for the fact that it resets language. i.e.: a user is logging in from page `www.example.com/en/new-user` the code above redirects him to `www.example.com` instead of `www.example.com/en`. Is there a way to implement this?


title: is_home doesn't affect content

text: I have a bunch of html i need to show only if it is a homepage. My theme pulls content from AJAX and then changes the URL to reflect the new content change. in the meantime, the homepage content (the entirety of which is contained in the footer) still remains below, what i need to happen is the footer content should still be there but the content under   `<?php if ( is_home() ) { ?>` disappears. there is a close button included on each page, when it's clicked the AJAX content is removed and the page returns to the homepage, i need the is_home content to come back at this point. What happens right now is that the content does not go away when the url chnages, and when the ajax content is removed and the page scrolls back to the homepage area and the url goes back to home, i simply get the background no content. My entire footer file can be found here: http://pastebin.com/Xpjc0vrG (the issue begins at line 46. ). The actual site is HERE: http://onthemouse.com/. the content i need gone when not in home is the grey stuff under the carousel you can see the custom.js file here http://pastebin.com/i4cQRS27, this file handles all the ajax requests, but i'm not sure which part actually pulls the page content. i added code on limnes 261 and 594 to try and make this work, hasnt so far. I think the url chnage and ajax content starts at LINE 236.


title: Remove link on full-size images

text: Is there a way to remove the link on full size images in posts/pages? I still would like to have it for the other smaller sizes. Since the full size image is already full size, it seems unnecessary to link to itself.


title: How can I implement a location based (zip code) search in WordPress?

text: I am working on a local business directory site that will use custom post types for the business entries. One of the fields will be "Zip Code." How can I set up a location based search? I'd like visitors to be able to enter their zip code and choose a category and show all the businesses withing a certain radius, or all the businesses ordered by distance. I saw a couple plugins that claim to do this but they don't support wordpress 3.0. Any suggestions?


title: Why doesn't a custom post type permalink ever hit index.php

text: So, I've got an entirely custom theme which has a number of custom post-types. I've also got a custom taxonomy which I can visit on the front end with URLs such as:               www.mysite.local/custom-tax/custom-term      Which runs a query giving me results of posts that match the term 'custom- term' in the tax 'custom-tax'. Also paginates, etc. When it comes to the custom post type pages, e.g. I've got a CPT of 'submissions' with the permalink slug set to 'your-reviews', the backend suggests the permalink will be:               www.mysite.local/your-reviews/my-new-awesome-post/      Which 404's. I've checked out the WP template hierarchy and everything falls back to index.php which routes to the various custom templates that need to be used depending on the part of the site the user is visiting etc. So if I change the first line in **index.php** to a               die or               wp_die I'd expect no matter which page I visit, I'd always get the message in the die statement even for the 404'ing custom post type page. It's worth noting that I get a 404 whether I visit the 'archive' page at:               www.mysite.local/your-reviews/      Or the individual page (some of which are 'hierarchical' and produce a permalink such as (the non-hierarchical pages also 404).               www.mysite.local/your-reviews/my-parent/my-new-awesome-post/      **Updated** So, the code that generates this specific CPT (alongside a few others) is:               define( 'LL_POSTTYPE_ONELINER', 'll_submissions' );          $args = array(         'label' => __('Submissions'),         'labels' => $labels,         'public' => true,         'can_export' => true,         'show_ui' => true,         '_builtin' => false,         '_edit_link' => 'post.php?post=%d', // ?         'capability_type' => 'post',         'menu_icon' => get_bloginfo('template_url').'/images/thumb_up.png',         'hierarchical' => true,         'rewrite' => array( "slug" => "submissions" ),         'supports'=> array('title', 'thumbnail','page-attributes' ) ,         'show_in_nav_menus' => true,         'query_var' => true,         'taxonomies' => array()          );          register_post_type( LL_POSTTYPE_ONELINER, $args);      Note, whilst this one's marked as 'hierarchical' => 'true', others that aren't hierarchical also 404 in the same way. And to follow up, from the reply I've had so far, out of the template hierarchy (single.php, etc...) I only have `index.php` which it never hits.


title: Does wordpress insert automatic google analytic?

text: I just noticed there was this script in my source code:               <script src='/google_analytics_auto.js'></script>      I did not insert this script and I have no plugins, so I don't know why it's there? Does someone know how to remove that?


title: Get the latest tags in a cloud?

text: Is there something that allows us to get a list of the latest tags used in post. I want to get the 10 latest tags and align them side by side How Can I make this happen?


title: Remove Parents From Permalink of Hierarchical Taxonomy

text: I have a custom hierarchical taxonomy called "places" set up with categories like so: Services > Financial Services > Financial Advisors. The permalink for this category listing page is currently mysite.com/places/services/financial-services/financial-advisors. Does anyone know how I can remove the parents from my permalinks so it would simply become mysite.com/places/financial-advisors/ ? I've searched quite a lot and cannot find an answer. There's a plugin out there called "no category parents" that achieves this for regular blog posts, but it doesn't work for custom taxonomies. Any help would be much appreciated!


title: How to add a custom URL placeholder to author archives?

text: I am working with a client who has a directory site that allows users to create accounts, then lists of items from the directory. Right now, whenever a user creates an account, she gets a profile URL like:               domain.com/member/%author%      Which is accomplished with a simple:               $wp_rewrite->author_base = 'member';      Now, I need to allow those users the ability to create a list, which should result in this kind of a URL structure:               domain.com/member/%author%/%list%      So far, I'm creating these lists as custom post types. All of the articles and Stack Exchange posts I see on WP_Rewrite don't cover a URL rewrite like this. Is this possible? Do you have any pointers on how this could be done?


title: Using strpos with WordPress

text:
I have a navigation bar that uses strpos to highlight the tab of the current page the user is on. This method works fine as:               <a <?php if (strpos($_SERVER['PHP_SELF'], 'current-journal')) echo 'class="current-st"';?> href="current-journal">
3Elements
      The problem arises when I try to use this method with a few WordPress pages that I have incorporated into my static website. For some reason, trying to find the occurence (the page the user is on) does not work with the WordPress pages. Any insight would be great


title: hook into completed image upload filter

text: I'm trying to run a little function to determine the luminance of an image and store that in the postmeta for that image.. I have the function working, but id like it to fire when an image has finished uploading.. does anyone know the function/filter/action i should hook into for this? ive looked at   * image_attachment_fields_to_save   * attachment_fields_to_save   * wp_handle_upload   * media_upload_form_handler   * wp_generate_attachment_metadata and i just cant seem to make any of them simply run an addition to the postmeta table for the image currently my code looks something like:               function insert_luminance_data($post, $attachment) {         if ( substr($post['post_mime_type'], 0, 5) == 'image' ) {             $lum = 'TEST';             add_post_meta( $post['ID'], 'image_lum', $lum, true ) || update_post_meta( $post['ID'], 'image_lum', $lum );         }         return $post;     }          add_filter('image_attachment_fields_to_save', 'insert_luminance_data', 10, 2);      but this isnt working. Thanks in advance for any assistance * * * **SOLUTION** Thanks to s_ha_dum               function get_avg_luminance($filename, $num_samples=10) {         $img = imagecreatefromjpeg($filename);              $width = imagesx($img);         $height = imagesy($img);              $x_step = intval($width/$num_samples);         $y_step = intval($height/$num_samples);              $total_lum = 0;              $sample_no = 1;              for ($x=0; $x<$width; $x+=$x_step) {             for ($y=0; $y<$height; $y+=$y_step) {                      $rgb = imagecolorat($img, $x, $y);                 $r = ($rgb >> 16) & 0xFF;                 $g = ($rgb >> 8) & 0xFF;                 $b = $rgb & 0xFF;                      // choose a simple luminance formula from here                 // http://stackoverflow.com/questions/596216/formula-to-determine-brightness-of-rgb-color                 $lum = ($r+$r+$b+$g+$g+$g)/6;                      $total_lum += $lum;                      $sample_no++;             }         }              // work out the average         $avg_lum  = $total_lum/$sample_no;         return $avg_lum;         // assume a medium gray is the threshold, #acacac or RGB(172, 172, 172)         // this equates to a luminance of 170     }          function insert_luminance_data($post_ID) {         $src = wp_get_attachment_image_src( $post_ID, 'large' )[0];         $lum = get_avg_luminance($src, 10, true);         add_post_meta( $post_ID, 'image_lum', $lum, true ) || update_post_meta( $post_ID, 'image_lum', $lum );         return $post_ID;     }          add_filter('add_attachment', 'insert_luminance_data', 10, 2);      this creates a number between 0 and 255 that represents the luminance of the image.. this is particularly useful if you are layering text over a background image and wish to know if the image is mostly light or mostly dark.


I have an elderly WordPress theme that I am trying to bring back up to date. I am stuck on the following snippet...               if ( function_exists('register_sidebar_widget') )         register_sidebar_widget(__('Pages'), 'widget_nav');      This is giving me the following message... register_sidebar_widget is deprecated since version 2.8! Use wp_register_sidebar_widget() instead I realise that reigster_sidebar_widget has now been replaced by wp_register_sidebar_widget() but I can't work out whats changed with the syntax.


title: Allow Permalinks to Work with and without Hyphens

text: Is there a way that I can change my .htaccess file to allow the user to go to a permalink with or without the hyphen? For example: I have a page: `http://example.com/parent/two-words` To get to that page, I'd like to be able to type in any of the following:               example.com/parent/two-words     example.com/parent/twowords     example.com/two-words     example.com/twowords      Is that possible? Thanks!


title: Custom section (e.g. Demos or Downloads)

text: On my website, I want to display a page where I will store all my demos, which should function just like a blog (so I can add new records, edit them and specify custom meta data and list all of them on a public page), but it should independent for easier management. I have searched the web for answers or tutorials, but haven't any. Example can be found here: http://css-tricks.com/downloads/ As you can see there there is a separate blog and the demos page function as an independent group of records, with their special metadata and I'm pretty sure there is a way of creating something like this.


title: Changing from localhost:8888 to localhost

text: I have just changed ports on MAMP from :8888 to :80 for localhost in order to setup a WordPress multisite for local development. However I have several sites with separate installations that are in my htdocs folder and previously used localhost:8888 as a root. I did the following things in order :   1. Opened wp-config and changed the Mysql hostname to `define('DB_HOST', 'localhost');`   2. Went to the options table of the database and changed the siteurl and home.    3. I cleared my .htaccess file   4. Cleared my browser cache.  Still, when I am at the index for localhost I am still being redirected to localhost:8888. I'm sure other people have had this problem and yet I can't seem to find the same question. Interestingly enough I have access to admin just not to the front end.


title: Get fields of a widget

text: I have a widget that has fields, so how can I get these fields in my Metabox. I have tried with this variable `$wp_registered_widgets`, but I can't get the fields. Is there any solution for my problem and thanks. [Update] here is the code of metabox               <?php                    add_action('add_meta_boxes','dar_meta_create');          function dar_meta_create()     {         add_meta_box(               'dar_meta', // $id               'metabox dardar', // $title                'dar_meta_function', // $callback               'page', // $page               'normal', // $context               'high');     }          // callback          function dar_meta_function($post)     {         wp_nonce_field(basename(__FILE__), 'dar_nonce');                   // my form              $nbr1 = get_post_meta($post->ID,'nombre1',true);         $nbr2 = get_post_meta($post->ID,'nombre2',true);              echo          '<input type="text" value="'.wp_kses_post($nbr1).'" id="nombre1" name="nombre1">          <input type="text" value="'.wp_kses_post($nbr2).'" id="nombre2" name="nombre2">';               //******************************************************//                   //  I want get and display fields of a specific widget                       //*****************************************************//               }          // save meta box          function dar_meta_save($id,$post)     {          // check the autosave         if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)               return $id;               if (             'page' == $post->post_type             && current_user_can('edit_page', $id)             && wp_verify_nonce($_POST['dar_nonce'], basename(__FILE__))             && isset($_POST['nombre1']) && isset($_POST['nombre2'])         )          {         update_post_meta($id, 'nombre1', strip_tags($_POST['nombre1']));         update_post_meta($id, 'nombre2', strip_tags($_POST['nombre2']));         }          }     add_action('save_post','dar_meta_save',1,2);


title: Advanced custom field - posted fields from custom post type

text: I'm using the Advanced Custom Fields - plugin and I have custom post type called 'course' where some fields from the ACF are related to. I have this code below:               function update_course($course_id) {              //Check conditions and tell user if certain values are incorrect/inconsitence         $nr_available = intval(get_field('nr_available'));         $nr_registered = intval(get_field('nr_registered'));              echo 'nr avail=' . $nr_available;         echo 'nr registered=' . $nr_registered;          }          add_action( 'edit_post' , 'update_course');      The thing I want to do is to check for instance if available spots are less then register = incorrect. Then I want to indicate that the user has done this incorrectly. But anyway, my real issue is that I don't know how (I don't get it) to get values from ACF of the custom post type posted (course). Above would only return the actual values in the database (for the current course - I think), **I want the posted values**. If I look at the $_POST - variable it shows something like:               [field_524bceba787b8] => 800 [field_524bcf0a787b9] => 40 [field_524bcf58787ba] => 50 [field_524bcfdb787bb] => [field_524bd005787bc] => [field_5253d4b31053b] => 0      **UPDATE:** Whole array looks like:               Array ( [_wpnonce] => 8fce853ce2 [_wp_http_referer] => /wp-admin/post.php?post=1911&action=edit&message=1 [user_ID] => 1 [action] => editpost [originalaction] => editpost [post_author] => 1 [post_type] => course [original_post_status] => publish [referredby] => http://{host}/wp-admin/post.php?post=1911&action=edit&message=1 [_wp_original_http_referer] => http://{host}/wp-admin/post.php?post=1911&action=edit&message=1 [post_ID] => 1911 [autosavenonce] => 0995694d61 [meta-box-order-nonce] => 1da8897fe1 [closedpostboxesnonce] => c92ea6dd81 [post_title] => Balett 8-9 Ã¥r [samplepermalinknonce] => 31966e47cc [content] => coolt222 [wp-preview] => [hidden_post_status] => publish [post_status] => publish [hidden_post_password] => [hidden_post_visibility] => public [visibility] => public [post_password] => [mm] => 10 [jj] => 02 [aa] => 2013 [hh] => 07 [mn] => 52 [ss] => 46 [hidden_mm] => 10 [cur_mm] => 10 [hidden_jj] => 02 [cur_jj] => 08 [hidden_aa] => 2013 [cur_aa] => 2013 [hidden_hh] => 07 [cur_hh] => 20 [hidden_mn] => 52 [cur_mn] => 55 [original_publish] => Uppdatera [save] => Uppdatera [tax_input] => Array ( [categorycourses] => Array ( [0] => 0 [1] => 29 [2] => 27 ) ) [newcategorycourses] => Namn fÃ¶r ny kategori [newcategorycourses_parent] => -1 [_ajax_nonce-add-categorycourses] => 2a26873ebd [acf_nonce] => 52e8f939a6 [fields] => Array ( [field_524bcd27ed097] => [field_524bcde2787b4] => o [field_524bce12787b5] => 433 [field_524bce5f787b6] => 1/:00 [field_524bce98787b7] => [field_524bceba787b8] => 1000 [field_524bcf0a787b9] => 10000 [field_524bcf58787ba] => 5 [field_524bcfdb787bb] => [field_524bd005787bc] => [field_5253d4b31053b] => 0 ) [advanced_view] => 1 [add_comment_nonce] => 82940723b5 [_ajax_fetch_list_nonce] => 83bc001ed1 [post_name] => balett-8-9-ar [post_author_override] => 1 [post_mime_type] => [ID] => 1911 [post_content] => coolt222 [comment_status] => closed [ping_status] => closed )


title: Regarding Wordpress Post, reply tree view

text: I want to make post/reply tree view in my admin panel so anybody can guide me which is best way to do that. I am using custom post type, custom post category and also added meta values to added post as per requirement on fronted. Just thinking will using walker class would be good solution for this although i don't have much information/knowledge about wordpress walker class so i need to study it in deep to use it. Thanks for your guidance in advance.


title: Display First posts without the default featured image

text: How can i display in loop (paged) the posts without the default featured image ? Here is my query of my custom taxonomy template page :                        <?php                  $term_region = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );                 $secteur_id = $_GET["secteur_id"];     if($secteur_id == ""){                 $args = array(                     'post_type' => 'visite',                     'paged' => $paged,                     'tax_query' => array(                         array(                             'taxonomy' => 'regions',                             'field' => 'slug',                             'terms' => $term_region->slug,                             )                         )                     );                   $wp_query = new WP_Query($args);              ?>      I know this kind of query to display only posts with not the default "thumbnail" :               <?php          $args = array(             'post_type' => 'visite',             'posts_per_page' => 5,             'meta_query' => array(                 array(                     'key' => '_thumbnail_id',                     'value' => '556',                     'compare' => 'NOT LIKE',                 )             )             );                     $wp_query = new WP_Query($args);     ?>      Any idea ? Thank you


title: Errors with paginating custom table

text:
I have this code for a custom table with pagination. But my error is that it is not redirecting to paged_numbers. And additionally, it produces a 404 error. My code is:               add_filter( 'the_content', 'get_scrapy_scraped' );          function get_scrapy_scraped( $content )     {     include_once('paginator.class.php');              global $wpdb;              if ( ! is_page( 'jobs' ) ) //when jobs is read             return $content;             $query = "SELECT COUNT(*) FROM wp_careers";     $result = mysql_query($query) or die(mysql_error());     $num_rows = mysql_fetch_row($result);          $pages = new Paginator;     $pages->items_total = $num_rows[0];     $pages->mid_range = 9; // Number of pages to display. Must be odd and > 3     $pages->paginate();          echo $pages->display_pages();     echo "".$pages->display_jump_menu().$pages->display_items_per_page()."";          $query = "SELECT * FROM wp_careers ORDER BY Job_Name ASC $pages->limit";     $result = mysql_query($query) or die(mysql_error());          echo "
";     echo "
Job Name	Department/Location	Information	Apply Links
";     while($row = mysql_fetch_row($result))     {         echo "
$row[3]	$row[1]	$row[0]	$row[2]
\n";          }     echo "
";          echo $pages->display_pages();     echo "
Page: $pages->current_page of $pages->num_pages
\n";     echo "
SELECT * FROM table $pages->limit (retrieve records $pages->low-$pages->high from table - $pages->items_total item total / $pages->items_per_page items per page)";     }      and paginator.class.php is:               class Paginator{         var $items_per_page;         var $items_total;         var $current_page;         var $num_pages;         var $mid_range;         var $low;         var $limit;         var $return;         var $default_ipp;         var $querystring;         var $ipp_array;              function Paginator()         {             $this->current_page = 1;             $this->mid_range = 7;             $this->ipp_array = array(10,25,50,100,'All');             $this->items_per_page = (!empty($_GET['ipp'])) ? $_GET['ipp']:$this->default_ipp;         }              function paginate()         {             if(!isset($this->default_ipp)) $this->default_ipp=25;             if($_GET['ipp'] == 'All')             {                 $this->num_pages = 1;     //          $this->items_per_page = $this->default_ipp;             }             else             {                 if(!is_numeric($this->items_per_page) OR $this->items_per_page <= 0) $this->items_per_page = $this->default_ipp;                 $this->num_pages = ceil($this->items_total/$this->items_per_page);             }             $this->current_page = (isset($_GET['pg'])) ? (int) $_GET['pg'] : 1 ; // must be numeric > 0             $prev_page = $this->current_page-1;             $next_page = $this->current_page+1;             if($_GET)             {                 $args = explode("&",$_SERVER['QUERY_STRING']);                 foreach($args as $arg)                 {                     $keyval = explode("=",$arg);                     if($keyval[0] != "pg" And $keyval[0] != "ipp") $this->querystring .= "&" . $arg;                 }             }                  if($_POST)             {                 foreach($_POST as $key=>$val)                 {                     if($key != "pg" And $key != "ipp") $this->querystring .= "&$key=$val";                 }             }             if($this->num_pages > 10)             {                 $this->return = ($this->current_page > 1 And $this->items_total >= 10) ? "items_per_page$this->querystring\">« Previous ":"« Previous ";                      $this->start_range = $this->current_page - floor($this->mid_range/2);                 $this->end_range = $this->current_page + floor($this->mid_range/2);                      if($this->start_range <= 0)                 {                     $this->end_range += abs($this->start_range)+1;                     $this->start_range = 1;                 }                 if($this->end_range > $this->num_pages)                 {                     $this->start_range -= $this->end_range-$this->num_pages;                     $this->end_range = $this->num_pages;                 }                 $this->range = range($this->start_range,$this->end_range);                      for($i=1;$i<=$this->num_pages;$i++)                 {                     if($this->range[0] > 2 And $i == $this->range[0]) $this->return .= " ... ";                     // loop through all pages. if first, last, or in range, display                     if($i==1 Or $i==$this->num_pages Or in_array($i,$this->range))                     {                         $this->return .= ($i == $this->current_page And $_GET['pg'] != 'All') ? "num_pages\" class=\"current\" href=\"#\">$i ":"num_pages\" href=\"jobs?page=$i&ipp=$this->items_per_page$this->querystring\">$i ";                     }                     if($this->range[$this->mid_range-1] < $this->num_pages-1 And $i == $this->range[$this->mid_range-1]) $this->return .= " ... ";                 }                 $this->return .= (($this->current_page < $this->num_pages And $this->items_total >= 10) And ($_GET['pg'] != 'All') And $this->current_page > 0) ? "items_per_page$this->querystring\">Next »\n":"» Next\n";                 $this->return .= ($_GET['pg'] == 'All') ? "All \n":"querystring\">All \n";             }             else             {                 for($i=1;$i<=$this->num_pages;$i++)                 {                     $this->return .= ($i == $this->current_page) ? "$i ":"items_per_page$this->querystring\">$i ";                 }                 $this->return .= "querystring\">All \n";             }             $this->low = ($this->current_page <= 0) ? 0:($this->current_page-1) * $this->items_per_page;             if($this->current_page <= 0) $this->items_per_page = 0;             $this->limit = ($_GET['ipp'] == 'All') ? "":" LIMIT $this->low,$this->items_per_page";         }         function display_items_per_page()         {             $items = '';             if(!isset($_GET[ipp])) $this->items_per_page = $this->default_ipp;             foreach($this->ipp_array as $ipp_opt) $items .= ($ipp_opt == $this->items_per_page) ? "<option selected value=\"$ipp_opt\">$ipp_opt</option>\n":"<option value=\"$ipp_opt\">$ipp_opt</option>\n";             return "Items per page:<select class=\"paginate\" onchange=\"window.location='jobs?page=1&ipp='+this[this.selectedIndex].value+'$this->querystring';return false\">$items</select>\n";         }         function display_jump_menu()         {             for($i=1;$i<=$this->num_pages;$i++)             {                 $option .= ($i==$this->current_page) ? "<option value=\"$i\" selected>$i</option>\n":"<option value=\"$i\">$i</option>\n";             }             return "Page:<select class=\"paginate\" onchange=\"window.location='jobs?page='+this[this.selectedIndex].value+'&ipp=$this->items_per_page$this->querystring';return false\">$option</select>\n";         }         function display_pages()         {             return $this->return;         }     }      which is from this article. How to solve this?


title: Different template for second page result for Ajax-loading new pages

text:
Everytime I enter a posts page, index.php is called. Now on the site I load next pages (page2, page3...) with Ajax and insert the posts (just the posts) from the Ajax result inside my page. This works perfect but I was wondering if it is possible to have a different page template for second-pages so I would just load the articles in those (no scripts or styles or parent-innecesary divs). This way the Ajax call would be faster. A thing to consider is that if it would be possible, it wount just be for the page number different to one, as the user might enter directly in the fourth page (this one should have all the styles and divs) and then load the fifth, sixth by this second-Ajax template. **EDIT2:** I realized about http://stackoverflow.com/questions/3124636/detect-ajax- calling-url               if (strcasecmp('XMLHttpRequest', $_SERVER['HTTP_X_REQUESTED_WITH']) === 0)      **EDIT:**               <?php get_header(); ?>
              <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                  <article id="post-<?php the_ID(); ?>">                  ...
              <?php endif; ?>
          <?php get_footer(); ?>      And then I load via javascript Ajax next pages:               $.ajax({              url : page_to_load,              success : function (data) {                  $('#main').append($('#main>article', data));              }          });      If Im right, every time an Ajax page is called all the page is actually downloaded (scripts,etc.) I was sondering if it would be possible to have a different page template for this second page, something like:                   <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                  <article id="post-<?php the_ID(); ?>">                  ...
              <?php endif; ?>      So ONLY articles are loaded, no header,scripts,styles or anything extra. Thanks.


title: custom image dimensions (for gallery)

text: when uploading an image into the mediapool, wordpress will auto-resize it in several dimensions. unfortunately i'm requiring a special format which is kinda between thumbnail + medium. any ideas if it's possible to do that? thanks


title: Wordpress Rewrite Rules

text: I created the page template which needs to take some GET variables, currently URL's looks like that: http://example.com/coupons/?cat_id=25 I need to make that way: http://example.com/coupons/25 I checked the WP_Rewrite documentation and playing a bit with that stuff, but can't make things work as except. Regards, Chris


title: Why is my mod_rewrite not working?

text: Ok I have a WP site using the permalink structure of `/%category%/%postname%/` I have built it in the way of page templates, using category queries inside, i.e. **page-help.php**               <?php $my_query = new WP_Query('category_name=help');     while ($my_query->have_posts()) : $my_query->the_post(); ?>          <!--content-->     <?php endwhile; wp_reset_query(); ?>        **page-about.php**               <?php $my_query = new WP_Query('category_name=about');     while ($my_query->have_posts()) : $my_query->the_post(); ?>          <!--content-->     <?php endwhile; wp_reset_query(); ?>         Pretty simple. The problem I have is, I need an archive by year for the news section. I did this by just making the **archive.php** have the same layout as **page-news.php** and just query the posts in the news category. *-this is fine in my case because news is, and will only ever be the content to be archived. My news category (latest-news) is a child of the about category (about), so when I go to the news section, the url is: > www.example.com/about/latest-news/ On the news page is use the following code to list the archives;               <!-- Gets archive for news-->        <?php $my_query = new WP_Query('category_name=news_article');     while ($my_query->have_posts()) : $my_query->the_post(); ?>          <?php wp_get_archives('type=yearly'); ?>      <!--Ends archive for news-->     <?php endwhile; wp_reset_query(); ?>         The links it generates naturally lead me to > www.example.com/2000 > > www.example.com/2001 etc. I want the rewrite to change them to > www.example.com/about/latest-news/2000 > > www.example.com/about/latest-news/2001 I have modified the .htaccess in the WP route to this:               # BEGIN WordPress       <IfModule mod_rewrite.c>          RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]         RewriteRule  /([0-9]+/?)$  /about/latest-news/$1     [NC,L]  #Added this line     </IfModule>       But I am having no luck, the url remains as > www.example.com/2000 I have the issue of not knowing wether my re-write is wrong, wether I should be putting this line of re-write in a different htaccess elsewhere, or if WordPress is overwriting it. Any help would be really appreciated.


title: wp_query display posts based on day

text:
I am trying to get all posts to be displayed on a certain date. For example today Tuesday I want all posts to be displayed. It doesn't matter that the posts were created today (Tuesday) or last week or last year - I just want a loop that will display all post of the current day. Tomorrow (Wednesday) I want all post to be displayed. I have created this code but it isn't working for me and I am getting a little frustrated. Here is my code.               <?php     $day = date('j');     query_posts( 'day='.$current_day);     query_posts('cat=9&posts_per_page=2' );          if (have_posts()) :         while (have_posts()) :             the_post(); ?>
                                      <?php the_field('time'); ?>                                  <a href="<?php the_permalink() ?>" class="eventFeed">                     <?php the_title(); ?>
             <?php         endwhile;     endif;     wp_reset_query();     ?>      Thank you for any help in advance :)


title: Shortcode displays always first. Once again

text: OK, I've had a problem with echoes in my last shortcodem, but everything works fine now. But I have another one:               function myWidget_shortcode( $atts ) {             extract( shortcode_atts( array(             'title' => 'My Widget',             'value' => '5',             ), $atts ) );                  return the_widget(myWidget,'title='.$title.'&value='.$value);     }          add_shortcode('myWidget', 'myWidget_shortcode');       Can you tell me wy this shortcode always displays first on pages? There's no echo etc., all the data is being returned... [found the answer - edit] **This resolves the problem:**               ob_start();         the_widget(popularPosts,'title='.$title.'&number='.$number);     return ob_get_clean();      Anyways I don't understand why it's always first in this case. Because the_widget is a function itself and echoes something? :>


title: Insert data in custom table during new post creation

text: I want to in insert data in my custom db table when creating a post. Suppose there are three categories (php, wordpress & jquery). When i create a post in wordpress, i want to insert post id and category id in my custom database table. How can i do this job?


title: Trouble with Transient API when W3TC is activated

text: I'm using W3 Total Cache 0.9.2.11 on Wordpress 3.5.2. I've got a problem with transient API and w3tc's object cache setting. When I activate 'object cache' with memcached (other settings are default), transient APIs stop working. The behavior is: when I call get_transient() within the expiration time after set_transient(), I get null. The behavior is consistent when 'object cache' is activated, and it works flawlessly when it's deactivated. The documentation mentioned no scenario where a `set_transient` call might fail. I tried the debugging mode w3tc object cache. And the page displayed some 1000 to 2000 object cache entries. I don't quite understand the name of each entry, but my transient values aren't there. I'm wondering if there are any settings I have overlooked? What's the cause of this? **Update:** I also noticed that refreshing the page will make `get_transient` return the desired output. It goes like this:   1. first `set_transient`, `get_transient` returns null   2. second `set_transient`, `get_transient` returns the first value   3. third `set_transient`, `get_transient` returns the second value So it looks like `set_transient` is taking longer to finish, is there any reference on whether w3tc have made this call asynchronous? And if so, how do I workaround it?


title: Random Alphanumeric Key URLs

text: I need random (and unique) alphanumeric permalinks. I've looked at several plugins but they all seem to do some form of redirection to a longer URL. That's not what I want, I want the permalink to be changed. Basically, I'm wanting URLs like bit.ly or 9gag.com. I've looked, but came up empty in my searches - does a plugin exist that does this? If not, could someone point me into the right direction as to how I might accomplish it? I'm pretty self sufficient in PHP but I'm not very familiar with WordPress yet. The easiest way I could think of is something like `add_filter("post_slug", md5(rand()))` (if that were actually valid code). Obviously, I'd have to check for duplicate slugs and what not... Honestly, what I'd much rather prefer is something like: `example.com/prefix/hf434g5ay/postname` In that the `/prefix/alphanumeric-key` is required but postname is used for SEO.


title: WordPress updates

text: How does WordPress know that a plugin is belong to WordPress plugin repository and it need to pull the updates from the WordPress SVN? And on the other end how does it know that another plugin does not belong to repository?


title: How to use get_post_custom function on the blog page?

text: First, I have a static page for homepage and for blog page too. I created a custom box for pages to setup unique background image for the pages. My idea is working on all page templates, but on blog page something wrong. **header.php is same on all page**               <head>     {...}     <?php $values = get_post_custom( $post->ID );  ?>     <style type="text/css">         body { background-image:url("<?php echo $values['background_image_meta'][0]; ?>"); }     </style>     {...}     </head>


title: A plugin for having rel="nofollow" in posts?

text: I'd like to make all the links in posts on one of my sites to be with rel="nofollow" on links inside posts. I wasn't able to find a plugin that did the job except for WP-NoExternalLinks. It also didn't work, unless I used it's dooms day option: > "Mask ALL links in document (can slow down your blog and conflict with some > cache and other plugins. Please use it on your own risk." But when I use it, it also puts nofollow on my blogroll links (which I would have preferred to keep alive.) Any suggestion what might be causing this? or how to resolve it? Thanks.


title: How organize uploaded media in WP?

text: I am new in WordPress and I came from Joomla. I am having some problem to understand how can I (if I can do it...) organize the uploaded media into folders and subfolders using WordPress. If I go in my backend administration panel I have the **Media** sub panel in which I can add a file (for example a jpg image). The problem is that all files are added in the same library. I want to organize my library having subcategory\subfolder in which the uploaded files are stored. For example I want have category image for: "Spring articles images" and "project management articles image", etc. How can do it?


title: Custom text box containing post titles

text:
I added two text boxes to my home page on a wordpress site and I need to display recent posts titles only. What line of code should i add to do that ? Here is the code I used to create the boxes:

Latest News

Our Clients


title: wp3 custom post types rss

text: From what I've found online, getting an rss feed for a custom post type is as simple as:               http://mywebsite.com/feed/?post_type=custom_type      Well I have tried it with no success as it just returns the default feed. However I can get this to work on the website just fine with               http://mywebsite.com/?post_type=custom_type      So why does it work for the html but not the rss feed? Please advise. ** EDIT ** I ended up adding this to my theme's functions.php:               function myfeed_request($qv) {         if (isset($qv['feed']) && isset($_GET['post_type'])) {             //$qv['post_type'] = get_post_types();             $qv['post_type'] = explode(',', $_GET['post_type']);         }              return $qv;     }     add_filter('request', 'myfeed_request');


title: Add $more_link_text parameter to the_excerpt()

text: this `filter` is on the Wordpress Codex …               add_filter('excerpt_more', 'new_excerpt_more');          function new_excerpt_more($more) {         global $post;         return '<a class="moretag" href="'. get_permalink($post->ID) . '"> … </a>';     }      This works perfect, however I wonder if it is also possible to create a filter that extends `the_excerpt()` with the same parameter like `the_content()` where it is possible to set the "more-link-text" as parameter? So I wonder how I can achieve this … `the_excerpt('custom more link')`` This would be especially useful for me because I have multiple custom-post- types where I always use `the_excerpt()` as teasers. Since those custom-post- types have various contexts and meanings it would be nice to have different "more-links" at the end … Is this somehow possible? Thank you in advance!


title: Removing duplicate values between two wordpress queries

text: I'm addressing a well known issue in Wordpress, in which I want to display "featured" posts, and under it the rest of the posts.   I have a `$query1` which holds 2 featured posts, and my `query_posts` which holds all of the posts on the site (including those two from `$query1`).   I now wish to remove from `query_posts` those two posts so I can display it using regular Wordpress loop in the form of:                 while (have_posts ()) : the_post();     the_title();     the_content();     endwhile;         I have the solution for removing these duplicate posts inside the above loop, but because of the paging, I want to have the query without duplicates before that, so the `query_posts` array will be paged **without** those two featured posts.


title: List author's posts with SQL

text:
I want display authors'posts with the code below but authors' name aren't showing. What is wrong?               <? // query test     $qry = $wpdb->get_results( $wpdb->prepare("     SELECT *     FROM $wpdb->posts     WHERE post_type ='post'     AND post_status='publish'     order by 'ID' DESC     LIMIT 5     "));          echo "
";          foreach ( $qry AS $k => $v ){          $qry_name = $wpdb->get_results( $wpdb->prepare("     SELECT user_nicename AS USER_NAME     FROM 'wp-users' AS a     LEFT JOIN 'wp-posts' AS b     ON a.ID = b.post_author     WHERE b.post_author = a.ID     "));          $ID = $v->ID;     $title = stripslashes(mb_substr($v->post_title, 0,20,"utf-8"));     $ddate = $v->post_modified;     $name = $v->user_nicename;     $link = '';     $list = "
".$ID."	".$link.$target.$title."	 on ".$ddate."	".$qry_name[0]->USER_NAME."
";     echo $list;     }          echo "
";     ?>


title: See output of a sql query while plugin installation in wordpress

text: Doing wordpress plugin development, I am creating a table (while installing the plugin) with the following string:               $sql = "CREATE TABLE (query skipped)..."; /*someting*/      For example: I have this               register_activation_hook( __FILE__, 'my_plugin_install' );     function my_plugin_install(){          $sql = "CREATE TABLE (query skipped)..."; /*someting*/     echo $sql;     }      The problem is there is some error with this query and and I want to see the output of $sql using php. But the above code doesn't echo anything when plugin is installed. Any way to see the ouput?               Details:      function my_plugin_install(){             global $wpdb, $current_user;;             //getting the musician/user rating keys         global $k11, $k12, $k13, $k14, $k21, $k22, $k23, $k24;             $fabprofile_table_name=$wpdb->prefix."fabulous_profile";             $fabulous_profile_version = "2.0";             //mid= music user id        //uid = general user id        //creating the ratings table        $sql = "CREATE TABLE $fabprofile_table_name (            mid tinyint(9) NOT NULL,            uid tinyint(9) NOT NULL,            $k11 tinyint(1) NOT NULL, $k12 tinyint(1) NOT NULL,$k13 tinyint(1) NOT NULL, $k14 tinyint(1) NOT NULL,            $k21 tinyint(1) NOT NULL, $k22 tinyint(1) NOT NULL, $k23 tinyint(1) NOT NULL, $k24 tinyint(1) NOT NULL          );";                       require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );             dbDelta( $sql );        $wpdb->show_errors();          echo $sql;         }


title: wordpress plugin to create subdomain from registered user

text: I have created Network enabled (Multisite) site in Wordpress installation. I can able to create multiple site as many as i want.It will create the separate table to maintain the site data respectively. I have parent domain which is like `www.site.com`. I have created the subdomain `s1` like `www.site.com/s1` and `www.site.com/s1/wp-admin`. Separate admin to maintain the data respectively. Wordpress has all its features by default. Is it possible to create subdomain dynamically from parent site for registered user? How do I programmatically do user registration to create subdomain for multisite enable wordpress setup?


title: How to permanent redirect old domain to new one. in case amazon store

text: How do I permanently redirect this url using .htaccess, so that if anyone views old web page, it redirects to the new one. For example:               http://olddomain.com/folder/AmazonASIN.html       --> http://newdomain.com/AmazonASIN.html          http://oldexample.com/detail/B007OZNZG0.html        --> http://newexample.com/B007OZNZG0.html


title: Why adding Categories does not auto refresh in Backend while using my custom theme?

text: If I am using my own created custom theme, the Post Categories Page in admin panel is not getting updated automatically when I add a new Category. **To see the new category I have to reload the page Manually**. When I change to default themes it works as perfectly. So the problem is in my theme. I think I must have missed something in my functions file. Any idea what it can be??


title: Use get_term_children to get the sub category of a parent category for the current post

text: In my WooCommerce theme I've created a root category: 'Brands' then for each product I've added it's brand as a sub category to the 'Brands' parent category. On the product page I want to display the brand of the current product.               global $post;          // Get the brands ID from slug     $brands_id = get_term_by('slug', 'brands', 'product_cat');          // Get the children of that term     $termchildren = get_term_children( $brands_id, 'product_cat' );          // Loop through the children of 'brand' term to echo the name of the brand     foreach ( $termchildren as $child ) {         $term = get_term_by( 'id', $child, 'product_cat' );         echo '' . $term->name . '';     }      This always echoes _all_ the brands. How do I take this information and filter out the brands not associated with the current product?


Is wp_nonce_field vulnerable if you know the action name? I am actually adding a hidden field with name = the name of the action name in my form so that my plugin can identify it. I want to know if there's security issues if I am making my action name "visible"? edit: I am actually automating my form submission workflow; so if displaying the action name is a concern, i can encrypt it. ex. I call `MyFormPlugin::generateAction( 'submitQuestion' );` in my form to generate the nonce and my hidden "form_action" action field.               class MyFormPlugin{              public static function generateAction( $action, $referer = true ){             $nonce_field = wp_nonce_field( self::secured_action( $action ), "mfp_nonce" , $referer , FALSE );             return $nonce_field.'<input type="hidden" name="form_action" value="'.$action.'"/>';         }              public static function secured_action( $action ){             return md5( $action.'randomsalt');         }              public function verify_nonce( $action ){             $nonce = $_POST[ 'mfp_nonce' ];             return wp_verify_nonce( $nonce, self::secured_action( $action ) );         }     }      does this look secured?


title: $wpdb->prepare with ON DUPLICATE KEY UPDATE

text: I just took this code from $wpdb Codex page, and modified my existing Insert query:               $table = $wpdb->prefix . 'user_req';          $post_id = explode('_', $_POST['post_id']);     $user_id = $_POST['user_id'];     $wpdb->insert(              $table,             array(                 'user_id' => $user_id,                 'post_id' => $post_id[1]             ),             array(                  '%d',                 '%d'             )         );      into:               $wpdb->query( $wpdb->prepare(                  "                     INSERT INTO {$wpdb->prefix}user_req                     ( user_id, post_id )                     VALUES ( %d, %d )                     ON DUPLICATE KEY UPDATE                     user_id = VALUES(user_id), post_id = VALUES(post_id)                 ",                  $user_id,                  $post_id[1]             ) );      Because I need to **prevent the duplicate entries** entering into the database. But still the duplicate entries are entering into the db while the insert query is functioning properly. To add the `ON DUPLICATE KEY UPDATE` portion, I followed the s_ha_dum's Answer on another thread. What am I doing wrong?


title: I change all options except for General Settings

text: I can change all the settings on the site except for the Wordpress General Settings section. This includes both Wordpress options and plugin related options. I get a this error code: ** ## 403 Forbidden Access to this resource on the server is denied! ** I have tried switching off all the plugins to no avail along with trying the the htaccess modification I found recommended by a similar problem.               # BEGIN WordPress     <IfModule mod_rewrite.so>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress      I have eventually changed the site name by manually changing it via phpMyAdmin but I cant ship this site to my clients with this type of problem.


title: Rewrite for page with a possible unknown parent page

text: I am trying to add a wp rewrite for my plugin that allows users to include a shortcode on a page that will then display a calendar. This calendar then requires url params in order to navigate the dates. All this is working fine without issues...it is now getting it to work if a user includes the shortcode on a page that has a parent page or pages. So another words if the page with the shortcode is on is called 'class-calendar' and the user puts it as a subpage to a parent page called 'yoga' then the url may look like mysite.com/yoga/class-calendar/ and if you navigate the schedule then it will look like mysite.com/yoga/class-calendar/7/4/2014. I have it working fine if it is like mysite.com/class-calendar/7/4/2014 but I need to able to make so it works for an unknown parent page or pages. I can make it work like the code sample below $newrules = array();                       $newrules['([^/]*)/([^/]*)/' . $this->schedule_page_slug . '/([^/]*)/([^/]*)/([^/]*)/?$'] = 'index.php?pagename=$matches[1]/$matches[2]/' . $this->schedule_page_slug . '&month=$matches[3]&days=$matches[4]&years=$matches[5]';                  $newrules['([^/]*)/' . $this->schedule_page_slug . '/([^/]*)/([^/]*)/([^/]*)/?$'] = 'index.php?pagename=$matches[1]/' . $this->schedule_page_slug . '&month=$matches[2]&days=$matches[3]&years=$matches[4]';                  $newrules[$this->schedule_page_slug . '/([^/]*)/([^/]*)/([^/]*)/?$'] = 'index.php?pagename=' . $this->schedule_page_slug . '&month=$matches[1]&days=$matches[2]&years=$matches[3]';                  return $newrules + $rules;      However, even though this works I know it is not right and it only handles the page with the shortcode to be 2 pages deep ( not that it really should go any deeper, but just the same I know how I have it is not right) Any help getting me pointed in the right direction would be much appreciated. I have been trying to mess with a wild card parent, but can't get it to work. Thanks


title: Use Advance Custom Fields to fill text widget

text: I have a custom WYSIWYG field setup in Advance Custom Fields Plugin and I want to show that content in a text widget on the sidebar / widgets. I've tired the shortcode and the php code but no luck.


title: Extend the wp_users table

text: I'd like to to extend the `wp_users` table in my WordPress' database.   Why? I want people to add more information about themselves when they sing up at my website. I know how to extend it, but I'm afraid that when WordPress needs an update the `wp_users` table, i.e. the columns I added, will be deleted. I there anyone here who has some experience with extending the `wp_users` table?   Will this table be updated when the WordPress version is updated?


title: Images in sub-pages fail to load

text: I added a .htaccess file to a wordpress website I'm working on, to show nice urls instead of page ids. The content of the .htaccess is this:               <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>      It's working fine, but in every subpage I have it doesn't show images. Using Firebug I see that the path to the image is correct (for example: for the logo is the same path as in other pages), but it gives the error "Failed to load the given URL". The src for the images is this: wp-content/themes/.../file.jpg. I noticed that putting an absolute url, such as http://mysite.com/wp-content/.../file.jpg does solve the problem. Shall I just use absolute URLs or is there something I can do in the htaccess?


title: problem with add_size_image

text: why if im add size like :               add_image_size( 'featured1', 466, 316, false);     add_image_size( 'featured2', 466, 260, false);      the seconde size Does not generated What is the problem ?


title: how to get the post id in the option tag

text: $term_id .= $_POST['main_brand_id'];             $term = get_term( $term_id, 'state' );             $slug = $term->slug;             global $post;             $args = array( 'post_type' =>'dealers','taxonomy'=>'state', 'term' => $slug );             $myposts = get_posts( $args );             foreach( $myposts as $post ) :  setup_postdata($post);                 echo '<option>';                     $options .= '<option value="'.$post->id.'">';                     $options .=  the_title();                 echo '</option>';             endforeach;      I have to pass the **post id** to get the output as below               <option value="24">Andhra Pradesh</option>     <option value="29">Bangalore</option>     <option value="44">Delhi</option>      This piece of code is not working........               $options .= '<option value="'.$post->id.'">';      This is the output im getting               <option>Andhra Pradesh</option>     <option>Bangalore</option>     <option>Delhi</option>      can anyone help me....


title: How to control display of page lists on sidebar that doesn't have childrens

text:
I am using the following code to list the child pages of current page on my sidebar. It is working very well.               $titlenamer = get_the_title($post->post_parent);     $output = wp_list_pages('echo=0&depth=1&title_li=
'.$titlenamer.'
' );     if (is_page( )) {       $page = $post->ID;       if ($post->post_parent) {         $page = $post->post_parent;       }       $children=wp_list_pages( 'echo=0&child_of=' . $page . '&title_li=' );       if ($children) {         $output = wp_list_pages ('echo=0&child_of=' . $page . '&title_li=
'.$titlenamer.'
');       }     }     echo $output;      But If a parent menu has no childs, this code will list all the parent pages on my sidebar. How can I control this? If the parent menu doesn't have any childs, then I wants to display certains pages I define. If this is not possible, I don't want to display anything for page that doesn't have childs.


title: Adding pages to the Admin panel

text: Instead of going to Pages on the Admin panel nav bar on the left to see all the pages that are created. I would Like the pages to show up on the Admin panel nav bar it self. Like a custom post type. How can I do this. Any help would be greatful.


title: Optimizing wp_get_attachment_image_src

text: I'm working on WordPress gallery. I display images with wp_get_attachment_image_src function:               foreach($slideshow_data['attachment_ids'] as $attachment_id) {         $img_data = wp_get_attachment_image_src( $attachment_id, 'full' );         echo "<img src=\"{$img_data[0]}\" width=\"{$img_data[1]}\" height=\"{$img_data[2]}\">";     }      Which results in over 140 database queries per page for large galleries. Of course this can be cached, but I feel that this is not correct way. My question is, am I doing something wrong? Thank you.


title: Eliminate MultiSite Network Splogs

text: Are there any plugins that can delete splogs from a MultiSite Network? I have been looking for quite a while but can not find any plugins that can delete splogs from a MultiSite Network. Although I have been able to find plugins to prevent spam, that is not what I want here. Thanks Guys.


title: wordpress - load a template based on the URI

text: I have a number of custom of post types - i.e. `'windows'`, `'doors'`, `'garages'` and I want to load a custom template (`special.php`) whenever my wordpress site has a url that looks like this:               www.mysite.com/windows/     www.mysite.com/doors/     www.mysite.com/garages/      I don't want to use pages, as it is not appropriate in this case (I have given a scaled down example in the above example) **How can I achieve this?** Currently, as no pages exist with those names, I am getting an 404 (index.php)


title: How can I rename the element <dc:creator> to <author> in my RSS?

text: I need to change the author element of the feed from dc:creator to author. How does this is possible?


title: Search ONLY by meta key / meta values

text: I'm almost there on this one. On functions.php i have this:               function base_home_product_post_type( $query ) {              if($query->is_search() && $_POST['box'] == 'sku') {             $query->query_vars['post_type'] = 'product';             $query->query_vars['meta_key'] = 'sku';             $query->query_vars['meta_value'] = $query->query_vars['s'];             return;         }          }     add_action('pre_get_posts', 'base_home_product_post_type', 1);      And it does what it's told. Searches for the search string on the meta_key 'sku'. Problem here is that by default, the query object returned from WordPress also contains this and queries `post_title` and `post_content` by default:               SELECT SQL_CALC_FOUND_ROWS  whirl_2_posts.ID FROM whirl_2_posts  INNER JOIN whirl_2_postmeta ON (whirl_2_posts.ID = whirl_2_postmeta.post_id) WHERE 1=1  AND (((whirl_2_posts.post_title LIKE '%__SEARCH_STRING__%')  OR (whirl_2_posts.post_content LIKE '%__SEARCH_STRING__%')))      I really don't want that when i'm searching only for the "sku" value, so I've tried removing it using `posts_where` and some pretty ugly REGEX like this (warning, hacky and buggy):               function get_rid_of_titles($search) {         if(is_search() && $_POST['box'] == 'sku') {         $search = preg_filter('|AND\s\({3}\w*\.post_title\sLIKE\s\'\%[^%]*\%\'\) OR \(\w*\.post_content\sLIKE\s\'\%[^%]*\%\'\){3}\s|', '', $search);         }         return $search;     }     add_filter('posts_where','get_rid_of_titles');      But to no luck. Can anyone point me the how-to's to search onlu for the custom value in this case? **SOLUTION** Thanks to @kaiser below, I got this working:               function get_rid_of_titles($search) {              if(is_search() && $_POST['box'] == 'sku') {                    $sku = $_POST['s'];          // get search string               $needle = "LIKE '%$sku%'";   // search only for LIKE '%_SEARCH_STRING_%'. This is a multisite environment, so involving table names directly is a bad idea               $replace = "LIKE '%'";       // replace it with SQL Wildcard so any title and any content are welcome               $count = 2;                  // only the first 2 occurrencies which happen to be post_title and post_content               return str_replace($needle,$replace,$search, $count);              }     }     add_filter('posts_where','get_rid_of_titles');


title: How to make sure a wp-cron job runs

text: I am using a plugin to send emails to a relatively large email list. Because we have a low per-hour email threshold from our host we have to use a setting in the plugin to throttle the emails down to only a certain number every hour. I am assuming that the plugin uses wp-cron to accomplish this. I have tried finding documentation on wp-cron but the only substantial information I have been able to find is that it requires a page view to run. Questions:   1. Is an RSS feed being pinged enough to trigger a "page view" and therefore wp-cron?   2. How long after a page view will wp-cron run? (e.g. if last page view is at 6:59p.m. will cron scheduled for 7pm run?)   3. What happens if a cron job is missed?(No one visits website all day until 7:03 p.m. Is 7p.m. cron job run?)


title: Custom fields: In what order are they saved into the DB?

text: If I insert multiple custom fields to my article, they get sorted in _"I don't know what"_ way. So when I insert some multiple fields in an article and call those via               $cf = get_post_custom();     foreach ($cf['ISSUU-configID'] as $key => $value) {       echo "<h4>" . $cf['ISSUU-configID'][$key] . "</h4>\n";     }      their order is mixed up and neither logically ordered nor in the way I inserted them. Seems weird to me. To make it a little clearer:   I insert these numbers, each one in an own custom field (in specifically that order):   12345, 23456, 34567, 45678 And the output will be something like (in fact this is always different):   45678, 23456, 12345, 34567