Deregister nextgen on shopp pages

Ok, I have a site using Netgen Gallery and Shopp. I'm trying to deregister the nextgen styles and scripts on the shopp products and pages as there is a conflict. My shopp page title is "Registration" and I'd like to stop any Nextgen stuff from loading on any shopp pages. Here's the code (that didn't work) that I added to my functions.php               // NextGEN script exclusions     add_action('wp_print_scripts','my_deregister_javascript', 100);     function my_deregister_javascript(){     if ($post->post_parent == registration) {         wp_deregister_script('ngg_script');         wp_deregister_script('thickbox');     }     }          // NextGEN style exclusions     add_action('wp_print_styles','my_deregister_styles', 100);     function my_deregister_styles(){     if ($post->post_parent == registration) {         wp_deregister_style('NextGEN');         wp_deregister_style('thickbox');     }     }      Does anyone see what I am missing?


Wordpress MAMP Installation Issue

I have MAMP configured in my machine and I've been using it to run multiple Wordpress installs with no issue until this new site where the Wordpress install is in a subdirectory. The site is installed under htdocs and it has the following structure: /mylocalpath/htdocs/www.mysite.com/Web Applicatin/WordpressInstallCoreFiles For some reason this keeps returning a 404. I followed the steps for "Wordpress in Subdirectory" but still no luck. I do have the hosts file set up correctly for the local domain. Any tips or ideas on how to get my site running on the subdirectory? Anything I can do in Apache to configure this correctly?


Functions containing parameter 'yourtheme'

I had a colleague create a new theme and while doing so he copied an old theme and made the changes necessary. Now, in many of the files, there are functions that contain the old theme name in the function call instead of the new theme name. Is this parameter used in WordPress for anything and I should therefore change it, or is it OK to leave it with the old theme name?


Change menu items URL

I create a single page website and use only anchors (#) on main menu items. Now, I need to include a second page on the website and keep the same menu. I'm using roots theme. Then, I'm building menu using:               wp_nav_menu(array('theme_location' => 'primary_navigation'));       But how to change items url from, for example, #contact to mywebsite.com.br/#contact only on this second page?


Wordpress Cookies - wp_set_auth_cookie

I would like to make the login working to all of my wordpress sites. They are single installs, so no multisite plugins can help. I decided to go with the cookies. I store the users in the same usertable and metatable. Please check out my code. The auth, the salt and the other security encription keys are the same, I have defined the directory of the loginsessions. I have also defined cookiehash and it's buddies, because the are going to be the names of the cookies.               define('AUTH_KEY', 'xxxxxxxxxxxxx');     define('SECURE_AUTH_KEY', 'xxxxxxxxxxxxxxxx');     define('LOGGED_IN_KEY', 'xxxxxxxxxxxxxxxxxxxx');     define('NONCE_KEY', 'xxxxxxxxxxxxxxxxxxxx');     define('AUTH_SALT',        'xxxxxxxxxxxxxxxxxxxxxxxxx');     define('SECURE_AUTH_SALT', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');     define('LOGGED_IN_SALT',   'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');     define('NONCE_SALT',       'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');     define('COOKIEHASH', md5('linkyou'));     define('USER_COOKIE', 'linkyouuser_' . COOKIEHASH);     define('PASS_COOKIE', 'linkyoupass_' . COOKIEHASH);     define('AUTH_COOKIE', 'linkyou_' . COOKIEHASH);     define('SECURE_AUTH_COOKIE', 'linkyou_sec_' . COOKIEHASH);     define('LOGGED_IN_COOKIE', 'linkyou_logged_in_' . COOKIEHASH);     define('TEST_COOKIE', 'linkyou_test_cookie');     session_save_path('/home/content/86/9513386/html/loginsessions');      The thing is I have edited `wp_set_auth_cookie()` and `wp_clear_auth_cookie()`, Reference from codex: http://codex.wordpress.org/Function_Reference/wp_set_auth_cookie The function is located in a core file: wp-includes/pluggable.php I think wp_set_auth_cookie() must be the mayor problem, please check out the code: Original               function wp_set_auth_cookie($user_id, $remember = false, $secure = '') {         if ( $remember ) {             $expiration = time() + apply_filters('auth_cookie_expiration', 14 * DAY_IN_SECONDS, $user_id, $remember);             // Ensure the browser will continue to send the cookie after the expiration time is reached.             // Needed for the login grace period in wp_validate_auth_cookie().             $expire = $expiration + ( 12 * HOUR_IN_SECONDS );         } else {             $expiration = time() + apply_filters('auth_cookie_expiration', 2 * DAY_IN_SECONDS, $user_id, $remember);             $expire = 0;         }              if ( '' === $secure )             $secure = is_ssl();              $secure = apply_filters('secure_auth_cookie', $secure, $user_id);         $secure_logged_in_cookie = apply_filters('secure_logged_in_cookie', false, $user_id, $secure);              if ( $secure ) {             $auth_cookie_name = SECURE_AUTH_COOKIE;             $scheme = 'secure_auth';         } else {             $auth_cookie_name = AUTH_COOKIE;             $scheme = 'auth';         }              $auth_cookie = wp_generate_auth_cookie($user_id, $expiration, $scheme);         $logged_in_cookie = wp_generate_auth_cookie($user_id, $expiration, 'logged_in');              do_action('set_auth_cookie', $auth_cookie, $expire, $expiration, $user_id, $scheme);         do_action('set_logged_in_cookie', $logged_in_cookie, $expire, $expiration, $user_id, 'logged_in');              setcookie($auth_cookie_name, $auth_cookie, $expire, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN, $secure, true);         setcookie($auth_cookie_name, $auth_cookie, $expire, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, $secure, true);         setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, COOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true);         if ( COOKIEPATH != SITECOOKIEPATH )             setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, SITECOOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true);     }      Edited version               function wp_set_auth_cookie($user_id, $remember = false, $secure = '') {         if ( $remember ) {             $expiration = time() + apply_filters('auth_cookie_expiration', 14 * DAY_IN_SECONDS, $user_id, $remember);             // Ensure the browser will continue to send the cookie after the expiration time is reached.             // Needed for the login grace period in wp_validate_auth_cookie().             $expire = $expiration + ( 12 * HOUR_IN_SECONDS );         } else {             $expiration = time() + apply_filters('auth_cookie_expiration', 2 * DAY_IN_SECONDS, $user_id, $remember);             $expire = 0;         }              if ( '' === $secure )             $secure = is_ssl();              $secure = apply_filters('secure_auth_cookie', $secure, $user_id);         $secure_logged_in_cookie = apply_filters('secure_logged_in_cookie', false, $user_id, $secure);              if ( $secure ) {             $auth_cookie_name = SECURE_AUTH_COOKIE;             $scheme = 'secure_auth';         } else {             $auth_cookie_name = AUTH_COOKIE;             $scheme = 'auth';         }              $auth_cookie = wp_generate_auth_cookie($user_id, $expiration, $scheme);         $logged_in_cookie = wp_generate_auth_cookie($user_id, $expiration, 'logged_in');              do_action('set_auth_cookie', $auth_cookie, $expire, $expiration, $user_id, $scheme);         do_action('set_logged_in_cookie', $logged_in_cookie, $expire, $expiration, $user_id, 'logged_in');              setcookie($auth_cookie_name, $auth_cookie, $expire, 'gamerspost.us/wp-content/plugins', 'gamerspost.us', $secure, true);         setcookie($auth_cookie_name, $auth_cookie, $expire, 'gamerspost.us/wp-admin', 'gamerspost.us', $secure, true);         setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, 'gamerspost.us/', 'gamerspost.us', $secure_logged_in_cookie, true);              setcookie($auth_cookie_name, $auth_cookie, $expire, 'linkwave.us/wp-content/plugins', 'linkwave.us', $secure, true);         setcookie($auth_cookie_name, $auth_cookie, $expire, 'linkwave.us/wp-admin', 'linkwave.us', $secure, true);         setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, 'linkwave.us/', 'linkwave.us', $secure_logged_in_cookie, true);              setcookie($auth_cookie_name, $auth_cookie, $expire, 'linkyou.us/wp-content/plugins', 'linkyou.us', $secure, true);         setcookie($auth_cookie_name, $auth_cookie, $expire, 'linkyou.us/wp-admin', 'linkyou.us', $secure, true);         setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, 'linkyou.us/', 'linkyou.us', $secure_logged_in_cookie, true);              setcookie($auth_cookie_name, $auth_cookie, $expire, 'linkmusic.us/wp-content/plugins', 'linkmusic.us', $secure, true);         setcookie($auth_cookie_name, $auth_cookie, $expire, 'linkmusic.us/wp-admin', 'linkmusic.us', $secure, true);         setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, 'linkmusic.us/', 'linkmusic.us', $secure_logged_in_cookie, true);              setcookie($auth_cookie_name, $auth_cookie, $expire, 'linkask.us/wp-content/plugins', 'linkask.us', $secure, true);         setcookie($auth_cookie_name, $auth_cookie, $expire, 'linkask.us/wp-admin', 'linkask.us', $secure, true);         setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, 'linkask.us/', 'linkask.us', $secure_logged_in_cookie, true);         /*if ( COOKIEPATH != SITECOOKIEPATH )             setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, 'gamerspost.us/', 'gamerspost.us', $secure_logged_in_cookie, true);             setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, 'linkwave.us/', 'linkwave.us', $secure_logged_in_cookie, true);             setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, 'linkyou.us/', 'linkyou.us', $secure_logged_in_cookie, true);             setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, 'linkmusic.us/', 'linkmusic.us', $secure_logged_in_cookie, true);             setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, 'linkask.us/', 'linkask.us', $secure_logged_in_cookie, true);*/     }      `wp_clear_auth_cookie()` is created by mostly the same method, but it comes up when you are logging out, if you want I can post that here. Any thoughs? Thank you in advance! :D


When filtering query on custom taxonomy; main menu dissapears

