title: How to create custom content on custom page from plugin?

text: I have a plugin that I'm working on and I'd like the plugin to create and display custom content on a "page" created using a rewrite rule. I've successfully created the rewrite rule with `add_rewrite_rule()` and when navigating to that URL, I don't receive the "Page not found" error. What I'm having trouble figuring out is how to have the plugin display content when that URL is accessed. I know how to do this in a theme with `get_template_part( 'content', $page_template );` but how can I have the plugin serve this functionality? The plugin can't add a file to the Theme, so how can I have custom page content (via the plugin) show up? Instead of using a theme's `page.php`, I'd like the plugin to pull from `my- plugin/views/custom.php` I've seen other plugins that do this sort of thing, but haven't been able to track down how it gets the content to the public user. I'm sure I'm overlooking something fairly simple, but I'm having a hard time tracking down the issue, I'm not even sure exactly how to search for what I'm looking for. Any help would be greatly appreciated. Thanks.


title: How to setup the landing and entry pages for a custom post type

text:
I have created a custom post type called services but am not sure if they way the setup pages is most optimal. For the landing page, I have created a normal 'static pages' called services and am using this loop to list the service entries int the file called page- services.php:               <?php $the_query = new WP_Query( array( 'post_type' => 'services' ) ); ?>     <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>                            <?php the_title('') ?>     <?php the_field('service_description') ?>     <?php endwhile; ?>      Everything else on the services landing page is hardcoded like the page title (which I think should really be dynamic). For the services individual posts (using custom post types services), the loop looks like this in the file called single-services.php:               <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>     <?php the_field('testimonial_qoute'); ?>     <?php the_title('') ?>     <?php the_field('service_description') ?>     <?php endwhile; else: ?>
There are no services found
     <?php endif; ?>      The HTML markup for both pages is the same, is just one list the services and the other displays individual service. Any advice is welcome. Thanks


title: Use Click Image to Play Youtube Video in a Wordpress Loop

text:
Here is my code on Playing Youtube Video when an image is clicked.. The HTML

                    The jQuery                     I tried to used it in a loop, but if i clicked on one image, it plays all the video's inside the loop. Here is the code               <?php if (have_posts()) : while (have_posts()) : the_post(); ?>              <article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?> role="article">
         <?php         if(get_field('youtube_id'))         { ?>

             <iframe src="http://www.youtube.com/embed/<?php echo get_field('youtube_id'); ?>?rel=0&hd=1&autoplay=1" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen>

          <?php the_post_thumbnail('full', array('class' => 'featimg')); ?>         <?php } else { ?>         <?php the_post_thumbnail('full', array('class' => 'featimg')); ?>         <?php } ?>

<?php the_title(); ?>

         <?php the_content(); ?>
          <?php endwhile; ?>
      I want it be dynamic, but I don't know how. Any suggestion will be appreciated, thanks.


title: Link images to post permalink - custom post types

text: When someone creates a post in a custom post type and uploads an image the Link URL box shows it as the attachment URL. What I would like is for it to be the permalink to the post. Is there a way to do it without modifying core files?


title: Creating a photo gallery in WordPress

text: At times I've tried a few different solutions for a WordPress-powered photo gallery. There are lots of options, including plugins and custom post types. Theme matters a lot, here. ma.tt has a pretty impressive setup (as you would expect from the creator of WordPress), though I'm not sure where all the magic comes from. So, have you implemented a gallery? Did you use built-in functionality, or are there some plugins you found helpful? What sorts of challenges did you face, e.g., needing to pick a focus/highlight image to represent the set.


title: Looking for simple and lightweight plugin for post reading stats

text: I am already using Piwik to register all stats of my blog site. What I need now is a simple and lightweight plugin that stores the number of visitors for single posts. It would be nice if it provides a way to show the number of readings inside the post.


title: Wordpress page editor for clients, opinions needed

text: I wanted to ask other wordpress developers their thoughts on how clients can best create fairly advanced page layouts via the standard WYSIWYG editor. When I say advanced layout I primarily mean a layout with responsive columns, maybe an image on the left and a heading and content on the right. As simple as that sounds it can end up getting fairly ugly to look at in the editor. Personally I have tried using the standard editor, using shortcode plugins, using advanced custom fields with flexible content fields, and I've researched some of the editors that essentially replace the standard editor. They all have there pros and cons, and in the end I have to remember my client may have fairly limited knowledge in laying out a page let alone markup and CSS. So my question is, what are other wordpress developers using to allow their clients to create more advanced page layouts? Thanks for your thoughts!


title: Looking for similar posts plugin with custom tuning

text: I am using Similarity by David Miller; it is nice, but it misses some features. I would like to:   * Assign more "weight" on some specific posts (specify them by ID is ok)   * Assign more "weight" to most recent posts (the plugin that I am using it prefers many times very old posts based on tag/category than recent) Do you known if it exists a plugin with these features?


title: Custom content before post content

text: I am using this code to insert custom content after title and before content. How can i limit it to only "post" not pages and custom post types.               function theme_slug_filter_the_content( $content ) {     $custom_content = 'YOUR CONTENT GOES HERE';     $custom_content .= $content;     return $custom_content;} add_filter( 'the_content', 'theme_slug_filter_the_content' );


title: Why do I get the timeout warning?

text: I turned on debug mode in WordPress and the first request of the day I get this error: Warning: http_request() [function.http-request]: Timeout was reached; Operation timed out after 1000 milliseconds with 0 bytes received (/wp- cron.php?doing_wp_cron) in /public/wp-includes/class-http.php on line 1218 I know what cron jobs are and I understand how WordPress might want to run periodic jobs (and since HTTP is stateless, running a "cron" job on the first request of the day makes sense) but why does it time out?


title: Customizing a WordPress theme without changing it?

text: I have found and downloaded a theme. However I want to tweak the CSS some to change the design, colours etc. a bit. How should I go about doing this, while still being able to update the theme without loosing the changes.


title: Hiding styles from Facebook

text: Some of my pages/posts have very short custom stylesheets at the beginning of them. I know this isn't great practice, but it's worked very well thus far. The problem, however, is linking on Facebook: Facebook auto-generates a preview of the page, and it includes a picture, the page title, and a snippet from the beginning of the post content. The post content snippet is only showing the stylesheet that I have directly inside the post--Facebook isn't ignoring the fact that it's HTML. What can I do on WordPress's end to really hide that code? Do I need to put all of those styles in my custom CSS then give everything the proper class? (To clarify, the `<style>` tag doesn't show, just the content of the stylesheet itself. It doesn't show on the page in WordPress, only in the Facebook snippet. This is a self-hosted blog.)


title: custom walker nav issue involving ajax

text: I am using ajax in a theme not written by me. This ajax gets the link clicked and then slides that page into view. it works good. In order for it to do it's thing, I had to make a custom walker for wp_nav_menu that adds two characters to the link so my links look like this in the nav                http://my-site.com/#!/post-1      my problem with this is that when viewing a single page. I have to have WordPress reload the page to get the single post. So then my link would look like this                http://my-site.com/?p=post-1      So when I hover over the nav to go back to a previous or new page, this is where my problem starts. my nav shows this as the selection when clicked                http://my-site.com/?p=post-1#!/post-1      I don't know why it won't get rid of the previous address. Here is my custom walker http://pastebin.com/Xn7NRiG7 Most of the site is is loading posts and pages into the index and then using the ajax to scroll that page into view. I am trying to make the single blog pages external to the ajax functionality. I tried using two different menus for this like so                if( is_home() || is_page()){                $args = array( 'depth' => 3, 'container' => '', 'container_class' => '','menu_class' =>'', 'menu_id' => 'menu', 'fallback_cb' => 'default_menu','link_before' => '','link_after' => '', 'theme_location' => 'primary','walker' => new Amaranthe_Custom_Walker_Nav_Sub_Menu());                 wp_nav_menu($args);             } else {                $args = array( 'depth' => 3, 'container' => '', 'container_class' => '','menu_class' =>'', 'menu_id' => 'menu', 'fallback_cb' => 'default_menu','link_before' => '','link_after' => '', 'theme_location' => 'primary');                 wp_nav_menu($args);             } ?>      Do you have any idea how I might be able to get back into the ajax flow properly?


title: Redirection based on location but without affecting search bots

