title: Custom post type archive category page results in 404

text: I've created a custom post type:               register_post_type('campaign',        array(           'labels' => array(              'name' => __("Campaigns"),              'singular_name' => __("Campaign"),           ),           'rewrite' => array(              'slug' => 'campaigns',              'with_front' => FALSE,           ),           'public' => TRUE,           'has_archive' => TRUE,           'supports' => array('title', 'editor', 'thumbnail'),           'publicly_queryable' => TRUE,        )     );      And a custom taxonomy for categories:               register_taxonomy( 'campaign_category', 'campaign',         array(            'hierarchical' => TRUE,            'label' => 'Categories',            'query_var' => TRUE,            'rewrite' => array(               'slug' => 'category',               'with_front' => FALSE,               'hierarchical' => FALSE,           ),        )      );      Because the post type was created with `has_achive` set to `TRUE` I can browse to the `/campaigns` URL and my `archive-campaign.php` template is triggered. So far so good. However, when I try to access a category, `/campaigns/category/fashion`, I get a `404`. The category with the correct slug exists and I've re-saved my permalinks each time I've made a chance to any of the rewriting rules. Any suggestions would be much appreciated.


title: (Bluehost) navigating to the dashboard via mydomain.com/wp-admin/ results in directory listing

text: I recently had my WordPress blog's domain reassigned as the primary domain on my BlueHost account. The blog is in a sub-folder of `public_html/`. Below is the contents of the `.htaccess` file I re-uploaded to replace the default `.htaccess` file. When I tried navigating to my dashboard by clicking on the Dashboard link from the site, I am greeted with a directory listing for `wp- admin`. However, when I use `ofthreadsandthings.net/wp-admin/index.php`, things are fine. ## The `.htaccess` (root level)               # Use PHP54 Single php.ini as default     AddHandler application/x-httpd-php54s .php          AddType audio/mp4 .m4a          # BEGIN WordPress     RewriteEngine On     RewriteCond %{HTTP_HOST} ^(www.)?ofthreadsandthings.net$ [NC]     RewriteCond %{REQUEST_URI} !^/ofthreadsandthings/     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule ^(.*)$ /ofthreadsandthings/$1     RewriteCond %{HTTP_HOST} ^(www.)?ofthreadsandthings.net$ [NC]     RewriteRule ^(/)?$ ofthreadsandthings/index.php [L]          # END WordPress


title: reference the current category being used in the category.php page

text: I have this code in my category.php file                           <?php query_posts( array('post_type'=>'featured' ));                       $featured = new WP_Query( array('posts_per_page'=>1, 'tax_query'=> array(                 array(                     'taxonomy' => 'category',                     'field' => 'slug',                     'terms' => 'fever'                 )             )));                          while ( $featured->have_posts()) : $featured->the_post();                     unisphere_get_post_image('normal-slider');?>                     <?php endwhile; wp_reset_query(); ?>      This code works, but what I need is where it says 'terms' => 'fever' to instead reference whatever the current category being used in the category.php page would be. I need it to work this way so that my featured image changes out with the current category that being used by the page category.php at that moment. // Got the answer I needed. Here's a copy of the working code.                           <?php                  $term = get_queried_object();                 query_posts( array('post_type'=>'featured' ));                       $featured = new WP_Query( array('posts_per_page'=>1, 'tax_query'=> array(                     array(                         'taxonomy' => 'category',                         'field' => 'slug',                         'terms' => $term                             )                         )                      ));                      while ( $featured->have_posts()) : $featured->the_post();                 unisphere_get_post_image('normal-slider'); ?>                 <?php endwhile; wp_reset_query(); ?>


title: Getting featured image setting as background

text: I'm using the code below to get the posts featured image URL. I need to be able to get the `large` size image, right now it's getting the URL to the original size image.               <?php $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID, 'ttrust_post_thumb_big'), array( 5600,1000 ), false, '' );?>          <a href="<?php the_permalink() ?>" rel="bookmark" class="imagewrap"><div style="background: url(<?php echo $src[0]; ?> ) !important;">


title: Adding new value to existing meta key

text: I'm currently using this to add post meta                   add_post_meta($post_id, 'when', $date);      Naturally, it creates a new meta key/value combination each time. I want to another value to the key, so that when date is submitted again, there are now TWO dates in the "when" meta key? Would I then be able to query these dates? Or would storing them in the same meta key cause them to be unreadable later? Eventually the goal is to count how many entries there are in the meta key, while still being able to process the dates as dates. Is this possible or should a new method of storage be used?


title: How can I sort homepage by a meta value?

text: I am trying to sort my home page posts by a custom meta value. I've been told I should use `pre_get_posts` but I seem to not be implementing it correctly. This is what I am doing:               add_filter('pre_get_posts','alter_query');          function alter_query($query){                if( $query->is_home() ){             $query->set( 'meta_key', 'key name' );             $query->set( 'orderby', 'meta_value_num' );             $query->set( 'order', 'DESC' );           }          return $query;      }      When I use the above function, the homepage query is not returning all the posts and not ordering them properly; I am trying to figure out if it I am going about this the correct way.


title: Determine image height within Fancybox

text: I have single.php rendered within Fancybox. For the purpose of resizing an image within single.php I am obtaining the image height in javascript using: var contentheight = jQuery('.postimage').height(); The first load of single.php within Fancybox successfully populates the "contentheight" variable and I am able to resize the image as per my needs. However, when I use Fancybox's left/right navigation buttons to navigate to next post, the "contentheight" variable never gets populated. Any ideas on what could be causing this erratic behavior?


title: Set a cookie in WordPress, using a select form and Jquery