I have created a custom taxonomy, and that works. But here is the problem; I have created an archive page, which in the url gets e.g. this: `?category=23`. Then, in `functions.php`, I do this:               function add_inspiration_category( $q ) {         if (is_post_type_archive('inspiration') && !is_admin()) {                  $category_id = $_GET['category'];             if (!empty($category_id)) {                 $q->set('tax_query', array(                     array(                         'taxonomy' => 'inspiration-taxonomy',                         'field' => 'id',                         'terms' => $category_id                     )                 ));             }         }              return $q;     }     add_filter('parse_query', 'add_inspiration_category');      So, basically I'm filtering the archive pages result based on the id in the url. This works, except when I'm filtering on a category, the main menu dissapears from the header. If I remove the `?category=23` from the url or comment out the section above where I set the `tax_query`, it works as expected again. Anyone know what this is?


Setting default thumbnails size & creating multiple thumbnail sizes

Two quick questions. **How does default thumbnail size work?**               if ( function_exists( 'add_theme_support' ) ) {        add_theme_support( 'post-thumbnails');        set_post_thumbnail_size( 800, 600, true );     }      What does above code really mean? Does it mean all my thumbnails will be 800x600 or smaller? Because even after setting set_post_thumbnail_size `get_post_thumbnail_id($post->ID)` points to full-sized thumbnails (like 2500x1200). I don't really need that big images... **When do WordPress create (custom) thumbnails?**               if ( function_exists( 'add_theme_support' ) ) {       add_theme_support( 'post-thumbnails');       set_post_thumbnail_size( 800, 600, true );       add_image_size( 'foo', 400, 300, true );       add_image_size( 'bar', 200, 150, true );      }      When are these custom thumbnails created (like image-800x600.jpg / image-400x300.jpg etc.) ? Only during upload process? What if I'm just changing themes to theme based on add_image_size functions with different thumbnail sizes, do I have to reupload all my images to get right sizes? If yes, then using timthumb over add_image_size wasn't that bad idea... Thanks!


Rename menu items for All except super admin

I can rename wp-admin menu items But How Can I active it for all users except Super Admin ?               add_filter('gettext', 'rename_admin_menu_items');     add_filter('ngettext', 'rename_admin_menu_items');     function rename_admin_menu_items( $menu ) {     $menu = str_ireplace( 'Dashboard', 'Home', $menu );     return $menu;     }


What is <# code #> in media-template.php, and how does it work?

I'm checking `/wp-includes/media-template.php` and just found this:               <# if ( data.compat && data.compat.meta ) { #>         {{{ data.compat.meta }}}     <# } #>      Never seen `<# #>` or `{{{ }}}` before. What kind of PHP is this?   Searching for this symbols in Google seems futile...


$is_iphone - to redirect a page

I have a responsive site that works well with @media queries except for 1 or 2 maps that are embedded in an iframe and use html5 overlays to display location markers. When viewing the site in general, the @media queries work fine, but viewing the specific map pages on different devices results in varying success - iphone retina for example shows the overlay completely in the wrong place, as does ipad, whilst android seems fine. Rather than trying to create different css @media queries for different devices, I've decided the easiest solution will be to redirect any mobile user to an alternative full size map (a html file that is contained in the root folder, but outside of WP) that is scaleable and zoomable. However, I've tried a variety of conditional statements to achieve this and the one that works the best seems to be the global WP variable $is_iphone. This works for iphone and android - but I am unable to determine the exact screen size / device response at which this variable returns true. Is there a list or some specifications somewhere that show the controllers? For example Galaxy tab 10.1 does not respond to this variable, and neither does the ipad. So - my question is, what php function can I harness to best target the most popular devices? I've tried adding the various functions to detect user-agent with minimal success. I do NOT want a mobile plugin as this is just for 1 page - so please don't suggest wptouch! Currently I'm using this statement within the page template, but as mentioned, it's not very accurate;               <?php if ($is_iphone) : ?>          <script type="text/javascript">     <!--     var answer = confirm ("Mobile device detected.\nClick OK to view a larger, zoomable    map or click Cancel to stay on this page.")     if (answer)     window.location="../map1-full.html"     else     alert ("Redirect cancelled.\nReload the page to display this option again.")          // -->     </script>     <?php endif; ?>


undefined index

I upgraded to the latest version of WordPress and now for some reason when I go to the menus page and it only seems to happen there, I get an error saying Notice: Undefined index: eventmeta_noncename in /home3/themes/savior/functions.php on line 1399 Here is the code. Line 1399 would be line 4 in the code http://pastebin.com/rNR7sMGP I can't figure out why it's an undefined index.


WordPress 3.5 how to determine if user is on category listing or category edit screen?

I have a custom bit of code that I need to place on the category edit screen but not on the manage categories screen. Prior to WordPress 3.5, I was able to set a global $action variable to check for action="edit" and place my code. The same action variable returns empty in 3.5


View Details/Edit/etc. view for custom admin plugin

I am working on a plugin for Wordpress that will have formatted data from a couple of non-Wordpress tables in the same database as WP, and I am not quite sure how to go about having something like a custom view, like details or edit (or even have a way to delete the entries). What would be the best way to do this?


Best Way to Enable Two Step Authentication

I'm looking for a bit of guidance on setting up a two step authentication system in WordPress. I've looked at a few of the main plugins and they seem to fall in to two camps:   * Add an extra field to the login form   * Add another authentication cookie in addition to the standard WP cookie I don't really like the UI of an extra login field, and I don't feel knowledgeable enough to setup a cookie based authentication system that is secure enough to be worth it. Is there third option I'm missing? Note: I did see this similar post, but that consisted mainly of plugin recommendations, and I would like to write something myself if possible. **Update:** Since my site will only have a handful of privileged users, I decided to add a query string argument that, when present, will cause the extra login field to be shown. This way, normal users don't ever see the extra field, and I don't have to worry about managing an extra authentication cookie.


Show all post of taxonomy on base taxonomy URL

I know there have been similar answers but I'm not having any luck. I have a custom taxonomy called events. I would like to see all the post from all terms here: domain.com/events/ That doesn't work though it gets a 404. This works though domain.com/events/term How do I get it to work with the other way also?


Logging in user automatically from non-WP ASP.net site?

At the time I was brought in, the client had a fully WP site and I had specific tasks to built surveys and reporting available only to logged in users. Since completion, the client's other developers have moved their eCommerce portion, and therefore the user administration, to an ASP.net solution. Now they are asking my advice on whether there is a way to link back to the content I created in WP without requiring the user to log into WP. The content needs needs a logged in user because surveys and reports are only view-able by the client who creates them. I know 0 about ASP, but I wonder is there a way to bridge the two? Perhaps when a new account is created on the ASP side to also creates a matching account in WP?


Similar posts formatting

I'm using the similar posts plugin `http://wordpress.org/extend/plugins/similar-posts/`, and I want the similar posts to show on the same line instead of as a list... like link 1, link 2, link 3, link 4 instead of   link 1   link 2   link 3   link 4 I posted this on the wordpress forum and on the plugin's official site days ago and still no answer... please help me! (I know very little about coding, so try to be specific, and if you give me code explain what each line does so I can learn please) thanks! Added info: I'm using mostly default settings for the plugin, I think the only change I made was to set it to only consider tags. I would think there would be something I could change on the output settings tab, but I have no idea what. I've got it set to display after the content because I couldn't figure out what file to put `<?php similar_posts(); ?>` and that's really where I wanted it anyways so it worked out perfectly. Oh, I am using the default theme Twenty Ten. Follow the link to wordpress forums in my chosen answer below for the missing parts of the discussion.


How can I change how my tag pages display?