text: A client has a successful UK site based powered by Wordpress and is launching a US arm. While the US sub-sites are built, he has a holding page that is visible to US visitors, who are redirected to it from the usual home page by the Geo Redirect plugin. I've just realised that Geo Redirect is also redirecting Google's (and other search engines') bots, which is not at all good; does anyone have a relatively easy solution that would do what Geo Redirect does so well but would not affect visits by search engine bots?


title: do_action appearing outside of menu?

text:
I'm using Bill Erickson's "Add Extra Code to Any Menu" function:               <?php     /**      * Add Extra Code to Any Menu      * @author Bill Erickson      * @link http://www.billerickson.net/customizing-wordpress-menus/      *      * @param string $menu      * @param object $args      * @return string modified menu      */     function be_menu_extras($menu, $args) {     //$extras = '
Your extras go here
';     if ('secondary' == $args->theme_location)          //return $menu . $extras;           return $menu . '
' . do_action('posts_logout_link') . '
';     else         return $menu;     }     add_filter('wp_nav_menu_items','be_menu_extras', 10, 2);      to insert `do_action('posts_logout_link');` from the Logout Password Protected Posts plugin. Can anyone shed some light as to why `do_action` appears outside the `$menu`. If I use html, it appears at the end on the menu wrapped in the `<li>` tags, as it's supposed to. (Using $extras seemed to duplicate the link in other areas.)


title: jQuery and AJAX Not working with Select Form Element

text: I seem to be having a strange issue with jQuery and a newly-created AJAX form/function. I'm pretty new to AJAX so please bear with me. Here's the jQuery:               jQuery('#wpuf_new_post_form').submit(function(e) {              e.preventDefault();              var data2 = jQuery('#wpuf_new_post_form').serialize();              var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';              jQuery.ajax({             type: 'POST',             url: ajaxurl,             data: data2 + '&action=savedata',             success: function(resp) {                 if(!resp){ alert ('Failed!')}else{ alert(data2) }             }         });          });      The above code takes the submission of my `#wpuf_new_post_form` form, serializes the data, then passes it through to my PHP function:               add_action('wp_ajax_nopriv_savedata', 'my_ajax_save_form');     add_action('wp_ajax_savedata', 'my_ajax_save_form');          function my_ajax_save_form(){              $my_post = array(             'post_title'    => $_POST['wpuf_post_title'],             'post_content'  => $_POST['wpuf_post_content'],             'post_type'     => $_POST['wpuf_post_type'],             'post_status'   => 'publish',         );              wp_insert_post($my_post);              $this_post_ID = wp_insert_post($my_post);              add_post_meta($this_post_ID, 'cf_user-timestamp',  $_POST['cf_user-timestamp']);         add_post_meta($this_post_ID, 'cf_project-id',  $_POST['cf_project-id']);         add_post_meta($this_post_ID, 'cf_bin-id',  $_POST['cf_bin-id']);         add_post_meta($this_post_ID, 'cf_status',  $_POST['cf_status']);         add_post_meta($this_post_ID, 'cf_schedule-date',  $_POST['cf_schedule-date']);         add_post_meta($this_post_ID, 'cf_reply-url',  $_POST['cf_reply-url']);         add_post_meta($this_post_ID, 'cf_from-user',  $_POST['cf_from-user']);          }      Creating the post and post meta as shown above, via the AJAX submission, works just fine. The only three fields which refuse to work happen to be `select` form elements. They are:   * cf_project-id   * cf_bin-id   * cf_status Again, all the other post meta submissions as depicted above, hit the database just fine. It's only the `select` form element values that do not. Is there possibly a better way to handle the serialized value of `select` form elements? **PS:** If it's of any value, here's an example of the serialized string that's being passed through as the jQuery variable `data2`. As you can see, the format doesn't differ from any of the other submitted form elements: `_wpnonce=537e4539cc&_wp_http_referer=%2Fajax%2F&wpuf_post_title=1395254005136&wpuf_post_content=Testing&cf_user- timestamp=March+19th+2014%2C+11%3A33%3A25+am&cf_project-id=3797&cf_bin- id=3325&cf_status=-status-today&cf_schedule-date=03%2F21%2F2014&cf_reply- url=&cf_from-user=&wpuf_post_type=post&wpuf_post_new_submit=yes`


title: Sorting editor screen items

text: When new users log into our site they have to organize a number of screen options in order to begin creating custom fields and editing the site. I would like to force a specific order in which these are displayed. Is there a way to force the sort on the edit screen? ![enter image description here](http://i.stack.imgur.com/ywKll.jpg)


title: Make Custom Field Into A Link On The Front End?

text: I have set some custom field 'artist' and 'song-name' displaying like:               Artist: <user input>     Song Name: <user input>      My question, how do you make the on artist and song name into a clickable link? Such that when the artist name is clicked for example, it will bring up the page with all posts of that artist name? Thinking about it, its kinda like the_category() or get_category_link, only I am using custom fields.


title: difference between methods of query

text:
Looking in other plugins/widgets code , I usually see TWO different methods for a query : one would be :               $args = array( 'numberposts' => $limit , // or, 1, or 20 ...                     'exclude' => '1049',                     'meta_key' => 'some_meta',                     'post_status'=>'publish');     $recent_posts = get_posts( $args ); //or get_recent_posts() or any other function     //end query     foreach( $recent_posts as $recent ){ // do something with array     $pop_string .= '
' . $recent["post_title"] .'
 ';     }     echo $pop_string;      the second method would be :               $orig_post = $post;     global $post;     // query posts     $my_query = new WP_Query('posts_per_page=5&meta_key=somekey&meta_compare=>=&meta_value=somevalue&orderby=meta_value&order=ASC');     if( $my_query->have_posts() ) {     while( $my_query->have_posts() ) {     $my_query->the_post();     $pop_string .= '
';     $pospstring .=  the_title() . '
';     }     }          echo $pop_string;     $post = $orig_post;     wp_reset_query();      I am very curious as to What is the difference between them . (I do not mean the fact that one uses array and one is using direct wp functions. - but more the technical capabilities) I understand that the second one is a "custom loop" and the first one is "outside" a loop - but both can be used in widgets for example, to achieve very similar results (if not equal ..)   1. Is there something that one can do , that the other can´t ?   2. Which one is the preferred choice , and when ?   3. what would be the considerations to use one over the other , and how to choose them?   4. Is there a performance difference ?   5. If I want for example to write some simple widgets to get data - which should I choose ? and why ?


title: Create download page from post option link

text: I have a button download. It's contain the link from post option. I want to when click button download, it will show a download page with the link in post option instead go direct link from it. Please help me ! ![The link download in post option](http://i.stack.imgur.com/i3epM.jpg) ![The single post page with download button](http://i.stack.imgur.com/qlvLp.jpg) ![The page i want to show download link when customer click download button](http://i.stack.imgur.com/1hAak.jpg)


title: Use of unicode postname when using custom generate_rewrite_rules

text: I have a custom rewrite rules like..               add_action('generate_rewrite_rules', function ($wp_rewrite)     {         $wp_rewrite->rules = array('products/(.+?)$' => 'index.php?post_type=product&name=$matches[1]') + $wp_rewrite->rules;     ...      This rule only work when `postname` is English, since if postname is other language, the url is encoded, so the `$matches[1]` is storing the encoded value and it must be first decoded first in order to have a match in the database. So, how to make `$matches[1]` decode first before it is used to query the db?


title: Get main term from a sub term in Woocommerce

text:
I need to show   * MAIN term      * sub term 1     * sub term 2     * … Every time I click on sub term. I mean, I don't want to show the other MAIN terms, just the one I select with the sub terms. In `woocommerce-template.php` I use:               function woocommerce_content() {              if ( is_singular( 'product' ) ) {                  while ( have_posts() ) : the_post();?>

                 <?php                          global $post;                              $terms = get_the_terms( $post->ID, 'product_cat' );                         foreach ( $terms as $term ){                         $category_id = $term->term_id;                         $category_name = $term->name;                         $category_slug = $term->slug;                         echo '
slug, 'product_cat') .'">'.$category_name.'
';                              }?>

                  <?php   woocommerce_get_template_part( 'content', 'single-product' );?>
                  <?php endwhile;              } else {                  ?>

                 <?php                           global $wp_query;                     // get the query object                     $cat_obj = $wp_query->get_queried_object();                     if($cat_obj)    {                         $category_name = $cat_obj->name;                         $category_desc = $cat_obj->description;                         $category_ID  = $cat_obj->term_id;                         $category_slug = $cat_obj->slug;                     }                     woocommerce_subcats_from_parentcat_by_ID($category_ID)                          ?>

<?php woocommerce_page_title(); ?>

             <?php do_action( 'woocommerce_archive_description' ); ?>                  <?php if ( have_posts() ) : ?>                      <?php do_action('woocommerce_before_shop_loop'); ?>
                      <?php woocommerce_product_loop_start(); ?>                          <?php woocommerce_product_subcategories(); ?>                          <?php while ( have_posts() ) : the_post(); ?>
                              <?php woocommerce_get_template_part( 'content', 'product' ); ?>
                          <?php endwhile; // end of the loop. ?>                      <?php woocommerce_product_loop_end(); ?>
      It works for single product, but if I click on a sub term, the MAIN disappears. The function I use in `functions.php` is:               function woocommerce_subcats_from_parentcat_by_ID($parent_cat_ID) {     $args = array(        'hierarchical' => 1,        'show_option_none' => '',        'hide_empty' => 0,        'parent' => $parent_cat_ID,        'taxonomy' => 'product_cat'     );     $subcats = get_categories($args);     echo '
';            foreach ($subcats as $sc) {         $link = get_term_link( $sc->slug, $sc->taxonomy );           echo '
'.$sc->name.'
';       }     echo '
';      } Can you help me please?


title: Get the a specific image from the post gallery linked to post_id

text: Is it possible to get the second image from the gallery with the `post_id`? I usually work with `get_the_post_thumbnail` but in this case I would like to get the second image from the post gallery, so a different image from the post's featured image. Does exist some tutorial to get it?


title: Excluding additional featured images in Wordpress galleries

text: I'm using a plugin to provide support for multiple featured images in Wordpress: http://wordpress.org/plugins/multiple-featured-images/ I'm trying to exclude both the standard featured image and the second featured image from a gallery entry (I've successfully excluded the standard one, but I'm not sure about the synax for the plugin-related featured image).               <?php echo do_shortcode('[gallery size="full" columns="1" exclude="' . get_post_thumbnail_id( $post->ID ) . ',' . kd_mfi_get_featured_image_id('$post_id') . ' "]'); ?>      If anyone's familiar with this plugin and could provide some assistance here, I'd appreciate it. Thanks!


title: How to order categories in Woocommerce that are spread over multiple pages?

text: I'm building a store using Woocommerce and need to manage a large number of product categories. I would like to re-order them to appear in alphabetical order. However the drag and drop ordering system splits categories over several pages and I can't seem to find a way of editing the entire list rather or move items from one page to another. Is there any way I can do this? If so how is it done? Thanks.


title: Making posts permalinks consistent numbers

text: I'm developing a new website, but I can't quite figure out a solution to my permalinks problem. My main website is http://w3spine.com, I'm sending posts to my second WP installation at http://w3lol.com where I want posts permalinks to be consistent numbers like w3lol.com/50, w3lol.com/51, w3lol.com/52, etc. I cannot use post ID since there are a whole bunch of other stuff that are stored in wp_posts and the IDs skip some numbers (ex. if given post has id 50 in the best case scenario the next one is with id 54 (50 is the post id, 51 and 52 are revisions put there by default and 53 is the next post's attached image), not to mention that if I happen to do a revision on some post, or add a page or anything that number will increase. It is not a problem to use the post slug as permalink, but the regular users will find it difficult/impossible to keep track of their previous sessions, plus I was hoping to get that short URL look. I'm willing to accept any kind of solution that will achieve the effect I'm going for. PS. By using the slug as permalink (%postname%) I mean that every post has it's own name and I cannot change it to 50, 51, 52, etc. which is obvious solution that on the other hand will create another problem.


title: Plugin is available to update when its not

text: I have developed a plugin for my client, but for some reason, its saying that update is available.Whereas i have no idea how to feed a update. The plugin says in update field, about author with a different name (not me), its a totally confused situation. If someone hit update, my plugin can be overwritten by someone else.   Why is it happening? How i make sure it is not updated by any other means, only if i have feed it to update.


title: Installing Facebook comment plug in without loosing all previous wordpress comments?

text: I'm trying to install Facebook comments onto a word press blog, but I do not want to loose all the previous comments. I'm curious if anyone has any ideas how to do this. I've looked at a lot of the various plugins, and haven't been able to find a good solution. I would like to find a way for the Facebook comment system to be the default comment system, and if someone doesn't have Facebook (or doesn't want to use it) they can use the default wordpress comment system (unless something different exists.) Another option is to use the default wordpress plug in on all previous posts, and moving forward use just the Facebook plug in. I just don't want it to look like all previous posts have no comments when they actually do, if that makes sense. I'm open to any ideas that you have. Thanks!


title: How to sort a loop after most viewed

text:
I have a site and i'm almost done with it. It have teached me a lot about wordpress, although i'm still a noob who doesn't know anything about php or programming (besides html). I have managed to create a loop as a page template. But I want to show posts ordered by most viewed and most rated. My loop looks like this               <?php     /*     Template Name: Most watched     */     ?>          query_posts( 'posts_per_page=5' );                 <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>                             <?php if ( in_category('3') ) { ?>
      <?php } else { ?>
      <?php } ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
                 <?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?>
        <?php the_content(); ?>

Posted in <?php the_category(', '); ?>

                  <?php endwhile; else: ?>
Sorry, no posts matched your criteria.
                 <?php endif; ?>      Really simple - taken form the wordpress documentation examples. I'm using the two plugins wp-postviews and wp-postratings. How should my loop look, if I want to order posts using those plugins? I googled it a lot but never found a complete example - only code snips that i don't know where to put in :( Thanks in advance!


title: Permission to change post Author

text: I am trying to create a "limited admin" but I cannot manage to give this user rights to change the author of posts. The regular administrator can see the dropdown option to change author from both Quick Edit and Edit. The "custom" Admin **cannot** see the dropdown menu either in the quick edit or the normal edit. I don't really know what else I could be missing, I activated almost every "role" for this user: ![First group of roles](http://i.stack.imgur.com/q3u0l.png) ![Second group of roles](http://i.stack.imgur.com/txFwM.png)


title: Updated to version 3.8 and Admin pages are very slow. How to diagnose problem?

text: I manage a large multi site Wordpress installation with about 300 hundred users and blogs. The server is blocked from making internet requests, so I have defined a proxy service in wp-config.php ( WP_PROXY_HOST and WP_PROXY_PORT ) A few weeks ago, I upgraded to version 3.8. Things seemed to go well, but almost immediately I noticed that the admin panel was a bit slower. Now that the users are back from vacation, they are starting to complain that the admin panel is intermittently slow. Sometimes it's quick and responsive, sometimes it takes 20,30,or 60 seconds for an edit-page page to load. Unfortunately, I don't have the freedom to uninstall or reinstall the update without planning downtime and giving the organization notice. Is there a way I can diagnose the problem ? Any plugins or log files that I should be looking at ? error_log and access_log seem pretty normal. Occasionally, when editing a page, users see this errror : > Connection Lost. Saving has been disabled until you're reconnected we're > backing up this post in your browser just in case. ![Connection Lost. Saving has been disabled until you're reconnected we're backing up this post in your browser just in case. ](http://i.stack.imgur.com/1Wz4H.jpg) If I use Chrome's developer tools->Network tab, I can't see much info other than that the post.php page is taking forever to load. ![slow network page load](http://i.stack.imgur.com/amLag.jpg) Could the proxy server be contributing to this problem ? How can I get to the bottom of it? Thanks


title: Re-directing URLs with dates to URLs without dates

text: When I first started writing entries I decided to include the month and day in the URL's, thinking I might need them. In the end turns out I didn't. I found that I can access a particular entry as               http://myblog.com/2013/02/16/my-entry     http://myblog.com/my-entry        Typing in the second one would simply lead to a 301 redirect to the first. Is there a way to make it so that typing in the long form with the date would re-direct to the second without breaking any permalinks?


title: Slug Taken, Cant Find Which Page

text: I'm working on a friends site and I am attempting to update the slug `example.com/blah` but when I update the slug/url to `/blah` and click ok it updates it to `/blah-2`. This means that there is an existing page/post with this setting. I searched the trash/etc in both pages and posts and I cannot find one. I hopped into the DB to take a look around and I wasn't able to find it either in the DB. Albeit, I'm no pro (beginner in this db schema). Where can I find what page/post has this slug so that I can fix this mess? DB queries, plugins to help, etc. Thanks!


title: Ordering custom post type by custom field without a title

text: My custom posts don't have a title, rather they rely on custom fields, and all the solutions I've tried so far seem to work if the title is present.               <?php     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;          $args = array(         'post_type' => 'people',         'posts_per_page' => 40,         'meta_key' => 'surname',         'orderby' => 'meta_value',         'order' => 'ASC',         'paged' => $paged     );     // The Query     query_posts( $args );     ?>      This should work (and it works for other custom post types that have a title), but I can't seem to get it working on the ones without. `surname` is a custom field on the custom post type `people`.


title: Single Responsibility Principle and WP Classes

text: Still working my way through OOP and Solid principles. I’m having a hard time getting around having to have many `new SomeClass();` calls, or adding them to an action hook ( `add_action( 'init', array( 'SomeClass', 'get_instance' )` ). Case in point: I have a posts controller I’m using to handle anything having to do with posts: creation, deletion, modifying its status via ajax, etc. I would think SRP would call for different classes for post creation/modification, ajax requests, etc. Is there a better way to instantiate these classes other than new / add_action? I feel like there will be an excessive number of classes and class instantiations and someone would have come up with something by now. Am I crazy?


title: I18n not working in plugin

text: I'm sure I'm making a dumb mistake, but I don't for the life of me know what it might be. I recently converted one of my larger plugins to utilize I18n (my first time doing so for any of my plugins). The correct function calls are evidently being used since WP was able to generate a complete `POT` file through the admin section of my plugin. Just in case, here are some examples of my I18n calls:               __('Settings', 'plugin-domain')     _e('Select which one to use.', 'plugin-domain')     _n('The following ID is invalid: ', 'The following IDs are invalid: ', count($bad), 'plugin-domain')      My issue is getting the translation to actually happen now that everything is in place. I've got the `plugin-domain-es_ES.[po/mo]` files in a languages directory under my plugin's root and have added `define('WPLANG', 'es_ES');` to my `wp-config.php`. In the main plugin file, I've added the following to hook text domain loading:               add_action('plugins_loaded', array('PluginName', 'loadTextDomain'));     class PluginName {         public static function loadTextDomain() {             load_plugin_textdomain('plugin-domain', false, plugin_dir_path(__FILE__) . 'languages/');         }     }      With this in place, no translation is taking place in the areas where it should be within my plugin. I've also verified that the hook is being reached. I've also tried a few other hooks, including `admin_init` and `init`, but nothing seems to work.


title: how i can make recursive wp_query and work

text:
What i have done so far is:   1. on single post page i have a box with 3 recent posts, i use WP_Query and reset with wp_reset_postdata();    2. i have made a shortcode that displays recent posts, i use WP_Query and reset with wp_reset_postdata();  The problem is when i use the shortcode in single post and not in a page it ruin the box with 3 recent post and shows posts that are not "the 3 mosts recent". I think when the box on single page is trying to check for posts and one of them contain the shortcode it ruin the query with wp_reset_postdata()... ..any sugestion? The Query for shortcode:               global $post;     $atts = extract( shortcode_atts( array(     'title' => ''     ), $atts, 'shortcode_name'));          $args = array(     'post__not_in' => array($post->ID),     'showposts'=> $items,     'post_status' => 'publish',     'ignore_sticky_posts' => 1,     );     $my_query = new WP_Query($args);     if( $my_query->have_posts() ) {         $html .= '
';     if( $title != '' ){         $html .= '
'.$title.'
';     }     $html .= '
';     while ($my_query->have_posts()) {         $my_query->the_post();         $html .= '
';         if( get_the_title() != '' ){                  $html .= '
';              if( has_post_thumbnail() ) {                 $html .= get_the_post_thumbnail( $post->ID, 'thumbnail' );             }              $html .= '
';                        $html .= '

' . ag_short_title(get_the_title()) . '

'.get_the_time('F j, Y').'

';         }         $html .= '
';      }     $html .= '

';      }     wp_reset_postdata();


title: importing plugin w/ settings from one WP installation to another

text: Is there a way to import plugins (and their settings) from one WP installation to another? I've found various tools and tutorials for exporting/importing entire WP installs, posts and pages, etc. but nothing for plugins & plugin settings.


title: Adding 3rd level in custom walker

text:
at present my custom walker works great :) but I can for the life of me get a 3rd level to appear... I can get the top level and the 2nd level dropdown to show perfect, but how do I achieve a 3rd level. Here is the custom walker I am using:               //bootstrap navigation     class bootWalker extends Walker_Nav_Menu {         function check_current( $classes ) {             return preg_match('/(current[-_])|active|dropdown/', $classes);         }              function start_lvl( &$output, $depth = 0, $args = array() ) {             $output .= "\n
\n";         }              function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) {             $item_html = '';             parent::start_el($item_html, $item, $depth, $args);                  if( $item->is_dropdown && ($depth === 0) ) {                 $item_html = str_replace('<a', 'url).'"', $item_html);             }                  elseif( stristr($item_html, 'li class="divider') ) {                 $item_html = preg_replace('/]*>.*?<\/a>/iU', '', $item_html);             }             elseif( stristr($item_html, 'li class="nav-header') ) {                 $item_html = preg_replace('/]*>(.*)<\/a>/iU', '$1', $item_html);             }                  if($depth === 0){                 $item_html = str_replace('current_page_item', 'active', $item_html);             }                  $output .= $item_html;         }              function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output) {             $element->is_dropdown = !empty( $children_elements[$element->ID] );                  if( $element->is_dropdown ) {                 if( $depth === 0 ) {                     $element->classes[] = 'dropdown';                 }             }                  parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);         }     }      I then call it in within the header using the following:
         <?php         if( has_nav_menu( 'primary' ) ) {            wp_nav_menu( array( 'theme_location' => 'primary', 'container' => false, 'menu_class' => 'nav nav-pills', 'depth' => 3, 'walker' => new bootWalker() ) );         }         ?>
            Could anyone put me out of my misery, been trying for a few days now :( Thanks


title: Modify the siderbar footer

text: I have to update a website made with wordpress, and I can't find how to change the "sidebar footer". here's the link to the website: somatbel.be the part I want to change is right under the last menu item(contact), it starts by "contactez nous". When I inspect that part with google chroem its says "box widget". I'm new to wordpress, I look into the widget, menu sections but there is nothing there.


title: Issue with permalinks for custom post type

text: I have a little issue here... When i'm using default permalinks, everything works great, but when I set up > %postname% permalink in settings, my template with custom post type is not loaded. Instead of that it loads archive.php. On other site is works. In this site with the template that I use the custom post type, I have a front end post editing system and I'm using a plugin User Submitted posts. This plugin doesn't have support for custom post types, so I made a little change in code               $postData['post_type']  = 'link'; // here we add a custom field to array $postData      That works well with the post type. I've read about it here, so I used it and after that I've used the classic query for post types in my template. I've no idea why the pretty permalink does not work for that site. Anny suggestions to why it is not working?


title: Disable html in custom post types

text: My webstie have custom post type created, and now I want to disable usage of any html tag in content editor, so only plain text is saved in database (and to remove content editor and html editor if possible). I found functions to remove (rich) content editor:               add_filter('user_can_richedit' , create_function('' , 'return false;') , 50);      And HTML editor remained. But even if I maange to remove HTML editor (this: http://prntscr.com/26uj6u ), users will be able to just type html tags and they will be saved in database. Can someone help me with this?


title: Trying to exclude posts from a category on the home page

text: I've tried the code below to grab the cat ID for one of my categories (watch- isatv) and exclude all of the posts in that category. However, the posts are not being excluded. What is wrong with the code?               function excludeCat($query) {         if ( $query->is_home ) {             $catid = get_cat_ID('watch-isatv');             $query->set('cat', '-'.$catid);         }         return $query;     }     add_filter('pre_get_posts', 'excludeCat');


title: How to enable the <br /> tag in Wordpress posts and pages

text: i can't understand why so simple feature are disabled by Wordpress Team. I want have line breaking with "br" tag. On one wordpress forum was idea to modificate editor.js (in wp-admin/js) and formating.php (in wp-includes) files. http://wordpress.org/support/topic/ltbrgt-stripping-problem-ultimate-solving I was tryed to do this, but 0 good results.


title: Theme modification for custom category menus

text:
My goal is to have a custom menu in the header based on the category of the post being viewed. I'm setting up a single wordpress site that will contain about a half dozen different categories. Each category is going to be a manual I'm responsible for maintaining. I view wordpress as a much improved delivery method for this content than printed manuals or simply downloaded PDFs. Based on the thread found at: http://wordpress.org/support/topic/custom- menusheaders-for-different-categories (specifically the fourth post) I've altered the header.php file in my theme folder by replacing the following code:               <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>      with this code:               <?php   $cat = get_the_category();                         $catSlug = $cat[0]->slug;                         $catMenu = $catSlug . "-nav-menu";                         wp_nav_menu(array(                                     'container'=>'nav',                                      'container_class'=>'menu-header',                                     'theme_location'=>'primary',                                     'menu'=>'{$catMenu}'                                     )                                 ); ?>      I've created custom menus that have names matching the category slug followed by "-nav-menu". For example, the category Employee Handbook has a slug of employee-handbook and specific nav menu of employee-handbook-nav-menu. I can echo out $catMenu and it displays exactly what I would expect. The nav menu in the header is however the default nav menu, not the one specific to the category. Does anyone have a suggestion as to why my wp_nav_menu call isn't performing the way I'm expecting? If anyone could point me in the right direction to accomplish my goal, I'd greatly appreciate it. Thank you very much. Per the request in the first comment, here is the output as found in view source:                    <button class="menu-toggle">Primary Menu</button>     Skip to content

Flight Operations Manual

Standardization Manual

Standard Operating Procedures Amplifier

                     Edit: Found the solution. You do not need either the single quote marks or the curly brackets around the variable in wp_nav_menu call. Example below:               <?php   $cat = get_the_category();                         $catSlug = $cat[0]->slug;                         $catMenu = $catSlug . "-nav-menu";                         $options = array(                                     'container'=>'nav',                                      'container_class'=>'menu-header',                                     'theme_location'=>'primary',                                     'menu'=>$catMenu                                     );                              wp_nav_menu($options); ?>


title: Nav menu of all posts in a custom post type

text: How can I create a nav like those generated by wp_nav_menu which lists all the posts in a specific custom post type? For example, I have CPT "section1" and I'd like to have the menu list all posts which are of type "section1". I've been searching the internet for three days now with no answer. Can anyone point me in the right direction? I'm lost here, help!


title: using pre_get_posts to exclude

text: I am trying to use pre_get_posts to exclude categories from posting to the homepage. If I do it like so it works just fine                $query->set( 'cat', '-13,-7,-19,-12,-24,-21,-14');      that is hard coded in. I am building a custom admin that lists the categories in the admin menu. So now I want to use the id's that get selected in the admin menu. So I have assigned my id's to a variable and when I var_dump the variable, this is what I get                string(2) "13"      string(1) "7"      string(2) "19"      string(2) "12"      string(2) "24"      string(2) "21"      string(2) "14"      So all those are assigned to the variable $category and so I thought I could do this                $category = get_option( 'excludecats' );      foreach( $category as $exclude ){         $query->set( 'cat', '-'.$exclude );      }      when I view the source, I expect there to be 1987 lines of code but what I end up with is 3117 lines of code trying to use the foreach to exclude them. What am I doing wrong?


title: wpdb->insert and stripslashes against sql injection

text: I've been reading the codex at this page: http://codex.wordpress.org/Function_Reference/stripslashes_deep The code i wrote before reading that page is this:               $data   = array(         'col1' => $v['float'],         'col2' => stripslashes($v['string'])     );     $format = array( '%f', '%s' );     $wpdb->insert( 'table', $data, $format );      Basically i manually pass stripslashed values in the $data array. Now, is this code correct and secure or shall i perform a `$_REQUEST = array_map( 'stripslashes_deep', $_REQUEST );`? Is there any important difference or is it the same?


title: Hierarchical gallery

text: I want several galleries, every gallery containing several images. What is the proper way to do this two-level structure? I'd make every element of each gallery a post.


title: Automating Excerpt

text: I am trying to `automate` editors work by automating `excerpts`. My solution works but there are few problems with it:   1. If a post has images/broken html at the beginning it breaks the layout.   2. Substring cuts words. Is there a better solution to automate excerpts or improve my existing code?               <?php if(!empty($post->post_excerpt)) {                the_excerpt();              } else {                echo "<p>".substr(get_the_content(), 0, 160)."...</p>";              }     ?>


title: WP Page and Subdirectory with same name

text: I have a subdirectory within my WP installation called `labs`. I created a WP page called `labs` as well. When a user hits `mydomain.com/labs/` I want them to load up the WP page. But instead it's loading up the `labs` directory listing. I've read a few ways to do this if I want my WP page to have a different name than my directory name, but I don't really want that. For example, I want to have:               mydomain.com/                <-- WP Root     mydomain.com/labs/           <-- Pretty WP page listing all of my projects     mydomain.com/labs/project1/  <-- raw (i.e. no WP) web app     mydomain.com/labs/project2/  <-- raw (i.e. no WP) web app      Is this possible? I should also mention that WP is installed in the root of `mydomain.com`, so `/labs/` is both a WP page and a subdirectory that I created manually. * * * **Solution** : I renamed my `labs` folder to `projects` and used the following .htaccess.               RewriteEngine On     RewriteCond %{REQUEST_URI} labs/(.+)$     RewriteCond %{REQUEST_URI} !labs/(.+)/$     RewriteRule ^labs/(.+)$ http://mydomain.com/labs/$1/ [L]     RewriteRule ^labs/(.+)$ projects/$1 [L]      I'm a little unclear as to why I had to use               RewriteRule ^labs/(.+)$ http://mydomain.com/labs/$1/ [L]      instead of just               RewriteRule ^labs/(.+)$ labs/$1/ [L]      But when I used the latter it never appended the trailing slash.


title: Post Thumbnails multiple sizes

text: I am working on a theme that shows 200/200px post thumbnail on the home page and 500/300px image on the category page. Here is what I have in fuctions.php but it doesn't seem to work (only the homepage thumbnail works)               add_theme_support( 'post-thumbnails' );     set_post_thumbnail_size( 200, 200, true );     add_image_size( 'homepage', 200, 200, true );     add_image_size( 'category', 500, 300, true );


title: Display posts from category in post content?

text: I am developing a website using WordPress. As I don't want the sidebar, I removed 'get_sidebar()' from my page. But I need to place a category in the content part (like a category for latest news) - not in a sidebar. How could I do this?


title: wp_reset_query equivalent for WP Ecommerce

text: I'm having product duplication issues while running two loops on a single page. Is there an equivalent to wp_reset_query for wp ecommerce? You can see the site at http://standingarmed.com/products-page You can see the loop here since it didn't format properly on the page. As you can see I set a variable to grab the first product only. The site only have 7 products so I didn't figure it would be a big deal to let the loop run 7 times. Of course I'd rather query for just the first product but wp ecommerce doesn't support queries like WordPress does, or at least that's what I've found. It then runs into the slider loop.


title: Automatic Refresh all posts at once

text: I created a function to save custom fields on publish a post. Something like this.               function create_fields() {           global $post;              $casa_id = $post->ID;           update_post_meta($post->ID, 'casa_id', $casa_id);       }       add_action('publish_post', 'create_fields');        This function saves on a custom field some string. **Now the question** : How can i use this action on older posts? I have 1000 posts and i don't want to refresh all the posts manually, **is this possible?**


title: My first plugin doesn't save the data in options

text:
This is my entire code. It doesn't save the data I enter on the plugin settings page. I don't have a clue on why this happens! Can somebody please help me?               <?php // add the admin options page     add_action('admin_menu', 'plugin_admin_add_page');     function plugin_admin_add_page() {         add_options_page(             'Revenue Share Plugin',             'RSP Menu',             'manage_options',             'RSP_plugin',             'RSP_options_page'         );     }     ?>          <?php // display the admin options page     function RSP_options_page() {         ?>

Adsense Revenue Share Plugin
         Set the publication id and the position of the ad here!         <form action="options.php" method="post">         <?php settings_fields('RSP_options'); ?>         <?php do_settings_sections('RSP_plugin'); ?>              <input name="Submit" type="submit" value="<?php esc_attr_e('Save Changes'); ?>" />         </form>
              <?php               $options = get_option('RSP_options');         echo '

Current Settings

';         echo 'Adsense Publisher Id';         echo $options['RSP_text_string'];          print_r($options)         ?>              <?php     }?>          <?php // add the admin settings and such     add_action('admin_init', 'RSP_admin_init');     function RSP_admin_init(){         register_setting( 'RSP_options', 'RSP_options', 'RSP_options_validate' );         add_settings_section('RSP_main', 'Main Settings', 'RSP_section_text', 'RSP_plugin');         add_settings_field(             'RSP_text_string',             'RSP Adsense Pub Id',             'RSP_setting_string',             'RSP_plugin',             'RSP_main'         );     }     ?>          <?php // validate our options     function RSP_options_validate($input) {         $options = get_option('RSP_options');         $options['RSP_text_string'] = trim($input['RSP_text_string']);         if(!preg_match('/^[a-z0-9]{32}$/i', $options['RSP_text_string'])) {             $options['RSP_text_string'] = '';         }         return $options;     }     ?>          <?php     function RSP_setting_string() {         $options = get_option('RSP_options');         echo "<input id='RSP_text_string' name='RSP_options[RSP_text_string]' size='40' type='text' value='{$options['RSP_text_string']}' />";     }     ?>          <?php     function RSP_section_text() {         echo '
Main description of this section here.
';     }     ?>


title: How do I create an alternate RSS feed for tags with custom image sizes for MailChimp?

text: I am looking to create an alternate RSS feed for a specific group of tags with custom image sizes to be used with MailChimp. Is it possible to customize RSS feeds for specific tags? For example the tag "Apple" we would like the feed to have an image size of 100x100 in the RSS feed, whereas for the tag "Orange" we would like the images to be of size 500x500? We're using this for a MailChimp RSS newsletter and MailChimp can only pickup the first image within the feed so we need the sizing to be done on a per-tag basis and on the feed-level rather within the HTML/CSS.


title: How to call shortcode function directly and pass $atts

text:
I am using the Media Library Categories plugin. It does not have much documentation, so I have concluded the way to implement it would be using the shortcode `[mediacategories categories="6"]`. I want to implement this directly into the theme template. So I have tried:               <?php if(function_exists(do_shortcode('[mediacategories categories="6"]'))) { ?>
Inspiration
     <?php       do_shortcode('[mediacategories categories="6"]');     }      I also tried to implement the function directly, but could not pass the $atts correctly for the function to use them.


title: Simple and customizable contact form with option to send copy to submitter

text: I'm looking for a simple contact form that allows easy styling on the fields and most important includes a checkbox to send a copy of the message to the submitter (e.g ☑ send copy to myself) Does anybody knows anyone? I've been playing with Contact Form 7, but couldn't find a way to do this. Thanks


title: Comment as post - understanding wp_list_comments

text: I'm creating a site where a central question will be posed on the front page with excerpted first-tier comments linking to a page with the full first-tier comment, presented almost as a post, with nested replies to that comment below. Why a comment as a post? Seemed like a good way to let users author content without giving access to the back end. Where I'm having trouble is with those nested replies to a specific comment. I'm trying to keep things simple and use wp functions where possible. My approach was to build an array of all the replies to the specific comment and then pass that array in to `wp_list_comments`. Which all works, except for the nesting part; all replies are treated as at the same level, or tier. Obviously, I don't fully understand how `wp_list_comments` works. Here's my loop to create the array of all replies to a specific comment (passed as `$_GET[comment_id]`):               $my_comments = array();     $args = array(         'type' => 'comment',         'status' => 'approve',         'parent' => $_GET[comment_id],     );     $my_comments1 = get_comments($args);     if(!empty($my_comments1)) {         $my_comments = array_merge($my_comments, $my_comments1);         $x=1;         $finished = false;         while(! $finished) {             foreach(${'my_comments'.$x} as $my_comment) {                 if($my_comment->comment_ID) {                     $args = array(                         'type' => 'comment',                         'status' => 'approve',                         'parent' => $my_comment->comment_ID,                     );                     $x++;                     ${'my_comments'.$x} = get_comments($args);                     if(!empty(${'my_comments'.$x})) {                         $my_comments = array_merge($my_comments, ${'my_comments'.$x});                     }                      elseif(empty(${'my_comments'.$x})) {$finished = true;}                 }             }         }     } // if not empty      And here's how I'm displaying:               <ol class="commentlist">         <?php wp_list_comments( array( 'style' => 'ol' ), $my_comments); ?>     </ol><!-- .commentlist -->      Any insight on how wp_list_comments works would be appreciated, as would any other big idea approaches to my goal of a first-tier comment presented as a post with replies to that comment nested below.


title: stumped on add_action hook to delete_comment - any ideas?

text: I'm pretty new to plugins and trying to run a function when deleting a comment. This entails hooking into "delete_comment" if I'm not mistaken. http://hitchhackerguide.com/2011/02/12/wp_delete_comment/ Theoretically, this should work as a plugin, so when you delete a comment, it emails me. But when I install and activate it, nothing happens when I delete a comment. I hard coded the email function into ajax-actions.php and it works, but I think the idea is to have all the functions in the plugin file if possible. What am I missing here? Am I missing a do_action somewhere?               add_action( 'delete_comment',  'do_something', 10 ,1);            function do_something($comment_id)  {         mail("me@domain.com", "$comment_id","$comment_id");     }      Note: If I require() the plugin file and call do_something() from /wp- admin/includes/ajax-actions.php, it works...               function wp_ajax_delete_comment() {         ...         if ( isset($_POST['trash']) && 1 == $_POST['trash'] ) {             if ( 'trash' == $status )                 wp_die( time() );                  // BEGIN INSERT             require_once( plugin-file.php' );             do_something($comment->comment_ID); // THIS WORKS FINE             // END INSERT                  $r = wp_trash_comment( $comment->comment_ID );         }         comment_to_post($comment->comment_ID);         ...     }      Is wp-admin/includes/ajax-actions.php NOT a part of the regular WP install and not in the scope that you can hook into?


title: How to filter 'post_gallery' after all other filters/plugins etc

text: I'm trying to re-format the gallery output a bit, change default columns and link setting, as well as exclude the featured image from the gallery images. I can use *add_filter('post_gallery' ...)* in functions.php but that seems to overwrite any previous calls to this filter by the core and plugins. Example of this overwriting as requested by m0r7if3r:               function test1($content, $attr) { return $content.'Test One ';}     add_filter('post_gallery', 'test1', 10, 2);     function test2($content, $attr) { return $content.'Test Two ';}     add_filter('post_gallery', 'test2', 10, 2);      Instead of outputting the original gallery and appending 'Test One' to the output, the first function there just outputs 'Test One' on it's own. Interesting if I apply a second function as above, 'Test One Test Two' is outputted.. weird I think! Any idea why? Alternatively I can *remove_shortcode('gallery', 'gallery_shortcode')* and add my own, but then this also removes any manipulation by other scripts/plugins. Note: there seems to be a future solution here where a *post_gallery_output* filter has been suggested, but no idea when this will be added to the core. I'm not familiar with how and when patches like the one suggested get added, so more info about that would also be helpful. So... any ideas how I can achieve this now? Primarily my main issue is the removal of the featured image. I can filter the content to change the gallery column and link type for now. Thanks! Ben


title: Can't get rid of 'Free Shipping' option on the cart page in Woocommerce

text: I've just added the Shipping module and set up zones and tables based on weight, but I can't get rid of the 'Free Shipping' radio button on the Cart summary page - can't find where to delete it!


title: Get all posts from custom post type and insert in select input as metabox

text:
I would like to know if its possible to do something like this. I have **Slider** custom post type and **Services** custom post type. For slider posts I have created a metabox for URL value to display next to all slider posts. What I would like to do now, is to get all posts from **Services custom post type** , and display them in this slider post metabox as select input, so I can choose which post should the link go to. Thanks in advance :) Here is the current code:               function rm_display_slider_metabox($post) {              wp_nonce_field(basename(__FILE__), 'slider_nonce');              $slide_url_value = get_post_meta($post->ID, '_slide_url', true);         $slide_url = isset($slide_url_value) ? esc_attr($slide_url_value) : '';              $services_loop = new WP_Query(             array(                 'post_type' => 'services',                 'posts_per_page' => -1,                 'post_status' => 'publish'         ));               ?>

                 <?php _e('Select URL from the dropdown below for this slide', 'rmtheme' ); ?>
                 <select name="_slide_url">                     <?php while ($services_loop->have_posts()) : $services_loop->the_post(); ?>                         <option value="<?php the_permalink(); ?>"><?php the_title(); ?></option>                     <?php endwhile; ?>                 </select>

          <?php           }          function rm_save_slider_meta($post) {              global $post;              if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)             return $post_id;              if (!isset($_POST['slider_nonce']) || !wp_verify_nonce($_POST['slider_nonce'], basename(__FILE__)))             return $post_id;              if (!current_user_can('edit_post'))             return $post_id;              $allowed = array(                'a' => array(                 'href' => array()             )           );              if (isset($_POST['_slide_url']))             update_post_meta($post->ID, '_slide_url', wp_kses($_POST['_slide_url'], $allowed));          }          add_action('save_post', 'rm_save_slider_meta');     add_action('add_meta_boxes', 'rm_slider_metabox');


title: Wordpress core responsive video not working with shortcode

text:
I cannot get the video from Wordpress core to behave responsively. I'm using the following CSS:               .videocontent {       width: 100%;       height: 100%;       max-width: 1024px;       margin: 0 auto;     }           .wp-video-shortcode {       max-width: 100%;     }      The following HTML using the shortcode doesn't scale to the full size of the containing div:
         <?php         echo do_shortcode('[video webm="http://localhost/dnp/stalker.webm" width=100%]');         ?>
      But using HTML directly it works fine:
         <video  id="myvideo2" style="width:90%;height:100%;" controls="controls">           <source src="http://localhost/dnp/stalker.webm" type="video/webm"/>         </video>
      I have tried various settings with the shortcode - such as height 100%, height and width 100%, and width 100%. What am I doing wrong? Screenshot -> screen shot Live Site : http://www.deekwa.com/dnp


title: Why is the value zero going in my custom database table?

text: I am working on a task where I have to insert a customer into database table in WordPress. It's a custom table so I used a template file and applied a `wp_query`. The rest of the data is getting into the table in the proper way, but the `book_ref` value is always `0`. I have assigned the data type `varchar` for `book_ref`. I made a string from two strings by using `substr` and saving it `$ref':               $ref=substr($from,0,2).substr($to,0,2);          $wpdb->insert( 'customer_info', array( 'post_id' => $q, 'name' => $a,'lname' => $b, 'email' => $c,'mobile' => $d, 'phone' => $e,'adress' => $g,'accom'=>$f,'v_name'=>$taxi1, 'remark' => $h,'from'=> $from.''.$flight,'to'=> $to,'t_date'=>$t_date,'pass_num'=>$adult,'vehicle_num'=>$texi_no,'total_price'=>$price,'book_ref'=>$ref,'status'=>$status  ), array( '%d', '%s','%s', '%s' ,'%d', '%s' ,'%s', '%s','%s' ,'%s', '%s','%s' ,'%s', '%s','%s','%d'  ) );          echo $wpdb->last_query;      it gives this output:               (`post_id`,`name`,`lname`,`email`,`mobile`,`phone`,`adress`,`accom`,`v_name`,`remark`,`from`,`to`,`t_date`,`pass_num`,`vehicle_num`,`total_price`,`book_ref`,`status`) VALUES      (0,'Dinesh ','Kumar','dinesh@macadamia.co.in',1234567890,'1122','New Market empior','Chd, 22','Limousine','rerer','Trapezaki','Svoronata','11/22/2013-02:20','3','1',300,0,1)      where book_ref is always 0. Any idea what I missing?


title: Get posts, terms and custom fields in array

text: I have a multisite and want all posts from post type products I want to query through the database to get all posts belonging to post type "products" i have accomplished this with the following code http://pastebin.com/0qFJmW4R But i can't get the terms of those posts i know they are in another table, but i don't know how to get them inside the array. I also need to get the custom fields belonging to that post. Can anybody help me with accomplish this?


title: Removing admin bar from wordpress dashboard

text: I'm using wordpress multiste 3.3.1 I'm not gonna update it in the future. So I disabled all upgrade functions. I want to remove the wordpress admin bar from both frontend as well as dashboard. I can remove it from frontend using this code.               add_action( 'init', 'disable_admin_bar', 1 );     function disable_admin_bar() {         add_filter( 'show_admin_bar', '__return_false' );     }      But i couldn't find any solution to remove it from dashboard. **I don't want to use css solution to hide admin bar and I'm ready to edit the core files to remove it** Can anyone help me to remove it completely?. Thanks


title: Custom WP permalink structure

text: I've been struggling trying to wrap my brain around this problem for a few hours. I'm basically trying to achieve this URL structure for a coupon site I run. `http://www.mysite.com/store/walmart/coupon-1` Each coupon is a WP post and the default structure for it now is. `http://www.mysite.com/coupon-1` The `store` text is static and if that was the only prefix I needed for a coupon I could easily go into Settings -> Permalink and setup something like this `/store/%postname%/` but since the store name is dynamic ... well you see my problem. I've started off approaching the problem by doing what I know and using a RewriteRule in .htaccess (ex: `RewriteRule ^store/(.*)/(.*)$ $2 [R=301,L]`) but that didn't give me the right result, it would just redirect to the original URL structure. I've found a couple articles on the topic but they're either poorly explained or just refer to a simple redirect. Can anyone shed some light on this for me?


title: return unformatted content in encosing shortcode

text:
I've written a little shortcode, following basic instructions on Wordpress Codex:               function myshortcode( $atts, $content = null ) {         extract( shortcode_atts( array(             ...,         ), $atts ) );         return some_html _code_here . $content;     }      When I put               [myshortcode]     this      is      a      test     content     [/myshortcode]      in a post, I obtain the following output:               this
     is
     a
     test
     content
      How can I avoid the inserting of br / tags?


title: Pagination on Single Post

text: I'm looking to set up pagination on my single.php file so I can have my infinite scroll function correctly. I know that pagination can be put on a single post but I somehow need to make the single.php page be able to have an appended variable on the URL. What I mean is if I have this URL:               http://www.example.com/post_URL/      I would need it to function like this:               http://www.example.com/post_URL/page/2/      It needs to function like that because I have the infinite scroll working on the homepage/main blog page that way and it's picking up the get_query_var('page') variable which doesn't seem to exist in the single.php pages. It keeps looping the first page over and over in the infinite scroll which seems to say to me that it's just defaulting to a value of '1' over and over. Is there a way to do this? Thanks for your help! ## EDIT I've found that I can manually make a 'page' variable by going to the URL here:               http://www.example.com/my-article/2/      The loop at the bottom of the page treats this page as if it's page = 2 even though the same content shows. My assumptions is that the 2 on the end of the page is a get_query_var() variable but it's not necessarily treated as such during my loop/infinite scroll. So I know it exists but is not accessed by the infinite scroll. What do you think the reason is for this? ## EDIT Here is the pagination code I am using on the single post page for the query (not I am using 'paged' instead 'page' which is how it should be on a single post; I have tried 'page' as well just in case):                   $paged = get_query_var('paged');               $wp_query = new WP_Query(         array(             'post__not_in' => array(get_the_ID()),             'category__not_in' => 9,             'post_type' => 'post',             'post_status' => 'publish',             'posts_per_page' => 3,             'paged' => $paged         )     );      This code works on the homepage for a loop I have there. It does not work on the single.php page though. ## EDIT So all the help has been great but it still hasn't solved the problem completely. When I echo out the $paged variable on the main page URL I get '0'. If I do it with the url with /2/ appended, it is '2', etc. (so it works then). So it's not recognizing the main page as page '1'. This is with an infinite scroll so it needs to be able to start with 1 and I'm not sure if it's possible to have the infinite scroll work on the single posts pages like that. Any idea why the main URL doesn't have a query var page value of 1?


title: Getting post and attached image from subdomain

text: I Recently installed wordpress as subdomain on my main website. Now i have two installations: www.example.com and www.example.com/store/. Now i want my Main domain to show recent posts from subdomain in the sidebar of main site. All i want is: post->url post->title post->thumbnail getting post url and title was very easy with the following code "               $products = $wpdb->get_results( "     SELECT * FROM store_posts WHERE post_status = 'publish'     AND post_type = 'post' LIMIT 4" );      My both WordPress installations share the same database but different prefixes and only one image is attached each post (not using featured image function, just attaching image to post) I don't have much idea for how to join and do custom queries. Kindly help in his regard.


title: WP_Query - How to orderby parent publish date?

text: I am using WP_Query to display `'post_type' => 'attachment'` on a different page than the posts they are uploaded to:               $media_args = array(         'post_type' => 'attachment',         'post_status' => 'publish',         'orderby' => 'date',         'posts_per_page' => 50,         'tax_query' => array(             array(                 'taxonomy' => 'media-tags',                 'field' => 'slug',                 'terms' => $term->slug             )         )     );     $media_items = new WP_Query($media_args);      The problem I am running in to is when I upload new photos to an older post.   1. `'orderby' => 'date'` orders the results by each attachment's date.    2. `'orderby' => 'parent'` orders the results by the parents' post id. The latter would be perfect except for the fact that post ids and publishing dates do not represent the same ordering (I schedule drafts at different points in the future). Is it possible to order WP_Query results by the attachment parents publish date?


title: Ordering taxonomy output in this function

text: I found (googled) this function which performs almost exactly as I need. Creating a link text structure (breadcrumb) of terms for a CPT i.e. Parent Category -> Child Category -> Grand Child Category The only issue is the order is which it is output is slightly off - Child Category -> Parent Category -> Grand Child Category I cant figure out from the code below how to order it correctly. Any pointers would be much appreciated. Many thanks in advance rob               function get_the_term_list_breadcrumbs( $id = 0, $taxonomy, $before = '', $sep = '', $after = '', $breadcrumb_sep = ' → ' ) {     $terms = get_the_terms( $id, $taxonomy );          if ( is_wp_error( $terms ) )         return $terms;          if ( empty( $terms ) )         return false;          foreach ( $terms as $term ) {         $link = get_term_link( $term, $taxonomy );         if ( is_wp_error( $link ) )             return $link;              // Find parents         $names = array();         $ancestors = get_ancestors( $term->term_id, $taxonomy );         if ( count( $ancestors ) > 0 ) {             foreach ( $ancestors as $anc ) {                 $t = get_term( $anc, $taxonomy );                 $names[] = $t->name;             }         }         $names[] = $term->name;         $link_text = implode( $breadcrumb_sep, $names );              $term_links[] = '' . $link_text . '';     }          $term_links = apply_filters( "term_links-$taxonomy", $term_links );          return $before . join( $sep, $term_links ) . $after;     }


title: HTML Inside of Shortcode Breaks Shortcode Output

text:
Lots of Googling has still not yielded a solution. Here is the problem: I have created a custom Wordpress shortcode to use inside my Thesis theme. The goal of the shortcode is to allow users to wrap content on a page/post in Schema markup tags. My code is below:               function articlesection_rs_shortcode($atts, $content) {         $content = do_shortcode($content);         return ''.wpautop($content).'';     }     add_shortcode('schema_article_section', 'articlesection_rs_shortcode');      But here is the issue. If the content between my shortcode opening/closing tags has no HTML elements, everything looks good. If, however, I have any HTML tags on inner content, the closing `</span>` gets placed at the very end of my content, instead of where I placed the closing shortcode tag. Visual example: Output when content inside shortcode is plain-text:               test content      Output when content inside shortcode is HTML content:
test content
         .........                    I have tried using `wpautop()` and `wptexturize()` but no luck. I am using Wordpress 3.8.2 and Thesis 1.8.5. Any help, advice, code, or links are much appreciated. EDIT: Anyone have any ideas?


title: Why always one post missing

text:
In my custom query, every time I query for posts from a particular category using WP_Query() and the category has 10 posts for example, I seem to be missing a post. So querying for 10 posts only returns 9, querying for 11 posts only returns 10 and so on. Does anyone know why I am always missing one post in my query results? This is the code I am using that is not working. Some of my other code tests have returned the same results.               if($carouselOnOff){?>

<?php echo get_cat_name( $carouselCategory ) ?>

         <?php $showPostsInCategory = new WP_Query(); $showPostsInCategory->query('cat='. $carouselCategory .'&showposts='. $carouselNumber .'');         if ($showPostsInCategory->have_posts()) : while ($showPostsInCategory->have_posts()) : $showPostsInCategory->the_post();?>
                 <?php $data = get_post_meta( $post->ID, 'key', true ); ?>                 <a href="<?php  if ($data[ 'custom_link' ]) { echo $data[ 'custom_link' ];} else { the_permalink(); } ?>">                     <?php the_post_thumbnail('sponsor', array('title' => "")); ?>
         <?php endwhile; endif; ?>

     <?php } ?>


title: How do you update user_email on the front end in WP 3.3?

text:
I am using the following code and everything in the user profile is updating except the user's email. In the template:               global $current_user, $wp_roles;     get_currentuserinfo();          /* Load the registration file. */     require_once( ABSPATH . WPINC . '/registration.php' );          /* If profile was saved, update profile. */     if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'update-user' ) {                  /* Update user password. */             if ( !empty($_POST['pass1'] ) && !empty( $_POST['pass2'] ) ) {                     if ( $_POST['pass1'] == $_POST['pass2'] )                             wp_update_user( array( 'ID' => $current_user->id, 'user_pass' => esc_attr( $_POST['pass1'] ) ) );                     else                             wp_redirect( get_permalink() . '?error' );                     exit;             }                  /* Update user information. */             if ( !empty( $_POST['first_name'] ) )                     update_user_meta( $current_user->id, 'first_name', esc_attr( $_POST['first_name'] ) );             if ( !empty( $_POST['last_name'] ) )                     update_user_meta($current_user->id, 'last_name', esc_attr( $_POST['last_name'] ) );             if ( !empty( $_POST['user_email'] ) )                     update_user_meta($current_user->id, 'user_email', esc_attr( $_POST['user_email'] ) );             if ( !empty( $_POST['cell_phone'] ) )                     update_user_meta( $current_user->id, 'cell_phone', esc_attr( $_POST['cell_phone'] ) );             if ( !empty( $_POST['mailing_address'] ) )                     update_user_meta( $current_user->id, 'mailing_address', esc_attr( $_POST['mailing_address'] ) );             if ( !empty( $_POST['description'] ) )                     update_user_meta( $current_user->id, 'description', esc_attr( $_POST['description'] ) );                            /* Redirect so the page will show updated info. */         if ( !$error ) {             wp_redirect( get_permalink() . '?success' );         }             else {                 wp_redirect( get_permalink() . '?error' );             }             exit;         }               get_header(); ?>      And in the page:               <?php if (stripos($_SERVER['REQUEST_URI'],'?success') !== false) { // THIS IS THE BEGINNING ?>
Your profile was updated successfully.
     <?php } ?>     <?php if (stripos($_SERVER['REQUEST_URI'],'?error') !== false) { // THIS IS THE BEGINNING ?>
Hmm, something went wrong and your profile was not updated.
     <?php } ?>          <form method="post" id="adduser" action="<?php the_permalink(); ?>">

                                      First Name                 	                                      <input type="text" name="first_name" id="first_name" value="<?php global $current_user; get_currentuserinfo(); echo $current_user->first_name; ?>" />

                                      Last Name                    	                                      <input type="text" name="last_name" id="last_name" value="<?php global $current_user; get_currentuserinfo(); echo $current_user->last_name; ?>" />

                                      Email Address                 	                                      <input type="text" name="user_email" id="user_email" value="<?php global $current_user; get_currentuserinfo(); echo $current_user->user_email; ?>" />

                                      Phone Number                 	                                      <input type="text" name="cell_phone" id="cell_phone" value="<?php global $current_user; get_currentuserinfo(); echo $current_user->cell_phone; ?>" />

                                      Mailing Address                 	                                      <textarea name="mailing_address" id="mailing_address" rows="4" cols="30" class="regular-text"><?php global $current_user; get_currentuserinfo(); echo $current_user->mailing_address; ?></textarea>

                                      Business Description                 	                                      <textarea name="description" id="description" rows="4" cols="30" class="regular-text"><?php global $current_user; get_currentuserinfo(); echo $current_user->description; ?></textarea>

                  <?php echo $referer; ?>             <input name="updateuser" type="submit" id="updateuser" class="submit button" value="update-user" />             <?php wp_nonce_field( 'update-user' ) ?>             <input name="action" type="hidden" id="action" value="Update" />
     </form>


title: How can I access my posts on my wordpress site, now I've lost the domain name for it?

text: I wrote some posts for a wordpress site I've got, unforunately I couldn't renew the domain name in time, so I want to access the text in those posts, and put it into my new site, how can I do that? I can access the site via my cpanel and IP for the site, and I can see the WP files there but I don't know where the post data is?


title: Category base 404 - fix

text: I have seen the problem before when hacking in WordPress When trying to access the **www.example.com/category/** I get a 404-page displayed. Is there a way to display something useful such as a page with custom code instead of the 404-page? Need your help to figure this out, please tell me if something is unclear. I tried to add the tags category-base and category-page but that did not work. I you have suggestions on good tags please inform me. Thanks Anthony


title: Style Wordpress Custom Post Type Single Page

text: I'm registering a custom post type 'events'. The events can be listed using a shortcode, and when you click on an event you go to the single view of that event. Now, I want this single view page to be styled completely different using all of the event's metadata to create maps, images, etc, but I cannot figure out how. Using a template for this single view isn't an option since this is a plugin and should work with any theme. Just filtering the post's content isn't enough as I want to style the title too. Any ideas? Thanks in advance!


title: Filter WordPress Media Uploader Images Via Dropdown

text: The screenshot below is basically what I want to do: ![screenshot](http://i.stack.imgur.com/9ZRe8.jpg) I want to add an item to the dropdown and when that item is selected filter the images that show in the library so they only come from a folder in my plugin that will contain a select set of images. Or, if there's some way to tag/flag images when uploaded so that they can be filtered for this list somehow. I'm really open to any ideas on this. I'd love to show you some code I've tried, but the documentation for the WP 3.5 media uploader is so scarce I'm really not even sure where to start. Can you provide any leads on how to do this?


title: Change Order of Admin Posts Depending on Meta

text: In my Admin Panel I have a custom post type of posts - with page attributes to define order. Is there "easy" way of changing how the admin panel pulls posts so I can reorder them? Page Attributes define order and parents. My Custom Post Type isn't a page but it still supports Page Attributes because I want to order them in a meaningful way. Currently in Wordpress Admin Panel when using Custom Post Types and Page Attributes, the Admin Panel doesn't order posts in the defined order, it instead orders all posts by publish date (so newest on top). I'm looking to use Page Attributes to order my Custom Post Type posts in the admin panel in the same order defined by Page Attributes. Even more clarification: Defined in `register_post_type()` as `supports => array()` Found Here ![Shows where to find Page Attributes when inside Edit CPT](http://i.stack.imgur.com/Ei7cn.jpg) The expected outcome would be something like this, where the post with page attribute 0 is at the top and the greatest page attribute would be at the bottom: ![Shows an example of the expected output with the Order set.](http://i.stack.imgur.com/FOX6B.jpg)


title: Add a custom form on the post-new.php admin page

text: i need to add a custom form on the post-new0.php page of the admin of wordpress. ( this form will load an external script in ajax and fill all the field) I'm able to do it via my plugin with               add_action('admin_print_scripts-post-new.php', 'my_echo_function');      But it print it at the top of the page, how can i do to print it as i show on the image ? ( just above the title post text area). ny idea ? Thank you. EDIT: it can be before or after th wp form this is where i print it right now: ![where its printed](http://i.stack.imgur.com/QWFVa.jpg) ![illustration](http://i.stack.imgur.com/g3MNk.jpg)


title: Wordpress MU and Media Uploader issue

text: Ok, a bit longer question here: I have WP MU and I have a page on main domain from where blog admins can update/manage their pages/posts. so it looks like: www.MainDomain.com/members On that page I am check if user is blog admin and I am gathering infos I need and doing this:               switch_to_blog($userblog_id);     wp_enqueue_script('post');     wp_enqueue_media( array( 'post' => $post_id ) );     wp_editor( $post_content, 'post_content', $settings = array(textarea_rows => 15, media_buttons => true) );      $userblog_id is actually ID of the blog that user is assigned to. $post_id is ID of the post that user is editing on member page. Now when blog admin clicks on Upload Media button it shows media upload popup, but the media gallery is always empty and when admin tried to upload something it is always failing with this error "An error occurred in the upload. Please try again later." I saw that MainDomain.com/wp-admin/admin-ajax.php is called when I click Add Media button and that json response is: {"success":false} Now when I am logged in as superadmin - it works properly. Does anybody have an idea what's wrong here ? ## EDIT: ..Forgot to mention when I go to the site dashboard for that blog and click Add media button - admin-ajax.php response is : {"wp-auth-check":true,"wp- refresh-post-lock":{"new_lock":"1386087028:4"},"server_time":1386087028} So obviously even if I am logged in as blog admin on main site - I am not getting authenticated as blog admin when ajax request is run on MainDomain.com ? Is there a work-around ?


title: How to edit my theme for full width?

text: I am using Manifest 1.01 by Jim Barraud on my site www.inteftrust.org. I'd like to know how can I get full width with this theme. Thanks.


title: Upgraded to latest version - 3.0.3 and Now I get a "sufficient permissions to access this page" error

text: The issue appeared immediately after upgrade. The only part of the application impacted is the sub-menu items under settings where it relates to a plug-in. The core application settings work, just not the plug-ins. All plug-ins are up to date and impacted. Thoughts?


title: write in functions.php

text: i just want this code to be added in my functions.php, so that it will directly display after my post ends currently i am adding this code to my single.php, but i want to add this is in functions.php, this code is use to fetch all the tweets of the respective account, the code is here               <?php     function parse_twitter_feed($feed, $prefix, $tweetprefix, $tweetsuffix, $suffix) {       $feed = str_replace("<", "<", $feed);       $feed = str_replace(">", ">", $feed);       $clean = explode("<content type=\"html\">", $feed);            $amount = count($clean) - 1;            echo $prefix;            for ($i = 1; $i <= $amount; $i++) {         $cleaner = explode("</content>", $clean[$i]);         echo $tweetprefix;         echo $cleaner[0];         echo $tweetsuffix;       }            echo $suffix;     }          function the_twitter_feed($username) {       // $username = "Mba_"; // Your twitter username.       $limit = "5"; // Number of tweets to pull in.            /* These prefixes and suffixes will display before and after the entire block of tweets. */       $prefix = ""; // Prefix - some text you want displayed before all your tweets.       $suffix = ""; // Suffix - some text you want displayed after all your tweets.       $tweetprefix = ""; // Tweet Prefix - some text you want displayed before each tweet.       $tweetsuffix = "<br>"; // Tweet Suffix - some text you want displayed after each tweet.            $feed = "http://search.twitter.com/search.atom?q=from:" . $username . "&rpp=" . $limit;            $twitterFeed = get_transient($feed);       if (!$twitterFeed) {         $twitterFeed = wp_remote_fopen($feed);         set_transient($feed, $twitterFeed, 3600); // cache for an hour       }       if ($twitterFeed)         parse_feed($twitterFeed, $prefix, $tweetprefix, $tweetsuffix, $suffix);     }     ?>


title: How do you apply multiple skins to a site via the "templates" selector using stylesheet switching?

text: I'm just getting my feet wet with templates and have a few questions. First, Ideally, my templates use the same structure as my main theme, however, they simply use a different stylesheet and images. Currently, the way I allow changing the look of the site is with stylesheet switching. I simply have a folder under my main theme called "styles", then under that I have a single folder for each of my "skins". Inside each skin folder is a style.css along with some images. The way it works is that I've placed some code in my main theme's header.php file, so that it reads the value of the currently active skin from the options database, then loads the stylesheet for that skin like so... In the above example, the active skin is "skin1" so I'm always loading... "...mytheme/styles/". get_option('active_skin') ."style.css" This works exceedingly well, and allows me to place a simple skin switcher widget (a pulldown menu with thumbnail display) inside my function.php file to allow the admin user to easily switch between several skins that completely change the look and feel of the site. The beauty of this approach is that the selected theme and underlying markup remains unchanged, so I'm able to create a variety of styles using predictable markup. Sort of like CSS zen garden. Same markup, thousands of designs. All that changes is the stylesheet and images. However, the one downside to this approach (at least with WordPress) is that the selected skin applied to the whole site. I'm unable to apply one skin to the home page and one skin to a special page that might need a completely different look and feel. If there was a way to add some code to each skin folder so that it would appear in the "templates" drop down menu in the page editor, I'd be able to do exactly what I want. Is this possible?


title: Is there a hook attached to general settings save?

text: I want to add a field to the general settings page, but I can not save the field because I can't find a hook for the pages save. Any ideas?


title: How to setup mobile subdomain with Multisite

text: I have a WordPress 3.8.1 Multisite setup with subdomains fine to do just what I need now:   1. www.example.com   2. www.city1.example.com   3. www.city2.example.com Now I want to serve mobile site on subdomains like   1. m.example.com   2. m.city1.example.com   3. m.city2.example.com I can use http://51degrees.com/ or http://mobiledetect.net/ for mobile detection. How should I configure WordPress to do so? OR can it be done with WordPress at all?


I have some translations of Bible in Turkish language. But, they are as of books. (Matthew, Mark, Luke, John... ) I uploaded them into a website which is being managed by a wordpress software. http://www.incil.biz/incil-1 http://www.incil.biz/incil-2 I want to make a Bible search engine. But, these are very long texts. How can I create a Bible search engine via WordPress? Is there a way to split the books into verses?


title: Textarea type on one field custom add_meta_box?

text:
i got close solution for this question from this link "How to add a textarea to only one of the fields of this custom metabox?", but with different code and he use new metabox, i need to see value on custom fields also, with this solution i cant see on "custom fields box". so i use this code:                   $sp_boxes = array (         'Digi Box' => array (             array( 'shortdesc', 'Shortdesc:' ),             array( 'url', 'Url:' ),         ),     );               add_action( 'admin_menu', 'sp_add_custom_box' );               add_action( 'save_post', 'sp_save_postdata', 1, 2 );          function sp_add_custom_box() {         global $sp_boxes;              if ( function_exists( 'add_meta_box' ) ) {                  foreach ( array_keys( $sp_boxes ) as $box_name ) {                 add_meta_box( $box_name, __( $box_name, 'sp' ), 'sp_post_custom_box', 'post', 'normal', 'high' );             }         }     }               function sp_post_custom_box ( $obj, $box ) {         global $sp_boxes;         static $sp_nonce_flag = false;              if ( ! $sp_nonce_flag ) {             echo_sp_nonce();             $sp_nonce_flag = true;         }              foreach ( $sp_boxes[$box['id']] as $sp_box ) {             echo field_html( $sp_box );         }     }          function field_html ( $args ) {              switch ( $args[2] ) {                  case 'textarea':                 return text_area( $args );                  case 'checkbox':                 // To Do                  case 'radio':                 // To Do                  case 'text':             default:                 return text_field( $args );         }     }          function text_field ( $args ) {         global $post;              $args[2] = get_post_meta($post->ID, $args[0], true);         $args[1] = __($args[1], 'sp' );              $label_format =         '%2$s<input style="float: right; margin: -2px 0 0; width: 88%%;" type="text" name="%1$s" value="%3$s" />

';              return vsprintf( $label_format, $args );     }          function sp_save_postdata($post_id, $post) {         global $sp_boxes;                   if ( ! wp_verify_nonce( $_POST['sp_nonce_name'], plugin_basename(__FILE__) ) ) {             return $post->ID;         }                   if ( 'page' == $_POST['post_type'] ) {             if ( ! current_user_can( 'edit_page', $post->ID ))                 return $post->ID;              } else {             if ( ! current_user_can( 'edit_post', $post->ID ))                 return $post->ID;         }              foreach ( $sp_boxes as $sp_box ) {             foreach ( $sp_box as $sp_fields ) {                 $my_data[$sp_fields[0]] =  $_POST[$sp_fields[0]];             }         }                   foreach ($my_data as $key => $value) {             if ( 'revision' == $post->post_type  ) {                      return;             }                       $value = implode(',', (array)$value);                  if ( get_post_meta($post->ID, $key, FALSE) ) {                           update_post_meta($post->ID, $key, $value);                       } else {                      add_post_meta($post->ID, $key, $value);             }                  if (!$value) {                      delete_post_meta($post->ID, $key);             }         }     }          function echo_sp_nonce () {              echo sprintf(             '<input type="hidden" name="%1$s" id="%1$s" value="%2$s" />',             'sp_nonce_name',             wp_create_nonce( plugin_basename(__FILE__) )         );     }      i have 2 fields: 1. shortdesc 2. url with this code, it just show input type only. now, how to make "shortdesc" to be textarea type? and "url" still input type. Thanks. sorry for my english.


title: Prevent pre_get_posts filter on specific post type

text: I am running into one issue with **pre_get_post** filter. Actually I have 4 post types. Post, Pages, Events, and Venue. I created one custom field called city for event and venue post type. When creating custom field I have one option to select post type on which I want to display that custom field. Now, on the front end part I added one filter on **pre_get_posts** and modified the main query to get all posts from specific city. All things are working perfectly on events and venue listing and single page **but this filter also applies on post and pages as well.** What I want is, **I want to remove the this filter from the post type which are not included with that custom field. I have tried with **$wp_query->query_vars['page_id']** this code but its not working any more. Can any one help me to sort this our ? FYI: My code looks like,               add_action( 'pre_get_posts', 'citywise_post_filter' );     function citywise_post_filter($query) {         global $wp_query;         if( isset( $_REQUEST['city_filter'] ) ){             $city = $_REQUEST['city_filter'];         }else{             $city = $_SESSION['CURR_CITY'];         }         if ( !is_admin() ){             $query->set( 'meta_key', '_ct_selectbox_52f65ae267764' );             $query->set( 'meta_value', $city );             return;         }     }      Thanks, Aezaz


title: Escape special characters in image link

text: I am importing the images from XML using a plugin, it truncates the image link while importing. Some symbols are causing the images not to show in the posts. This is the image link.   What it shows is mydomain.com/wp-content/uploads/2014/03/watermark.jpeg I need a php function which escapes the special characters in a URL. (Wordpress Plugin Name: WP-ALLIMPORT)