title: wp alchemy multiple image uploader output images to template

text:
I am using wp alchemy to add a custom metabox to my site with multiple image uploader option. This part is working fine, but I have no Idea how to go about outputting the image links to my template. I am hoping to output as a unordered list. setup.php file               <?php          include_once WP_CONTENT_DIR . '/wpalchemy/MetaBox.php';     include_once WP_CONTENT_DIR . '/wpalchemy/MediaAccess.php';          // include css to help style our custom meta boxes     add_action( 'init', 'my_metabox_styles' );          function my_metabox_styles()     {         if ( is_admin() )         {             wp_enqueue_style( 'wpalchemy-metabox', get_stylesheet_directory_uri() . '/metaboxes/meta.css' );         }     }          $wpalchemy_media_access = new WPAlchemy_MediaAccess();      custom-spec.php               <?php     $custom_mb = new WPAlchemy_MetaBox(array     (         'id' => '_custom_meta',         'title' => 'Add images to home page slider',         'template' => get_stylesheet_directory() . '/metaboxes/custom-meta.php',         'include_template' => 'home.php'     ));     ?>      custom-meta.php               <?php global $wpalchemy_media_access; ?>

Remove All
              <?php while($mb->have_fields_and_multi('docs')): ?>         <?php $mb->the_group_open(); ?>                  Remove                  <?php $mb->the_field('imgurl'); ?>             <?php $wpalchemy_media_access->setGroupName('img-n'. $mb->get_the_index())->setInsertButtonLabel('Insert'); ?>
                 <?php echo $wpalchemy_media_access->getField(array('name' => $mb->get_the_name(), 'value' => $mb->get_the_value())); ?>                 <?php echo $wpalchemy_media_access->getButton(); ?>
                  <?php $mb->the_field('title'); ?>             <label for="<?php $mb->the_name(); ?>">Title
<input type="text" id="<?php $mb->the_name(); ?>" name="<?php $mb->the_name(); ?>" value="<?php $mb->the_value(); ?>"/>
              <?php $mb->the_group_close(); ?>         <?php endwhile; ?>
Add

      functions.php file               include_once 'metaboxes/setup.php';          include_once 'metaboxes/custom-spec.php';


title: Get Posts by Custom Post Type ,Taxonomy, and Term

text:
Ok, so i have a Custom Post Type called "Services". This custom post type has a taxonomy called "Areas" and there's 5 terms in that taxonomy. Let's say I have 10 posts on "Services" and there's 5 posts in the term "Painting" and 5 more on the term "Photography". I need to be able to query posts from "Services" but instead of showing those 10 posts, only show 5 associated to "Painting". At the moment i'm able to query by taxonomy and terms, but that will show all of the posts from "services" with no filter by term. Basically query post by post_type from the term I choose. Any help would be awesome. Thanks.
     <?php              $args = array('tax_query' => array( array('taxonomy' => 'areas', 'field' => 'slug','terms' => 'painting')));                  $the_query = new WP_Query( $args );                  if($the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post();                  ?>

<?php the_title(); ?>
             <?php the_content(); ?>
          <?php endwhile; else: ?>
Nothing Here.
          <?php endif; wp_reset_postdata(); ?>
      So if I could just specify on the $args from which post type to get the posts from this would be solved.


title: How to Automatically import external images to Upload

text: Hi to all I would like to have a simple plugin, hook, anything that Automatically caches external images. Simple explanation: Actually I'm using this plugin: http://wordpress.org/extend/plugins/cache-images/ But with this I have to click on scan, then choose which images I would like to save then wait and so on... I'm in need of something more automatic. Is there anyone who can teach/tell me how to do it? Thank you!


title: Open graph problem: Showing wrong description of homepage while sharing on Facebook

text: Check out this URL: http://developers.facebook.com/tools/debug/og/object?q=www.linuxstall.com Everything is fine except the last line which is Note: "Reference in Perl" is the most recent post at my site. When I share any of my post on facebook then it works fine but when I share the homepage (www.linuxstall.com) then it shows most recent post's description instead of the site's description. What is the reason of that? How can I correct that? I have configured open graph using YOAST. ![enter image description here](http://i.stack.imgur.com/GTqhj.png) See the screenshot. It is showing "Reference in Perl" as a description.


title: When should I create custom post types?

text: When do I create the Custom Post Type, does it only need to be done once when the plugin is installed (so once), or do I need to do it each time in the constructor? Or does it not matter?


title: New post notification in wp_nav_menu

text: By blog has a header menu that consists of different links to pages like "About Us", "Help", "Contact Us" and "Blog". The "Blog" link is actually a page with a custom template that displays all the posts from my "blog" category. > What i want to do is to display a little notification text/link near my > "Blog" link in the top menu if the "blog" category has a post published in > the **last 24 hours**. The theme i'm using is using the `wp_nav_menu` function to display the menu in header.php. Is there any way to achieve this?


title: Ajax call to transients

text: If I make an ajax call to a Wordpress transient, is the transient value taken from memory on the server or is a call to the database made? I'm not using any caching plugins. My application is fetching a tag list. The frontend will display matching tags as the user types. I'm assuming that all transients are loaded when the page loads. And therefore that the transient is fetched from memory when the ajax call is made. Yes?


title: RSS Feeds not working in Chrome/ok in IE and Firefox

text: I have problems with the RSS feed not functioning properly in Chrome. When clicking on the RSS icon in top header or bottom of this page, I get strange page message. I usually put all urls through 'Social profiles', dashboard, 'my themes' but in this case, it does not offer that option. The template is Hades, themeforest. Any ideas where I can input the rss url so that the feed will work. The rss feed in sidebar works too in all browsers.


title: Wordpress plugin shortcode not working

text: I have a shortcode defined in a plugin as follows:               // [tag1] -> Some Longer Text     function shortcode_example1() {         return 'Some Longer Text';     }     add_shortcode('tag1', 'shortcode_example1');      Now within a wordpress page I am trying to access the plugin as follows:               [tag1]      However, the shortcode is not run and the output is just "[tag1]". Can you help? Thanks for your help.


It looks like social login plugins (such as Wordpress Social Login, OneAll etc.) do not create users in the original wp-database as regular registration from Admin dashboard. Hence it is not possible to add or get user-meta-data from current user the 'normal way'. **Question is: How to get user-meta from Social Login registered users?** I have a current case, and have not yet found he answer. Hope you can help me out. **The case** In this case we have a Gravityform which allows registered users to submit a new page. We want them to submit only one page per user. Page title is auto created and do have the form entry-ID as unique part of page title (Gravityforms settings). This function below is used to make Gravityforms to create a page instead of a post:               add_filter("gform_post_data", "change_post_type", 10, 2);     function change_post_type($post_data, $form){         //only change post type on form id 1         if($form["id"] != 2)            return $post_data;              $post_data["post_type"] = "page";         return $post_data;     }      Now we want users who have completed the form successfully and are currently logged in, to show the url of their created page like www.example.com/pagenumber{entry-ID} Therefore there are 3 options what to display:   1. user is logged in and have created a page -> show page url   2. user is logged in and have not yet created a page -> show form -> redirect to point 1 after completing   3. user is not logged in -> show social login buttons -> redirect to point 2 after connecting First we need to add the form entry ID to the user-meta:               add_action( 'gform_after_submission', 'wpse96480_map_user_to_page', 10, 2);              function wpse96480_map_user_page( $entry, $form ) {             $user_id = $entry['created_by'];             $meta_key = 'generated_page_id';             $meta_value = $entry['post_id'];             $unique = true;             add_user_meta( $user_id, $meta_key, $meta_value, $unique );         }      Now we add the code below to the page.php (or page template file) to check if current user is logged in and have an entry-ID in user-meta, and if so, to display the url with the entry-ID:               <?php         if ( is_user_logged_in() ) {             global $current_user;             // $current_user = get_currentuserinfo();             $user_id = $current_user->ID;             $meta_key = 'gform_entry_id';             $single = true;             $entry_id = get_user_meta( $user_id, $meta_key, $single );             if( strlen( $entry_id ) > 0 && is_numeric( $entry_id ) ) {                 // we have an entry ID now                 ?>
Hey <?php echo $current_user->display_name ?>, thank you for submitting the form. Visit your page here: www.example.com/pagenumber<?php echo( $entry_id ); ?>
                 <?php             } else {                 // we don't have an entry ID for this user                 ?>
Hey <?php echo $current_user->display_name ?>, Thank you for joining. To create a page please submit the form below:
<?php echo do_shortcode('[gravityform id="2" name="just a form" title="false" description="false"]'); ?>                 <?php             }         } else {             // user is not logged in             ?>
<Please log in to create a page <?php do_action( 'wordpress_social_login' ); ?>
             <?php         }     ?>      **The result:** If a regular registered WP user (who is created by Admin in the Admin dashboard) is logged in, and completes the form successful, option (1) is effective/successful showing as we wanted. If user have not completed the form yet, option (2) is effective/successful showing. **The problem with Social Login users:** If a user registered via a Social Login Plugin is logged in, and have completed the form successful, option (2) is still showing like user has never completed the form. **Question:** How to get user-meta from Social Login registered users?**


title: Unfiltered html in widget title not working