Ok, I'm using the TagCloudShortCode plugin. I have a problem with how my tag pages display.... I want them to display the way they show on my main page, with the image and more button... how do I change the way it displays? I want it to display like this `http://www.top-iphone-apps.info/` but it displays like this `http://www.top-iphone-apps.info/?tag=free` (I know very little about coding, so try to be specific, and if you give me code explain what each line does so I can learn please) thanks! Update... I fixed it by changing this in the index.php file               <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>
                     <?php the_excerpt(); ?>
      to               <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>
                     <?php the_content( __( 'Continue reading →', 'twentyten' ) ); ?>                     <?php wp_link_pages( array( 'before' => '
' . __( 'Pages:', 'twentyten' ), 'after' => '
' ) ); ?>
      basically copying the stuff from the else statemnt. It worked, but I know it's a sloppy way of fixing it, so if anyone can tell me the better way of doing it I'd appreciate it.


Adding new row to wp_post table

I want to add 2 more rows (for voting up or down) to my default wordpress posts table. Would those rows be deleted when I update my WP version, or cause any other problem? An alternative would be to create a separate table but it's much faster and easier to query from 1 in my case.


Missing sidebar parameter "fix" - before_content

as you know the sidebar parameters from register_sidebar() that control the widget layout are               - before_widget     - after_widget     - before_title     - after_title      the problem is that you cannot implement certain type of designs because a parameter like '`before_content`' is missing. for example:

         title

         content

      a HTML structure like this is only possible if you add `<div class="content">` in the `after_title` parameter. The problem is that if you do this, widgets without titles will break the page layout :( so is there a solution to somehow add that `<div class="content">` after `div.title`, or after `div.container` if title is missing?


Echo custom taxonomy term name

I would like to echo out the term name from a custom taxonomy `'recipes'` but all I get is the word "recipe" when it should say eg "pizza recipe". Is `name` the right argument here or I am mistaking it for `slug`?               <?php        $term = get_terms( 'recipes' );         echo '
' . $term->name . 'recipe
';


Why does hook priority affects admin menu permission error?

On this answer, there was this final comment > For future readers, Roland's issue was a hook priority issue. Changing > priority from 10 to 11 fixed it in his case The answer seems already closed, so I couldn't comment, but why/how would a hook priority make an admin menu work or produce a permission error? > You do not have sufficient permissions to access this page.


Add ALT attribute to Pin It Button image to pass HTML5 validation

I am using the Pinterest "Pin It" Button plugin so I can add to my posts/images. However, part of the Pin In button uses this code:               <img border="0" class="pib-count-img" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" />      There is no ALT attribute for the image and my blog is failing HTML5 validation on http://validator.w3.org because of this. I keep getting the error: 'An img element must have an alt attribute, except under certain conditions. For details, consult guidance on providing text alternatives for images.' How can I add the ALT attribute ( `alt="Pin It"` ) to the image used for the Pin It button so that my blog pages pass validation? [ Note: I've tried jQuery `$('.pib-count-img').attr('alt', 'Pin It');` but with no success. ]


Force wordpress to request for FTP Info on theme/plugin install/update

Is it possible to force wordpress to **always** request for FTP credentials when installing and updating plugins / themes? I know the ftp credentials input is bypassed if wordpress has enough unix user access, but i want wordpress to ask nevertheless. Is this possible? How?


External stylesheet per page

I want to know if this is a good thing to do. I have many `conditional tags` for `Wordpress pages` and all of them are combined in 1 stylesheet, which is not bad, but I see that the front-page for example does not use 50% of the stylesheet. Is there any reason to use the whole stylesheet?


Passing arguments in add_action inside search template

I'm trying to pass a argument to the function. But it is not transmitted. var_dump produces `string'' (length = 0)` What am I doing wrong?               $map_vars = 'Test';          function map_data($data) {         var_dump($data);     }          add_action('wp_footer', 'map_data', 10, 1);     do_action( 'map_data', $map_vars );


AJAX vs Fragment Caching for W3 Total Cache

I'm running a WP site with WooCommerce and I want to do some caching. I'm going to exclude the pages such as the cart/checkout for obvious reasons however there are a couple of the things on the site I would like to stay dynamic and not be cached. An example is the number of items in the cart and there's also a block of html that displays differently whether you're logged in or not. So my question is, should I load these via AJAX or should I define them as fragments using mfunc? What are the advantages and benefits for each and which one is recommended for this task? Cheers


homepage olderposts link showing page not found

I am using WordPress 3.5.1 version, now I had a problem with `olderposts` link present at bottom of homepage. it is ok with rest of the category pages. I am working on this problem since last two days, please somebody help me i changed the `settings > reading`, changed `htaccess` but the problem was not solved. I deactivated all the plugins and it didn't solve the problem. i need somebody to help me. my permalink structure is: `http://www.orclage.com/sample-post/` my website name: http://www.orclage.com when i click olderposts the page is moving to http://www.orclage.com/page/


CSV file header

What would be the CSV file header, (to import into WordPress), to show the category and subcategory of each post, and how would be the content, for that header? I´m using the plugin "CSV Importer".


data-type="" ... needed post tags stripped of characters

So I am trying to generate a list of post tags on the data-type attribute but I need them to be sanitized so spaces are replaced with underscores and there are no special characters... really struggling with it.
                          <?php                       query_posts(array( 'post_type' => 'work', 'posts_per_page' => '-1', 'orderby'=>'title','order'=>'ASC'));                       if ( have_posts() ) : while ( have_posts() ) : the_post();                     ?>                              <aside class="work_item" data-id="id-<?php the_id(); ?>" data-type="     <?php         $posttags = get_the_tags();             if ($posttags) {                 foreach($posttags as $tag) {             $tag = preg_replace('/[^A-Za-z0-9-]+/', '_');             echo $tag->name . ' ';           }         }     ?>">

                                         <?php echo get_the_post_thumbnail($post_id, 'Work Gallery', array('class' => 'lazy', 299,299)); ?>

<?php the_title(); ?>

<?php echo excerpt(25); ?>
                                         <?php                                             if( has_tag() ) {                                                 // IF THE POST HAS TAGS                                                 the_tags('
', '.

', '.
');                                             }                                             else {                                                 // IF NO TAGS                                             }                                         ?>

<a class="tooltip" title="full details" href="<?php echo the_permalink(); ?>">View All

<a rel="prettyPhoto[mixed]" class="expanded tooltip" title="preview" href="#prettyPhoto-<?php the_id(); ?>">Expand

                                             <?php if (has_post_thumbnail( $post->ID ) ): ?>                                             <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' ); ?>                                                 <a class="work_lb tooltip" title="view in lightbox" href="<?php echo $image[0]; ?>" rel="prettyPhoto">Lightbox                                             <?php endif; ?>

                                    Any help would be greatly appreicated.


Change Wordpress.org hosted plugin readme.txt

is it possible to change the readme.txt of a plugin that is hosted at `http://wordpress.org/extend/plugins/plugin-name` without tagging a new version? I would like wordpress.org to show the new readme.txt. I have added a link to the plugin documentation but I do not want to force the users of updating their version because of this change.


Can I generate then display a mixed list of linked and unlinked terms

Does anyone know a straightforward way to display a mixed list of linked and unlinked (custom) terms, dependent on whether there is more than one instance of a term being used? i.e. I have an item that may have three or four terms within a taxonomy. Of these terms, two or three may have also been applied to other items, but one or more only to that item. I want to display a list of terms for the item where if the term is used for other items, it's a link to a list of these, but if the item is the only one with that term, it isn't a link. (Object being to not provide a link if that link will only show the one item already being viewed!) Therefore I can't (I don't think) just use _get_the_term_list_ because this provides a linked list of all terms, regardless of how many instances of a term there are. I've got something working using _wp_get_object_terms_ where there's only one term from a custom taxonomy assigned to a post, but I need to do the same thing where there are multiple terms, some of which should be links and some not. I'm sure it would be possible by working out some long and clever script, but I was wondering if anyone knows an easy way [ not that I'd object if someone has already worked out the long and complex script and can point me to it! :-) ] I guess an alternative would be a fairly complex script but defined as a function, so the script itself is only entered once and I can use something simple each time I need it, but learning how to create functions from scratch is a challenge I've not taught myself yet! If it helps with understanding - i.e. I haven't explained myself as well as I thought! - you can see an example of the challenge here. The BP tag, for instance, links to a list of items tagged BP ... but the list consists only of the one item a visitor was already viewing. The surveys tag used further down, links to a list where the original item is only one of two with that term. Any help / suggestions really appreciated! :-)


Enqueue script/style with multiple GET parameters

I am trying to enqueue a style with two GET parameters, but the output is not correct. Here's what I have:               wp_enqueue_style('colors-css', '/root/assets/css/colors.css?style=blue');      The problem is, when it's rendered to the browser, it looks like this:               http://domain.com/root/assets/css/colors.css?style=blue&ver=3.9      It seems when there is already one parameter defined in the URL, Wordpress does not know how to add the version correctly with the `&` symbol. Any ideas how to correct this?


2 loops, is_home won't work, count is off

Alright, I've made a bunch of themes over the years, and I've written a lot of queries. And I just realized that I apparently have no clue how to get multiple queries to behave. So, here is the loops from my index.php:                       <?php do_action( 'voodoo_pre_loop' ); ?>                  <?php if( is_home() ) : ?>                      <?php $args = array(                     'posts_per_page' => 1,                     'post__in' => get_option( 'sticky_posts' ),                     'ignore_sticky_posts' => 1                 );                 $my_query = new WP_Query( $args );                 while ($my_query->have_posts()) : $my_query->the_post();                 $do_not_duplicate = $post->ID; ?>                 <?php get_template_part( 'content', 'featured' ); ?>                 <?php endwhile; ?>                      <?php if ( is_active_sidebar( 'sidebar-2' ) ) : ?>                         <?php dynamic_sidebar( 'sidebar-2' ); ?>                 <?php endif; ?>                      <?php $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;                 $more_args = array(                     'posts_per_page' => 9,                     'post__not_in' => get_option( 'sticky_posts' ),                     'paged' => $paged                 );                 query_posts( $more_args ); ?>                  <?php endif; ?>                  <?php if ( have_posts() ) : ?>                      <?php voodoo_content_nav( 'nav-above' ); ?>                      <?php while ( have_posts() ) : the_post();                 if( $post->ID == $do_not_duplicate ) continue; ?>                          <?php $format = get_post_format();                     if ( false === $format )                         $format = 'standard';                         get_template_part( 'content', $format ); ?>                      <?php endwhile; ?>                      <?php voodoo_content_nav( 'nav-below' ); ?>                  <?php else : ?>                      <?php voodoo_else(); ?>                  <?php endif; ?>      So, what I expected to have happen, was to have a loop. It would just grab one post. If there was a sticky, we'd grab it. If not, then the most recent post. That would always farm out to content-featured for the display. This loop seems to work. I get a stick / or not if there aren't any. And content- featured is called. This is all in the is_home, because I only want it to happen on the home/ front page. Still in is_home is a widget area. That ain't complicated. Next up, a second loop. My logic, the query was still inside the is_home. On the front page, I wanted 9 posts, never any stickies, no duplicates of that first post. On subsequent pages, I figured I didn't need that query. I just want all the other pages to show my standard 10 posts. No featured thing, no sidebar, etc. So where this seems to get me, is that first post, the widget, and a mess. That second area, I only ever get 7 posts. On subsequent pages, I still get that first featured loop which I don't want. And I only get 8 posts. I have read all over the internet, and I'm obviously not grasping something. Any ideas: Why is_home or is_front_page won't work here? Why I can't get my numbers right? (1+9 posts is home, 10 posts remaining pages) I'd love a little help here so I can understand this all a bit better. Thanks!


How to: PHP Log Out Link?

I originally came here to find help on creating a string of text that would display a login link, and when the user was logged in it would should their username. Travis Pflanz had the answer for another user, which works great but I'd like to expand on it further and add a log out link after the user display name when logged in. My PHP experience is extremely low and rely on copy/pasting code. Any help would be greatly appreciated!


Restrict admin access to certain pages for certain users

As the title says, I'd like to restrict back-end access to certain pages for certain users. While doing a site with 45-50 pages, I realised it would be a much better user experience if the Page menu only listed those pages which the user should be able to change/update. I've tried the plugins below to no avail. Advanced access manager has the functionality but does not work/is buggy on 3.5.1. http://wordpress.org/extend/plugins/advanced-access-manager http://wordpress.org/extend/plugins/role-scoper http://wordpress.org/extend/plugins/adminimize http://wordpress.org/extend/plugins/s2member Code snippet in functions.php?


Front end posting