text: Hi Guys and thank you in advance for giving me some attention with this. I have this code in wordpress that I just can't get right. I have the US states in a drop-down form. When the user chooses an option from the select form and presses the "set new location" button, I need a cookie to be written , containing that location's ID (or actual name). I am using (or at least trying to use) the jquery cookie plugin (https://github.com/carhartl/jquery-cookie) - but probably the main problem is I know almost no jQuery, lol. The think that is not working is `jQuery.cookie('my_cookie', 'my_value');` Can you help me? Here is the code I am working on:                               <form id="categoriesform" action="<?php bloginfo('url'); ?>" method="get">                              <div>                         <?php $cats = get_categories($args);                          $termID = $_COOKIE['my_cookie'];                              $term = get_term( $termID, 'location' );                              $name = $term->name;                         ?>                         <select id="categories">                         <?php foreach ($cats as $cat) : ?>                             <option value="<?php echo get_term_link($cat, $cat->taxonomy) ?>" ><?php echo $cat->name ?></option>                         <?php endforeach; ?>                         </select>                         <input type="submit" name="submit" value="Set New Location" />                         </div>                     </form>                          <script>                          jQuery(document).ready(function()                     {                         jQuery('#categoriesform').submit(function()                         {                             jQuery.cookie('my_cookie', 'my_value');                             window.location = jQuery('#categories').val();                             return false;                         });                     });                     </script>


title: Error Using Audio plugin

text: I have installed the audio plugin, to create Xbrowser playlists, but I am getting the following error `jPlayer 2.0.0 : id='jquery_jplayer_1' : Error!` All I have done so far is create a new post, upload audio to the post using the wordpress audio uploader, added the playlist to the post using the following shortcode, and published.               [audio layout="list"]      and also tried `[audio]` but produced the same error The files are .mp3 format, they play in other players fine. The site is stored locally, in case that is relevant.


title: remove links from images using functions.php

text: I am looking for a way to remove the attachment link from images in the post content. I would like to add this to the functions.php in my theme. I know you can disable this in the post on a per image basis, but I would like to do this just once in my functions.php page. Any ideas? Thanks, Bart


title: Themes—Child Themes

text: I apologize if this is a very basic question, but I am very new to working with Wordpress. I'm looking into using Wordpress as a CMS for a new site I'm building but I'm not sure I understand some of the best practices for themes. I've heard that a good approach is to use pre-existing themes and modify them to your own purposes using a child theme. Is this the direction in which I should look? Is there another approach that I should look in to? Thanks for your help!


title: Problem querying new custom post type while old display fine

text: I had existing custom post types, which I am able to query successfully. But newly registered custom post type does not show up, I have added 2 test posts, individually it shows up under post type site/slug/ but I want to display it on another page, results are not returning it there. Following is the code I put for registering the new post type:                   $custom_post_types = array('proof-concept' => array(         'labels' => array(         'name'          => 'Proof of Concepts',         'singular_name' => 'Proof of Concept'         ),         'taxonomies' => array('first', 'second','third'),         'has_archive'=> true         ))         foreach($custom_post_types as $id=>$custom_post_type){         if(!isset($custom_post_type['public']))             $custom_post_type['public'] = true;         register_post_type( $id, $custom_post_type);      Please note custom_post_types array does have other post types I removed from the code. Here's the query:                  $query = new WP_Query(array('showposts' => -1, 'post_parent' => get_the_ID(), 'post_type' => 'page', 'orderby' => 'menu_order', 'order' => 'ASC' ));      Am I missing something? Please help.


title: Comment submission & navigation redirects to default language

text: I'm using **qTranslate** for _multi-language_ & **wp-commentnavi** for _comment navigation_. The style of my base permalinks are like so:               site.com/     -> for default language     site.com/en/  -> for other language      I need help in regards to the following as they keep **redirecting to the default language** : **1. Comment submission** How do I hack this? I want the current language to be displayed after submission. I found this proposed solution: http://www.qianqin.de/qtranslate/forum/viewtopic.php?f=3&t=2631&p=9037#p8759 ..but the problem with that is that **it doesn't direct to the right comment page if there's pagination for the comments** , ie. it directs to the first comment page instead of the last page where the new comment is. **2. Next/Prev comment page links** It seems that wp-commentnavi uses `next_comments_link()` & `previous_comments_link()` for the Next/Previous comment page links respectively. For the rest of the links _(eg. pages, first, & last)_ I can use the `qtrans_convertURL()` function to direct them to the current language. But I don't know how I could hard code the links for the two former ones, ie. next/previous. Anyone knows? **3. Comment Link** I have a link in each comment to the comment link using `get_comment_link()`. Something like so:               qtrans_convertURL( esc_url( get_comment_link($comment->comment_ID) ) )      For **comment pages two & above**, the links work fine, in that they direct to the correct language. But **for links that are on page 1** , although the permalinks are correct, but once opened they get redirected to the default language. For example, in page 1, one comment have a link like so: > site.com/ **en** /post-type/post-name/ **comment-page-1** /#comment-2 When opened, it redirects to: > site.com/post-type/post-name/#comment-2 It seems that anything with **_comment-page-1_** is redirected to a shorter permalink, ie. it got rid of the comment page permalink, but the problem is that it also got rid of the language permalink. How do I maintain the current language? Anyone could help? Cheers in advance! :)


title: Wordpress json rest api - question about formatting and post_meta

text: Can someone help me with the following: We are trying to use the wordpress json rest api - and while we are able to filter and retrieve the json posts the way we want to - the post_meta data that we get back simply includes references. Example below. Essentially - i was hoping that the custom field values for the image would show up as opposed to just the reference to the id. Really what we are trying to do is get back several posts (based on filter queries) - and then for each post returned - get the custom field images (up to 5-10) and include the image data (ie: url, links, etc) within the object (as opposed to just the id reference).               post_meta: [     {     ID: 81,     key: "test_image_fields",     value: "6"     }     ],      Any advice would be much appreciated.


title: Why do themes have `while( have_posts() )` in templates like single.php?

text: Example: https://github.com/markjaquith/WordPress/blob/master/wp- content/themes/twentyeleven/single.php Isn't single.php's purpose to show single posts?


title: Edit custom HTML page from WP admin dashboard

text: I needed to make custom HTML page in root which will not use default wordpress theme and show content and I linked it on menu as custom links. So in front end everything perfect. But this page is not part of wordpress and I am not sure if it will harm SEO or something. Is there any way plugin or something so text on this pages can be edited from dashboard. Is there any way so this page to be covered with wordpress sitemap.xml, SEO settings and plugins, and chaching plugins


title: is there a simple way to list every templates / php files used to generate a specific page?

text: To customize a theme , it is not always easy to trace every files that are used and find out which one do what . For example i' like to find out how my menu is generated so i can add some conditions to it , and also change the display. Is there a way to find out all the files loaded ? which header is used ...etc... maybe put a bit of code somewhere in the autoload sytem? or using firebug?


title: Parent page for CPT

text: Alright, there's been numerous topics about this, but it doesn't seem to work for me. I have one normal page, called "Resources". Then I have several Custom Post Types. One of wich is "Video's". I want "Video's" to be a child page of "Resources". At the moment, I can both access the video's page by the URL: http://site.com/resources/videos AND http://site.com/videos (they both work). My Videos CPT is as follows: function register_custom_post_video() {               $labels = array(         'name' => _x('Videos', 'videos'),         'singular_name' => _x('Video', 'video'),         'add_new' => _x('Add New Video', 'Video'),         'add_new_item' => __('Add New Video'),         'edit_item' => __('Edit Video'),         'new_item' => __('New Video'),         'view_item' => __('View Video'),         'search_items' => __('Search Videos'),         'not_found' =>  __('No Videos found'),         'not_found_in_trash' => __('No Videos found in Trash'),         'parent_item_colon' => ''     );          $args = array(         'labels' => $labels,         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,         'query_var' => true,         'rewrite' => array('slug' => 'resources', 'with_front' => true),         'capability_type' => 'page',         'hierarchical' => true,         'menu_position' => null,         'supports' => array('title','editor','author','excerpt','page-attributes')     );          register_post_type( 'videos' , $args );     }     add_action('init', 'register_custom_post_video');      But the rewrite doesn't seem to work. Also, when I resave the permalinks settings, it doesn't work. I use archive-videos.php as the page. Also, according to a WP Tuts+ quicktip, the > Therefore, to make a hierarchical custom post type, you have to have the > ‘page-attributes‘ set in the ‘supports‘ array and the ‘hierarchical‘ flag > set to true. I hope this was helpful to you as well! does not work either. Am I doing something wrong?


title: Removing capabilities from cloned admin role

text: I'm trying to create a new role within my wordpress theme that has almost all the same rights as an admin. Basically, it's a cross between Editor and Administrator. One of the issues I'm having is allowing the Editor to "see" the add custom image header submenu in Appearances. I either want to allow the Editor to see that submenu or create a new role that allows them almost all the same capabilities as an admin. I saw the below link on cloning a role but how do I go about taking capabilities away and finding out what those capabilities would be? http://wordpress.stackexchange.com/a/31472/7662 TIA!


title: Does BuddyPress Have An Action Hook for remove_user?

text: BuddyPress has a behavior for removing users that does not run through WP's `deleted_user` action. I have a hook in my plugin for `add_action('deleted_user', 'myScript');` but it only works for WP-related user deletes. It does not run when I remove a user in BuddyPress. Has anyone hooked to the BP remove user action in their plugin? If so, what is the action to catch? Thanks!


title: Force WordPress 3.3 to use Flash uploader

text: Is there any way to force WordPress 3.3 to use the old Flash uploader instead of the new HTML5 version? (you can read below if you care about why I want to do this...) I'm working with someone on WordPress 3.3 whose image uploader occasionally freezes when bulk uploading large numbers of images. I've tried troubleshooting every way I could think of and can't find a solution. He never had this problem before upgrading to WordPress 3.3, so I'm wondering if it is an issue with the HTML5 uploader. He doesn't want to use the old browser uploader because he does lots of bulk uploading, so I'd like to find a way to force WordPress to use the Flash uploader.


title: Wordpress doesn't recognise created theme

text: I just started creating new theme in wordpress, I got the html/css, I put the heading in css like usual:               /*     Theme Name: Your Theme Name     Theme URI: http://your-theme-homepage.com     Description: Oh what a lovely description of your theme you'll put here!     Author: Your Name     Author URI: http://your-website.com     Template: If this is a child theme, you'll set the template theme's folder name here     Version: 3.1     Any general information, license statements, plugin requirements, or any other information you           might want to share.               */      and html site in the same directory. Wordpress doesn't recognise the theme and I get error like > Broken Themes > > The following themes are installed but incomplete. Themes must have a > stylesheet and a template. > > Name Description Wp_theme Stylesheet is missing. or something similar. What is EXACTLY the requirement for wordpress to register theme in directory? Is it just css heading or something else must be added? Thanks


title: Adding google authenticator and use only email address of user

text: I think most of you have seen SO way of authenticating. SO uses only ask for email address through Google Authentication. Can this feature be applied to a wordpress site.. like allowing users to give only their email and no password since the user will only have the ability to view the content, we dont't need users to provide passwords, so just email is sufficient for identity.. Is their any plugin to achieve this? If not a little help with StackExchange team how do they implement that signup from google resources..


title: List most recent image uploads, but only for specific custom post type

text: I can get a list of the most recent image attachments like so:               $attachments = get_posts( array(         'post_type' => 'attachment',         'posts_per_page' => $number,         'post_mime_type' => 'image'     ) );      This returns all images that have been recently uploaded, whether they are attached to a post or page, or unattached through the Media menu. What I'd like is to limit that list to only images that are attached to a custom post type I've created. (The custom post type is not that important; the same question could be: 'only images attached to Posts' or 'only images attached to Pages.') I realize I could test each image after running the above query and eliminate any whose parent is not the right post type, but I want to return a specific number of images (`$number`), and this method could eliminate some or all of the returned images!


title: Hide parts of the post content after typing it's name or searching it by category

text: Code "nohome" worked for displaying wanted (hided'n'waiting) content on home page (just postname and image) How it could be adjusted or modified to make the same after name of post has been typed in searchbox or searched by Categories? (At the moment the result of that 2 actions is simply = display whole founded posts) Sincerely Jacob


title: Common abstract class for plugins

text: I have a few plugins and intend to move them to a very common base with an abstract class. The issue is that even if I apply solutions in order to avoid class duplications ( like EarnestoDev's answer for #31034 ) the system could end up with different versions of the abstract class if more of my plugins are present. In order to avoid this I should update all my plugins when the abstract class is updated, but that seems to be an overkill. Is there any other way to include classes only for a specific plugin rather than using namespaces?


title: Sell photos through Wordpress

text: I have an existing photo blog, which displays photos with width of 670 pixels. I'd like to sell higher resolution photos from the same page the lower resolution photo is displayed. Does anyone know of a way to do this? I'm thinking something as simple as using WP E-Commerce could do the job. I just create a catalog of high resolution images, and add a link to the product page on the blog post. Can you see that working?


title: $ not defined using jQuery in Wordpress

text: I know that jQuery is loaded, because I can switch out the $ for 'jQuery' and everything behaves as expected, but this will be a messy script if I can't fix this This script:               jQuery(document).ready(function(){         $("ul.vimeo_desc_feed li a").click(function(){             alert($(this).attr('href'));             return false;         })          });      Produces the error **$ is not a function** This script:               jQuery(document).ready(function(){         jQuery("ul.vimeo_desc_feed li a").click(function(){             alert(jQuery(this).attr('href'));             return false;         })          });      works fine.


title: Wordpress Lightbox plugin not working with jQuery

text: I have an image gallery set up and divided into about five sections. Everything works great w/ the Lightbox Gallery plugin at this point--click any image, the lightbox comes up, can scroll through, etc. However, each section has a large amount of images and I used a bit of jquery to make it where each section is collapsed and only when you click a section header do the images it contains appear. This works well, but once I include the script for jQuery in my WP page, it disables the Lightbox plugin somehow. Each image thumbnail that you click goes straight to that image's url rather than the lightbox view. One potential solution I've found is to write this right after the jQuery inclusion:               <script>jQuery.noConflict();</script>      ...and then replace each instance of $ w/ jQuery, so there's no conflict between jq and plugins. However, as this is a WordPress page I cannot include script snippets like this. Instead I tried placing that snippet at the top of my jQuery file (not jQuery itself, the section collapse code). Unfortunately, I'm still having the same issues. Does anyone know how I might be able to either use this solution effectively or does anyone know another possible way to deal with this problem? Thanks


title: Cannot get jQuery to work in WordPress

text: I had the following jQuery script on a static HTML page and it worked fine. However, when I enqueue it into WordPress it doesn't work. Here is the JS file.               $(window).scroll(function()       if ($(".navbar").offset().top > 50) {          $(".navbar-fixed-top").addClass("top-nav-collapse");       } else {          $(".navbar-fixed-top").removeClass("top-nav-collapse");       }     )};      And here is the functions.php               function hat_rack_media_scripts() {        //THEME CUSTOM STYLES AND SCRIPTS        wp_enqueue_style( 'hat-rack-media-style', get_stylesheet_uri() );        wp_register_script( 'theme-script', get_template_directory_uri() . '/js/script.js', array('jquery'), '1', true );         if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {         wp_enqueue_script( 'comment-reply' );         }     }     add_action( 'wp_enqueue_scripts', 'hat_rack_media_scripts' );      I feel like i included the file correctly, it is mapped to the right location, and it worked just fine in a static html page. Thanks.


title: Javascript not bring used in 3.8

text: I'm getting an issue on http://bollywoodbang.ca/wp/, it appears that my javascript files aren't working. I called them in functions.php using wp_enqueue_script(), and in the inspector says that the right files are getting called. However, the script that's in the files isn't being run. Am I missing something obvious? Ps: the files that aren't working is to re-create this affect for the gallery


title: Using jQuery safe mode in WP?

text: I am pretty new in WordPress and I know just a litle about jQuery and Javascript and I have the following problem: Into my **functions.php** file I load **jQuery** , the jQuery **FlexSlider** pluging (that create a slideshow) and another personal **jQuery** scripts file, in this way:               /* Function automatically executed by the hook 'load_java_scripts':      * 1) Load all my JavaScripts      */     function load_java_scripts() {              // Load jQuery:         wp_enqueue_script('jquery');         // Load FlexSlider JavaScript         wp_enqueue_script('flexSlider-js', get_template_directory_uri() . '/assets/plugins/flexslider/jquery.flexslider.js', array('jquery'), 'v2.1', true);         // Load scripts.js:         wp_enqueue_script('myScripts-js', get_template_directory_uri() . '/assets/js/scripts.js', array('jquery'), '1.0', true);     }     add_action('wp_enqueue_scripts', 'load_java_scripts');      Ok so the **FlexSlider** neeeds **jQuery** and in the last **scripts-js** file I have the following JavaScript:               /* Slider */     $(window).load(function() {      $('#main-slider').flexslider({          animation: "slide",          useCSS: false,          pauseOnHover: true      });     });      I don't know very well jQuery but I think that this script create my FlexSlider slideshow into the **#main-slider** div of my theme, this one (correct me if I am wrong):               <div id="main-slider" class="flexslider">         ...........         ...........         ...........     </div>      The problem is that if I execute the previous scripts into a simple pure HTML website all work well but if I put these scripts into a WP theme the slide show is not shown After a few hours of panic I found this documentation about the **jQuery no conflict mode in WP** : http://codex.wordpress.org/Function_Reference/wp_enqueue_script#jQuery_noConflict_Wrappers So I have change the previous script that create my slideshow in this way (replacing the $ with the explicit jQuery function):               jQuery(window).load(function() {      jQuery('#main-slider').flexslider({          animation: "slide",          useCSS: false,          pauseOnHover: true      });     });      and now all work fine and the slideshow is shown. Reading the jQuery documentation related to how avoid conflict(http://learn.jquery.com/using-jquery-core/avoid-conflicts-other- libraries/) it seems to me that exist some other JavaScript framework different from jQuery that also use the **$** character and that the safe mode disable the use of **$** to avoid interpretation conflicts between Jquery code and other library code. And if I can't use **$** in my code I have to replace it using the explicit namespace* _jQuery_ *. Ok, in this WP documentations: http://codex.wordpress.org/Function_Reference/wp_enqueue_script#jQuery_noConflict_Wrappers show how continue to use $ even if jQuery is set in safe mode, and it do the following example: **ORIGINAL JQUERY FUNCTION THAT USE $** :               $(document).ready(function(){          $(#somefunction) ...     });      This function can't work if jQuery is setted in safe mode So if I want to use **$** and I don't want replace all **$** with **jQuery** in my code I can do:               jQuery(document).ready(function($) {         // Inside of this function, $() will work as an alias for jQuery()         // and other libraries also using $ will not be accessible under this shortcut     });      So it means that I have to replace the first **$** (before my ready() function) and the pass the $ symbol as parameter on my definied function, so in this function I can still use $ without replace it? Is this one the correct meaning?


title: why jquery never trigger

text: very simple think it was working before on my other project but now for this. i have no idea why.. i have simple drop down menu in wordpress. made via jquery and css.. actually everything fine... just if i add `<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> ` this to **before my js** then drop down menu working but if i don't use that then no work even fire bug show **TypeError: $ is not a function $('#menu- mainmenu li').hover(** but on my wordpress theme jquery already loaded on top i checked in view source it's show               <script type='text/javascript' src='http://localhost/LBW/site/wp-includes/js/jquery/jquery.js?ver=1.10.2'></script>      bellow is code               <?php wp_nav_menu( array('menu' => 'mainmenu','container' => false, 'menu_class'      => 'location ' )); ?>      JS               <script type="text/javascript">     jQuery(document).ready(function(){          $('#menu-mainmenu li').hover(         function () {             //show its submenu             $('ul', this).stop().fadeIn(300);              },          function () {             //hide its submenu             $('ul', this).stop().fadeOut(300);                   }     );          });     </script>      CSS               #menu-mainmenu  li {         position:relative;         z-index:500;     }     #menu-mainmenu  li a {     }     #menu-mainmenu  li a:hover {         color:#fff;         background-color: #09F;     }     #menu-mainmenu  a.selected {         color:#09F;     }     #menu-mainmenu  ul {         position:absolute;         left:0;         top:56px;         padding:0;         list-style:none;     }     #menu-mainmenu  ul li {         float:left;         font-size:11px;     }     #menu-mainmenu  ul a {         display:block;         padding: 6px 6px 6px 10px;         width:180px;         color:#FFF;         font-weight: normal;         background-color: #007575;     }     #menu-mainmenu  ul a:hover {         text-decoration:none;         background-color: #099;     }


title: FancyBox2 WordPress Plugin - Nearly Working

text: I have FancyBox2 installed. Clicking on an image launches the image in FancyBox as expected. What I'm trying to achieve though is the use of the button 'helper'. I've called the button function, and the helper buttons appear, but they just don't work. When I use the console feature within Chrome, I'm getting: "Uncaught TypeError: Cannot read property 'fancybox' of undefined" Regardless of the button I click on. The normal left and right and close buttons work fine, it's just the helpers. An example button within the helper looks like this: `<a class="btnPlay" title="Slideshow" href="javascript:$.fancybox.play();;">Play</a>` If someone knows jQuery well and can get to the bottom of this, I would be very grateful! Thanks in advance


title: retrieving page content per AJAX

text: I am currently working on a single page website. I am trying to retrieve the page content via AJAX. The page URL is `http://mylocalserver/sad/wp/clients`.                   $.get( 'http://mylocalserver/sad/wp/wp-admin/wp-ajax.php',                {                 'action' : 'retrieve_content',                'page_title' : 'clients'               }, function( response ){                 if ( !response.error ) {                   alert ('AJAX request made! The post title is ' + response.post_title );                 } else {                   alert ('error: ' + response.error );                     }             });      in my php functions.php                   function retrieve_content(){         $page = get_page_by_title( 'clients' );         $content = apply_filters('the_content', $page->post_content);          var_dump($content);         exit();          }      It says _Page not found_ , whereas if I visit the page via URL the content appears. I have hard coded the page title in the PHP function as-well.


title: JQUERY on my custom WP page wont work

text:
Code below, works properly here http://jsfiddle.net/sushanth009/rE2dW/ but when i put this on my custom wordpress page, Jquery doesnt seem to work. what below page does, is when i select a value in my `<select>` HTML markup, `<div id="divPie">` should appear. by default, it is hidden as declared in my `<style>`               <?php get_header(); ?>                                             <select id="category">     <option name="choice1" value="pie">Pie</option>     </select>

this is pie

               <?php get_footer(); ?>      This is my `script.js`               $('#category').change(function () {         var value = this.value;              value = value.substr(0,1).toUpperCase() + value.substr(1, value.length);              $('.food').hide();         $('#div'+ value).show();     });


title: Wordpress 3.5 Gallery Menu Order not set?

text: With the new Gallery editor in Wordpress I am able to set up my galleries and to drag the Thumbnails to re-arrange the image order. On the backend that seems to work fine. But I ran into an issue when I try to display the gallery on the front end using the 'orderby' => 'menu_order' attribute. The display was not using menu_order. When I looked in the database I noticed that the menu_order value for my attachments was still '0' for all gallery images. So it looks like reordering and saving Galleries in Wordpress 3.5 does not set the menu_order value in the database. Is this a bug? Has anyone else run across this? If so do you know of a fix?


title: Security to delete post by Admin

text: My code is so simple like when admin delete a post by Wordpress fucntion (PHP) and do action with jQuery               <?php     include('../../../../../../wp-config.php');     if(current_user_can('edit_posts')){     $id = $_POST['ID'];           wp_delete_post($id);          }else{die();}     ?>      This is my code , what are you think about security ? this is enough ?


title: Search page loop banner image issue

text: In Header file I have added               while ( have_posts() ) : the_post();  ?>     <img src='banner.jpg' />     <?php }  ?>      ` But in Search page the banner is loop equal to number of results. How can i avoid this. I want to show banner just one time in search page


title: A bunch of unrelated wordpress using same memcached don't store correctly their datas

text: Before begin I've to warn the reader: watch out the **d**! On a **single web server** (CentOS 6.3) using php-5.3.3 I've a bunch of **unrelated** wordpress sites (3.5), each one has its own DB (Mysql5.1) so the table_prefix is the same ("wp_"). To speep-up the wordpress I think to APC for the code and a memcache backend for the data, so on my web server I've compile & install libmemcached-1.0.15 and (using "pecl install") php-pecl-memcached 2.1.0 (pay attention to the ending " **d** "). As wp-plugin I used "memcached redux". On two different servers (CentOS 6.3) I've compiled & installed memcached-1.4.15 backend daemon. **The Issue** First I login on _wp.first-domain.com_ and everything is fine. When I try to log on on _wp.second-domain.net_ I found myself redirect on _wp.first- domain.com_! If I clean the memcached cache I can login on _wp.second-domain.net_ , but then every other wp I try to login redirect me on _wp.second-domain.net_. In my _wp-config.php_ I use these settings:               // server list definition     $GLOBALS['memcached_servers']=           array("memcache1.internal:11211","memcache2.internal:11211",);               // try to add a server-related prefix          $GLOBALS['blog_id']=$_SERVER['SERVER_NAME'];     ini_set('memcached.sess_prefix','memc.sess.key.'.$_SERVER['SERVER_NAME'].'.');      **IMHO the wp don't store the data with a significant prefix/salt so one blog fetch onother blog datas!** **The work around** As workaround I've intalled the wp-plugin "Memcached Object Cache", that uses php-pecl-memcache (2.2.7) (note the missing " **d** ") and the following code in config:               define( 'WP_CACHE_KEY_SALT', $_SERVER['SERVER_NAME'] );      I think that I miss some set-up of memcached-redux but I don't exclude a missing functionality (or a bug). **ADD** Final goal is to use php-pecl-memcached, so my work around can be the solution.


title: Large front end file uploads on cloud

text: I need to setup a front end page to permits users not registered to send me big files (500mb). I would prefer to host theese files in the cloud and not on my webserver. I thought the best solution was dropbox with the dropbox uploader form, but it is limited to 300mb per file. There are any file upload services that doesn't have this limitation?


title: Want a form to appear in a post via wp_insert_post, form tags appear, fields don't

text:
I use wp_insert_post to import external data in WP3.8. Part of the post_content field is a small form, see below.               $content="

";     $content.="<form action=\"http://www.mydomain.nl/solliciteren.html\" method=\"get\"><input type=\"hidden\" name=\"ref\" value=\"$reference\" /><input class=\"button\" type=\"submit\" value=\"Solliciteer naar deze functie\" /></form>	";     $content.="

";       When I echo this it looks fine, but after using wp_insert_post to import it I get the following result:

          <form action='http://www.mydomain.nl/solliciteren.html' method='get'></form>

      My question is: does anyony has a clue where my hidden field and button have gone? I think it has something to do with filtering, but (if that's the case) how can I prevent that in a save way?


title: Ajax navigation and scripts loaded only on certain pages

text: I'm building a theme. The theme post navigation is done through jQuery Ajax. I've been several plugins to see compatibility and I have a problem with the Ajax functionallity. Some plugins such as Jetpack, load certain scripts depending on the post content.Say for example Page1 has no post with VideoPress functionallity and Page2 does. Then scripts necessary will be loaded on Page2 **only**. I get into a problem as the user might go to Page1, then Page2 posts will load through Ajax and the Video post (from Page2) will break as the scripts were not loaded at first on Page 1. Is there a way to solve this? I'm quite lost on how to.


title: How can I get List Category Posts to work as a widget?

text: This plugin works just fine in a post/page, but I need it to appear in a Text widget. Anyway to make it work in this location?


title: Buddypress create custom tab on my profile and add on home page

text: I have been trying to add 2 tabs on user profile. “posts”,”gallery” posts : my posted posts. it will display a custom-post-type “user-post” gallery : my pictures .. or any thing.. it will display a custom-post-type “user-images”               // Set up Cutsom BP navigation      function my_setup_nav() {       global $bp;            bp_core_new_nav_item( array(             'name' => __( 'Posts', 'buddypress' ),             'slug' => 'user-posts',             'position' => 19,             'screen_function' => 'jv_user_posts',              'show_for_displayed_user' => true            ) );            bp_core_new_nav_item( array(             'name' => __( 'Gallery', 'buddypress' ),             'slug' => 'user-gallery',             'position' => 20,             'screen_function' => 'jv_user_gallery'        ) );            // Change the order of menu items       $bp->bp_nav['messages']['position'] = 100;            // Remove a menu item       $bp->bp_nav['activity'] = false;       $bp->bp_nav['blogs'] = false;            // Change name of menu item       $bp->bp_nav['groups']['name'] = 'community';      }      add_action( 'bp_setup_nav', 'my_setup_nav' );           // Load a page template      function jv_user_posts() {       bp_core_load_template( 'buddypress/bp/cst-user-posts' );      }      function jv_user_gallery() {       bp_core_load_template( 'buddypress/bp/cst-user-gallery' );      }      it has successfully created 2 tabs! works ok! BUT it goes to own “cst-user-posts.php” page and “cst-user-gallery.php” page. I mean I want to add them in /buddypress/members/sigle/home.php file Then they will be below profile head part. I guess the part is here on home.php                <?php do_action( ‘bp_before_member_body’ );           if ( bp_is_user_activity() || !bp_current_component() ) :       bp_get_template_part( ‘members/single/activity’ );           elseif ( bp_is_user_blogs() ) :      bp_get_template_part( ‘members/single/blogs’ );           elseif ( bp_is_user_friends() ) :      bp_get_template_part( ‘members/single/friends’ );           elseif ( bp_is_user_groups() ) :      bp_get_template_part( ‘members/single/groups’ );           elseif ( bp_is_user_messages() ) :      bp_get_template_part( ‘members/single/messages’ );           elseif ( bp_is_user_profile() ) :      bp_get_template_part( ‘members/single/profile’ );           elseif ( bp_is_user_forums() ) :      bp_get_template_part( ‘members/single/forums’ );           elseif ( bp_is_user_notifications() ) :      bp_get_template_part( ‘members/single/notifications’ );           elseif ( bp_is_user_settings() ) :      bp_get_template_part( ‘members/single/settings’ );           // If nothing sticks, load a generic template      else :      bp_get_template_part( ‘members/single/plugins’ );           endif;           do_action( ‘bp_after_member_body’ ); ?>      How can I make “if” condition for those 2 pages? I don’t know how to create “bp_is_user_posts” or “bp_is_user_posts” functions. if I could, I just need to add … if conditions. I can't even fine "bp_is_user_profile()" these functions on bp files. how it works?? Please advice me! Thanks, pulla


title: Display ajax preloader for large images within posts

text: Our WordPress installation runs only images within posts. Generally medium, lightweight images; but we are also publishing larger images, sometimes gif animated which take enormous time to load. When a post has a description, it is a bit different. The visitor has something to read and then the images pops out when loaded, but that's not our case. As I said, we only display images within our posts. When a post contains a big image, it is simply empty until the image is loaded, and I believe we are loosing a lot of possible future regular visitors because of this. They could believe we have empty pages. I've searched everywhere for a solution, a plugin, anything; in vain. I am really surprised that this issue has never came up before. My solution would be to display a tiny (ajax?) preloader until the image is loaded, so the visitor is notified that some content is being loaded. I'm a designer, and my programming skills are limited to html and css.


title: How to display every pictures from all the posts on one page?

text: So i want to create a gallery of all the pictures from all the posts into one page. I tried different plugins but they need constant maintain i.e. I have to go add the new picture in the gallery plugin everytime. What I want this gallery to be able to do is to auto-generate or auto-pull all the pictures from all the posts. So my client or I do not need to update both the post as well as the gallery everytime. However, I have no idea how to do this! haha Your help and kindness would be greatly appreciated! Thank you in advance! :)


title: wordpress testimonials

text: I have add a testimonial plugin to show the all featured testimonial on my wordpress home, and category pages. But on category page testimonial slider not working properly. I have also check the JS issue, nothing have to find. Please give me specified answer. Thanks in advance. Please specify me where I need to put the testimonials JS.


title: Wordpress running SQL query to update database from form

text:
Basically I want to take information in from a form and use a separate php page to update the database. so here is the original wordpress php page (add_person.php):               <?php     /*     Template Name: tpl_add_person     */     ?>          <?php get_header(); ?>

<?php echo the_title(); ?>
              <?php             if (is_user_logged_in()): ?>                 <form action="/wordpress/add_user.php" method="post">                     <input name="forename" type="text">                     <input type="submit" value="submit">                 </form>                  <?php endif; ?>
     <?php get_footer(); ?>      And here is the add_user.php form to update the database (note this works if I put it on the above page with dummy information and let it update the database on page load)               <?php         global $wpdb;              $wpdb->insert('tbl_pupils',             array(                 'forename'=>$_POST['forename']             ),             array(             '%s'                        )         );     ?>      But my problem is that when i click the submit button it shows the homepage, nothing done to the database and the url link in the url address bar is: localhost/wordpress/add_user.php can anyone help?


title: Child Theme Performance

text: I've read a lot of discussions here and elsewhere about creating a child theme being the recommended way to create a theme based on some other existing theme. I'd like to know about possible performance disadvantages of such approach, compared to creating a non-child theme. It seems that a parent-and-child-theme approach has to deal with loading a hell of a lot more files than a single theme – unless I'm missing something in the codex explanation. And if so, it has to slow down loading, probably significantly. I would appreciate if someone could clarify this for me.


title: How to create a button click counter meta box?

text:
I am trying to create button click counter meta box in a custom post type, but I can't get it to work. What I want to do is when a user click the submit button, then it will do `update_post_meta` in the background and display the value on the current screen by `echo` `get_post_meta` with ajax. Here is my codes so far: **Hooks the metabox function**               add_action('add_meta_boxes', 'add_custom_categories_box');      **Add metabox function**               function add_custom_categories_box() {        add_meta_box(             'wpse_54822_sectionid',             __( 'Page Attachments' ),              'wpse_54822_inner_custom_box',             'indtablea', 'normal'         );     }       **Meta box**               function wpse_54822_inner_custom_box(){     ?>          <?php     ?>     <button id="target" type="button">Click Me</button>
10

1
     <input type="submit" name="submit" class="submitmeplease" value="Submit" />     <?php     }      **Ajax Response**                // Response to ajax script     function ajaxResponse($post){       $data = $_POST['submit'];     update_post_meta($post_ID, 'my_key', $data);      }       add_action('wp_ajax_ak_attach', 'ajaxResponse');      I can't figure out what is the string of the variable `$data` in the `ajaxResponse` function should be. Could somebody walking me through on creating that button click counter in metabox? Please help me..


title: Remove Internal Style Sheet if no Value Provided?

text: I am using this code to add my options inside head section code works but my problem is that if no values are provided my function still echoes an empty `<style type="text/css"><style>` into my head.      _How can I remove style tags if no values are returned?_   Thank You!!               //Hook into WP head and add our options     add_action('wp_head', 'dynamic_options');     function dynamic_options() {         $checkbox = get_option('sandbox_theme_social_options');     $checkbox['hide_sidebar'] ='';       $css = array( 'headercolor'=>'blank',                    'wrapper_background_color'=>'blank' );               $css['headercolor'] = get_header_textcolor(); // get_header_textcolor();               $css['wrapper_background_color'] = get_option('wrapper_background_color');             foreach( $css as $itm => $value ) {                 if($value !='blank') {                        echo '<style type="text/css">';                     if($css['wrapper_background_color']!=''){                      echo "#wrapper{background-color:".$css['wrapper_background_color'].";                      }"; break;                      }//End if background color                          if ($checkbox['hide_sidebar'] == 'on'){                          echo '.sidebar_sec{display:none;}';                         }//End if sidebar on                     echo '</style>';                 }//End If value Blank                  }//End Foreach          }// End Dynamic options


title: update_post_meta, xml parser

text: I'm hitting the wall for nearly two hours now, trying to figure this out. Here is the thing' I have made a xml parser to read xml file and add posts (with content) from xml:               $ch = curl_init( "http://abc.xml" );          curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );     curl_setopt( $ch, CURLOPT_HEADER, 0 );     $data = curl_exec( $ch );     curl_close( $ch );     $doc = new SimpleXmlElement( $data, LIBXML_NOCDATA );               $size = count( $doc );     $count_added = 0;     for( $i = 0; $i <= 1; $i++ )     {         $img = $doc->prod[$i]->awImage;         // skipping the part of post adding         $my_post_id = wp_insert_post( $new_post );         update_post_meta( $my_post_id, 'prod_image', $img );     }      Problem is that custom filed doesn't get my `$img` value, even though if I do echo `$img` - I get the content... Strange thing is if I create some other variable `$var="test"` and enter this instead `$img` in `update_post_meta` - the custom field gets the value of `$test`... Whats wrong here, because I'm starting to hit keyboard really badly... Regards.


title: SFTP define in wp-config.php

text: just wondering if theres a way to define sftp info in wp-config.php the same way you can with ftp. makes plugin adding a lot easier! best,Dan.


title: How can I include a post in a theme?

text: Sometimes it might be necessary to include frequently-changing content in a theme, but themes take some time to modify, it may also be necessary to let a non-technical user maintain some content that appears on more than one page. Is it possible (without heavily impacting performance) to include a post in a theme? ![alt text](http://i.stack.imgur.com/hLWPU.png)


title: Custom Nav walker display current menu item children, or siblings on no children

text: I've been messing around / searching for hours and still can't get this to work, so i'm finally giving in and asking for some help. I'm trying to write a custom walker that shows only the current pages children, or if there are no children display the pages siblings. For example, take the following menu tree:   * 1.0      * 1.2.0        * 1.3.0       * 1.3.1       * 1.3.2     * 1.2.1     * 1.2.2   * 2.0 Let's assume that i am on the current page 1.2.0. On this page I want to display it's children (1.3.0, 1.3.1, 1.3.2) however, if i'm on the page 1.2.2, since it doesn't have any children, it should display it's current level siblings, so it should show me (1.2.0, 1.2.1, 1.2.2).


title: Put Microsoft Excel xlsx document

text: I want display Microsoft Excel xlsx sheet in wordpress. How i can do that? Also it will be looking like excel sheet.   http://i.stack.imgur.com/tBofs.png Thanks.


title: Hide meta box based on post format

text: I'm currently using a version of this function - post formats - how to switch meta boxes when changing format? which hides all meta boxes until a corresponding post format is selected (Ie; If someone selects "Video" then my custom Video meta box shows up) But when the post is saved all the meta boxes become hidden again unless I reselect the post format. Is there a way to show the appropriate meta box even when the post has been saved? This is the main function;               jQuery( document ).ready( function($)             {                 // Starts by hiding the "Video Options" meta box                 $( "#video-options" ).addClass( "hidden" );                      // If "Video" post format is selected, show the "Video Options" meta box                 $( "input#post-format-video" ).change( function() {                     $( "#video-options" ).removeClass( "hidden" );                 } );                  }         );


title: Is there possibility to Customize the present theme adding sidebars

text:
I am using a WordPress theme which has just header and footer. I would like to continue using it by changing the width and adding side bars. Could anyone help me to change the width (to fit to the screen) of the theme. Does anybody have an idea on how to add sidebars to this theme? ========== Sorry for not making clear in my earlier question. The theme I am using is Minicard The lines similar to ...               if (function_exists('register_sidebar') )         register_sidebar(array(             'name' => 'Sidebar Widgets',             'before_widget' => '
',             'after_widget' => '
',             'before_title' => '
',             'after_title' => '
'         ));      are already there. This is the code I found there:               if ( function_exists('register_sidebar') ) {              register_sidebar(array(             'name' => __('Beneath the Card (Top)', 'minicard'),             'before_widget' => '
',             'after_widget' => '

',             'before_title' => '
',             'after_title' => '
',         ));         register_sidebar(array(             'name' => __('Beneath the Card (Bottom)', 'minicard'),             'before_widget' => '
',             'after_widget' => '

',             'before_title' => '
',             'after_title' => '
',         ));     }      So I have created `sidebar.php` file and added the code you have given for side bar. Later I have tried to add the following code:               #sidebar {         width: 240px;         float:right;         padding:0 20px 20px;     }      to CSS. After making these changes I've looked for the sidebar and I havn't found any additional one.


title: How do I know if a user has a blog in Wordpress Multisite?

text: I have a Wordpress Multisite installation with Buddypress. I would want to restrict people from creating another blog so that they have only one blog. How do I achieve this?


title: Password protected Profile View

text:
I have extended the user profile page in the backend so that each user profile has several extra custom fields for data such as favorite movies, birthday and so on can be stored. Creating a dating website, that is why more fields are needed. People with the proper code can see these profiles in the front end using an entry code which basically is some random code plus userID as number at the end. Using PHP substring the userID is grabbed and access is granted See code:               if(empty($_REQUEST['enterCodeId'])){                 echo "";         }else{                 $getId=substr($_REQUEST['enterCodeId'], 4, 10);                 $querystr ="SELECT ID FROM wp_prefixcode_users WHERE ID='".$getId."'";                 $querystrChecking = mysql_query($querystr);                 if(mysql_num_rows($querystrChecking)<=0){                     echo "";                 }                 $uploads = wp_upload_dir();              //         }      This setup is not ideal because a: the code cannot be added from the profile page yet, which can be remedied with an extra `get_the_author_meta()`, but I need a better way to generate a password, but also because b: a password will always end in the same userID number. How can I give users the option to automatically generate an access password from the Dashboard > Users > User Profile so users can regenerate a new access key? This is needed so access given to another user can be revoked. I need a PHP function to generate a new key and get it stored as an author_meta field in the database. **Solution** Thanks to Toscho and another dev I got this code to load it all. In functions.php I added:               add_action( 'init', 'accesskeygen_func' );          function accesskeygen_func() {         $phpfile = explode('/', $_SERVER['PHP_SELF']);         $phpfile = $phpfile[count($phpfile)-1];              if (($phpfile=='profile.php') && isset($_GET['accesskeygen'])) {             echo wp_generate_password();             exit;         }}      and
     <?php _e("Access Key"); ?>	          <input type="text" name="myaccesskey" id="myaccesskey" value="<?php echo esc_attr( get_the_author_meta( 'myaccesskey', $user->ID ) ); ?>" class="regular-text" />
              <input type="button" class="button-secondary" id="myaccesskeygen" value="Generate Access Key"/>          <?php _e("Please click the button generate access key."); ?>


title: Is there a way to delete images from the Media Library programatically?

text: I did a custom user profile page for wordpress that lets you update your profile including uploading your custom avatar and save that photo to the Media Library. Is there a way for the a specific avatar to be deleted using it's attachment ID?


title: Combining queries with different arguments per post type

text: I am building a section on a site where I am merging _two different post types_ into one loop, and then displaying them randomly. The problem is, I'm having a hard time finding a way to limit the amount of posts _per_ type. Here's what I've tried:   * One query with multiple post types can be achieved with an array:              $args = array( 'post_type' => array( 'photos', 'quotes' ), ...      ... but cannot limited to a certain number of posts per type.        * Merging two query argument arrays before running **WP_Query** on it:              $photos = array( 'post_type' => 'photos', 'posts_per_page' => 15, 'orderby' => 'rand' );     $quotes = array( 'post_type' => 'quotes', 'posts_per_page' => 5, 'orderby' => 'rand' );          $args = $photos + $quotes;     // Also tried array_merge( $photos, $quotes );      No luck on this. What happens is the latter variable `$quotes` overwrites `$photos` and only shows the quotes.        * Merging two **WP_Query** objects together through typecasting:              $photos_query = new WP_Query( $photos );     $quotes_query = new WP_Query( $quotes );     $result = (object)array_merge( (array)$photos_query, (array)$quotes_query );      ... and so on. I could probably use an SQL query straight to the database, but I _need_ to be able to combine these two separate post types for one loop, arranged randomly, AND limited to a certain amount of posts per type. Thanks for your help!


title: Is it possible to use object in add_action?

text: So is it possible to do something like this with `add_action`?               class class{}     $my_class = new class;     add_action('init', 'my_class');


title: How to create a plugin that notifies for updates?

text: At this point when I activate a plugin and an update is available it updates the plugin. I like to create a plugin myself that I want to use private, I have several WordPress blogs and if I made an update to the plugin I like those several WordPress blogs to state that there is an update available. Does anyone know how to do that?


title: How to customly read JWPlayer's "Playlist" items by using its "playlistid"?

text: In Wordpress (3.8.1) and JW Plugin (v2.1.2) with JW Player (v5), I need to read off the items contained in the Playlists of the JWPlayer Plugin. ## Normally The **JWPlayer Plugin** works like this, via Shortcode:               [jwplayer playlistid="1234"]      .. then a `Video Player` will be being rendered on the Page, together with a Playlist inside. * * * ## What i want to do (The Customizing) So now how do i customly do by myself .. **if i want to know (or pull out) the items inside a Playlist** , by using its `playlistid` or `1234`. Lets say in a totally New Page ( **without using JWPlayer Shortcodes** ), i will use my **own Custom Shortcode** , like:               [playlistitems id="1234"]      (The `id` is the ID of JWPlayer "existing" Playlist)   Then **The New Page** will be showing (just list down) the Items inside, like:               - intro.mp4     - chapter-1.mp4     - chapter-6.mp4     - wrapup.mp4      .. something like that **which needs to be done by my custom module (or) functions**. * * * In more simple words:   * I want to list down the Items inside the JWPlayer's `playlist` (by using its ID)   * How does JWPlayer reads a Playlist. Then i may need to clone its function. Thank you.


title: switching theme in WordPress theme customizer control panel

text: I am working with WordPress theme customizer. My client wants several options in customizer screen like site title, tagline and few other options. i had gone well with above options but i am getting confused how switch the themes in customizer for example i am working on twenty fourteen, i have to show drop down options in customizer to change the theme preview to twenty thirteen, twenty twelve or all existing themes in that drop down. if the admin select the twenty twelve from drop down the customizer live preview has to be change to twenty twelve preview and once he press save & publish the website theme has to be change to twenty twelve. anybody have idea how to add this option to WordPress customizer ...


title: Show different time stamp based on time

text: What's the best way to show a time stamp based on different times? For example: if a post is under 24 hours, show _%% mins/hours ago_. If a post is over 24 hours, show _month/day/time_. If a post if over a year ago, show _month/day/year/time_. I've done this so far:               <?php if(get_the_time('G') < 23) {     the_time('Y'); } else {     the_time('F j, Y at g:i a'); } ?>


title: window.send_to_editor throws unterminated string literal error when adding image with multi line description

text: I am using `media-upload.php?type=image&tab=library` script to add an image to a post with a description that contains html. This php script uses the javascript function `window.send_to_editor` to send the html to the page. This allows you to insert image html into a post. The problem is, if you try to add an image with a description that has text broken up on multiple lines(html) you will get a `unterminated string literal` error from javascript b/c the string is not converted correctly before it is used. Is there anyway around this?


title: ACF Relationship Posts how to show additional content

text:
I have created a relationship between my custom posts Work and Talent using Advanced Custom Fields. I am currently showing posts from Talent on my work pages with the following posts:               <?php                               $artist = get_field('artist');                              ?>                         <?php if( $artist ): ?>
                             <?php foreach( $artist as $artist ): ?>
                                     <a href="<?php echo get_permalink( $artist->ID ); ?>">                                         <?php echo get_the_title( $artist->ID ); ?>
                             <?php endforeach; ?>
                         <?php endif; ?>      However I would like to be able to show/pull-through a field that is in my artist sections on my work pages. I have tried doing the below but it doesnt work:               <?php                               $artist = get_field('artist');                              ?>                         <?php if( $artist ): ?>
                             <?php foreach( $artist as $artist ): ?>
                                     <a href="<?php echo get_permalink( $artist->ID ); ?>">                                         <?php echo get_the_title( $artist->ID ); ?>                                                                                <?php the_field( 'artist_summary' ); ?>
                             <?php endforeach; ?>
                         <?php endif; ?>


title: Garbage in uploads folder

text: I have massive number of files in my uploads folder. Is there a way of identifying those which are not linked to any post? Note: some of those files are manually copied to uploads folder not via "media library"


title: Page navigation doesn't show when query category

text:
**Problem** :   when I do www.example.com?cat=4 or choose category through custom menu or from category widget it shows only first page without navigation at the bottom, where it supposed to be. It's the same if I use index.php or category-slug.php as template. For test, when I do www.example.com?year=2012 it works. Also, www.example.com?cat=4&paged=2 works. So it must be something with categories. **My setup:** Wordpress 3.5, Free WP tube theme, SQLite **Relevant code:** index.php               <?php get_header(); ?>                                                                              query_posts($query_string.$orderby.'&cat=4'); //in this case showing category with navigation works                                 if (have_posts()) : ?>                                 <?php $i=0; while (have_posts()) : the_post(); $i++; ?>                                                                          <?php if($i%3==0) : ?>

<?php endif; ?>                                      <?php endwhile; wp_reset_query(); ?>                                 <?php                                  $next_page = get_next_posts_link('Previous');                                  $prev_pages = get_previous_posts_link('Next');                                 if(!empty($next_page) || !empty($prev_pages)) :                                 ?>
                                     <?php if(!function_exists('wp_pagenavi')) : ?>
<?php echo $next_page; ?>

<?php echo $prev_pages; ?>
                                     <?php else : wp_pagenavi(); endif; ?>
                                                                  <?php endif; ?>      Note: you can see I'm using the `&cat=4` in query. It is the same as `category_name=video` because I want to show only videos on home page. But also, I want to make able to choose that category from custom menu in which case doesn't show page navigation. **What I have tried:** Making `$wp_query = null` then making new query before the Loop. http://wordpress.org/support/topic/next-page-navigation-doesnt-work. Basically any variation of this               <?php     $myqueryname = $wp_query;     $wp_query = null;     $wp_query = new WP_Query();     $wp_query->query('showposts=5'.'&paged='.$paged);     ?>      Doesn't work. Adding $paged as suggested by the creator of WP-pagenavi and forums:               <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>                                       <?php query_posts("cat=-11&paged='.$paged);; ?>      Doesn't work. **Testings:** besides the simple ones in the "problem" part of the question i did `print_r($wp_query)` all the way to see where to problem starts and it starts right on the beginning, ie. when i put `print_r($wp_query)` as the first line in header.php. So, the problem is not in the custom query of the theme, am I right? I did it for the working $wp_query and not working $wp_query then compared them. This is the relevant comparison part of the code: Working $wp_query:               [category_name] =>     [cat] => 4     ...     **//most important part**     [found_posts] => 382         [max_num_pages] => 43     ...     [request] => SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private')  ORDER BY wp_posts.post_date DESC LIMIT 0, 9     ...     //here shows code for some posts even if not displaying them, because they're not in the cat=4 or category_name=video       non working $wp_query:               [category_name] => video     [cat] => 4     ...     **//most important part**     [found_posts] => 1     [max_num_pages] => 1     ...     [tax_query] => WP_Tax_Query Object             (                 [queries] => Array                     (                         [0] => Array                             (                                 [taxonomy] => category                                 [terms] => Array                                     (                                         [0] => video                                     )                                      [include_children] => 1                                 [field] => slug                                 [operator] => IN                             )                          )                      [relation] => AND             )     ...     [query] => Array             (                 [category_name] => video             )              [request] => SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) WHERE 1=1  AND ( wp_term_relationships.term_taxonomy_id IN (4) ) AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 9     ...     //this $wp_query doesn't show code for the posts which are not from video category     ...     [queried_object] => objArray Object             (                 [term_id] => 4                 [name] => Video                 [slug] => video                 [term_group] => 0                 [term_taxonomy_id] => 4                 [taxonomy] => category                 [description] =>                  [parent] => 0                 [count] => 379                 [cat_ID] => 4                 [category_count] => 379                 [category_description] =>                  [cat_name] => Video                 [category_nicename] => video                 [category_parent] => 0             )      **Edit #1:** This is the comparison BEFORE the custom query! When I dumped $wp_query inside the Loop, after the custom `query_posts()` they are identical. So the problem is not in the $wp_query. Also, from the index.php code `get_next_posts_link('Previous')` returns NULL when choose category form menu or `?category_name=video` **Conclusion:** something is happening before the template files with default query, but I don't know what. Can somebody help me to show page navigation? **Edit #2:** Since the `get_next_posts_link('Previous')` returns NULL I knew it's something about the `$wp_query->max_num_pages;` That number must be bigger than 1 to show navigation. So i tested by putting code `<pre><?php echo $wp_query->max_num_pages; ?></pre>` to see when it changes from 1 to >1. I discovered that in working version it changes after the `<?php endwhile; wp_reset_query(); ?>` and in non working it doesn't change.


title: Formatting <code>?

text: I have serious trouble displaying code blocks in my theme. I want to display something like:               <something>          <something-else>               Content          </something-else>     </something>      And it works fine everywhere, but doing that inside code tag:               <code>         <something>              <something-else>                   Content              </something-else>         </something>     </code>      Displays code block looking like:               <something>     <something-else>     Content     </something-else>     </something>      And setting code's CSS to:               white-space: pre-wrap;      Produces confusing:               <something>     </br>        <something-else>     </br>           Content     </br>        </something-else>     </br>     </something>      Almost perfect, but where these come from? Additionally I'm disabling WP AutoP and it works, but not within code tags: **functions.php**               remove_filter ('the_content',  'wpautop');     add_filter( 'the_content', 'wpautop' , 12);      Any ideas?


title: How and why can a hook call itself without causing recursion?

text: When looking in WP hooks' code, I often see hooks that call themselves. For example, this snippet from image_downsize():               function image_downsize($id, $size = 'medium') {              if ( !wp_attachment_is_image($id) )            return false;              if ( $out = apply_filters( 'image_downsize', false, $id, $size ) ) {            return $out;         }      Why doesn't this cause recursion? Thanks


title: Can I paginate this get_attachment query?

text: Yeah, basically I want to be able to show 15 images attached to a certain page and have pagination when the page has more than 15 images. I'm not very well versed on this kind of query so I'm a bit stumped.                <?php $args = array('numberposts' => 15, 'orderby' => 'menu_order', 'order' => 'ASC', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'post_parent' => $post->ID); ?>                              <?php if ( $photos = get_posts($args) ) : ?>                                  <?php foreach ( $photos as $photo ) : ?>                                      <a href="<?php echo $photo->guid; ?>" target="_blank" class="lightbox" rel="[<?php echo $post->ID; ?>]"><?php echo wp_get_attachment_image($photo->ID,'thumbnail'); ?>                                  <?php endforeach; ?>                              <?php endif; ?>


title: WPML string translation not saving

text: I have a template file where I have a string. I would like to translate it, using WPML - Multilingual Blog. My setup is a following: functions.php               ##################################################################     # Language      ##################################################################     icl_register_string("template_fullwidth", "relatedSubjects", "Se relaterede emner:");      in my template file:               <?php echo "<h3>".icl_t("template_fullwidth", "relatedSubjects", "Se relaterede emner:")."</h3>"; ?>      When i go to the backend interface and enter the translation and press save the "spinning wheel of death" appears and nothing happens, see image. Image: https://lh6.googleusercontent.com/-paBv76Z3db8/UekaeUjtu6I/AAAAAAAAMoc/PQLV3n2XkO4/w685-h192-no/WPML.png (The spinning wheel of death is on top of the word "Related" in the translations field) In my JS console i get the following messages:               Warning: The page at https://<sitename>/wp-admin/admin.php?page=wpml-string-translation/menu/string-translation.php#icl-st-toggle-translations displayed insecure content from http://<sitename>/wp-admin/admin.php?page=sitepress-multilingual-cms/menu/languages.php.      [VM] admin.php?page=wpml-string-translation/menu/string-translation.php (1428):1     Error: Failed to load resource: the server responded with a status of 404 (Not Found) https://dev.studerende.dk/wp-admin/images/gray-grad.png     2     Error(2): Uncaught TypeError: Cannot read property 'parentNode' of undefined load-scripts.php?c=0&load%5B%5D=jquery,colorpicker,utils&ver=3.5.2:5     Warning: The page at https://<sitename>/wp-admin/admin.php?page=wpml-string-translation/menu/string-translation.php#icl-st-toggle-translations displayed insecure content from http://<sitename>/wp-admin/admin.php?page=sitepress-multilingual-cms/menu/languages.php.      [VM] admin.php?page=wpml-string-translation/menu/string-translation.php (1428):1      What am i doing wrong? And how do I make it translate my string?


title: get_children filter with postmeta

text: I am doing the following to get all the children associated with a post:                   $args = array(             'order'=> 'ASC',             'post_parent' => get_the_ID(),             'post_status' => 'publish',             'post_type' => 'task'         );         $tasks = get_children( $args );      Now the posts of type `task` have postmeta associated with them. One particular meta_key is `task_progress`. I would like to get all the children whose `task_progress` meta_value is less than 100. What is the best way to filter the results?


title: Add Post Author body class to WordPress

text: I'm trying to add a custom body class to WordPress which should be the author of the post which is displayed. I looked at different how to's and tried to create some code but it doesn't work:               add_filter( 'body_class' , 'ft_add_guest_body_class' );          function ft_add_guest_body_class( $classes ) {              // add 'wp_admin' to the $classes array              if (get_the_author() != 'MrX')             $classes[] = 'wp_admin';              // return the $classes array         return $classes;          }      The problem is that the `wp_admin` body class is displayed on every page and post. When I remove the conditional the body class is still applied so it must be that.


title: wordpress admin is broken

text: I have just installed a fresh version of the latest wordpress locally but the backend admin area looks like this http://grab.by/iGik Not sure what is causing this, I have tried redownloading and reinstalling witha new database but still doesnt work. uggh! DEBUG INFO I get the following error when I go to the updates page, but I have no errors or warnings on the homepage.               Notice: ob_end_flush(): failed to send buffer of zlib output compression (0) in /Volumes/data/Documents/websites/mrskitson2012/wp-includes/functions.php on line 2690


title: Open WordPress Page from selected option dropdown

text: Code/process to get option dropdown menu selection to open page in WordPress with php? Tried all kinds of plug-ins, widgets, but none will make menu that fits requirements of project so far. Selections are page titles that are dynamically loaded from a table of address and other data. Based on previous selection of state, then city, then place, the next step is to open WordPress page from selected title, called place. This is a normal option-select box:               <input type="submit" name="submit" value="place">      The selections are WordPress page titles. When submit is pressed, the issue is to go to page selected, a page for the selected business. What I'm actually trying to do is produce a menu that can select among pages by state, city, and choose the place - the page belonging to that place. Eventually this will expand to country but right now the US. Each place has its own page. Tried a **lot** of plug ins and widgets and none has so far been up to this. I don't know beans about java so I went with php.


title: Upload folder is not writable, even when permissions are correct

text: I recent migrated my site from Godaddy to Webfaction. On migration, I get this error: > Upload folder is not writable. Export and file upload features will not be > functional. Naturally, I check the permissions of the folder - and they are correct. Just to be safe, I changed it recursively to "777" (as a test, not permanently), and I still cannot upload images. How can I troubleshoot this issue?


title: Array: What is this value based on?

text: I need to do an import of an array of checkboxes, but there is a value that I don't how it is determined. The array is based on a user meta option that I created that shows a list of category checkbox options. It grabs all of the categories and creates a checkbox option that can be saved to a user's profile. This is part of the coding I used to create the user meta option:               $args = array( 'hide_empty' => 0, 'taxonomy'=> 'category');     $categories =  get_categories($args);          if ($categories){                             foreach ( $categories as $category ){                                  if(in_array($category->term_id,(array)$data)) {                                     $selected = 'checked="checked""';                                 } else {                                     $selected = '';                                 }                                 echo '<input name="user_cats[]" value="'.$category->term_id.'" '.$selected.' type="checkbox"/> '.$category->name.'<br/>';                             }                         }      This is what the options look like in the user profile page: ![enter image description here](http://i.stack.imgur.com/duVqo.jpg) After doing a test save of the some of the checkbox selections, I examined the database value of the "user_cats" field, it gives me something like this: **a:2:{i:0;s:2:"20";i:1;s:3:"343";}** Now, I know what all but one of the variables stand for. **a** = Total amount (quantity) of selections **i** = Sequential number of the selection (*Starting with 0) **"X"** = The number value within the parenthesis is the category ID My question is, what is the **s:** value based on? I tried comparing to


title: Last class on last headline?

text:
I have the following code which should add a last class to the fourth post but doesn't appear to be, what is wrong with this coding? It show's 4 posts fine but the fourth one doesn't have the class last attached to it.

               <?php if (have_posts()) : while (have_posts()) : the_post(); $count = 1;       if( $post->ID == $do_not_duplicate ) continue; ?>               <li <?php if ($count == 4) : ?>class="last"<?php endif; ?>><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>">                 <?php the_post_thumbnail( array (176,176) );?>                                  <?php the_title(); ?>
               <?php endwhile; $count++; endif; ?>


title: Why does WP allow to view and media item as a page

text: Every media item that is uploaded to Wordpress can be viewed in a page. This can be seen if you browse to the Media section, hover on any item and click view. Are there any benefits to this because I am not seeing any at the moment. Can this feature be edited (or removed)?


title: Front end submit form with jquery form plugin

text: Maybe someone can help me with a small problem I'm having. I'm trying to use this: http://jquery.malsup.com/form/ to create a submit form for Wordpress. I've tested it on a regular site(not WP) and it works. I can't figure out why it won't work in wp. This is my form. I've created two page templates, one has the form, the other has the wp_insert_post code. If I change the form action to action="http://mysite.com/page.php" it works, if I point it to a page template it doesn't. I need it to point to a page template for the wp_insert_post code to work. This is on one first page:               <form id="myForm" action="http://mysite.com/submitest" method="post">      Name: <input type="text" name="name" />      Comment: <textarea name="comment"></textarea>      <input type="submit" value="Submit Comment" />       Thanks


title: Custom Post Type Archives by Year & Month?

text: How do you display the archives of a Custom Post Type by Year & Month?


title: jquery: getting contents of #content field on post page

text: I managed to get the #content field html with this jquery call:               jQuery("#content").html()      This seems to be failing though on "Add New Post" pages. Any tips on how to get the contents of the #content div? Cheers


title: custom data in url

text: Inside a WordPress site I load a external xml file parse it and show some links. The link looks like this:   `domain.com/prof/vac/item?guid=1234&title=foo`   This works, but now i would like the url to look like this:   `domain.com/prof/vac/item/1234-bar`   when I create a link to that url and click it it says it kind find the page. However if i just put the guid in and forget about the title it works:   `domain.com/prof/vac/item/1234` can anyone point me in the right direction?


title: Front end user meta options for users

text:
I have created user meta options using this tutorial. Now I want to know how to allow users to edit (update) certain custom user meta options that I created. Users already have a template account page where they have access to some user meta options. I added the a function to the users' page to update the meta field upon clicking the update button on the page. Im using text input fields for the new user metas. This is the code I used to update the options:               add_action( 'personal_options_update', 'my_save_extra_user_fields' );     add_action( 'edit_user_profile_update', 'my_save_extra_user_fields' );          function my_save_extra_user_fields( $userId ) {              if ( !current_user_can( 'edit_user', $userId ) )             return false;              update_usermeta( $userId, 'address2', $_POST['address2'] ); // Custom meta 1         update_usermeta( $userId, 'address3', $_POST['address3'] ); // Custom meta 2         update_usermeta( $userId, 'hours', $_POST['hours'] ); // Custom meta 3     }      But when I update the page it shows the previous values saved in the back-end (admin) section of wordpress. Of course, any values saved in the back end are saved correctly and displayed on the front-end. I wanted to save either way, from back-end and from front-end. What am I doing wrong? How do I fix this? Thanks **UPDATE:** Here is the code for the template page that users use to update their existing meta information:               <?php get_header(); ?>                         <?php           $user_info = get_userdata($current_user->ID);      $userId = $userdata->ID;          $location = $userdata->jabber;     $lsplit = explode('**',$location);     $full_location =  ''.$lsplit[2]. ', ' .$lsplit[3]. ' ' .$lsplit[1]. ' ' .$lsplit[4]. ''; // 0 = Country; 1 = State; 2 = Address; 3 = City; 4 = Zip Code; 5 = Phone Number     $statesplit = explode(', ', $lsplit[1]); // State split: 0 = State name; 1 = State Abbreviation     $location_pt1 =  $lsplit[2];     $location_pt2 =  ''.$lsplit[3]. ', ' .$statesplit[1]. ' ' .$lsplit[4]. '';          ?>               <?php echo $PPTDesign->GL_ALERT($GLOBALS['error_msg'],$GLOBALS['error_type']); ?>

My Account

              <a href="javascript:void(0);" onClick="jQuery('#My').hide(); jQuery('#MyDetails').show()" title="<?php echo SPEC($GLOBALS['_LANG']['_tpl_myaccount2']) ?>">             <img src="<?php echo IMAGE_PATH; ?>a1.png" style="float:left; padding-right:20px; margin-top:10px;" />             <?php echo SPEC($GLOBALS['_LANG']['_tpl_myaccount2']) ?>
             <?php echo SPEC($GLOBALS['_LANG']['_tpl_myaccount3']) ?>

                           <img src="<?php echo IMAGE_PATH; ?>artwork1.png" style="float:left; padding-right:20px; margin-top:10px;" />             Artwork
             Approve your artwork

              <a href="<?php echo get_option("manage_url"); ?>" title="<?php echo SPEC($GLOBALS['_LANG']['_tpl_myaccount6']) ?>">             <img src="<?php echo IMAGE_PATH; ?>a3.png" style="float:left; padding-right:20px; margin-top:10px;" />             Manage My Offers
             <?php echo SPEC($GLOBALS['_LANG']['_tpl_myaccount7']) ?>

              <a href="<?php echo get_option('submit_url'); ?>" title="<?php echo SPEC($GLOBALS['_LANG']['_tpl_myaccount8']) ?>">             <img src="<?php echo IMAGE_PATH; ?>a5.png" style="float:left; padding-right:20px; margin-top:10px;" />             Create New Offers
            <?php echo SPEC($GLOBALS['_LANG']['_tpl_myaccount9']) ?>

              <a href="<?php echo get_option("messages_url"); ?>" title="<?php echo SPEC($GLOBALS['_LANG']['_tpl_myaccount4']) ?>">             <img src="<?php echo IMAGE_PATH; ?>a2.png" style="float:left; padding-right:20px; margin-top:10px;" />             <?php echo SPEC($GLOBALS['_LANG']['_tpl_myaccount4']) ?>
             <?php echo SPEC($GLOBALS['_LANG']['_tpl_myaccount5']) ?>

              <a href="<?php echo get_option("contact_url"); ?>" title="<?php echo SPEC($GLOBALS['_LANG']['_tpl_myaccount10']) ?>">             <img src="<?php echo IMAGE_PATH; ?>a4.png" style="float:left; padding-right:20px; margin-top:10px;" />             <?php echo SPEC($GLOBALS['_LANG']['_tpl_myaccount10']) ?>
             <?php echo SPEC($GLOBALS['_LANG']['_tpl_myaccount11']) ?>

              <a href="<?php  echo wp_logout_url(); ?>" title="<?php echo SPEC($GLOBALS['_LANG']['_tpl_myaccount12']) ?>">             <img src="<?php echo IMAGE_PATH; ?>a6.png" style="float:left; padding-right:20px; margin-top:10px;" />             <?php echo SPEC($GLOBALS['_LANG']['_tpl_myaccount12']) ?>
             <?php echo SPEC($GLOBALS['_LANG']['_tpl_myaccount13']) ?>

 Account Details<?php // echo SPEC($GLOBALS['_LANG']['_tpl_myaccount1']) ?>

<a href="<?php echo $GLOBALS['premiumpress']['dashboard_url']; ?>" title="<?php echo SPEC($GLOBALS['_LANG']['_head4']) ?>">Back

             <form action="" method="post" enctype="multipart/form-data">      <input type="hidden" name="action" value="1" />          <fieldset>

          <?php echo SPEC($GLOBALS['_LANG']['_tpl_myaccount15']) ?> <?php echo SPEC($GLOBALS['_LANG']['_tpl_myaccount16']) ?>
          <input type="text" value="<?php echo $userdata->user_login; ?>" disabled class="short" />

          Email *
          <input type="text" name="form[user_email]" value="<?php echo $userdata->user_email; ?>" class="short" tabindex="10" />

          <?php echo SPEC($GLOBALS['_LANG']['_tpl_myaccount17']) ?> *
          <input type="text" name="form[user_url]" value="<?php echo $userdata->user_url; ?>" class="short" tabindex="11" />

          <?php echo SPEC($GLOBALS['_LANG']['_tpl_myaccount18']) ?> *
          <textarea tabindex="5" class="short" rows="4" name="form[description]"><?php echo $userdata->description; ?></textarea>

          </fieldset>
<?php echo SPEC($GLOBALS['_LANG']['_tpl_myaccount19']) ?>
          <fieldset>

          <?php echo SPEC($GLOBALS['_LANG']['_tpl_myaccount20']) ?> *
          <input type="text" name="form[first_name]" value="<?php echo $userdata->first_name; ?>" class="short" tabindex="12" />

          <?php echo SPEC($GLOBALS['_LANG']['_tpl_myaccount21']) ?> *
          <input type="text" name="form[last_name]" value="<?php echo $userdata->last_name; ?>" class="short" tabindex="13" />

          <?php echo SPEC($GLOBALS['_LANG']['_tpl_myaccount25']) ?> *
          <input type="text" name="address[address]" value="<?php echo $ADD[2]; ?>" class="short" tabindex="17" />

          <?php echo SPEC($GLOBALS['_LANG']['_tpl_myaccount23']) ?> *
          <select type="text" name="address[state]" id="first" value="<?php echo $ADD[1]; ?>" class="short" tabindex="15"><option value=""></option></select>

          <?php echo SPEC($GLOBALS['_LANG']['_tpl_myaccount24']) ?> *
          <select type="text" name="address[city]" id="second" value="<?php echo $ADD[3]; ?>" class="short" tabindex="16"><option value=""></option></select>

          <?php echo SPEC($GLOBALS['_LANG']['_tpl_myaccount26']) ?> *
          <input type="text" name="address[zip]" value="<?php echo $ADD[4]; ?>" class="short" tabindex="18" />

          <?php echo SPEC($GLOBALS['_LANG']['_tpl_myaccount27']) ?> *
          <input type="text" name="address[phone]" value="<?php echo $ADD[5]; ?>" class="short" tabindex="19" />

          <?php if ($current_user->ID == 1){ ?>

            Address 2
           <input type="text" name="address2" id="address2" value="<?php echo esc_attr( get_the_author_meta( 'address2', $userId ) ); ?>" class="short" />
           E.g. Street Address, City, State Zipcode

            Address 3
           <input type="text" name="address3" id="address3" value="<?php echo esc_attr( get_the_author_meta( 'address3', $userId ) ); ?>" class="short" />
           E.g. Street Address, City, State Zipcode

            Hours
           <input type="text" name="hours" id="hours" value="<?php echo esc_attr( get_the_author_meta( 'hours', $userId ) ); ?>" class="short" />
           Enter your hours of operation. (Optional)

          <?php } ?>           </fieldset>
<?php echo SPEC($GLOBALS['_LANG']['_tpl_myaccount30']) ?>
          <fieldset>

          <?php echo SPEC($GLOBALS['_LANG']['_tpl_myaccount31']) ?> *
          <input type="text" name="password" class="short" tabindex="20" />

          <?php echo SPEC($GLOBALS['_LANG']['_tpl_myaccount32']) ?> *
          <input type="text" name="password_r" class="short" tabindex="21" />

                                    </fieldset>          <?php if ($current_user->ID == 1){ ?>          <?php           add_action( 'personal_options_update', 'my_save_extra_user_fields' );     add_action( 'edit_user_profile_update', 'my_save_extra_user_fields' );          function my_save_extra_user_fields( $userId ) {              if ( !current_user_can( 'edit_user', $userId ) )             return false;              update_usermeta( $userId, 'address2', $_POST['address2'] );         update_usermeta( $userId, 'address3', $_POST['address3'] );         update_usermeta( $userId, 'hours', $_POST['hours'] );     }          ?>          <?php } ?>

      <input type="submit" name="submit" id="submit" class="button grey" tabindex="15" value="<?php echo SPEC($GLOBALS['_LANG']['_tpl_myaccount33']) ?>" />

          </form>

          <?php get_footer(); ?>      You can that I created three test meta fields (address 1, address 2, and hours), but Im not able to save them from the front end of the site.


title: Strip post_tags from list of returned taxonomy terms

text:
Thanks to GhostToast for helping me on my way with this post. Now I am successfully able to echo out all of the taxonomy associated terms dynamically. However, this unfortunately also seems to spit out all the site's post_tags too. So how can I use the following code, but not show the standard post_tags (I'd like to keep the post_tags available for use, just not show them as a result of this query)               // taxonomy term archives     $post_type = get_post_type();     $taxonomies = get_object_taxonomies($post_type);     if(!empty($taxonomies)){     foreach($taxonomies as $taxonomy){         $terms = get_terms($taxonomy);         if(!empty($terms)){              echo "
";             foreach ( $terms as $term ) {                 echo '
slug, $taxonomy).'">'.     $term->name . "
";             }             echo "
";         }     }     }


title: Query to return maximum of one post per author

text: We are introducing a "featured author" area on our site and would like to display the most recent articles by a select group of authors. However, we only want a maximum of one post per author to display. So an author could potentially have posted 5 times since another author had posted, but regardless only one of their posts should appear. Currently this is the code I've got:               <?php     $args = array(     'showposts' => 5,     'author' => "6800,3845,1720,7045,4949"     );          $the_query = new WP_Query( $args );          while ( $the_query->have_posts() ) : $the_query->the_post();           ?>          // DISPLAYING STUFF          <?php endwhile; wp_reset_query(); ?>      One potential solution I have considered is querying more posts and setting up an array, then checking the array each time to see if an author is already in it. If they are, it would continue to the next row. But an obvious issue with this would be that I may potentially end up having to pull back 100's of posts if a particular "featured author" hadn't wrote for a while. I'm still fairly new to PHP/MySQL and a solution is probably starring me in the face. Appreciate any assistance.


title: Require custom post type if is_admin() - template doesn't show up?

text: In my functions.php I require PHP files which register custom post types, if I'm logged in as an admin.               if (is_admin())         require_once(TEMPLATEPATH . '/custom-post-types/cpt.php');      This works great, except that the wrong template is loaded. Instead of `single-{cpt}.php` the `index.php` is used. If I remove `if (is_admin())` everything works correct, but of course the custom post type becomes visible for every non-admin. How can I solve that?