text:
function update( $new_instance, $old_instance ) {         if( current_user_can( 'unfiltered_html' ) ) {             $new_instance['title']     = strip_tags( $new_instance['title'], '
' );             $new_instance['more_text'] = strip_tags( $new_instance['more_text'], '
' );         } else {             $new_instance['title']     = strip_tags( $new_instance['title'] );             $new_instance['more_text'] = strip_tags( $new_instance['more_text'] );         }     [...]      I for sure am Admin i checked i can unfiltered html. But when i do this in my widget as seen in a tut its not working. Wordpress outputs it transformed into htmlspecialchars. any filter for that? Hope its not a global filter i just wan't to do it in some widgets. Whats the purpose of the sanitising in wigets then when wordpress runs it trough filters anyway? After thinking about it i just will do this globally, i let wp do its thing and after that i just convert back what i need. Maybe a better solution then to remove the default esc_html filter and replace it with wp_kses and just allowing some tags. This way you still can see everything typed in and nothing is stripped out. Well at least not at that level. The widget itself might strip it or not.               /** allow  tags inside widget titles */     add_filter( 'widget_title', function($title) {         $title = str_replace('<small>', '', $title);         $title = str_replace('</small>', '', $title);         return $title;     } );      and the widget can now allow the tag or even everything, wordpress converts everything to htmlcharacters anyway. So only will end up as real html.


title: How to implement different color schemes in your themes

text: This question is for theme developers. I know how to use the settings API to gather input data, but I was wondering what's the best way include the styles. Let's say you have 4-5 versions of the design, each with its own CSS rules and images. Options:   1. You stuff all the CSS in style.css and trigger the color change trough a body class. In this case you get the browser to load CSS rules and images that are not used (eg. selected option: "red", and you have rules for "blue", "green" as well).   2. Create separate stylesheets for each variant, and enqueue the selected style in the page. This could make the theme hard to maintain, because if you change one CSS file, you need to revise all the others too.   3. Create separate stylesheets for each variant, but only with the extra color styles. So you enqueue a big "common.css" file and the CSS for the selected color scheme (which is small). Here you make an extra HTTP request :P   4. ?


title: Problems with plugin that fetches data from database with ajax

text: After some answers I have edited my code. This is my plugin structure               stpl1        stpl1.php        getuser.php      In stpl1.php I have the following code:               <?php     /*     Plugin Name: Wordpress Plugin Stijn 1     Description: Een Wordpress plugin die data uit een database haalt en invult via Ajax           in een form.     Version: 1.1     Author: Stijn Aerts     Author URI: http://stijnaerts.be     License: GPL2     */          add_action( 'wp_head', 'ajax_lookup_userdata' );              function ajax_lookup_userdata(){         if (!is_admin()) {                 wp_enqueue_script('jquery');             }         $url = plugins_url('getuser.php', __FILE__);         ?>              <script type="text/javascript">         jQuery(document).ready(function($){             alert('test');         jQuery('#input_1_2').change(function(){                 showUser(this.value);             });                  function showUser(str){                      if(str==''){                     jQuery('form').html('');                 }                      jQuery.get(<?php echo $url; ?>, { q: str }, function(response){                     jQuery('#input_1_3').val('test');                 });             }         });         </script>     <?php     }          ?>      And in getuser.php I have the following code:               <?php     $q = intval($_GET['q']);          $con = mysqli_connect('localhost',****,****,****);     if (!$con) {       die('Could not connect: ' . mysqli_error($con));     }          mysqli_select_db($con,"ajax_demo");     $sql="SELECT * FROM Personeel WHERE personeelsNummer = '".$q."'";     $result = mysqli_query($con,$sql);          echo "test";          mysqli_close($con);     ?>       I activated the plugin and I go to this page: test website I enter a number in the first text input, in the second text input should come 'test'. But nothing happens... It seems like this code is causing the failing:               jQuery.get(<?php echo $url; ?>, { q: str }, function(response){                         jQuery('#input_1_3').val('test');                     });      What am I doing wrong? Thanks for the help I have already gotten, it was very helpfull and learnfull.


title: 301 redirect for converted post type

text: I just converted my posts from the default 'post' type to a variety of different custom post types based on what category the post is in. E.G. Posts in the "News" category are now a custom post type called "article_news". Of course, with this my permalink structure changed, leaving me with a bunch of rotten links. I backed up the database prior to conversion so it is possible to restore and repeat the process if necessary. Is there a plugin or any method I could use to have these old links 301 redirect?


title: How to Make Thumbnail of Post Stay Animated

text: When I upload my post with an animated .gif, the thumbnail generates into a new image and doesn't stay animated. It will stay animated inside the post which is great. It seems to resize the .gif image and convert it into a static image because it generates an image with the sizing at the end of the original file. Is there a code to add or remove that prevents it from generating a new image for the thumbnail so it just resizes down as the gif?


title: Edit specific nodes in WP_Admin_Bar

text: Is it **easily possible** to edit links in the `WP_Admin_Bar` global `$wp_admin_bar` instance?


title: Convert function output into string

text: How can I convert functions like the_permalink() into strings like $permalink?


title: Twitter List Tweets and Delicious Links as Posts

text: I'm trying to integrate Tweets from a Twitter list as individual posts categorized as "Twitter," and trying to do the same thing from a Delicious account. I've found several plugins that will add Tweets as a post from a specific user, but have been unable to find one that does it based on a list on Twitter, nor with Delicious. Anyone have any experience (or can point me toward a plugin that will do either tasks)?' The ultimate goal is to show relevant tweets and delicious links for a given post (or page), and have a random sampling of both the tweets and delicious links on the home page.


title: Active menu item / category

text: I was wondering if there's any way to discover which categories are "active" on a category archive page. This is for the purpose of menu highlighting. To demonstrate, compare these: (1) Parent category archive: http://building.mediumutm.ca/test-cat/ In the menu, the category is highlighted because it's active - cool. But so are both the dropdown menu links, its subcategories. (2) Post in the parent category: http://building.mediumutm.ca/post-test-cat/ Working perfectly. Only the parent category is active and highlighted, not the dropdowns. So it's really only (1) that's a problem, and I suspect it's not a CSS class issue because (2) works fine... So it that that archive page treats the subcategories as active? If so, can I disable that? Or what? Thanks!


title: Extend a plugin to include a widget option

text: I currently have a plugin (not a widget) that allows people to use shortcode to put the results on their web pages and posts. Some people have asked for a widget option, so the output can go in the sidebar (if the theme supports it). Is this possible? I tried putting together a dummy widget (using code from the WP docs), but if I try to activate it like this:                add_action( 'widgets_init', 'src_load_widgets' );       function src_load_widgets() {           register_widget('Foo_Widget');      }      I just get this error: Fatal error: Class 'Foo_Widget' not found in /Users/me/My Webs/wordpress/wp- includes/widgets.php on line 324 Currently, the widget script is in the same folder as my plugin script since I want to same admin screen as I do for my plugin. Not sure if this is the problem...so basically, I'm a bit lost. Thanks for any help you can provide here.


title: Assigning multiple or additional capabilities to specific users or how to create additional roles like bbpress roles?

text: even though I think I understand the hierarchy of roles in WordPress, I never really bothered creating my own user roles or custom capabilities. What I need to achieve is to assign a few capabilities to certain users (who might belonging to different roles: authors, subscribers, contributors...). I plan to use these capabilities to assign some badges in my BuddyPress driven community or to trigger some actions/events in other contexts (discounts in a WooCommerce store for example). At the moment I do not plan to use these to restrict content access. I understand that WordPress does not allow users to have multiple roles (and this is a bit frustrating). Yet I don't know how to address my case. I might want to have a subscriber with a new capability "x" and also a contributor with new capability "x" or as well as some subscribers with capability "y" but not "x". It's really impractical to me to create several new user roles only to match all the combinations. An alternative approach would be one similar to bbPress. I noticed that bbPress has its own user roles, which can be assigned to users who may have any WordPress roles. How to do someting alike with my own roles? (and being able to edit such roles for users from the user admin panels?) Or yet alternatively should I forget about user roles/capabilities and use user_meta instead? thank you


title: Can YOAST SEO fields be removed from custom post type

text: The Yoast SEO plugin is great, but it seems to appear in more places then wanted (columns, custom post type pages, etc.). I want to remove this option because as it stands even when I ignore the fields if I save my custom post type I get several fields added to my database.               _yoast_wpseo_google-plus-description     _yoast_wpseo_linkdex     _yoast_wpseo_opengraph-description     _yoast_wpseo_redirect     _yoast_wpseo_canonical     _yoast_wpseo_sitemap-html-include     _yoast_wpseo_sitemap-prio     _yoast_wpseo_sitemap-include     _yoast_wpseo_meta-robots-adv     _yoast_wpseo_meta-robots-nofollow     _yoast_wpseo_meta-robots-noindex     _yoast_wpseo_metadesc     _yoast_wpseo_title      So the goal is to not have them appear on the admin page at all so that they are not entered as values. Thanks in advance for any help with this


title: Permitting Wordpress to accept dates outside of 1902-2038

text: I'm using Wordpress 3.9.2, MySQL 5.1.73, & PHP 5.3.27 to put together a history-based site. As is well-documented elsewhere (including many questions on StackExchange & WP forums over the years), due to the limitations of PHP, one cannot have posts with dates outside of the minimum and maximum values for a 32-bit signed integer. As I am running on a 64-bit system, I researched the problem further and found this useful research elsewhere on StackExchange. Using that information, I was able to put together a solution with surprisingly little code to overcome what basically boils down a PHP limitation w/ `strtotime()` (but not the MySQL limitation of years in the 1000-9999 range). I checked the following places to confirm that the date is treated properly: post creation/update in the admin, date on the post in the front-end and admin sites, sorting of posts on list pages, and date in RSS feeds. Although I have years of programming experience, PHP and Wordpress are not my forte, so I'm posting this for folks with that expertise to address 2-3 problems with my proposed solution.   * Couldn't see a way to do this w/o hacking the core.   * Don't know how to handle date localization (noted in the below).   * Not sure if I tested everywhere necessary. But here is the solution I came up with: (1) Replace mysql2date in wp-includes/functions.php:               function mysql2date( $format, $date, $translate = true ) {         if ( empty( $date ) )                 return false;              if ( 'G' == $format )                 try {                   $i = new DateTime($date . ' +0000');                   return $i->format('G');                 } catch (Exception $e) {  // This doesn't appear to be WP's way of handling errors                   echo $e->getMessage();                   exit(1);                 }              try {              $i = new DateTime($date);         } catch (Exception $e) {              echo $e->getMessage();              exit(1);         }              if ( 'U' == $format )                 return $i->format('U');              if ( $translate )                 return $i->format($format); // Not sure how to localize here (had date_i18n before)         else                 return $i->format($format);     }      (2) Edit post_submit_meta_box() in wp-admin/includes/meta-boxes.php -- replace line 175 with the following:                   try {           $date = new DateTime($post->post_date);         } catch (Exception $e) {           echo $e->getMessage();           exit(1);         }         $date = $date->format($datef); // Same issue as before -- this date should be localized      Thanks in advance for showing a better way to implement these fixes (or pointing out where these fixes fail). **Update** I know I know don't hack the core. I would like to submit this code as a patch to Wordpress, hence my desire to be sure I've done it the right way. Thank you!


title: Post Type Label Name

text: i've just created a new post type. It's name is Academias so the first menu option is Academias as well. But I would like to change it to something like See All Academias (just an example), is that possible?


title: WP_Query 'orderby' => 'title-of-parent title'

text: How can I order a query by parent page attribute first and then by child page attribute? By title or by menu_order is acceptable. For example, if my query matches child pages, and my search results page displays a list of parent titles with subpage titles...               Names - Joe     Names - Reuben     Names - Victor     Sandwiches - Hamburger     Sandwiches - Reuben      I want them sorted as above in alphabetical order of parent then of child, or by menu_order of parent then of child. If you want a reason, it's because some of my subpages have matching titles and need further categorization.


title: custom comments on specific post type

text:
I have a custom post type called debate and I want to create some custom fields just on this post type. So, I have this code:               function debate_comment_fields( $fields ) {             if( is_singular( 'debate' ) ) {              unset($fields['url']);          unset($fields['author']);          unset($fields['email']);              $fields['options'] = '
' . __( 'I want to' ) . '' .             '<input id="first" name="category" type="radio" value="' . get_post_meta(get_the_ID(), 'agree', true) .'" />'.              '<input id="second" name="category" type="radio" value="' . get_post_meta(get_the_ID(), 'disagree', true) .'" />
';                   return $fields;             }       }      add_filter('comment_form_default_fields','debate_comment_fields');        Everything is ok on my custom post type, but on the default blog post type the author,email and url are not displayed. Any idea why?


title: Seeking clarification on page request life-cycle

text: I'm just trying to get my head around the "life-cycle" of a typical page request in WordPress. The Action Reference page lists 38 actions that occur during a typical page load, but two things aren't clear to me:   * does functions.php get invoked _before_ any of the hooks are executed?   * does the framework call your "page.php", etc., somewhere _within_ the sequence of hooks, or _after_ all hooks have been executed? Thanks. (apologies if my terminology is a little off, but I believe I understand the idea behind hooks being made available by the framework, and actions being associated with these hooks by the theme author)


title: awthemes Reactor: Moving the main navigation

text: I am trying to move the main navigation to below the header in my WP site. I think the place to do that is in this page: https://github.com/awtheme/reactor/blob/master/library/inc/content/content- header.php I have tried changing the lines like this:               add_action('reactor_header_inside', 'reactor_do_nav_bar', 2);      to something like this:               add_action('reactor_header_after', 'reactor_do_nav_bar', 2);      I am not a coder but what I think this line does is attaches the function to the hook reactor_header_inside or reactor_header_after and the number at the end is the priority or order that these things happen. I can get the menu to move but if I put it outside the header then it screws things up on smaller screens. I would appreciate a bit of advice to know firstly if I am on the right track and if not a hint at least, at what I should be thinking about. Thanks


title: How to develop child theme for thesis

text: I have `thesis theme` but for that thesis I want to create a child theme but I am not find out any help for starting. even i have search on Internet but nothing found Hey any body have any idea regard this then please help me. I am waiting for your reply Thanks


For example, I used the plugin Vote it Up but it haven't been updated since 2010-5-28. Now I moved to GD star rating which was last updated in January 6, 2011 (and still maintained by he author). Is it not recommendable to stick with plugins that are no longer supported by the author for production sites?


title: Email all subscribers when i do an action

text: I've created this function:               function email_subscribed_users($event)     {         $users = get_users('role=subscriber');              foreach ($users as $user) {             $accepted = get_user_meta($user->ID, 'accepted', true);             if ($accepted) {                 wp_mail($recipients, $event->event_title, $event->event_desc, 'From: <example@example.com>');             }         }     }      But it requires a lot of time sending the emails knowing that the users will increase by time.What function should I use to send the emails efficiently or there is a newsletter plugin to do this?


title: Should the caching of WordPress menus be specific to each page?

text: ## Introduction In optimizing large WordPress Websites for performance I always look at caching certain parts of the Website, mostly (of course) those that require a lot of Queries/calculation. For the Caching of the WordPress menu I usually use a function like the one I posted as an Answer here. This function checks if there is a transient containing the menu-HTML, and if it exists, delivers the HTML from the transient. If it does not exists, the menu is build and the transient set. To be clean, I also hook into `wp_update_nav_menu` to clean the transient as soon as the menu is saved, to always have the latest version available. ## So far so good. This technique works very good and gives a great performance boost, especially if the menu contains a lot of entries. ## The Problem Now, some months after developing this method, I ran into a problem, and feel stupid for not thinking about it in the first place. ### Menus are different on different pages Depending on what Page is called, `wp_nav_menu` delivers different HTML Code. `current-menu-item` and classes like that are of course applied to the menuitems. So the problem is, what is the best way to cache the menus and still have the correct classes available for each specific page? ### I thought about two versions   * adding the classes via jQuery, which results in more calculating on the Clientside   * caching the menus for each `ID` seperatly, resulting in quite some Databaseload, if the page has a lot of menuentries However, I tend to use the second option. Do you have any concerns with caching that much HTML as Transients?


title: How To get a list of popular tags by post views?

text: I am searching for a code, not a plugin, that will allow me to display the most popular tags based on post views for that day. Someone asked this same question but they asked about a plugin, my points aren't high enough for me to comment and ask for a code, so I have to waste space and the same question :(


title: How to create an archive section of a Wordpress site

text: I have created a WordPress site, nothing out of ordinary, except that the posts - that are shown in the home page - are filtered by a fixed category, and place the filtering code in the `home.php` template of my theme. I use a custom permalink structure (something like `site.com/posts/[post-slug- here]/`). Now I need to provide a section of the site that displays a list of all posts of the site, a global archive, with the URL `site.com/archive/` and for this the output of `wp_get_archives()` will do just fine for what I need. How to add the '/archive/' section to this site? I'll prefer not to create a "template" and having the user adding a page and assigning that template to the page in order to work. What I'm asking is for a solution that works as soon as the user activates the theme. Thanks!


title: Remove field in the form : only works for "url", not for "email"?

text: I would like to remove the email field in the comment form. It works for `url` but not for `email` : the email field is still there. Do you know why?               <?php     function url_filtered($fields)     {       if(isset($fields['url'])) {         unset($fields['url']);       }       if(isset($fields['email'])){          unset($fields['email']);       }       return $fields;     }     add_filter('comment_form_default_fields', 'url_filtered');     ?>      Thanks


title: Is there any tool to find lines of codes responsible to generate front-end HTML elements?

text: Dreamweaver CS5 is very useful to design or modify a Wordpress theme. It inspects CSS elements in Live view (after seting up a test server), but its unable to trace original wordpress code responsible for generating front-end HTML. So, I'm looking for a smart dev tool which could trace internal PHP code responsible for generating selected front-end HTML.


title: Welcome Mails based on user role

text: hope you can help me. users can chose between subscriber and editor role on my website. now, i'd like to send a register welcome mail to EDITORS only (WITH a specific) text. subscribers must not receive a welcome mail. any chance? looking forward hearing from you! THANKS!!!


title: Gravity Forms field ID $entry not working

text: So my script is simple right now just to test out the $entry field id's.               add_action("gform_after_submission_3", "set_post_content", 10, 2);     function set_post_content($entry, $form){     $subject = $entry["28"] . 'Applied as: ' . $entry["2"];      mail( $emailremoved, $subject, $message);     }      Right now entry 28 is a dropdown, this one returns the selected value. Entry 2 is the name field with split first and last. This returns nothing. Ive also tried $entry["2.1"] and get nothing. Entry 34 (not added) is a multi checkbox. This value is not echoed out either. This is a multipage form, but that shouldnt matter. Any ideas why the values are not returning? They are saving to the form entry.


title: Get current Wordpress page then add #post ID to the end

text: I'm trying to find out the PHP code that will get the current URL and add a hash ID onto the end of it so a link can be generated and linked to. The end goal is to create a link that returns: http://mydomain.com/news#postID-123. This should a) take users to the news page and b) jump to the part of the news page where the post ID of 123 is displayed. Ideally I need a solution that can handle pagination within Wordpress, this is my code to get the curent page URL that I spotted on another thread but how do I create a new string from it?               <?php     $Path=$_SERVER['REQUEST_URI'];     $URI= get_bloginfo('url').$Path; // get the current web address for my WP site     ?>


title: Whats the difference between current_page_item and current-menu-item

text: Whats the difference between `current_page_item` and `current-menu-item` when using Custom Menus               .current_page_item{} // Class for Current Page     .current-cat{} // Class for Current Category     .current-menu-item{} // Class for any other current Menu Item     .menu-item-type-taxonomy{} // Class for a Category     .menu-item-type-post_type{} // Class for Pages     .menu-item-type-custom{} // Class for any custom item that you added     .menu-item-home{} // Class for the Home Link


title: Bulk Delete Users Error uri too large

text: I am trying to delete thousands of users at once. After seeing that I can only display up to 999 user records at once using the "Screen Options" menu I thought that might be ok. But upon clicking delete I get a "Request-URI Too Large" error. How can I delete these users without doing it 10 or 20 at a time?


title: Open a Thickbox with content trough AJAX

text: I added a custom button to the TinyMCE editor, and I want to open WP's Thickbox when I click on it. How can I make it so that the `tb_show()` function loads the content I want with ajax?               // the ajax     add_action('wp_ajax_getTheContent', 'getTheContent');     function getTheContent(){       echo 'weqwtegeqgr'; // <- this should be displayed in the TB       die();     }      Here's some of the editor plugin code I'm using:               init : function(ed, url) {       ed.addButton('do_stuff', {         title : 'Do Stuff',         image : url + '/icon.gif',         onclick : function() {             OpenMyThickbox('do_stuff');         }       });     ...      So the `OpenMyThickbox` javascript function should do what I want:               function OpenMyThickbox(tag){       tb_show(tag, '...'); // <- how to load content trough ajax here ?     }


title: Best way to Integrate Google Search?

text: I would like to use Google Search as opposed to the built-in search provided by the WordPress engine. What would be the best way to integrate Google Search?


title: wordpress is automatically linking plaintext email addresses

text: Hey guys, I'm using the latest version of wordpress (3.1.1). Is it just me, or is wordpress now automatically linking plain-text email addresses? I type `jdoe@email.com` as a comment and it shows up as `<a href="mailto:jdoe@gmail.com">jdoe@gmail.com</a>` I am working on a plugin that filters comment text using the `get_comment_text` filter and then subsequently modifies the presentation of the email address. This plugin worked fine before, but like I said, now wordpress automatically links email addresses. I figured that wordpress would follow its own rules and do it by means of a filter, so I went ahead and added a priority level to my _own_ filter of `9000` figuring that way I can force mine to trigger after wordpress is done sticking its nose in something that's not its business, but this did not work. I'm wondering if anyone here knows a way around this situation, or at the very least, if someone knowledgeable about the system could point me to the source that is responsible for this automatic linking. My plugin already has the functionality to work with plain-text emails, but this too is broken because after it modifies the presentation of the plain- text email, wordpress then goes and linkifies it. **EDIT** : One Trick Poney pointed me to `make_clickable` which is responsible for this. It's indeed added as a filter in `wp-includes/default-filters.php`, with a priority of `9`. However, I have already tried, like I mentioned above, to set the priority level to `9000` to make my plugin work after wordpress has done its dirty business. This didn't work, is it because I'm getting the original unfiltered content? I figured I would be getting the filtered content (i.e. the content already linked). So then I went ahead and activated the plain-text filter (which applies to plain-text emails), and applied it a priority of `-9000` so that it gets in before `make_clickable`, but again nothing good came of this because when `make_clickable` did fire, it went ahead and figured it'd be a good idea to linkify the links I create. It 'linkifies' the urls in the `href` attribute of a link, making for very messy output. So it seems that the best thing to do would be to get in _after_ wordpress has done its business, after `make_clickable` has fired, but like I said for some reason even though I apply my filter a priority level of `9000`, compared to `make_clickable` whose priority level is only `9`, nothing seems to happen. I will continue to investigate. I can understand and imagine that wordpress devs were trying to be more user- friendly, but this seems to have caused some edge-case problems (ex. linkifying href attributes in already-existing links). Any help would be greatly appreciated. **EDIT 2** : Yep, I just tested my filter with a priority level of 9000, which I would imagine should run _after_ wordpress' `make_clickable` whose priority level is 9. My filter gets the unaltered/unfiltered content. I don't know how or why this is happening. I would have imagined that having a later priority I would get the content as it had so far been altered by higher-priority filters, otherwise situations like these (collisions?) would arise, like this one.


title: Modify the main loop to display current month / year

text: So `pre_get_posts` seems to be the way to do this now - a lot of the background is nicely explained here: When to use WP_query(), query_posts() and pre_get_posts I can happily modify the main loop to show a chosen month using this function:               function loop_current_month( $query ) {     if ( $query->is_home() && $query->is_main_query() ) {         $query->set( 'monthnum', 3 );         return;      }     }     add_action( 'pre_get_posts', 'loop_current_month' );      However, I would like to modify the loop for the current month, and the current year. How can `$query->set()` take two vars? Something like:               $query->set( 'monthnum', 3 & 'year', 2013 );      Any ideas? Many thanks Dave


title: Row actions for custom post types?

text: I'm working on a plugin, which converts a site into a feedback sort of portal. I made a new object page, 'Feedbacks', which displays all the feedbacks is a tabular format, and I'm using `register_column_headers($array_of_column_headers)` to make my table. I wanted to know if it is possible to add my own page row actions to this table, i mean under every feedback in the list, actions like 'approve', 'delete', 'blacklist' etc. I read the code and a couple of tickets, and found out its done this way: for posts, its `post_row_actions`, for comments its `comment_row_actions`, for media its `media_row_actions` and so on. Is there a filter that allows me to do, `my-page-slug_row_actions`?


title: How to prevent Wordpress loading external resources when developing

text: As I'm developing my new web site on a local machine while commuting (with limited connectity), I wonder if there is any option to avoid WP loading any external bit. In fact, all scripts like google fonts, gravatar, are making my page saving / editing activity terribly slow. Is there any options I can set? Thanks


title: blank page after submitting a comment

text: I was testing a new website with Chrome (latest build), everything working fine (no new plugin installed during the test) when suddendly when I try to post a comment, after pressing the "reply" button it stops on a blank wp- comments-post.php without posting. I am testing on localhost with MAMP. The funny thing is on the other browsers installed in the same machine (Safari, FF) it is working regularly. I have tried to overwrite the file from a wordrpess install, clear the cache, reboot, reboot MAMP, but nothing. I also checked the file wp-comments-post.php in the root and it is not blank and Akismet is disabled. any ideas?


title: Best practices for complex taxonomies

text: I have a question about complex taxonomies. What are the pros and cons of tagging multiple terms? For example, tagging the lowest "child" or all of them up to the "parent." I'm currently working on a template and would like to know the best practices.


title: Operable default menu *and* custom 3 menu

text: OK, this is a basic question...I'm upgrading a theme I built (from scratch) to support 3.0 menus (finally). With the new wp_nav_menu tag, as expected, the tag's default container is added when a custom menu is assigned only. The added div prevents the custom menu from taking the css I previously created. I need to be able to support both default and custom menu. Rather than bulking out my css with added selectors to support the new class, I'd like to null the container and container_class in the wp_nav_menu array and state the container in HTML around the tag. Is there any reason I should not do this? Is there a more elegant way of supporting both default and custom menus? Thanks for reading.


title: Couldn't find a documentation for a filter API in plugin development

text: I'm new to wordpress plugin development, I read the whole documentation this afternoon http://codex.wordpress.org/Plugin_API/Filter_Reference, I tried to write some code, like this in plugin file:               add_filter('the_title', 'my_own_function', 10, 2);      **Function is:**               function my_own_function($title, $post_id){         return $title. $post_id;     }          This plugin really worked, but the documentation doesn't tell the filter API `the_title` has two arguments, and what those arguments are. That's the problem! If it doesn't tell, how would I know? **Here I just quote the official documentation relevant excerpt:**               the_title      applied to the post title retrieved from the database, prior to printing on the screen (also used in some other operations, such as trackbacks).      So, my **question is:** How can I find a full explanation of filter API such as `the_title`? Please help.


title: Automatically republish old posts

text: been seaching on google for a plugin for this and can't seem to find anything realiable. The only plugin I found is called "old post promoter". Any ideeas? Can this be done with googl old fashion coding, not a plugin? Ty!


title: Show page and subpage on wordpress theme

text: I have the next pages structure: \-- Main Page \--- Sub Page \--- Sub Page \--- Sub Page How can I display on the main page and on the sub page only the sub links of this Main Page?


title: static page with multiple loops breaks post pagination

text:
**I have a static page which runs two loops but pagination doesn't work on the second loop.**   1. The first loop shows the static content of the page   2. The second loop shows the last 3 blog posts Pagination shows up, adds /page/2 to the url but it always shows just the same 3 posts. Why doesn't this work as expected? _**First loop: display the static content_**               if (have_posts()) : while (have_posts()) : the_post();         the_content('
Read the rest of this page »
'); ?>     endwhile; endif;      _**Second loop: shows the last 3 posts and pagination_**               global $more;     $more = 0;     $temp = $wp_query;     $wp_query= null;          $wp_query = new WP_Query();     $wp_query->query(array('post_type'=>'post','post_status'=>'publish','showposts'=>3,'paged'=>$paged));          while ($wp_query->have_posts()) : $wp_query->the_post();         the_content();     endwhile;          next_posts_link();     previous_posts_link();


title: 1st Level Page with No Children

text: I have a website (http://sfa.uconn.edu/) that displays left menu with a list of child pages on any parent page (and its children), like this: ![enter image description here](http://i.stack.imgur.com/FWb6W.png) However, I would like to hide this functionality from top level pages with no children, because it just displays the page title twice, like this: ![enter image description here](http://i.stack.imgur.com/dyz7Z.png) Does anyone know a way to test if (1) the current page is top-level and (2) the page has no children.


title: Automatically assign posts by author to a specific category

text: Some of the authors in my blog must always add their posts to a specific category each time they post. Sometimes they forget this so therefore I'm wondering if there are any ways to automatically check and fix this. Here's an example of my desired outcome:   * Posts by Author X should always be assigned to category A   * Posts by Author Y should always be assigned to category B   * Posts by Author Z should always be assigned to category C How do I achieve this?


title: Custom Post Types vs Database Table where many (10,000s + ) of entries are possible/desirable

text: I'm building a set of plugins... obviously, being plugins, they need to be suitable to a variety of installations. These plugins will keep track of specific types of user activity (namely whether links are clicked, actions taken, petitions sighned, that sort of thing) and provide access to the resulting data to the administrator. So my question is custom post types vs a specific set of bespoke database tables... I would normally choose custom post types for this kind of data, but a succesfull campaign could result in 10,000s, even, if really successful, 100,000s of actions being recorded. Since the objective of the plugins is to assist people in developing succesful campaigns this is obviously the kind of scale I need to think about, so I am concerned about the possible degredation of wordpress performance if the wp_posts table is are swamped with 10,000s of custom post type entries. Is this a case where I would be justified in creating a new set of database tables to handle my data?


title: Custom wordpress admin page/url "You do not have sufficient permissions to access this page."

text: Here's a custom wordpress admin page I created:-               // code located in my custom plugin's php file          function my_special_function(){              echo '<div> Hello World </div>';          }          function my_menu_page(){              $page_title = "Hello Page Title";         $menu_title = "Hello Menu Title";         $capability = "administrator";         $menu_slug = "do_something";         $function = my_special_function;         add_menu_page($page_title,  $menu_title, $capability, $menu_slug, $function);          }          add_action('admin_menu', 'my_menu_page');      According to http://codex.wordpress.org/Function_Reference/add_menu_page , this function takes a 'capability' (see Roles and Capabilities) which will be used to determine whether or not a page is included in the menu. The function which is hooked in to handle the output of the page must check that the user has the required 'capability' as well. The current user I am using is the administrator, but when I attempt to access the page               http://localhost:8888/wp-admin/admin.php?page=do_something      I get               You do not have sufficient permissions to access this page.      Why's that so? How do I fix this?


title: How to read the xml file in wordpress?

text: I have a feed link http://www.wdcdn.net/rss/presentation/library/client/iowa/id/128b053b916ea1f7f20233e8a26bc45d and I have to read all the elements of feed including credits, here is how the feed is displayed               <item>       <title>         <![CDATA[Dave's Lawnmower Bish Bash]]>       </title>       <link>http://cache.wdcdn.net/cdn/asset/view/client/filmconstruction/package/library/id/918787/format/o/h/503e4d2418da8c167f7a75d25638a35e/?7a6013aef28682d61703dff120d21b12266b54a2a637283d7d4f0a0843a6f755b7d8fa6f17d0ac1585d9530a052e29240a1a3c75fb</link>       <guid>http://filmconstruction.wdcdn.net/l/p/?presentation=a211defdbe060c7e8f42e884b7e8f584#918787</guid>       <description>         <![CDATA[DW_MLA_Lamb_DavesLawnMowerBishBash_30.mov]]>       </description>       <pubDate>Mon, 30 Apr 2012 21:49:55 -0700</pubDate>       <enclosure url="http://cache.wdcdn.net/cdn/asset/view/client/filmconstruction/package/library/id/918787/format/o/h/503e4d2418da8c167f7a75d25638a35e/DW_MLA_Lamb_DavesLawnMowerBishBash_30.mov?7a6013aef28682d61703dff120d21b12266b54a2a637283d7d4f0a0843a6f755b7d8fa6f17d0ac1585d9530a052e29240a1a3c75fb.mov" type="video/quicktime" length="6289971"/>       <media:content url="http://cache.wdcdn.net/cdn/asset/view/client/filmconstruction/package/library/id/918787/format/o/h/503e4d2418da8c167f7a75d25638a35e/DW_MLA_Lamb_DavesLawnMowerBishBash_30.mov?7a6013aef28682d61703dff120d21b12266b54a2a637283d7d4f0a0843a6f755b7d8fa6f17d0ac1585d9530a052e29240a1a3c75fb.mov" fileSize="6289971" type="video/quicktime" duration="0" height="360" width="640"/>       <media:thumbnail url="http://cache.wdcdn.net/cdn/asset/view/client/filmconstruction/package/library/id/918787/format/t/size/lg/h/87884cce4f657e643d3df42ccc623101/library_918787_lg.jpg?7a6013aef28682d61703dff120d21b12266b54a2a637283d7d4f0a0843a6f755b7d8fa6f17d0ac1585d9530a052e29240a1a3c75fb.jpg" height="360" width="640"/>       <media:thumbnail url="http://cache.wdcdn.net/cdn/asset/view/client/filmconstruction/package/library/id/918787/format/t/size/sm/h/87884cce4f657e643d3df42ccc623101/library_918787_sm.jpg?7a6013aef28682d61703dff120d21b12266b54a2a637283d7d4f0a0843a6f755b7d8fa6f17d0ac1585d9530a052e29240a1a3c75fb.jpg" height="101" width="180"/>       <media:credit role="client" scheme="urn:feeds-wiredrive-com:credits">         <![CDATA[MLA]]>       </media:credit>       <media:credit role="agency" scheme="urn:feeds-wiredrive-com:credits">         <![CDATA[BMF]]>       </media:credit>       <media:credit role="director" scheme="urn:feeds-wiredrive-com:credits">         <![CDATA[David Wood]]>       </media:credit>       <media:keywords>         <![CDATA[Humour]]>       </media:keywords>     </item>      I have used this code to read the content but can not get the all the credits with this code               $file   = file_get_contents('http://www.wdcdn.net/rss/presentation/library/client/iowa/id/128b053b916ea1f7f20233e8a26bc45d');      $xml    =  simplexml_load_string($file);          $doc = new DOMDocument();     $doc->load('http://www.wdcdn.net/rss/presentation/library/client/iowa/id/128b053b916ea1f7f20233e8a26bc45d');     $arrFeeds = array();     foreach ($doc->getElementsByTagName('item') as $node) {             $itemRSS = array (                           'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,                                          'guid' => $node->getElementsByTagName('guid')->item(0)->nodeValue,         'content' => $node->getElementsByTagNameNS('http://search.yahoo.com/mrss/', 'content')->item(0)->getAttribute('url'),         'vwidth' => $node->getElementsByTagNameNS('http://search.yahoo.com/mrss/', 'content')->item(0)->getAttribute('width'),         'vheight' => $node->getElementsByTagNameNS('http://search.yahoo.com/mrss/', 'content')->item(0)->getAttribute('height'),         'thumbnail' => $node->getElementsByTagNameNS('http://search.yahoo.com/mrss/', 'thumbnail')->item(0)->getAttribute('url'),         'credit' => $node->getElementsByTagNameNS('http://search.yahoo.com/mrss/', 'credit')->item(0)->getAttribute('role')                      );             array_push($arrFeeds, $itemRSS);     }      How do I read all the credits of each item? Can anyone help me is finding solution for this? Thanks in advance


title: In the Wordpress admin, how can I find out which page (themes.php, widgets.php, etc.) I'm on?

text: In the Wordpress admin, how can I programmatically find out which page (`themes.php`, `widgets.php`, etc.) I'm on?


title: Nothing Found error when creating new posts - how to correct this?

text: I recently installed WordPress on IIS 7 and wired it up to SQL Server 2008R2. The installation went fine, then after a short while of testing, new new posts could no longer be seen in any category (or any posts for that matter). In the admin menu, under posts, I see that there are six published posts "Published (6)". However the list below this is empty. Also trying to view these on the site, by selecting the category returns > **Nothing Found** > > Apologies, but no results were found for the requested archive. Perhaps > searching will help find a related post. I have re-installed the database, overwrote the PHP/SQL files and re-installed WP. Problem persists. I tried the Settings/Permalinks suggestions here and. No change. The suggestions here relate to not being able to write to the .htaccess file. Not an issue for me, and I am not seeing the error of not being able to save. (To verify, I saved, exited, navigated to the same Permalinks page and my settings were saved). I even set the Permalinks to to default and removed the Web.config rewrite rules:               <?xml version="1.0" encoding="UTF-8"?>     <configuration>       <system.webServer>         <rewrite>           <rules>             <rule name="wordpress" patternSyntax="Wildcard">                 <match url="*"/>                     <conditions>                         <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>                         <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>                     </conditions>                 <action type="Rewrite" url="index.php"/>             </rule>          </rules>         </rewrite>       </system.webServer>     </configuration>      No change. (Added them back in). I set SAVEQUERIES=TRUE in wp-config.php and I can see the contents of some of the posts in the log file. > ie. Hi there! I'm a bike messenger by day, aspiring actor by night, and this > is my blog. I live in Los Angeles, have a great dog named Jack... No change. I have seen other posts that refer to changing some security settings as the system may be detecting a potential SQL injection attack. However those posts are related to an Apache-related installation, and cannot locate any references in my version. Some assistance with this would be greatly appreciated. Thanks. **\-- UPDATE --** I retried this with WP 3.21 - same issue, and have been monitoring Windows/Temp/php53_errors.log. The only issue I see coming up is > [07-Mar-2012 21:00:51 UTC] WordPress database error 42000 : [Microsoft][SQL > Server Native Client 10.0][SQL Server]Incorrect syntax near 'wp_users'. for > query SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE > ''wp_users'' made by display_setup_form, pdo_wpdb->query, > pdo_wpdb->_post_query, pdo_wpdb->print_error


title: Contact Form 7 - process form using a PHP script, instead of mailing

text: I want to use a form from the `Contact Form 7` plugin to allow the users to upload a document to my website. The problem is that I'd like to manage those uploads from WordPress instead of receiving them in my E-Mail. Is there a way of redirecting the output of those forms to a PHP script, or something similar?


title: How to create another sidebar to be shown on another page?

text: I've created my wordpress theme from the default Twenty Eleven theme, and I want to show a different sidebar on a few pages. I found this tutorial but it really doesn't answer my question. So, I need a sidebar that is shown on admin panel at widgets page, and it should be at left side of the page.


title: Posts for next month

text: How would one get posts that are set to 'future' to display in a loop? I am trying to figure out how to get posts that are in the future months. So if we are in April I want to display posts for May. Think of it as a coming up posts. I have been looking at http://codex.wordpress.org/Function_Reference/WP_Query#Date_Parameters and I have been looking at this too: http://joshpress.net/blog/using-new-date-queries-wordpress-3-7/ Something like this but for next month's post:               <?php     //get an array of the date 2 days from now     $twodayslater = getdate( current_time(‘timestamp’) + 2*DAY_IN_SECONDS );     $args = array(         'date_query' => array(             'before' => array(                 'year'  => $twodayslater['year'],                 'month' => $twodayslater['mon'],                 'day'   => $twodayslater['mday'],             ),             'inclusive' => false,         ),         'post_status'         => 'future'     );     $query = new WP_Query( $args );     ?>      but have had no luck! Thanks, Ben.


title: How to Compile Sass in a Child Theme?

text: I am trying to figure out how to compile SASS in a child theme and I can't figure out what I am doing wrong. I built a parent theme based on jointsWP. Here is the file structure for the library of the parent theme: ![enter image description here](http://i.stack.imgur.com/IsvtN.png) Then I built a child theme. Here's the file structure for the library of the child theme: ![enter image description here](http://i.stack.imgur.com/3Mgle.png) In the root of my child theme, I have a style.css with the necessary child theme comments:                /*!      Theme Name:   Child Theme      Theme URI:    http://domain.com      Description:  Child theme of the SLAM! theme.      Author:       Megan Carroll      Template:     slam-theme_v1      Version:      1.0.0      Tags:         light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready     */               @import url("../slam-theme_v1/style.css");               /* =Theme customization starts here     -------------------------------------------------------------- */      Then in Library > SCSS > style.scss, I have the following code:               @import "http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,700italic,400,300,700";          //     // IMPORTING STYLES     //          // Load SLAM! Theme parent CSS, you will not want to uncomment it.     @import url("../../slam-theme_v1/css/style.css");          // import mixins     @import "mixins";          // import foundation overrides     @import "settings";      **EDIT** : To clarify, when I add something in style.scss, it does compile to style.css. But if I make any changes to _settings.scss, nothing happens. I'm using Foundation, so I'd like to be able to edit the Foundation variables in _settings.scss. What am I doing wrong?


title: user analytics with member website

text: I'm currently using wishlist member as my membership/subcriptions-based website, and I was wondering if anyone is using an analytics package to track their users' activities. Google analytics would catch the main statistics, but I'm looking to track usage ideally at the membership level and then at the individual user. Any help on this would be greatly appreciated


title: Login page theming?

text: is there a way for me to add a page to my template directory to customize my `login.php` page? I couldn't find much on the subject so I decided to post the question here.


title: How to batch convert comments to posts?

text: I want to display comments using a Post slider plugin, but comments aren't posts. I had a dodgy setup with FeedWordPress (sydnication plugin) by sucking the Comments RSS feed in to to the Comments into Posts, but the RSS feed has mysteriously stopped updating. So I'm thinking it might be better to find a way to convert Comments into Posts in a different way. I took a look at some post-type switchers, but didn't see any that considered Comments to be a post-type. Any tips would be much appreciated. Thanks in advance!


title: Making first post wider than other posts on home page(default)

text: I want to show first post wider than other posts on the index page of my wordpress theme like firstpost.com. Please suggest me how to do this?


title: Help me to find

text: how to realize such system on WordPress? ![enter image description here](http://i.stack.imgur.com/JfJSx.png)


title: moved site to development box, WP works fine except that only root of site is served

text: I have a small, ultra-low traffic WP site. Let us call it www.mysite.com. This same URL is listed both as the "Site Address" and the "Wordpress Address" under the wp-admin Settings panel of the live site. For development, I decided to create a local copy of it inside a virtual machine on my laptop rather than always editing the live version. (The VM has Ubuntu 14.04 LTS installed on it.) I created a tarball of the WP install on the server, made a dump of its database and carried over both of them to the virtual machine. Following this suggestion, I also modified /etc/hosts on my laptop so that, while I am working on the site, the domain of my site effectively points to the IP address of my virtual machine and it transparently replaces the live site in my workflow. Everything I describe belows refers to my attempts at **accessing and working with this development version of the site I installed inside the VM** (not about accessing the live site, which is just fine). Everything works (I can log into the site using wp-admin; all pages and content are there; I can edit the already existing pages or add new ones; etc.) **except that when I actually navigate to any page on the site other than the site root I get a 404 error** : > The requested URL /page-xyz was not found on this server. > > * * * > > Apache/2.4.7 (Ubuntu) Server at www.mysite.com Port 80 However, if I aim a browser at the site root (www.mysite.com) it displays perfectly. Why isn't this working? If the site root wasn't accessible, I would know this was related to the /etc/hosts hack -- but it **is** accessible. Also, the local copy of the database includes all the content: I can see it when I use wp-admin to make edits. Why aren't pages other than the root being shown? I have no plugins installed other than Jetpack. Also, my .htaccess reads:               <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>


title: Modify link in widget archive

text: I want to add Google campaign to link in default wordpress widget archive. How can I do this?


title: Database interaction (private-public)

text: I like to have a nice website for my client. I will do it with WordPress. But that client will manage a database, much like Excel or Lotus or Access or FileMaker. I like to offer the same style of database interaction (add, modify, query) with ans private access to wordpress... can i do that and how ? Thanks in advance


title: How to change domain used when pinging sites

text: Without boring you with the details of "why" to keep a long story short, I need to change the domain that my site uses when it sends pings. I went and searched the WP source for where this gets set, and I see the domain is set in weblog_ping() in wp-includes/comment.php. Unfortunately this has no filters or actions, so no dice. It does use home_url() which ultimately has a filter, but I only want to filter it when it's being called for use in a ping. Anyone have any thoughts on how I might accomplish that? ... And as I was about to hit post, I had an idea of how I might do this. I'll post it as an answer, but I'd still love to hear what others have to suggest. Thanks!


title: Why might $input (Settings API) be coming through empty?

text: I'm trying to be a good thememaker and pass all my settings through the Settings API, but I'm running into some difficulty in the sanitization callback function. The core of the problem is this: the $input variable, passed in by default, is empty. My $_POST[options group] is coming through just fine (it has everything I'd expect to see in $input) but, again, $input is empty. Where do I even start looking to debug this? **EDIT 1** In response to Chip, here's what I have (stubbed, obviously):               function lblg_sanitize_options( $input ){     global $lblg_shortname, $lblg_default_options;          echo "Input: ";     print_r($input);      If I do something similar using, e.g., Oenology and do a `print_r($input);`, I get the expected `Array(` etc. **EDIT 2** Here's the results of `print_r($_REQUEST);` for my theme:               Array ( [option_page] => lblg_options [action] => update [_wpnonce] => 1f96eb2410 [_wp_http_referer] => /wp-admin/themes.php?page=lblg_options [lblg_options] => Array ( [layout_stylesheet] => Select a layout: [alt_stylesheet] => *none* [use_custom_header] => true [display_footer_copyright] => true [footer_copyright] => [footer_credit_text] => [save] => Save changes ) )      And here it is for Oenology:               Array ( [option_page] => theme_oenology_options [action] => update [_wpnonce] => 748c46a1a1 [_wp_http_referer] => /wp-admin/themes.php?page=oenology-settings [theme_oenology_options] => Array ( [header_nav_menu_position] => below [header_nav_menu_depth] => 1 [display_social_icons] => on [rss_feed] => rss2 [facebook_profile] => [flickr_profile] => [linkedin_profile] => [myspace_profile] => [twitter_profile] => [youtube_profile] => [display_footer_credit] => false [submit-general] => Save Settings ) )      I can't spot the difference. Can you? **EDIT 3** Might the various slugs/shortnames/pagenames be conflicting somehow? **EDIT 4** Here's what I'm doing for registration:               function lblg_admin_init(){         global $lblg_shortname;         register_setting( 'lblg_options', $lblg_shortname . '_lblg_options', 'lblg_sanitize_options' );     }      Here's what I'm calling out, intra-options-form:               settings_fields( 'lblg_options' );      do_settings_sections( 'lblg_options' );      The settings themselves are all being registered in a big loop, in a fashion similar to this:               add_settings_field( $key, $value['name'], '', 'lblg_options', $section );      Further thoughts?


title: Help with custom widget options! (saving checkbox option)

text: I created a custom Flickr Widget for Wordpress and successfully set up an options form for users to enter their Flickr information, but I cannot get the checkbox in the form to save whether or not it is checked. Any help would be greatly appreciated! Here are my widget(), form(), and update() functions:               function widget($args, $instance) {     extract($args);          $title = apply_filters('widget_title', $instance['title']);     $displaynum = $instance['displaynum'];     $flickrid = $instance['flickrname'];     $num = 6;     $feed = new SimplePie($instance['feed']);     $feed->handle_content_type();      $photostream = $instance['show_photostream'];               function update($new_instance, $old_instance) {     $instance = $old_instance;          $instance['title'] = strip_tags($new_instance['title'] );     $instance['displaynum'] = strip_tags($new_instance['displaynum'] );     $instance['feed'] = $new_instance['feed'];     $instance['flickrname'] = $new_instance['flickrname'];     $instance['show_photostream'] = (bool) $new_instance['show_photostream'];          return $instance;     }          function form($instance) {     $defaults = array (         'title' => 'My Recent Flickr Uploads',         'displaynum' => 6,         'feed' => 'http://api.flickr.com/services/feeds/photos_public.gne?id=33927859@N06&lang=en-us&format=rss_200',         'flickrname' => 'rastajellyfish',         'show_photostream' => isset( $instance['show_photostream'] ) ? (bool) $instance['show_photostream'] : false     );     $instance = wp_parse_args( (array) $instance, $defaults); ?>      Any help would be greatly appreciated!!!


title: Query_posts and attachments

text: I need some guidance on some WP code. I'm wondering if it's possible to take this code (which is grabbing all the images from the posts across my site and dumping them out):               $args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => null );      $attachments = get_posts( $args );     if ($attachments) {     foreach ( $attachments as $post ) {     setup_postdata($post);     the_attachment_link($post->ID, true);     the_excerpt();     }     }      and use the `query_posts();` function in WP instead so I could create some pagination for all the images. I seem to have got something working with this below, but it's pulling in one post, infinitely.               <?php     $args = array( 'post_type' => 'attachment', 'post_status' => null, 'post_parent' => null, );     $attachments = get_posts( $args );     if ($attachments) {         foreach ( $attachments as $post ) {             setup_postdata($post);             the_attachment_link($post->ID, true);             the_excerpt();         }     }     ?>          <?php endwhile; ?>      You can see what I've got so far here: http://itsfoolsgold.com/grid/ Thanks so much in advance, R


title: How to add Posts to a Page

text: I want to have a domain.com/blog page that includes all of my blog posts. Problem is that currently to get to my blog, it looks like the permalink is going to always be... domain/category/categoryname I can change the permalinks but I dont want it to be something like domain.com/blog/featured or something. I want to have a page that is domain/blog which will show all of my blog posts. Is there a way to do this? My thought is simply creating a Page that includes all of my posts. How would I do this? Thanks!


title: Post Terms As Class Name For Full Calendar Events

text: I have implemented Full Calendar via json with my Wordpress custom post types. All is fine except I want to add the taxonomy term of the event / post to the 'className' of the event object but cant seem to get it working, can someone please take a gander at my implementation see where I am going wrong? I cant seem to get my pasted code formatting legibly as such I have added a link to a pastebin, apologies, can be see here get_single_term relates to a custom function to output the first term of the taxonomy as follows ....               function get_single_term($post_id, $taxonomy) {     $terms = wp_get_object_terms($post_id, $taxonomy);     if(!is_wp_error($terms))     {         echo $terms[0]->name;        } }      Thanks for any advice


title: Building a Digg clone using WordPress?

text: I am thinking of building a site similar to **Digg.com** (the old version). I think the best way in my case is to make a _custom post type_ for the links and then use a a plugin such as _TDO Mini Forms_ or _One Click Post_ for front end posting. As for voting I'm thinking of using the _Vote it up_ plugin. There are 3 main problems I need help with:   1. An important part of my site will be images. When submitting a new link I need the ability to automaticly grab images from the submitted the site that the user can crop to predefined size and then attach to the post. There is a plugin for Hotaru CMS (http://forums.hotarucms.org/showthread.php?559-Post-Images-0.6&highlight=post+images) that does exactly what I want but I don't know how to port it over to wordpress and then implement it in submission form.   2. **(EDIT: Answered, see below)** The _Vote it up_ plugin doesn't sort the posts based on how many votes they have. I want one page with all the new links and one with the 'popular' links were all links with a specific minimum number of votes will be. For example, when a link gets 10 or more votes it is moved from the 'new' page to the 'popular' page. There are some functions on the plugin page, I'm not sure how to use them: http://wordpress.org/extend/plugins/vote-it-up/other_notes/   3. I need a vote button that users can put on their blogs or websites for their readers to submit and vote on their posts. Something similar to the Digg button you can find all over the web. Thanks in advance.


title: Creating a page that does not show up in the frontend navigation bar

text: My plugin needs to add a few screens to the frontend of the site, eg. a history overview (http://www.site.com/history?event=X). At first, I implemented this by programmatically adding a page with a shortcode in the body, putting the logic behind the shortcode. This works well because the user can now edit the page title, URL and page template to influence how this page looks on his front end. However, an unwanted side effect is that, at least in the default Wordpress theme (I haven't checked in others for now), my page shows up in the navigation bar on the frontend. I don't want this, both for aesthetic reasons and because the page needs a parameter to run (?event=X) and doesn't stand on its own. So my second idea was to create a custom post type. That way I can tell it not to show up in the navigation menu (show_in_nav_menus => false), but now I lost the user's ability to apply a page template to it. So my actual question is "Can I programmatically create a page that won't show up in the navigation bar?", but if I'm doing something stupid and there's a much better way to handle this, I'll be happy to hear about it.


title: WP Insert Post and then go to post

text: After an WP_insert_posts array has been executed how do I then redirect the browser to that post. Many Thanks,


title: Activate different theme for temporary preview

text: I wanted that when i access my site with specific parameter, my site used a different theme at that moment (only temporarily, to show only to me as a preview). I want it for test purposes. Is there any way to do/activate that using php codes?


title: Theme option editing capability problems

text: I've setup some theme options using this helpful guide as a template. I want to give my editors the option to update these theme options, so I granted the edit_theme_options capability as mentioned here. However when logged in as an editor I can see the options page, but when I go to save it I get the 'Cheatin uh?' message. I checked the wp-admin/options.php page and the code is:               if ( !current_user_can('manage_options') )     wp_die(__('Cheatin’ uh?'));      So it seems you can't edit options without the manage_options capability, which makes sense. It makes me wonder how you differentiate between general options and theme options. Is there something I've missed?


title: if in_category on archive.php

text: So I'm trying to do an if / else statement on an archive.php template. I setting up my archives using WP Smart archives reloaded (http://wordpress.org/extend/plugins/smart-archives-reloaded/) The code from my archive.php is as follows:               <?php        if (in_category('166')) { include 'archive-blog.php';     }          else {        echo('foo');     }     ?>      Im trying to get archive.php to include a certain template based on the category number. However this code grabs the archive blog template no matter what (even if I click on a category archive that is not the blog). I'm wondering if I'm not doing this correctly - does in_category not work on an archive page? I have a similar set up with a single.php directing to a different include template based on the category. Thanks! _**Update_** I've also tried to use is_category and it seems to be completely ignoring my first condition and just echoing foo for any category.               <?php        if (is_category('166')) { include 'archive-blog.php';     }          else {        echo('foo');     }     ?>      Link to what I'm talking about: (go into the archives in the right sidebar) http://www.metropoliscreative.com/talent-analytics/w/?cat=166 http://www.metropoliscreative.com/talent-analytics/w/?cat=3 **also, im not using permalinks because the clients server does not have mod- rewrite**


title: How to update selective options on plugin settings page

text:
I write a wordpress plugin. My plugin has options. All options are in one group, 'pluginname-settings'. All option names are uniform and look like "pluginname-settings['option-name']". Some code to illustrate my case:               register_setting( 'pluginname_options', 'pluginname-settings', 'pluginname_validate' );     add_settings_section( 'section-one', 'Name of Section One', 'section_one_callback', 'pluginname_options-sectionname' );     add_settings_field( 'optionname', 'First Option', 'my_text_input', 'pluginname_options-sectionname', 'section-button', array(         'name' => 'pluginname[optionname]',         'value' => '42')         )      For blog admins to tweak them, I created a settings page and grouped options in tabs. Each tab shows a subset of options (one section) and an "Update button", as follows:               echo "<form action=\"options.php\" method=\"POST\">";     settings_fields( 'pluginname_options' );     do_settings_sections( 'pluginname_options-sectionname' );      submit_button('Update', 'primary',  'submit-form', false);     echo "</form>";      The problem is that when I press "Update" on one tab, the options from other tabs get cleared. To my understanding, this is because all options represent an array of one setting. Question: is it possible to save one section without clearing others under this setup? What is a good practice in such cases -- register separate settings, use validation function to fill in the blanks or something else? Or is it just me doing it all wrong? Thank you in advance. P.S.: Per request in comments, here is a minimal working example:               <?php     /*     Plugin Name: Plugin Name     Plugin URI:     Description: Description     Version: 0.0.1     Author: Author Name     Author URI:     License: GPL3+     */          add_action( 'admin_menu', 'pluginname_menu' );          function pluginname_menu()         {         add_options_page( 'PluginName Options', 'pluginname', 'manage_options', 'pluginname_options_page', 'pluginname_options_page' );         }          add_action( 'admin_init', 'pluginname_admin_init' );          function pluginname_admin_init()         {         register_setting( 'pluginname_options', 'pluginname-settings' );         add_settings_section( 'section-one', 'Section One', 'pluginname_section_callback', 'pluginname_options-section-one' );         $options_array = get_option('pluginname-settings');         add_settings_field( 'optionname-one', 'First Option', 'pluginname_field_callback', 'pluginname_options-section-one', 'section-one', array(         'name' => 'pluginname-settings[optionname-one]',         'value' => isset($options_array['optionname-one']) ? $options_array['optionname-one'] : '42')         );         add_settings_field( 'optionname-two', 'Second Option', 'pluginname_field_callback', 'pluginname_options-section-one', 'section-one', array(         'name' => 'pluginname-settings[optionname-two]',         'value' => isset($options_array['optionname-two']) ? $options_array['optionname-two'] : '42')         );         add_settings_section( 'section-two', 'Section Two', 'pluginname_section_callback', 'pluginname_options-section-two' );         add_settings_field( 'optionname-three', 'Third Option', 'pluginname_field_callback', 'pluginname_options-section-two', 'section-two', array(         'name' => 'pluginname-settings[optionname-three]',         'value' => isset($options_array['optionname-three']) ? $options_array['optionname-three'] : '42')         );         add_settings_field( 'optionname-four', 'Fourth Option', 'pluginname_field_callback', 'pluginname_options-section-two', 'section-two', array(         'name' => 'pluginname-settings[optionname-four]',         'value' => isset($options_array['optionname-four']) ? $options_array['optionname-four'] : '42')         );         }          function pluginname_validate($input)         {         return $input;         }          function pluginname_section_callback()         {         echo 'Feel free to change parameters below.';         }          function pluginname_field_callback( $args )         {         $name = esc_attr( $args['name'] );         $value = esc_attr( $args['value'] );         echo "<input type='text' name='$name' value='$value' /> ";         }          function pluginname_tab1()         {         echo "<form action=\"options.php\" method=\"POST\">";         settings_fields( 'pluginname_options' );         do_settings_sections( 'pluginname_options-section-one' );          submit_button('Update', 'primary',  'submit-form', false);         echo "</form>";         }          function pluginname_tab2()         {         echo "<form action=\"options.php\" method=\"POST\">";         settings_fields( 'pluginname_options' );         do_settings_sections( 'pluginname_options-section-two' );          submit_button('Update', 'primary',  'submit-form', false);         echo "</form>";         }          function pluginname_options_page()         {         ?>

Options

             <a href="?page=pluginname_options_page&tab=1" class="nav-tab <? if ( @( $_GET['tab'] == '1' ) || !isset($_GET['tab'])) echo "nav-tab-active"; ?>">Section One Options             <a href="?page=pluginname_options_page&tab=2" class="nav-tab <? if ( $_GET['tab'] == '2' ) echo "nav-tab-active"; ?>">Section Two Options
             <?php $current_tab = $_GET['tab'];             switch ($current_tab)                 {                 case '2' : pluginname_tab2(); break;                 default: pluginname_tab1();                 } ?>
         <?php     }     ?>      minimal working example.


title: How does WordPress access theme and plugin files through its editor?

text: I love that WordPress enables you to edit files in the WP back end, but I want to know how it works. How is WordPress able to access and allow you to edit files that are on a server like that? Please let me know if this would be better for a site like stackoverflow.


title: pagination for a custom loop with multiple post types

text: I realize that this seems to be a common problem and I've read through a lot of the posts but it's just not making sense. I was wondering if someone could take a look at my code. What I am trying to do is build a home page that pulls posts from my custom post types into one loop. It's looking like almost every article that I read is calling the pagination based off of categories. In my case I just have completely separate post types and I am calling it by the type. http://pastie.org/7378084 Thank you in advance


title: jQuery AJAX call not executing in Plugin

text: I've been working on a class for my free plugins that outputs a "Donate" form. The "No thanks" dismissal link hides the form and runs an AJAX call to update a WP Option keeping track of the dismissal. I'm having issues getting the called PHP function to actually fire. I added the "success" function to output an echo that I added to the PHP function called by the AJAX (typically, the function has no output, only a WP Option update), but "data" is always 0 and nothing happens in the database. I'm guessing that WP isn't actually able to use the function for some reason. The function is declared as public and this has actually worked. I'm not sure which modifications I made could've broken it. Here's the pertinent part of my jQuery AJAX call               // Create the AJAX data     ajax_call_data = {         'action': 'dismiss_ppd_dmgr',         'nonce': $nonce     };          // Call the AJAX function to update the options     jQuery.ajax({         url: ajaxurl,         type: 'post',         data: ajax_call_data,         success: function(data) { alert( data ) }     });      In the class, I have an attribute ajax_call, which is set at class instantiation and I'm adding my call to Wordpress like so. I've verified that $this->ajax_call is populated properly and also tried hardcoding it, instead of using the variable.               add_action( 'wp_ajax_' . $this->ajax_call , array( &$this , 'dismiss_form' ) );      So I suppose the question is, how do I debug this to figure out why WP can't call my PHP class function? Any ideas on why the function can't be found/run?


title: Override default options in plugin metaboxes

text:
Imagine you are on a post-new page to add a post, and a metabox added by a plugin has a lot of checkboxes that always need to be checked manually. Here is one of them:
             <input class="checkbox" id="plainview_form2_inputs_checkboxes_blogs_5" name="broadcast[blogs][blogs_5]" type="checkbox" value="5">             Some item I need to be checked by default
      I´d like to have this checked by default every time the page is loaded. I don't want to modify the plugin code. I suppose a jquery would be the most flexible way to approach this problem. Any advice on it?


title: How to use shortcode inside of shortcode in theme

text: I am trying to place a shortcode inside another shortcode within a page template, however the various attempts I've made seem to not do anything. Here's how my code looks now -               <?php echo do_shortcode('[shortcode]' .$shortcode2. '[/shortcode]');?>      I've also tried these -               <?php echo do_shortcode('[shortcode]$shortcode2[/shortcode]');?>          <?php echo do_shortcode('[shortcode]{$shortcode2}[/shortcode]');?>      What am I doing wrong?


title: Audio TAG Not using MediaElement When Page is loaded through ajax

text: I am using APPL loaded to load all pages of the website. One of the page is the blog read page, where the entire blog is been opened up for user preview. Some blog pages have audio tags in it where the WP audio player is showing up. If you open up this link http://tourworthy.com/tw21/?page_id=20&bID=17&bType=2 the audio player looks fine. but if you open up the same blog entry via http://tourworthy.com/tw21/?page_id=5751, then click "User blog" tab and go to page 2 of the listing and click the first blog (this is the same blog of which I have given the link earlier). Now you can notice, the audio player is not the same. I have checked the source, if I load the entire website with the blog read page, the audio player is using MediaElement.js but when loaded from ajax it is not. Is there a solution to this, so that MediaElement.js is been used even using ajax page load A quick help will be appriciated


title: How to structure WordPress plugin to display data from API

text: I am creating a plugin that connects to a remote API that has car listings and displays the data that's returned in that call. The plugin essentially does not need to interact with the WordPress database at all. I already know I can use things like `wp_remote_get`, `file_get_contents` and `file_get_contents` to retrieve that data. My problem is that I'm not sure if I should be creating a plugin for this or just shortcodes or page-templates or what. I want the urls to look like               example.com/cars/ //Cars listing results     example.com/cars/2 //Page 2 of Cars listing results     example.com/cars/?doors=4&engine=v8 //Search parameters for Cars listing results     example.com/car/1234 //Car info page 1234 is the car_id      I was thinking I could create pages in WordPress called `cars` and `car` and then create custom shortcodes that would hook into some functions I build to interact with the API, but for some reason that doesn't seem like the best idea to me. Can anyone recommend a better structure for setting this up?


title: Load scripts only for selected template

text: Is there a built in function to load scripts only for particular template? At them moment I am doing like so:               if (is_page('portfolio') || is_page('gallery')){          wp_register_script('jScrollpane', get_bloginfo('stylesheet_directory') . '/js/jquery.jscrollpane.min.js');     wp_enqueue_script('jScrollpane');     }      and it works as long as I call the pages "portfolio" and "gallery". I would like to have it more reusable, how can I achieve that? Thank you in advance


title: How to include php-generated javascript?

text: I've looked around and have found no great solution so far: I would like to add customized javascript from a widget using `wp_enqueue_script`, but Wordpress seems to be limiting scope to the javascript file I load in, as my javascript file says: > Uncaught TypeError: Object [object Object] has no method 'photogallery' Here is the output I would like to load in, as if it were its own script via `wp_enqueue_script`:               <script type = "text/javascript">                 (function ($) {                     "use strict";                     $(function () {                         var $gallery = $("#gallery").photogallery(                                 "a",                                 {                                     thumbs: <?php echo setBool($instance["hasThumbs"]); ?>,                                     history: <?php echo setBool($instance["historyEnabled"]); ?>,                                     time: <?php echo ($instance["transitionTime"] * 1000); ?>,                                     autoplay: <?php echo setBool($instance["autoplayEnabled"]); ?>,                                     loop: <?php echo setBool($instance["isLooped"]); ?>,                                     counter: <?php echo setBool($instance["hasCounter"]); ?>,                                     zoomable: <?php echo setBool($instance["zoomable"]); ?>,                                     hideFlash: <?php echo setBool($instance["hideFlash"]); ?>                                 }                             );                     });                 }(jQuery));             </script>      I know that manually coding the default values in to another js file, and using `enqueue_script` will work fine, but how do I do this properly, with custom widget values, and not load the required js file twice? I am not interested in complex ajax requests unless it is my only option, as mentioned here. Thanks in advance.


title: How to code arrays in other language which requires UTF-8

text: I´m changing a code to Rusian but the Admin panel get freeze, I need to deactive a plugin to access again the admin panel; there is no problem on front end. the lines I´m changing is   `   $listing_types = array('Продажа', 'Аренда', 'передача', 'аукцион');` which is   `$listing_types = array ('For Sale', 'Rent', 'transfer', 'auction'); ` I´ve done this for spanish   `$Listing_types = array ('Venta', 'Renta', 'transferencia', 'subasta'); `   But the spanish language is like english if I don't use special charset.


title: WP_Query tax_query - Show results if child has parent X

text: I've made a custom search which includes a 3 tier custom taxonomy that looks like this: continent \- country \- - state The search is formatting in the above way. Here is my problem: Example data: Taxonomy name = 'locations'. Custom post type = 'firms'.               America [term_id = 1]     - United States [term_id = 2]     - - Idaho [term_id = 3]     - - New York [term_id = 4]     - - Wisconsin [term_id = 5]      So how would I go about returning results for all firms with a 'locations' taxonomy PARENT of ID = 2 (United States)? Let's say the user selects United States in the dropdown. There will be no results because for the 'firms' custom post type, the 'locations' taxonomy selected is always drilled down as far as possible to the state level. So for example a firm with 'locations' set as New York would not show up when a user searches for 'United states', because their 'locations' taxonomy ID is 4 (state level) and NOT 2 (country level). Hope this makes sense... I was thinking of perhaps storing country level and continent level in post_meta and conditionally adding a meta query on the search page if the selection is not state level. Any ideas? I think this is quite an interesting problem :-) Thanks


title: Simple Custom Metabox Not Saving

text:
I'm not quite sure why but I've been playing around with all kinds of different solutions but none seem to work. I've traded `update_post_meta` with `add_post_meta` and even broke it up into 3 conditionals to see if it was adding, updating, or deleting but nothing seems to work. The problem is that it won't actually save and show the data on update. I know that '_desc' is set since it does show data when I `die()` (right before the update). Suggestions on how I can figure out why it's not updating?               /** Add the Meta Box **/     function add_custom_meta_box() {         global $meta_box;         add_meta_box(             'short-desc', // $id             'Short Description', // $title              'show_custom_meta_box', // $callback             'post', // $page             'side', // $context             'high'); // $priority     }     add_action('add_meta_boxes', 'add_custom_meta_box');          /** The Callback **/     function show_custom_meta_box() {         global $post;         // Use nonce for verification         echo '<input type="hidden" name="shortdesc_meta_box_nonce" value="'.wp_create_nonce(basename(__FILE__)).'" />';              // get value of this field if it exists for this post         $meta = get_post_custom($post->ID);              // Begin the field table         echo '

';                  echo 'Enter A Short Description:                 <input type="text" name="_desc" id="short-desc" value="'.$meta['_desc'].'" size="30" />';              echo '

'; // end table     }           /** Save the Data **/     function save_custom_meta($post) {         // verify nonce         if (!wp_verify_nonce($_POST['shortdesc_meta_box_nonce'], basename(__FILE__)))              return $post->ID;         // check autosave         if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)             return $post->ID;         // check permissions         if (!current_user_can('edit_post', $post->ID))             return $post->ID;              //echo $_POST['_desc'];         //die();              if(isset($_POST['_desc']))             update_post_meta($post->ID, '_desc', strip_tags($_POST['_desc']));     }     add_action('save_post', 'save_custom_meta', 1, 2);


title: Custom post type missing custom fields

text:
The theme I purchased came without custom fields in the post/product editor. It uses a custom post type in its own admin php file. I've managed to add custom fields by pulling the following code out of wordpress core metabox.php file however I'm unsure how to get it to work. Its missing the area where the custom field values should go.

     <?php     $metadata = has_meta($post->ID);     list_meta($metadata);     meta_form(); ?>


title: Custom Post Type post ordering not working

text:
I'm having a problem with entries for a custom post type not being ordered as expected inside a custom query:
Related projects
                      <?php                          $rp_args = array(                             'post_type' => 'work',                             'post_status' => 'publish',                             'orderby' => 'title',                             'order' => 'ASC',                             );                               $related_projects = new WP_Query($rp_args);                 ?>
                     <?php                      if($related_projects->have_posts()):                     while ($related_projects->have_posts()) : $related_projects->the_post();                 ?>
<a href="<?php the_permalink();?>"><?php the_title();?>
                 <?php                    endwhile;                    endif;                 ?>
      It's supposed to just simply pull out a custom post type and order it by name - but the ordering isn't working and I'm not sure why not. It's simply listing the posts in the order they appear in the WP admin. Any thoughts on why my ordering isn't kicking in? It finds the correct post type and number of posts I specify - just the ordering doesn't seem to work.