This source works with image upload. Without image upload, it works, but 'redirect' doesn't work. What should I do?? Any suggestions to what the problem might be?                   if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) &&  $_POST['action'] == "new_post") {              // Do some minor form validation to make sure there is content         if (isset ($_POST['post_title'])) {             $title =  $_POST['post_title'];         } else {             echo 'Please enter a game  title';         }         if (isset ($_POST['description'])) {             $description = $_POST['description'];         } else {             echo 'Please enter the content';         }              $new_post = array(             'post_title'    => $title,             'post_content'  => $description,             'post_status'   => 'publish',             'post_type' => 'property',               'tax_input' => array( 'property_type' => array($property_type), 'suburbs' => array($suburbs) )          );                   //save the new post and return its ID         $pid = wp_insert_post($new_post);         update_post_meta($new_post_id, 'tax_input', $property_type);         update_post_meta($new_post_id, 'tax_input', $suburbs);              //insert custom fields         update_post_meta($pid,'property_lease',$_POST['property_lease']);          update_post_meta($pid,'lost_found_date',$_POST['lost_found_date']);         update_post_meta($pid,'dog_sex',$_POST['dog_sex']);         update_post_meta($pid,'address',$_POST['address']);         update_post_meta($pid,'price',$_POST['price']);                       //add thumbnail             if (!function_exists('wp_generate_attachment_metadata')){                     require_once(ABSPATH . "wp-admin" . '/includes/image.php');                     require_once(ABSPATH . "wp-admin" . '/includes/file.php');                     require_once(ABSPATH . "wp-admin" . '/includes/media.php');                 }                  if ($_FILES) {                     foreach ($_FILES as $file => $array) {                         if ($_FILES[$file]['error'] !== UPLOAD_ERR_OK) {                             return "upload error : " . $_FILES[$file]['error'];                         }                         $attach_id = media_handle_upload( $file, $pid );                     }                    }                  if ($attach_id > 0){         $post = get_post($pid,'ARRAY_A');         $image = wp_get_attachment_image_src( $attach_id );         $image_tag = '<img src="'.$image[0].'" width="'.$image[1].'" height="'.$image[2].'" />';              //add image above the content         update_post_meta($pid,'_thumbnail_id',$attach_id);              //add image under the content         //$post['post_content'] = $post['post_content'] . $image_tag;             }                   $url = get_permalink( $pid );         wp_redirect($url);         exit();     }


How can I have a full comments.php for an easy editing of all its aspects?

Is there a way to get the full code of the comments.php instead of the one I have with any recent theme where I just can edit few parts of it? I know it's encoded but I wonder if there's a chance to get the full code, replace the one in commments.php with the new one and then apply all my editing to it... Thanks


Loop don't work within single.php page

I have this code below within the loop               <?php if (have_posts()) : ?>     <?php while (have_posts()) : the_post(); ?>

<a href="<?php the_permalink(); ?>"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_post_thumbnail(array(100,80)); ?>

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

<?php content('11'); ?>

<img src="<?php bloginfo('template_url'); ?>/images/tb_clock.png" /><?php the_time('F j, Y'); ?> at <?php the_time('g:i a'); ?> : <?php the_category(', ') ?>

           <?php endwhile; ?>     <?php endif; ?>      I have 5 posts in my blog the loop is work perfectly in home page and show all five posts without any problem but when I use same code within same loop in `single.php` page only show one post and don't show other four posts


wp_handle_upload returns empty error array

I am trying to do an upload via ajax and really dont want to use the regular wordpress media uploader. It is too much stuff and all i want to do is upload single image. I have everything working the ajax is sending the uploaded file via this Jquery plugin LINK I got it all set up and isn't the problem. Here is my function that is being called to upload however i always am returned this error message.                   if ( !empty($_FILES['files']) ) {             $daFile = $_FILES['files'];                  $upload = wp_handle_upload($daFile , array('test_form' => FALSE));             var_dump($upload);              }      and error message that is returned from $upload                  array(1) { ["error"]=> array(1) { [0]=> int(0) }}      Note I am using WPMU. I have checked online a ton about this but cant see why I am getting this blank error array... This is for a front end uploader for users. Does wp_handle_upload care about user privileges ie if logged in or not admin? if so what should I do to just upload this damn thing to the server? I just need the url link by the end of this function. Thanks!


automated import from blogger

I am looking for a way to make the Blogger importer tool run automatically to update a blog content category automatically. I appreciate that Google does not like duplicate content, but the site I am making will not be a site that only has duplicate content. What my client wants is a means of consolidating all their content across the web in to one place- a bit like the way you can make your facebook updates go to twitter etc. Part of this is their Blogger blog, but also they will be posting things like their Soundcloud music and their Youtube videos and all sorts of other stuff. The 'Blog' section of the site is only a small part of this and the posts imported from blogger will be accompanied by site specific posts. So just wondering if anyone has any smart ideas on how I could go about achieving this? Is this something I would have to do with a Cron job, or maybe it could happen in the background when someone visits the home page? Any ideas most welcome :)


How to query custom post then display sections by meta value

This seems like an easy thing to do but I am missing something here. I have a custom post type called "recipient" and a meta check box called "`yes_current`" - (we help children with cancer and run events for them so we need to know who is a current recipient and who is a past recipient.) We want to display two sections on our RECIPIENT page: CURRENT RECIPIENTS and PAST RECIPIENTS. My thought is to query the loop to get all of the `custom_post_types` that equal recipient, then display the featured image for all CURRENT recipients (if yes_current is ON) in the Current section, then do the same for PAST recipients in the Past section. Thank you guys! CODE:
CURRENT Recipients
          <?php $current_loop = new WP_Query(array('post_type' => 'recipient', 'posts_per_page' => '-1', 'yes_current' => 'on'));          if( $current_loop->have_posts() ): while( $current_loop->have_posts() ): $current_loop-the_post();           <?php get_the_post_thumbnail($page->ID, 'thumbnail'); ?>          <?php endwhile; endif; wp_reset_postdata(); ?>
PAST Recipients
          <?php $current_loop = new WP_Query(array('post_type' => 'recipient', 'posts_per_page' => '-1', 'yes_current' => 'off'));          if( $current_loop->have_posts() ): while( $current_loop->have_posts() ): $current_loop->the_post();           <?php get_the_post_thumbnail($page->ID, 'thumbnail'); ?>          <?php endwhile; endif; wp_reset_postdata(); ?>      ## Edit Custom post meta code:               $meta_boxes[] = array( 'id' => 'yes_current', 'title' => 'Current Recipient', 'pages' => array( 'recipient' ), 'context' => 'side', 'priority' => 'low', 'fields' => array( array( 'name' => 'Current Recipient', 'id' => "{$prefix}yes_current", 'type' => 'checkbox', // Value can be 0 or 1 'std' => 1, ), ),


Post count by meta_key meta_value

I have 100 posts to the ( states meta_key ), and different meta_value (AK,AR,CA,FL,HW,MN,SC,TX,MN,NJ). I want to show the post count on my site sidebar for posts AK-11 posts,AR-9 posts....


i am making text changes on my page show in preview not on live site, why?

I go into the admin back room on my site make text changes and hit preview changes and they show up, but when i go to the live site, they don't show at all. What am i missing, what should i be doing?


Display upcoming events in the next 30 days by querying posts with timestamp in custom meta

I have a custom post type "event" which stores a custom meta as a timestamp ($event_date). The date is always in a dd-mm-yyyy format, so I can generate a unix timestamp from this key. The timestamp doesn't match the pubdate, it's just any date set in the future. I'd like to make a wp query to list all upcoming posts (events) ie comparing present time with these timestamps and ordering the posts accordingly (show upcoming first, closer to present date). Pubdate should be disregarded; if date is ambiguous (if two events have same $event_date), then order them alphabetically or whatever. I would like also to be able to query only the events occurring in the next 30 days. I'm going to try this, but I'm wondering if there's a better way to do, because I don't know how to get only the posts scheduled within 30 days from now:               query_posts(array(         'posts_per_page' => 30,             'meta_key' => 'event_date',         'meta_value' => date(Y-m-d), // I could use directly unix timestamps         'meta_compare' => '>',             'orderby' => 'meta_value',             'order' => 'ASC'     ));      this should sort the posts with the posts occurring in the future first... howerver that doesn't necessarily mean they will be 30 days from now; suppose I want already to publish something that is going to happen in 60 days or next year... How to set a costraint for the query to display only the posts occurring in the next 30 days or any set amounts of days/period?


Adding a dropdown list box to the comments page

I'm creating a plugin that will add a dropdown list box as an additional field on the comments page. The data in the dropdown is not being added to the MySQL database. Can someone take a look at my code to see what the problem might be? Here is the code from my extendcomment.php plugin:               <?php          // Add custom meta  fields to the default comment form     // Default comment form includes name, email address and website URL     // Default comment form elements are hidden when user is logged in          add_filter('comment_form_default_fields', 'custom_fields');     function custom_fields($fields) {          $commenter = wp_get_current_commenter();     $req = get_option( 'require_name_email' );     $aria_req = ( $req ? " aria-required='true'" : '' );          $fields[ 'author' ] = '
'.         '' . __( 'Name' ) . ''.         ( $req ? '*' : '' ).         '<input id="author" name="author" type="text" value="'. esc_attr(                   $commenter['comment_author'] ) .         '" size="30" tabindex="1"' . $aria_req . ' />
';          $fields[ 'email' ] = '
'.         '' . __( 'Email' ) . ''.         ( $req ? '*' : '' ).         '<input id="email" name="email" type="text" value="'. esc_attr( $commenter['comment_author_email'] ) .         '" size="30"  tabindex="2"' . $aria_req . ' />
';          $fields[ 'industry' ] = '
'.         '' . __( 'Industry' ) . ''.         ( $req ? '*' : '').         '<input id="industry" name="industry" type="text" size="30"  tabindex="3"'. $aria_req .' />
';          $fields[ 'url' ] = '
'.         '' . __( 'Website' ) . ''.         '<input id="url" name="url" type="text" value="'. esc_attr( $commenter['comment_author_url'] ) .         '" size="30"  tabindex="4" />
';                    return $fields;     }          // Add fields after default fields above the comment box, always visible          add_action( 'comment_form_logged_in_after', 'additional_fields' );     add_action( 'comment_form_after_fields', 'additional_fields' );          function additional_fields () {     $req = get_option( 'require_name_email' );     $aria_req = ( $req ? " aria-required='true'" : '' );     echo '
'.         '' . __( 'Industry' ) . '' .         '<select name = "industry" id="industry">' .         '<option value="Commodities/Basic Materials">Commodities/Basic Materials</option>' .         '<option value="Conglomerates">Conglomerates</option>'.         '<option value="Consumer Goods">Consumer Goods</option>'.         '<option value="Healthcare">Healthcare</option>'.         '<option value="Industrial Goods">Industrial Goods</option>'.         '<option value="Services">Services</option>'.         '<option value="Technology">Technology</option>'.         '<option value="Utilities">Utilities</option>'.         '</select>'.         '
';          add_action( 'comment_post', 'save_comment_meta_data');     function save_comment_meta_data( $comment_id ) {         if ( ( isset( $_POST['industry'] ) ) && ( $_POST['industry'] != '') )             $industry = wp_filter_nohtml_kses($_POST['industry']);         add_comment_meta( $comment_id, 'industry', $industry );               }     // Add the filter to check if the comment meta data has been filled or not          add_filter( 'preprocess_comment', 'verify_comment_meta_data' );     function verify_comment_meta_data( $commentdata ){         if( !isset( $_POST['industry'] ) )             wp_die( _( 'Error: You did not add your industry. Hit the back button and   resubmit your comment with your industry.'));          }     // Add an edit option to comment editing screen          add_action( 'add_meta_boxes_comment', 'extend_comment_add_meta_box' );     function extend_comment_add_meta_box() {         add_meta_box( 'industry', __( 'Comment Metadata - Extend Comment' ),   'extend_comment_meta_box', 'comment', 'normal', 'high' );     }          function extend_comment_meta_box ( $comment ) {         $industry = get_comment_meta( $comment->comment_ID, 'industry', true );         $title = get_comment_meta( $comment->comment_ID, 'title', true);         ?>
             <?php _e( 'Industry' ); ?>             <input type="text" name="industry" value="<?php echo esc_attr( $industry );  ?>" class="widefat" />

             <?php _e( 'Comment Title' ); ?>             <input type="text" name="title" value="<?php echo esc_attr( $title ); ?>"  class="widefat" />
          <?php     }          // Update comment meta data from comment edit screen          add_action( 'edit_comment', 'extend_comment_edit_metafields' );     function extend_comment_edit_metafields( $comment_id ) {         if( ! isset( $_POST['industry'] ) || ! wp_verify_nonce( $_POST['industry'], 'industry' ) ) return;              if ( ( isset( $_POST['industry'] ) ) && ( $_POST['industry'] != '') ) :             $industry = wp_filter_nohtml_kses($_POST['industry']);             update_comment_meta( $comment_id, 'industry', $industry );         else :             delete_comment_meta( $comment_id, 'industry');         endif;              if ( ( isset( $_POST['title'] ) ) && ( $_POST['title'] != '') ):             $title = wp_filter_nohtml_kses($_POST['title']);             update_comment_meta( $comment_id, 'title', $title );         else :             delete_comment_meta( $comment_id, 'title');         endif;               }                    }


How to login with email only no username?

After searching for a couple of days and reading 2 year old threads I'm having difficulty finding a solution to the problem of having users login by email only. At first I was delighted to see WP_Email_Login only to find out you can still use your username to login. I'm not sure how to go about writing this as a plugin. My idea is to override the register_new_user function. I didn't see this on the "pluggable" functions list. Can I use filters/action do accomplish this? I realize it's not fashionable to edit the core files so I'm hoping a solution is out there however if one does not exist I'll take my chances. In the first line of the "register_new_user" function in wp-login.php I can add:               $nickname_variable(??) = $user_login // set the nickname to the username     $user_login = $user_email; // set the user_login/username to the email address      This works quite nicely since WordPress doesn't allow people to change their username. In the Register Screen (form) it asks for the Username & Email; I'd like to set the Username to the Nickname variable (if someone can tell me what the nickname variable is called or where it's set during registration that'd be appreciated). Cheers, Smith


How to select posts from one category but exclude posts in another category?

I am trying to select posts that have category id `4` but exclude posts that also have category id `2` Here's what i'm trying               $query = new WP_Query(array(       "cat__in"         => array(4),       "cat__not_in"     => array(2),       "post_type"       => "post",       "post_status"     => "publish",       "orderby"         => "date",       "order"           => "DESC",       "posts_per_page"  => $limit,       "offset"          => 0     ));      However, it's not making the proper selection. What am I doing wrong?


Where is the User's Admin Bar Preference stored? I want it to default to off for new users

In the `profile.php` admin page there is a checkbox for the _Toolbar_ : **Show Toolbar when viewing site**. I can't seem to find where this option is stored in the database. I would have thought it would be in the `wp_usermeta` table ... but I don't see it. My goal is to set the default value of this to "off" for new users. Then, of course, they would have the option to turn it on if they wanted.


Inserting Hundreds of Thousands of Posts at Once

I have a project in which I create an array of 200k+ lines w/ 25 fields that run the wp_insert_post and update_post_meta. To start it processes pretty fast the slows down a lot after 10k records or so. Is there a more efficient way to do this? Is there a MySQL stored procedure that exists so I can create these posts directly using SQL queries and skip the PHP?               echo "get list of posts to be created in wordpress \n";     //RETURNS ALL OFFER DATA OF POSTS THAT NEED TO BE ADDED     $sql = "SELECT a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z FROM offer WHERE modified = '1';";     $rst = $wpdb->get_results($sql,ARRAY_N); //run query     if(is_null($rst)){       echo mysql_error() . "\n";     }else{       echo "done \n";     }     echo "creating posts \n";;     foreach($rst as $r){       //print_r($r);       $my_post = array(            'post_title' => $r[0],            'post_status' => 'publish',            'post_author' => 72,            'post_category' => array(16)         );            // Insert the post into the database       $newOffer = wp_insert_post( $my_post );            if(!$newOffer){         echo "problem creating the post " . $r[0];       }            array_unshift($r,$newOffer); // so that the data positions matches when calling updateMetaData             if($newOffer){         updateMetaData($newOffer,$r);       }     }          function updateMetaData($id,$data){       global $wpdb;       $category = $wpdb->get_results('SELECT categoryName FROM category WHERE categoryIdentifier ="'.mysql_escape_string($data[8]).'"');       if($category){         wp_set_object_terms( $id, array($category[0]->categoryName,16), 'category');       }            update_post_meta($id,'a','yes');       update_post_meta($id,'b',$data[1]);       $year = substr($data[2],0, -4);       $mon = substr($data[2], -4, 2);       $day = substr($data[2], -2);        update_post_meta($id,'c',$mon."/".$day."/".$year." 12:00:00 AM");       $year = substr($data[3],0, -4);       $mon = substr($data[3], -4, 2);       $day = substr($data[3], -2);        update_post_meta($id,'d',$mon."/".$day."/".$year." 12:00:00 AM");       update_post_meta($id,'e',$data[4]);//description       update_post_meta($id,'f',$data[5]);       update_post_meta($id,'g',$data[6]);       update_post_meta($id,'h',$data[7]);       update_post_meta($id,'i',$data[8]);       update_post_meta($id,'j',$data[9]);       update_post_meta($id,'k',$data[10]);       update_post_meta($id,'l',$data[11]);       update_post_meta($id,'m',$data[12]);       update_post_meta($id,'n',$data[13]);       update_post_meta($id,'o',$data[14]);       update_post_meta($id,'p',$data[15]);       update_post_meta($id,'q',$data[16]);       update_post_meta($id,'r',$data[17]);       update_post_meta($id,'s',$data[18]);       update_post_meta($id,'t',$data[19]);       update_post_meta($id,'u',$data[20]);       update_post_meta($id,'v',$data[21]);       update_post_meta($id,'w',$data[22]);       update_post_meta($id,'x',$data[23]);       update_post_meta($id,'y',$data[24]);       update_post_meta($id,'z',$data[25]);       $year = null;       $mon = null;       $day = null;       //echo "wordpress post meta updated.\n";     }


wp_query not resetting, last post hanging

im creating a wordpress query for custom taxonomy. However im unable to get the last post that i queried to go to the permalink. Please could somebody help me get this query right, much appreciated in advance.               <?php     /*     Template Name: taxonomy-slug     */     ?>           <?php get_header(); ?>            <?php $loop = new WP_Query( array( 'post_type' => 'business', 'town' => 'cpt-cuisine', 'posts_per_page' => -1 ) ); ?>     <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>

          <a href="<?php the_permalink(); ?>">          <img style="margin-left: 0px; height: 65px;" alt="sample" src="<?php the_field('business_logo'); ?>" align="left"/>
<?php the_title(); ?>

<?php the_field('business_slogan'); ?>

     <?php endwhile; ?>          <?php wp_reset_query(); ?>          <?php get_footer(); ?>      kind regards


How do i place same widgets multiple time by default on theme activation?

I am creating a portfolio theme and want to place some widgets on sidebar by default on theme activation. I did it but the problem is that, I want to place Text widget two times at the same sidebar say at primary sidebar but somehow my 2nd widget is not saved/ placed. What should I do?               $sidebars_widgets = array();     $text = array();          $text[0] = array( "title"         =>    'Special Offers',         "text"        =>    'Super Discount offers for everyone. 25% Discount. Come, visit our Hotel at a special discounted rate.', );          $text[1] = array( "title"         =>    'Offers 2',      "text"        =>    '25% Discount. Come, visit our Hotel at a special discounted rate.',   );          $text['_multiwidget'] = '1';          update_option( 'widget_text', $text );     $sidebars_widgets[ "primary-sidebar" ] = array("text-{$text[0]}","text-{$text[1]}");     update_option( 'sidebars_widgets', $sidebars_widgets );


Having some trouble with "List Category Posts" plugin

I'm trying to use this plugin on my site, unfortunately I'm having to call these short codes in my template files like so:               echo do_shortcode('[catlist id=1]');      However, it doesn't seem to be working like I need it to When I place that code at the top of my template file, it literally just echos out the title of the article. For example I'm running a hearing loss blog, and for my tinnitus category page I place this code in there:               echo do_shortcode('[catlist name=tinnitus]');      and I see this at the top of the category page:               Ringing, Buzzing, or Chirping Sound in Your Ears?     Tinnitus – What IS that Ringing in My Ears??     Constant Ringing in Your Ears?     Dizzy? You’re Not Alone!     Tinnitus: What’s that ringing in my ears?!       so its just echoing out the titles of the posts at the top of the page... What am I doing wrong here, and how can I get these short codes to work in my template files? also, lets say I wanted to do something like this:               $category_id = get_cat_ID('Hearing Aids'); echo do_shortcode('[catlist id='.$category_id.' numberposts=1]');      would something like that work? I REALLY appreciate any help guys :) Thanks in advance


why the same code got different results when using query_posts in functions.php and index.php

I am using WordPress 3.5, and my blog sites have many registered users. After they log in, I want them to see just their own posts, not others. So I added this to my `functions.php`, but I get a blank page.               function only_login_user_post_on_homepage() {         $current_user = wp_get_current_user();         query_posts('author=', $current_user -> ID);     }     add_action( 'pre_get_posts', 'only_login_user_post_on_homepage' );      So, I comment out the `add_action`, then go to `index.php`, add the same code:               $current_user = wp_get_current_user();     query_posts("author=".$current_user -> ID);      Yeah, got the results, I don't know why? The code are the same, but why I got different result.


Plugin to create forms using HTML

Until recently I've been using Custom Contact Forms to create some more advanced forms. The sole reason I've chosen this plugin was the ability to create my own layouts and basically just code clean HTML with CCF taking care of the rest. However, recently I came across this topic and realized how vulnerable the plugin might actually be. Therefore, my question is: is there any other safe Forms plugin that allows me to create my own HTML-based - not UI-based - forms? I'd be grateful for any suggestions. Edit: Since I don't want to expose the vulnerability (however obvious it is), a temporary solution is to hard-code the recipient e-mail in the plugin code itself. If anybody would like to do that find and edit: `/wp- contents/plugins/custom-contact-forms/custom-contact-forms-front.php line 427` and replace               $dest_email_array = $this->getDestinationEmailArray($_POST['destination_email']);      with               $dest_email_array = $this->getDestinationEmailArray('your@mail.com');      Other solutions I can think of, if you really are stuck with the plugin and have to use different e-mail recipients, is to use Advanced Custom Fields Plugin, to create page-dependent recipients, however, it's not a place to describe the quite lengthy process of doing so.


add_image_size and add_filter('image_size_names_choose', 'my_custom_image_sizes') not working with wordpress 3.5.2

I'm tearing my hair trying to get additional image sizes appear in the media section when i upload new pictures. It works on older versions of wordpress but i can't get it to work on v 3.5.2 Here's my code in the functions.php file and i'm using the underscores.me framework to build the theme.               /*         Custom image sizes     */          add_action('after_setup_theme', 'images_setup');          function images_setup() {              add_theme_support('post-thumbnails');              if (function_exists('add_image_size')) {             add_image_size('slider', 1170, 400, true);         }         // Getting these sizes to appear in the media section within wordpress         add_filter('image_size_names_choose', 'my_custom_image_sizes');              function my_custom_image_sizes($sizes) {             $custom_sizes = array(                 //'custom-post-thumbnail' => 'Custom Post Thumbnail',                 'slider' => 'Slider'             );                  return array_merge($sizes, $custom_sizes);         }          }


long blog post on self hosted wordpress blog not displayed

I have my self hosted wordpress blog here I recently created a blog post which is very long with so many pictures and text, but i suddenly found that my blog post was not displayed but if i cut short the length by deleting some content then the blog gets displayed can anyone help ? Thanks in advance here is the link to my blog post which is not getting displayed


How to Overwrite validate_plugin function

How can I overwrite the WordPress `validate_plugin` function. I need to disable that function alone for my plugin, and it should not affect any other plugin. I don't want the validate_plugin function for my plugin right now, I couldn't find a declared hook, `do_action` or `apply_filter`, within the function in the `wp-admin/includes/plugin.php` file.               <?php     function run_activate_plugin( $plugin ) {         $current = get_option( 'active_plugins' );         $plugin = plugin_basename( trim( $plugin ) );              if ( !in_array( $plugin, $current ) ) {             $current[] = $plugin;             sort( $current );             do_action( 'activate_plugin', trim( $plugin ) );             update_option( 'active_plugins', $current );             do_action( 'activate_' . trim( $plugin ) );             do_action( 'activated_plugin', trim( $plugin) );         }              return null;     }     run_activate_plugin( 'plugin/subfolder/plugin.php');          ?>      If i activate the plugin from subfolder it got deactivate because of that above function. So that the reason i want to disable the validate_plugin function for my plugin alone.               run_activate_plugin( 'plugin/subfolder/plugin.php');      Generally run_activate_plugin argument is to be look like               run_activate_plugin( 'akismet/akismet.php');      But now i am doing activate the plugin from subfolder like this way               run_activate_plugin( 'akismet/newfolder/akismet.php');      Any suggestions?


Powering only a subfolder with WordPress on a LAMP stack with an nginx reverse proxy

[I just posted this on the WP Forums, too, before anyone starts Googling and saying that this is posted somewhere else] I'm hoping this isn't a duplicate, but I've been searching here and Googling and I haven't been able to find anything. I'm currently running a web server that constitutes nginx as both a front-end proxy to a LAMP stack and the web server for static sites. I'm working on some development for a site that will be powered by WP. Currently, mysite.com is served up by nginx as a static site. The WP install will be served out of a subfolder, mysite.com/sub. The document root for the nginx server (the static files) and the document root for the Apache server (all dynamic content, and also where the WP files are currently installed) are NOT the same directory. I want to install WP in mysite.com/sub so that only this subdirectory is powered by WP while completely ignoring the root of my site but all of the articles I have read discuss using WP to power the root while simply installing the files elsewhere. It took me forever to write all the correct proxy passing rules in my nginx configuration just to make the installation happen properly, and that is all good and well, but WordPress is operating out of mysite.com instead of mysite.com/sub and I'm not 100% sure what the easiest way to fix this is, since mysite.com isn't powered by Apache and so there are no PHP or .htaccess files to tinker with in the root of that directory. I realize that this is sort of rambling and difficult to explain, I'll be happy to provide answer to any questions for anyone that thinks they can point me down the right path. I would prefer to use this structure instead of using a subdomain, so if anyone out there has any suggestions I'd really appreciate it.


Search custom post type by meta data

I have a custom post type 'Property' which my users need to be able to search by meta data. I have 3 search functions - 2 on the frontend 1 in the admin area - 2 of which are running as expected and one which doesn't seem to be filtering results at all. I think there may be a problem with either my definition or usage of custom query_vars. In my functions.php I have the following:               function add_query_vars($public_query_vars) {         $public_query_vars[] = 'bedrooms';         $public_query_vars[] = 'type';         $public_query_vars[] = 'location';         return $public_query_vars;     }     add_filter('query_vars', 'add_query_vars');          function meta_search_query($query) {              $query_args_code = array(           'posts_per_page' => 5,           'post_type' => 'nc_property',           'meta_key' => 'nc_code',           'meta_value' => $query->query_vars['s'],           'meta_compare' => 'LIKE'         );                   $query_args_meta = array(             'posts_per_page' => -1,             'post_type' => 'nc_property',             'meta_query' => array(                 'relation' => 'AND',                 array(                     'key' => 'nc_bedrooms',                     'value' => $query->query_vars['bedrooms'],                     'compare' => 'LIKE'                 ),                 array(                     'key' => 'nc_type',                     'value' => $query->query_vars['type'],                     'compare' => 'LIKE'                 ),                 array(                     'key' => 'nc_location',                     'value' => $query->query_vars['location'],                     'compare' => 'LIKE'                 )             )         );              if (is_admin() && $query->is_search ) {             query_posts($query_args_code);              } elseif (!is_admin() && $query->is_search ) {             if ($_REQUEST["which_form"] == 'meta_form') {                 query_posts($query_args_meta);                  } elseif ($_REQUEST["which_form"] == 'code_form'){                 query_posts($query_args_code);                  }         }       }     add_filter( 'pre_get_posts', 'meta_search_query');      Searching by the property code works no problem at all in both the frontend and backend however trying to filter results by the custom query vars - location, type and bedrooms - falls flat everytime. An example query string which is created is as follows:               /property/?post_type=nc_property&which_form=meta_form&bedrooms=Two&type=Apartment&location=Bahceli      There is one property on the site which matches those details but WordPress returns all results each time. Have I missed something? EDIT: It turns out that because my search form for my meta queries was not using an element with `'s'` as its name the `$query->is_search` condition of my if statement was returning false, meaning my meta_query simply wasn't being called. Kudos to fischi for spotting this for me! :D


Removing Image Sizes for Custom Post Type

_I'm trying to go about this without the use of a plugin, but actions and filters_ Is there a way to remove extra image sizes generated by WordPress based on the Custom Post Type? I've been trying to work with the `intermediate_image_sizes_advanced` filter but it doesn't look like it has access to `$post` or `post_type`. So I'm using the function like so:               function filter_image_sizes($sizes) {         global $post;         global $post_type;              if($post->post_type == 'cpt_slides' || $post_type == 'cpt_slides'){             unset( $sizes['thumbnail']);             unset($sizes['medium']);             unset( $sizes['large']);         }              return $sizes;     }     add_filter('intermediate_image_sizes_advanced', 'filter_image_sizes');      **The Reasoning / Situation** I've created a Slides Custom Post Type (like an Image Slider) that uses the Featured Image to allow the user to upload "Slides". I also have a few custom image sizes, but one specifically for the slides alone. Since the slide images are going to be one static size, I don't want WordPress to generate all these extra image sizes I'll never use, hence the question.


Add container to nav_menu sub menu

Is there a way I can wrap a div around wp_nav_menu's ul.sub-menu So for example the markup would go from

Item 1

             Item 2

Item 1

Item 1

Item 1

Item 1

      to this

Item 1

             Item 2

Item 1

Item 1

Item 1

Item 1

      Where "sub-menu-wrap" is the custom div. Is this possible?


the_author_meta not resetting

I'm looping through posts normally. I want to display the author ... simple `<?php the_author(); ?>` gives me "Patrick Daly". Nah, I just want the first name, so I use `<?php the_author_meta( 'first_name' ); ?>` and now I get .... "John"??? So the actual author of the post is "Patrick Daly" -- whose user account has all the correct information in it (nothing about John). The loop seems to not be clearing "John's" meta and continues to reuse it. It does it's job when using `the_author();` though. Anything I need to be doing to clear `the_author_meta();`? Here's what each function outputs on a single post (where the values in the database don't have John Doe):                          the_author_meta( 'ID' ); : 1        the_author_meta( 'first_name' ); : John         the_author_meta( 'last_name' ); : Doe      the_author_meta( 'display_name' ); : Patrick Daly                           the_author(); : Patrick Daly      This is a really `if( have_posts() )` query, but I've tried `wp_reset_postdata()` and of course it didn't work.


How to handle complex data with Settings API

I hope my question isn't out of the scope of this website and that someone can help me with it. I'm currently studying the WP Settings API and I'm wondering how to create a form management section which will allow you to do the following:   * Create fields   * Delete fields   * Change field properties (type, default value, etc)   * Change order of fields I do know how to create the mentioned form and all the features, I`m just not sure about the correct way to save the desired form format (fields order, field properties). First thing that came to my mind was to create hidden fields and modify their values using javascript but something tells me that there should be a better solution for this situation. Any suggestion is appreciated!


Display a Page of Results from Multiple Taxonomy Queries

I created a theme for a client with three CPTs and a Custom Taxonomy for each CPT. It is currently set up as CPT > North, South, East, West Each CPT has the same categories > activities, dining, events, & shopping Currently visitors to the site can view the Activities for each Region i.e. show all North Region Activities, or all South Region Dining, etc. The client wants to add a global page which show ALL ACTIVITIES for ALL REGIONS, ALL DINING for ALL REGIONS, etc. I need to build a query which first loads each CPT, and then grabs all posts in the "Activity" category. This is what I have so far, which is not working.                   $myquery['tax_query'] = array(             'relation' => 'OR',                 array(         'taxonomy' => array('north_category', 'south_category', 'east_category',  'west_category'),         'terms' => array('actvities'),         'field' => 'slug',             ),         );         query_posts($myquery);      Any help/examples/solutions are much appreciated!


controlling whether upload is attached to post or not

I'm using the new (3.5+) media upload API to open a media modal dialog from a post meta box, and select a file from the media library (as per https://github.com/thomasgriffin/New-Media-Image-Uploader). I need to control whether or not files uploaded through this dialog are attached to the current post or not. I'm looking through media-views.js and can't see anything to control this. Any ideas?


Placeholder text for registration form

I am trying to add placeholder text to the native WordPress registration form. I am currently using the Register Plus Redux plugin. How to add this placeholder text into the text input fields on the form? I need to tell people to use their first and last name as the username. I'd be stoked if someone could help me out.


How i can upload images to another folder?

If I go in `Dashboard -> Settings -> Media` I don't see field where I can change upload folder. Is it possible now? For example my website is `myblog.tld`, by default all media content uploads into `wp- content/uploads/year/month`. I want uploads all media to `sub.myblog.tld/year/month` Thanks for advance. PS WP 3.5, Sorry for my english.


Query pulling a single post per month

I am trying to only show a single post per month on a query. I can set the date as a variable and use something like the php array_unique function to check the dates and only echo out unique ones, however this feels a bit 'hacky'. Is there a built in query variable, or something built in WordPress I can use instead? As for the 'hacky' option, I am quite new with PHP and struggling with using the aforementioned function. Checking the date is unique and only echoing out said variables when it is already inside a while loop is confusing me somewhat. Below is the query I am using currently.               <?                  $news_archive = array(                   'post_type'=> 'news',             'posts_per_page' => 6,             'orderby' => 'date'         );              query_posts($news_archive);                    echo '
';                 while ( have_posts() ) : the_post();                    $date = the_date('F m Y','','',false);             $date = explode(' ', $date);                      $month_str = $date[0];             $month_int = $date[1];             $year = $date[2];                              echo '
';             echo $month_str . ' ' . $year;                       echo '
';                   endwhile;                       echo '
';                 endif;              wp_reset_query();           ?>


Can't update WP Editor after Ajax

I want to update the WP Editor textarea after Ajax, but it does not work. I have the following in my Ajax success function:               $('input#pn').val(response.name);          $('select').val( response.category_name );          $('textarea#pd').val(response.description);          $('textarea#ld').val(response.long_description);      `ld` is the id of the `wp_editor` textarea. The first three work but the fourth one is `wp_editor`.


wp_get_archives() output

Iv got this code in my blog.php:               <?php wp_get_archives( array( 'type' => 'monthly', 'limit' => 12 ) ); ?>      It links to: > /2013/01 My page only loads the header and footer - I think its the main loop - what do I have to do, do I need another file?   Or say where to output the code? Thanks..


How to load dynamic option with ajax

Basically I'm creating an options page in which the user will click on a button to display a text input field, which will then be populated by the user with a name. This name will be then saved into the db using ajax (all that's working already). The user will be able to as many names she/he wants. At the moment, as a feedback to the user, I'm adding a list with the names that were previously saved with jQuery, however I'd like to load the options from the db to check whether the info collected by jQuery is correct. I've been doing some research and it seems the way to do it is to use `wp_localize_script` which I'm finding it cumbersome to load dynamically created data. Is using `wp_localize_script` the correct way to do it or should I just make an ajax call as you'd normally do?


PHP/MySQL issues when running WP on EC2 cloud

I am trying to create a wordpress blog on an Amazon EC2 instance. The amazon base image had apache and php already installed. I installed MySQL manually in my user directory. I am able to login to the MySQL database from linux command line. But I am not able to connect to the MySQL db from php. The scenario I tested was the following. I have a php file which I host through apache. When I open that php file in a browser; the MySQL connection fails. The following is the message in the browser               Error establishing a database connection          This either means that the username and password information in your wp-config.php file is incorrect or we can't contact the database server at xxx.xxx.compute-1.amazonaws.com:port. This could mean your host's database server is down.              Are you sure you have the correct username and password?         Are you sure that you have typed the correct hostname?         Are you sure that the database server is running?      My question is. Is it incorrect to manually install MySQL when php has already been installed? I mean is it recommended to compile-install the php with mysql first? **EDIT** php/apache was already pre-installed in the machine which I instantiated from amazon. It has amazon linux as the OS.               rpm -qa |grep -i httpd     httpd-tools-2.2.16-1.0.amzn1.x86_64     httpd-2.2.16-1.0.amzn1.x86_64          rpm -qa |grep -i php     php-common-5.3.5-1.11.13.amzn1.x86_64     php-5.3.5-1.11.13.amzn1.x86_64     php-cli-5.3.5-1.11.13.amzn1.x86_64      Thanks. The yum install mysql-server helped a bit. So first I removed my manual installation; and then yum install mysql-server; Additionally yum install -y php php-mysql **EDIT 2** I debugged a bit more. What I found is that if I put the wordpress directory under apache root and don't do port forwarding (no Proxy and proxyreverse), then I am able to connect to the DB from the WP install files. However, if I put the WP files under JBoss and do port forwarding from apache to JBoss, then from within JBoss, I am unable to connect through WP php files to the MySQL DB. So the problem is somewhere within the Caucho Quercus part of JBoss. Any suggestions? Thanks


Using Select HTML in Bootstrap Popovers

I want to be be able to utilize a select few HTML tags in a Bootstrap popover. I know that I could include the option HTML = true in the settings, but this would leave me exposed to an XSS attack (wouldn't it?). I am looking to allow a select few tags - just like when I use wp_kses with the $allowedposttags global. (p.s. I'm asking this here instead of stackoverflow because I'm wondering whether some built-in WordPress functionality may be the ticket).


Postal address auto-complete on profile page

Is it possible to have an address auto-complete function (Where you enter your house number and post code and it automatically populates the address fields for you) within the Wordpress user profile page? I'm more than happy to use a plugin if needs be (In fact I'd probably prefer it, this project is already well over budget)


Add a jQuery Function

Forgive me for knowing next to nothing about coding. BUT, I am calling jQuery in functions.php, which I have been told is the best way to include jQuery:               //Get jQuery     function modify_jquery() {         if (!is_admin()) {             // comment out the next two lines to load the local copy of jQuery             wp_deregister_script('jquery');             wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js', false, '1.8.3');             wp_enqueue_script('jquery');         }     }     add_action('init', 'modify_jquery');      I am now trying to add a jQuey function from PaperMashup.com which looks like this. I was under the impression if I simply copy and pasted the above jQuery function into the following code it would work, but it does not. How do i incorporate this function?               jQuery(function ($) {         /* PASTE CODE HERE */     });


Can I obtain differents links for different installed theme?

I have to show 3 differents template to a person and then say to him: "Please, choose one of these templates and I will use it for your web site" So the question is: **Have I to install 3 differents WP test websites (one for each templates) or can I install only one WP website and install on it 3 templates and give to him a differents links (one for a specific installed template)?** Tnx Andrea


Custom field with subdomain

I am currently having a problem related to the display of custom field article is "language" Specifically as follows: I have a blog with multiple applications for mobile phones, as this blog http://sameapk.com Each application corresponding to an article each article has a few custom fields in which the custome field: "_language" for example: sameapk.com/facebook/ --> language is english sameapk.com/%E6%8A%BC%E5%BF%8D%EF%BC%81%E7%95%AA%E9%95%B7%EF%BC%92/ --> language is Japanese Now I want to create the blog form en.sameapk.com or jp.sameapk.com in which Israel is to display the custom field with the article is the english language jp longer to display the custom field with the article is in Japanese language Can i using mulsite for this case thank you and thanks for your help


loading a javascript on a WP PAGE

so im trying to do this _http://jsfiddle.net/2XV7w/5/_ on `my custom_page` on wordpress. this is a conditional html form. It will display a specific `<div>` when i choose a specific drop-down value. when i try to load a sample javascript on my `custom_page.php` it works fine. to make sure that JS is working.                     but when i use this `script.js`, it wouldn't work.               $("#dd").change(function(){     var selected= $("#dd option:selected").text();     $('div').hide();      $('#'+ selected).show();      });          $(document).ready(function(){     $('div').hide();     });      My custom_page.php               <?php get_header(); ?>                         <select id="dd">     <option value="1">SHOW DIV 1</option>     <option value="1">SHOW DIV 2</option>     </select>
Content of div 1

Content of div 2
               <form action="" method="POST">         Message <input type="text" name="message" />           <input type="submit" name="submit" value="Send">     </form>          <?php get_footer(); ?>


Liking a facebook page from wordpress website?

I have added a button that links to a facebook page at the left of my **website**, I would like to be able to let people like the page directly from my website. How can I do that? Right now I added the following CSS line:               #fbtab{     background: url(http://mamou-mani.com/wp-content/themes/arthur/images/icon-fbtab.png) no-repeat; /* Path to Image */     left:1px;  /* change this to left: 1px; to put it on the left of the screen */     top:40%;height:60px;width:60px;margin:0px;padding:0;position:fixed;z-index:5000;}     #fbtab a{display:block;width:100%;height:100%;}      and following line in my footer.php:


Creating a form contact page?

I'm newbie on WordPress, how can I create a new page/top-link/contact-form for a contact page? I'm using a third party theme which allows you to create a contact form with field, but unbelievable I can't understand how to add that form to the site, or it maybe it doesn't comes up!? Is there any way to create that from standard WP backend?


Main menu navigation links and new pages

Sorry i'm pretty new on wp, i would like to add new menu links and site pages, to the main top menu bar. I'm using a third parties template, and i see the top.php file which contains the top menu looks like:

             <?php $nav_menu_params=array(               'depth'=>0,               'theme_location'=>'main-menu',               'menu_class'=>'menus menu-primary',               'fallback_cb'=>'block_main_menu'             );             wp_nav_menu($nav_menu_params); ?>
      how does i edit this code or how can i enter anyway new links and new web site pages from backend side? thanks for help


Using Wp_Query without the loop?

I want to query for posts with a certain meta value. I would use the `WP_Query` but when in a loop (correct me if i am wrong.. I am learning wordpress; is it only when in loop? is the `the_post()` that sets the globals?), it changes the `global $post`. Is it possible to loop without setting up the global values? I just want to fetch some stuff in the posts, i don't want to use `the_content`, `the_title`, etc.. just raw rows of arrays? If I want to query `WP_Query` with meta fields conditions and expect and want only post, how do I get it? Do I still need to loop?


Display Custom Field Value on Admin Page Column

What I want is to display the value of the custom field called 'page_template'. I use the code below but it displays nothing under Page Template column although I have already defined a value for the page_template custom field of the page               add_filter('manage_pages_columns', 'column_page');     function column_page($defaults) {         $defaults['column_template'] = 'Page Template';         return $defaults;     }               function page_template_field() {         $custom_field_id = get_post_meta($post_ID);         if ($custom_field_id) {             $custom_field_value = get_post_meta($custom_field_id,'page_template');             return $custom_field_value;         }     }            add_action('manage_pages_custom_column','column_page_content',10,2);     function column_page_content($column_name, $post_ID) {         if ($column_name == 'column_template') {             $column_template_list = page_template_field($post_ID);                 if ($column_template_list) {                 echo '<p> '. $column_template_list .' </p>';             }         }     }


Using WPAlchemy metabox values in another metabox

I'm building a quite complex custom post type structure and I would need some help regarding my metaboxes. What I want to do:   1. Thank's to the `have_fields_and_multi()` function, the user enters data in simple text input fields (with a "Add new" button)   2. The values from the previous text inputs should be used to build a `select` dropdown in another metabox. To make it simple, here is a mockup (also attached to this post): http://idzr.org/0c95 I have the first part working, it's easy. But I can't figure out how to make the second part to work. If I use a `while($mb->have_fields_and_multi('aaa'))` in another `while($mb->have_fields_and_multi('bbb'))` the page is infinite (the loop doesn't end. If I use `foreach` I have other problems. Do you have an idea about how I can achieve this ? Thanks!!!


How to add product images using script?

I have few hundred products on woocommerce without images. I am planning to upload images in future. Images have same name as the SKU of product (+.jpg). Is there a way I could write a script that adds this image as product image and featured image of the SKU = name of this image(-.jpg)?


Searching for media items with certain category item

I created a custom taxonomy called "Reference Type" which is used to categorize media library items. I want to create a search form to search for media library items based on file name and "reference type". What file do I have to create to handle the get method of the form and what should it contain? I want this done not in the admin panel.


ACF Plugin Conditional Logic add 'published' option

Is there a way to use the `conditional logic` of the ACF plugin to test whether the post has been published natively? I think I might be able to do this manually, but later updates would break the functionality. Another way to ask the question is: Is there a way to extend the plogin via a theme to add this functionality? `WP v3.8 ACF v4`


Load wordpress enviroment for external content?

We have a couple of forms and landing pages that cannot be stored in our wordpress installation as posts/pages. For this reason they remain apart from our Wordpress installation in a folder though they share the menubar, stylesheet and other resources. My question is whether there is a way to integrate some Wordpress functionalities to them so as to be able to use some plugin functions we need (we are using a plugin for localization that works amazingly but it would be trouble if we had to localize these pages differently). Is there a way to make this pages part of the Wordpress installation while keeping the content in them?


Using has_tag() outside loop

I want to if the check next post has a specific tag. I tried the following code, but it is not working because `has_tag()` only works in the loop. I want to use it outside the loop.               <?php if ( has_tag( 'mario', $post->ID ) ) : ?>     my content     <?php endif; ?>      The following code lists the tags from post, but I don't know how to make it work with an `if()` / `else()` condition:               global $post;     foreach ( get_the_tags( $post->ID ) as $tag ) {         echo $tag->name . ', ';     }


Best way to diagnose which plug-ins/theme uses the most memory?

I just upgraded one of my WP website from 3.1.4 to 3.4.2 but i immediately got a > Fatal error: Allowed memory size of message. So i added define('WP_MEMORY_LIMIT', '128M'); to wp-config.php, but if i have to this with all my WP website i reckon i am out of memory pretty quick. How to check the amount of memory a plugin or theme is using? regards ps: and why didn't i get the message when i used 3.1.4? is 3.4.2 using more memory ?


block a page from logged out users and redirect to homepage

How am I blocking certain pages from being viewed by logged out users? I have some pages like a dashboard for example that each user has to display their posts an is found in the top level like mysite.com/dashboard. I made a custom template and assigned it to the page "dashboard" but I need to block all non logged in users and limit to author level and up. If the user doesn't meet the criteria then I need to redirect them to the homepage. I tried placing this at the top of the template but it returned an error.               get_currentuserinfo();     if (!( is_user_logged_in() && current_user_can( 'publish_posts' )) ) {       wp_redirect(home_url());       return false;     }      But this leaves the error.. Warning: Cannot modify header information - headers already sent by ()


Theme customizer: How do you grab the value later?

I'm working on a custom site, doing all my work in a child theme. I need to add one variable, slider speed, to the customize control system. I've been able to modify the custom controls via the following additions to my child- theme functions.php file:               function Primm_customize_register( $wp_customize ) {          $wp_customize->add_section( 'primm_section' , array(         'title'     => __( 'Primm Home Page', 'Divi-child' ),         'capability' => 'edit_theme_options',         'description' => 'Setting options for home page'     ) );          $wp_customize->add_setting(        // ID        'primm_slider_speed',        // Arguments array        array(            'default' => '5000',            'type' => 'option'        )     );     $wp_customize->add_control(         // ID         'primm_slider_speed',         // Arguments array         array(             'label' => __( 'Cycle Time on Slider (0.001 secs)', 'Divi-child' ),             'section' => 'primm_section',             'type' => 'text',             // This last one must match setting ID from above             'settings' => 'primm_slider_speed'         )     );     }      add_action( 'customize_register', 'Primm_customize_register' );      That stuff seems to work well. I can make changes on the admin custom menu, save the settings and see that a value seems 'set'. On the other hand, I'm attempting to call that variable from within my home.php file.                $slider_timing= get_theme_mod('primm_slider_speed');      echo("Slider Timing: ".$slider_timing);  // test only      var_dump($slider_timing);      total fail. This is my response:                Slider Timing: bool(false)                   Been working on this for hours. I'm missing something, but its just not clear to me what. Note: my child theme is "Divi-child" (based on the directory name at root/wp-content/themes/Divi-child ) Anybody been here before on the general topic of Wordpress Theme customizer? How do I allow admin users to set a value in 'storage' and then retrieve it again later? Many thanx, Zip.


Widget only in first post

I want to put a widget area into the content of the first post. My problem though is that is can't figure out how to get only the first post in my function. Here is my function:                   function pietergoosen_insert_content_filter( $content ) {         ob_start();         $sidebar = dynamic_sidebar('sidebar-19');         $new_content = ob_get_clean();         if ( ! is_admin() ) {             return pietergoosen_insert_content( $new_content, 2, $content );         }         return $content;     }      If i replace               if ( ! is_admin() ) {      with               if ( ! is_admin() || is_paged() || $wp_query->current_post > 0 ) {      it shows the widget in all other posts and not in the first post. Any suggestions on a conditional tag for this


Is it possible to visually group items on the theme customizer?

My theme customizer is getting bigger and I think from an UX perspective would be nice to visually group some similar items. Is there way to do that? Something like put a divider or playing with CSS among the items or even put them into 'parent' sections.


How can I lock down an old wordpress install I don't intend to update?

I am starting a new wordpress blog, and no longer updating an old one. The old one still gets 400-500 hits a day, so I would like to keep it up for archival purposes, as people still link to its posts. Obviously there is the problem that wordpress and plugins will be updated, and I have no desire to maintain it. How can I lock the installation of wordpress down so I don't need to maintain it? I have seen someone suggest making a static version, which sounds like alot of work. A more reasonable solution I thought of was to disable write access to the database at the database user level. I'm fine with disabling comments from now on. Feel free to share any thoughts or comments on this. Thanks in advance.


What filters to call to modify the output of the entire page?

I want to write a simple plugin. For every time a page is viewed, it will write to the MySQL database. Then, if the current hour is odd, it will set a PHP variable of $is_odd to true;               <?php       require_once('library-of-functions-to-support-this-plugin.php');       function_to_write_to_mysql_db();       $is_odd = false;       if(current_hour_odd()) {         $is_odd=true;       }       $is_odd_json = json_encode($is_odd);     ?>      Then, it should embed the following JavaScript (note: I've already modified the theme's templates to put an on each page):               <script type="text/javascript" src="jquery.js"></script>     <script type="text/javascript">        var odd = <?php echo $is_odd_json; ?>;        if(odd) {           $("#OddElement").html('Odd!');        }     </script>      So basically, I have no idea where to put these code snippets. What filters do I want to apply? I know this plugin seems stupid, but it's laying the groundwork for something else I want to do. Thanks so much!