How can i set post_per_page in my taxonamy?

<?php     $myquery['tax_query'] = array(         'relation' => 'OR',             array(                 'taxonomy' => 'brands',                 'terms' => array('ALL'),                 'field' => 'slug',                 'operator' => 'NOT_IN'                 ),             array(                 'taxonomy' => 'media',                 'terms' => array('news', 'events'),                 'field' => 'slug',                 'operator' => 'NOT_IN'                 ),             );                                             query_posts($myquery);          if ( have_posts() ) : while ( have_posts() ) : the_post();?>     <div>     <php the-title(); ?>     </div>     <php endwhile; else: endif; ?>


For better digital journalism, how to store a second title and excerpt?

This is a digital journalism issue. As the technology evolves, digital journalism has found new best practises. One of them is to always write a predictive title, combined with a good excerpt. This predictive title, however, lacks that "x factor" that a non predictive title has. A great example is the news published by Time about Microsoft that will cut 18.000 jobs in the next year. The proper title of the news is "Microsoft to Cut Up to 18,000 Jobs", but on the home page the opening title was "Ctrl-Alt-Del". Simple, catchy. So, we want to be able to create two titles and two excerpts inside a post. What should be the most effective and less resource consuming solution? Two meta values that I use only on the front-page.php? I don't want to add to much weight to the post queries. Any pointers?


wp_list_table bulk action button is not working - no submit

I have a custom `wp_list_table` to create my own table. Almost everything works perfect, but the bulk action button seems to be not working. It's proper displayed,but on click nothing happens. I think somehow there is a form- wrapper missing or just some javascript? I added the button described on wp- engineeers: http://wpengineer.com/2426/wp_list_table-a-step-by-step- guide/#bulk My Bulk-action functions:               function get_bulk_actions() {         $actions = array(             'activate'    => __('Show'),             'deactivate'  => __('Hide')         );         //Add delete function for admins         if(current_user_can( 'delete_published_posts' )){             $actions['delete'] = __('Delete');         }         return $actions;      }              function process_bulk_action() {                  $action = $this->current_action();             if( 'activate'===$action ) {                    foreach($_GET['wp_list_event'] as $event) {                     echo($event['title']);                 }                  }             if( 'deactivate'===$action ) {               wp_die('Items deactivated (or they would be if we had items to deactivate)!');             }             //Detect when a bulk action is being triggered...             if( 'delete'===$action ) {               wp_die('Items deleted (or they would be if we had items to delete)!');             }         }       The rendered HTML (not wrapped by any `form` tag)               <div class="alignleft actions">       <select name='action'>         <option value='-1' selected='selected'>Aktion wählen</option>         <option value='activate'>Anzeigen</option>         <option value='deactivate'>Verstecken</option>       </select>       <input type="submit" name="" id="doaction" class="button action" value="Übernehmen"  />     </div>


plugin shortcode output

I have a plugin which uses this shortcode: `[daisy]` And the html output of this shortcode is : `<a class="clickable">Click Here</a> ` Plugin is working perfect if I use the shortcode to trigger the plugin. It works with this also: `<?php echo do_shortcode('[daisy]'); ?>` Normally it should work also with the `<a class="clickable">Click Here</a> ` but it's not working, the link appears but if I click on it nothing happens. I want to use the html output because my website is using a lot of javascript for displaying html content I cannot use php shortcodes inside javascript/jquery functions. So, do you have any suggestions for this issue? Because I think the shortcode should work also with the html output which triggers that plugin (in my case is a contact form popup) Thanks! Later edit: This is the javascript which triggers the plugin:               <script type="text/javascript">     $(document).ready(function(){         // Init Plugin         $(".clickable").contactpopup({             'style' : '<?php echo $wp_cpup_theme; ?>',             'bgcolor' : '<?php echo $wp_cpup_color; ?>',             'formelement' : '#Form_PopContactUs',             'effect' : '<?php echo $wp_cpup_effect; ?>',             'header' : '<?php echo $wp_cpup_popup_title; ?>'         });     });


How To Disable Category Hierarchy In Categories Widget?

I want to disable all category's hierarchy in default categories widget. With a code in functions.php . But how? Thanks in advance.


Breadcrumb ordered wrongly

/*Breadcrumb*/          if ( ! function_exists( 'seobreadcrumbs' ) ) :      function seobreadcrumbs() {     $separator = '›';     $home = 'Home';     echo '
';     global $post;     echo '       You are Here :- Home      ';     $category = get_the_category();     if ($category) {     foreach($category as $category) {     echo $separator . "     term_id)."\" >$category->name     ";     }}     echo '
';}     endif;          function show_crumbs() {     if(is_single() || is_tag() || is_search() || is_404() || is_page() || is_category()) { ?>     <?php seobreadcrumbs(); ?>     <?php }}          add_action('thesis_hook_before_content','show_crumbs');     /* End*/      I use these codes to show breadcrumb trail. The problem I’m having with it is, some times its getting messed up let me clarify suppose I’ve category named Social Media parent category is Facebook When I publish a post under facebook It should show like               # Social Media >> Facebook      But some times facebook is coming 1st then Social Media 2nd like this:               # Facebook >> Social Media      And Google also displaying this way. Can anybody help me regarding this?


Changing comment_count to views

I have a plugin installed to show the latest popular posts based on number of comments. But comments are disabled on my website. How can I change it to number of views? And do I need to install something else like a plugin to calculate the number of views, or is it not needed? `comment_count` needs to be changed. What should I put there?               WP_Query arguments $args_popular = array ( 'posts_per_page' => '5', 'order' => 'DESC', 'orderby' => 'comment_count', 'day' => '2', 'cache_results' => true,


What is the Better way to manage posts in Wordpress?

I am looking for a plugin or a "tool" that would mod the administration interface and would allow me to mass edit the posts. Currently the posts are paginated by 20 post per page, if i have to turn 1000 post into drafts or delete them - i have to browse multiple pages. Same for changing categories or making mass changes to posts. This can be quite a pain for big blogs with many posts So i was wondering, is there a "Better" way to manage posts in wordpress ? What would you recommend ? i am poking around the topic of post management and would love to hear from you Thanks in advance


Subscribers become Authors after Upgrade? / Mass Update of Users?

I have a site with ~30K users, and the vast majority have role `'subscriber'` on the main blog. After upgrading from WPMU 2.9.2 to WordPress 3.0.1 I noticed that all 30,0000 users are appearing in the main blog's _"Author"_ dropdown in `post-new.php`. _(Well, that is if it manages to load without crashing the browser...)_. To clarify: the users all still have subscriber-level access, but are included in _"Author"_ dropdown. Before I go diving down in to the guts of `/wp-admin/`, has anyone else seen this? Does anyone know if this behavior is an intentional change in WordPress? Thanks, Bethany


Wordpress installation from live site to localhost

I just need to know if this is the only way to install wordpress from live to localhost. I downloaded the files and database from live, then push the files folder to my htdocs folder, and uploaded the db through phpmyadmin and change the config file. Upto this point I think im on correct side. After entering `http://localhost/mylocalsite` URL in web browser site loads in correct way, however link seems to be still pointing the old (live site) URLs. So for this I search my live site URLs in the DB like -- `http://www.mylivesite.com` and replace this with the `http://localhost/mylocalsite` URL. So my question is if this is the correct way i am implementing it on my locals or some more appealing method i am missing.


Strip tags from a the terms() function

Trying to print my custom post type's taxonomy but without the link. Tried this, but doesn't seem to work, any suggestions?               $text = the_terms($post->ID,'type','','','');      echo strip_tags($text);      Any help would be greatly appreciated... I'm about to start punching babies.


Wordpress Settings API: saving multiple rows of similar data

I've been experimenting with the plugin options starter kit but can't find a way to save multiple rows of similar data using the Settings API. Example of what I'm trying to save:               _________________________________________     |____Order#____|___Image URL___|_Enabled_|     |      1       |   http://...  |    Y    |     |      2       |   http://...  |    N    |     ........      Can this be generated and saved using just one register_setting? I can't work out how this would be done, especially with the format of the data being saved to the database. Thanks, Alex


Downsizing Many Large Images Attached to Posts, in Bulk?

_( **Moderator's note:** The original title was: "Shrink full size images in post")_ I built a WordPress site for someone and they entered a ton of posts with images that are wider than the content area. Is there a way to shrink all of the image attachements to use a max width? They are entered as "full size", not as thumbnail, medium, etc.


vQmod-like tool for Wordpress?

I realize that vQmod works on opencart because it is MVC. Is there any tool out there that would function LIKE vQmod, to inject core hacks into--say, for example--theme files, plugins, et al, without actually modifying the files themselves? Haven't been able to find anything like this out there. Anyone else know of something like this?


retrofiting old blog

I was asked to program out a blog/site. Everything went smoothly using thematic framework. Then I find out that they actually want to switch out themes and basically keep everything from the old site. The new design is slightly different in look as well as functionality. Thier current blog is pimped out to the max"I has about 20 plugins Has a forum with 6000 users Subscribers/mailers over 800 posts. 60pages. I tried to bring int bits and pieces to the new one, and unless I am doing it wrong, it was pretty cumbersome, mainly in part due to the plugins and all the feautres they had on the pages. There are also alot of users that are aprt of the site, some kind of subscription etc. I am trying this approach, I would love to hear some feedback or guidance. 1.) I moved the site to a new directory keeping the old one intact and running for current users. 2.) I activated the new theme, and basically have had to implement the new widgets etc etc, restyle some things etc. But the idea is to get this new theme working in additions to the bizzilion plugings. 3.) Let the user test this one out alittle and make sure it is all working savy. 4.) Move this one into new directory backing up and replacing current one.


jquery plugin only in one page/post

Ive seen all the documentation in the codex but I am doing something wrong since it doesnt work! I want to implement this jquery plugin (https://github.com/davidcrawford/typist-jquery) in my welcome page (www.english.intermediavs.com) Ive added this code in my function.php               function my_typist() {         if (!is_admin()) {                  wp_enqueue_script('jquery');                  wp_enqueue_script('jquery.typist', get_bloginfo('template_url') . '/wp-includes/js/jquery.typist.js', array('jquery'), '1.0', true);         }     }     add_action('init', 'my_typist');      And I also introduced this code in "welcome page" by using html raw plugin.               <!--raw-->     <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/wp-includes/js/jquery.typist.js">     jQuery(document).ready(function($) {          $('#terminal').typist({       height: 300     });          $('#terminal').typist('prompt')       .wait(1500)       .typist('type', 'greet')       .typist('echo', 'Hello, world!')          });     </script>     <!--/raw-->      PS: I am using the plugin Use Google libraries as well. Thanks in adavance! links: http://codex.wordpress.org/Using_Javascript http://codex.wordpress.org/Function_Reference/wp_enqueue_script


Using Conditional Tags to restrict something to 1 user?

I am using the following widget http://wordpress.org/plugins/widget-logic/ This allows me to restrict widgets using WP Conditional tags. What I want is to restrict one widget to only 2 users. This works for one user `current_user_can('level_10')` but gives access to all other level_10's (none atm) and not the other user. How can I restrict this to just 2 users? I tried `is_author( '4' )` but didn't seem to pick it up (think it's just for author pages)


Custom field for default gallery

How I can add custom field in default WordPress gallery? in visual editor and in shortcode. ![enter image description here](http://i.stack.imgur.com/aRkdc.png)


Create unique page without header.php for json feed

I have two WordPress sites on separate domains. I need to expose the latest posts within a category via a json feed on one site that I have to use for the other site. I'll need to hit a "hidden" url, ex: `/themes/mytheme/json_api.php?cat=news` to get the json response. I'd like this json feed to be a unique page without header.php and only includes the code necessary to output the posts within a specific category. What do I need to import to have access to `WP_Query` in this file?


wp_enqueue_script + how to load JS or CSS in one URL merge call?

Is there any proper wordpress way of including the JS and CSS through one merged URL? So that instead of loading in x number of separate calls for each JS asset, it can be all merged into one URL? Samething for CSS. I know this is easy enough to do using straight up PHP, but I wanted to check if wordpress has some nifty way of combining requests.


Redirect to Post List by Taxonomy on User Selection of Taxonomy Dropdown?

> _( **Moderator's note:** The original title was "drop down taxonomy")_ > > I want to add a drop-down box filled with my custom taxonomies, so when > someone selects any value, it redirects to corresponding page. I tried out > this code, which worked > > `<?php wp_dropdown_categories( array( 'taxonomy' => 'name of taxonomy' ) ); > ?>` > > The problem is I want a the page to redirect without the user needing to > press any buttons. How can I do this? this question was resolved but i want to modify further, i want to add a shortcode, so that i can also call drop-down-list into my post, i tried this but not working `add_shortcode('drop','the_taxonomy_dropdown');` but when i call this in my post `[drop="location"]` its not working, whats the problem?


How to use remote db tables in current config?

> **Possible Duplicate:**   >  Shared Members between two different wordpress installations with different > databases For example I have 2 different wordpress installations with different domains and hosts. Databases are separated too (two different databases). I want to use `www.b.com` mysql db tables on `www.a.com` `wp-config.php`. Is there any way to do that? If I could register tables from a remote database, I could use that in site `b`:               define('CUSTOM_USER_TABLE', 'wpsiteA_users');      Can I the database connection from site A on site B?


What hook is executed just after wp_query has been executed? before template is rendered? I want to change the page title but it depends on what has been queried. I have put it in template_redirect but not sure if it is the right hook


Privilege escalation bugs in 2.9?

Are there any known privilege escalation bugs in WP 2.9 to be careful for?


Moving WP from local server to live, error establishing a db connection

Not sure what's going on here 'cos I've done it already a couple of times and it always worked. Basically I'm moving a testing site from my local machine (MAMP) to a live server by:   * zipping the entire WP directory and uploading it to the server   * exporting db from localhost   * creating empty db on the server and importing the sql file   * updating wp-config file with the new credentials When I try to access the site it gives me "Error establishing a database connection". I tripple checked the db details (db name, user, pass) and even log in via terminal using those credentials. What am I doing wrong?


WordPress Sitemap for MSSQL

Does anyone know a proper sitemap plugin for WordPress that works with MS Sql? Here is the error I get:               Array (          [0] => Array (              [0] => 42000              [SQLSTATE] => 42000              [1] => 402              [code] => 402              [2] => [Microsoft][SQL Server Native Client 10.0][SQL Server]The data types text and varchar are incompatible in the equal to operator.              [message] => [Microsoft][SQL Server Native Client 10.0][SQL Server]The data types text and varchar are incompatible in the equal to operator.          )      )      WordPress database error: [1]     SELECT post_id FROM wp_postmeta, wp_posts WHERE ID = post_id AND meta_key = '_wp_old_slug' AND meta_value='sitemap'      I get this error with Google XML Sitemaps plugin.... any ideas?


Why is the visual editor in WordPress limiting the width by wrapping the content?

Why is the visual editor in Wordpress is limiting the width by wrapping the content? I found this behavior in the editor at least annoying, it does prevent me from using my screen real estate.


WordPress TwentyTen Theme Incompatible with Theme Unit Test

I'm trying to test the comments template on a theme that is based on TwentyTen, using the the WP Theme Unit Test XML file, and there is one post that does not display comments properly. The post is called "Comment Test", and it contains 20 comments, including 2 pingbacks. The only thing that displays are the pingbacks. Is that the expected behavior? I can't seem to figure out why it's only displaying the pingbacks. Perhaps there is a setting I missed in the backend. The way to reproduce this, is to create a blog, apply the TwentyTen theme, and import the WP Theme Unit Test file: http://svn.automattic.com/wpcom- themes/demo/test-data.2011-01-17.xml Then visit the post called "Comment Test", published on March 3, 2008. You should see it say "20 Responses to Comment Test", and underneath it you should see 2 pingbacks, no comments. Thanks for you help, Dave


Best way to import users, post and categories from an external database

I need to migrate an existing website to WordPress. This website already has a basic database containing users and posts (with a category), but it also has a high number of records so it's not possible to do it manually. What is the best way to import them into my WordPress database? Should I try to export the old one into a CVS file or something similar?


Custom nav menu is created with default pages, but not hooked to theme's custom menu location

The script below creates a nav menu and assigns a page to it. Everything's working perfectly except that the nav menu is not being automatically assigned to my theme's "Header-menu" location. Any ideas why?               //Register menu locations for the theme     add_action( 'init', 'register_my_menus' );     function register_my_menus() {       register_nav_menus(         array('header-menu' => __( 'Header Menu' ), 'footer-menu' => __( 'Footer Menu' ))       );     }          //Create a nav menu, add a page to it and assign it to the theme's "header-menu" location.     $menu_id = wp_create_nav_menu( 'header-menu' );     $menu = array(          'menu-item-type' => 'custom',          'menu-item-url' => get_home_url('/'),         'menu-item-title' => 'Home',          'menu-item-status' => 'publish',          'theme_location' => 'header-menu', //Just a guess but didn't work!!!         );     wp_update_nav_menu_item( $menu_id, 0, $menu );


urlencoding of the_title() doesn't work?

hey guys, `<?php urlencode(the_title()); ?>`doesn't take effect. this is my entrie line of code: `<li><a href="mailto:?subject=<?php urlencode(the_title()); ?>&body=<?php the_permalink(); ?>">e-mail</a></li>` I don't want to have spaces in the_title(). Why does urlencode not work for me?


Create a custom post type based on 'Post'

I would like to create a custom post type, but all the tutorials I've found are geared towards making a brand new one and creating meta boxes from scratch. Whereas all I would like to do is copy an existing and add one or two extra entities. I would like to go through the motions of creating a new post type because it'll show up in the admin menu as a separate entity as you would expect, but I would like this custom post type to use pretty much all of the meta boxes associated with a normal 'post' type, plus one or two more I'd add. How could I duplicate the post type for 'post'? How could I go about making these adjustments?


advanced paging in wordpress

I can create pages in wordpress very simple like               www.mysite.com/profile      Now I have a question how can I make more pages in this page like `www.mysite.com/profile/edit` or maybe more pages like                www.mysite.com/profile/edit/image      Thanks in advance


How to display a category from a specific post-type

I have a custom post type called "my_people" along with a custom taxonomy named my_people_categories. It is used to display a list of people. I would like to show only the people in the list that are in a specific category in the custom taxonomy. I have tried using the following short code, but it displays all the people and not just the ones in the categories named.               [catlist name=cat1,cat2 post_type=my_people orderby=title order=ASC]      Is there someway I am supposed to mention the taxonomy? Is what I am trying to do even possible using this addon?


What is this in my tables

Cleaning up my databases and I found this in my main table atpp_options perhaps from a plugin, anyone have any idea what it might be?


How to get plugin name from plugin file location

I'm running this code to tell me what plugins need updating:               $update_plugins = get_site_transient('update_plugins');      Here is an example return:               Array     (         [login-lockdown/loginlockdown.php] => stdClass Object             (                 [id] => 3760                 [slug] => login-lockdown                 [new_version] => v1.5                 [url] => http://wordpress.org/extend/plugins/login-lockdown/                 [package] => http://downloads.wordpress.org/plugin/login-lockdown.1.5.zip             )          )      From that it doesn't tell me the name of the plugin that needs updating. Is there a WordPress function that you can feed the plugin file name like: `ogin- lockdown/loginlockdown.php` and return the plugin name? In this case I'd want `Login LockDown` to be returned.


Custom Scripts per page or Custom Post Type

A client has requested some interesting functionality. THey have about 20 different scripts, most of which are needed by one page only. They would like an area within Wordpress's pages and custom post types to add scripts for THAT PAGE ONLY. So when that page loads, the script loads in the header or footer, NOT inline with the body content. I am looking for an idea or a plugin to make this functionality happen. Any ideas?


post_author for wp_insert_attachment

I am working on a custom theme, in which I need to programmatically inserts posts and attachments. One requirement is those posts belong to users that are not the user who is logged in and running the action. To give you an example, an admin user logs in to WordPress, and runs this custom action. The custom action will create suggested posts for two other users, user1 and user2. Now if user1 logs in, he/she will see a suggested post and he can choose to publish it. Everything is cool and dandy so far, because the function `wp_insert_post` allows for programattic insertion of posts. One of the arguments that this function takes is `post_author` which can be set to the id of either user1 or user2. So far, everything is still great. Now, those post will have attachments (images). My question is, is there a way to add a `post_author` to the `wp_insert_attachment`? I could not find that in the documentation. I need the attachment to have the same author id as that of the post. Currently it takes the id of the the admin. Thanks.


Can deactivating a plugin sometimes "reset" settings within that plugin?

I need to deactivate a plugin on a client's website to check whether it is causing a certain issue or not. But I'm not 100% sure that after deactivating this plugin, all its settings will necessarily be restored upon re-activating it. Can anyone confirm please?


Create a page without adding a page in the Database

I am trying to include a special Archive page with my theme, right now I have a PHP file with `Template Name: Archives Template` at the top and I the user must create a blank archive POST PAGE and then select this as the template. The content for creating the page is blank so nothing is added into the database for the page content. Is there anyway to make it where they do not have to do this?


Using actions, hooks and filters in a non-WordPress page

I have a php script that sits outside of wordpress, but loads WP core with wp- load.php. Here is my basic page:               <?php     define('WP_USE_THEMES', false);     global $wp, $wp_query, $wp_the_query, $wp_did_header;     require_once('wp-load.php');     switch_to_blog(1); //make sure we're on the top level site     $author_id = 77; //admin     ?>      However, this also loads plugins - one of which (FacetWP) is throwing an error. As I don't need it, I thought I'd deactivate it with:               function deactivate_plugin_conditional() {         deactivate_plugins('facetwp/index.php');         }     add_action( 'admin_init', 'deactivate_plugin_conditional' );      However, this didn't appear to work, so I thought I'd try a simple echo:               function myDebug() {         echo "test";     }     add_action( 'init', 'myDebug', 10, 1 );      This didn't work either, so I'm clearly not understanding how to use these API calls. Any help with this problem would be much appreciated.


WP_query returns error when used for custom widget

I was working on creating my first plugin/widget that should display a really simple loop containing only a custom field (image) I've been testing the loop without any problems in my theme but when I place the loop in my plugin file it generates a fatal error preventing the plugin to b activated. I really don't understand why this happens as the loop works without any problems in the theme. This is the loop that I'm using:               <?php $args = array(         'posts_per_page' => 3,         'post_type' => 'sponsors',         'orderby' => 'rand',     );     $the_query = new WP_Query( $args ); ?>          <?php if ($the_query->have_posts()) : while ($the_query->have_posts()) : $the_query->the_post();  ?>     <li>     <?php      $image = get_field('sponsor');     if( !empty($image) ): ?>     <img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />     <?php endif; ?>     </li>     <?php endwhile; ?>     <?php else : ?>     <?php endif; ?>      And this is the fatal error displayed when activating the plugin: > Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting > T_STRING or T_VARIABLE or T_NUM_STRING I've already solved it another way by using the PHP Code Widget plugin but would like to know why I get this error. If I need to place the full plugin code let me know.


Post Templates and Post ID's

I am trying to make use of the Single template for single posts ( I have a custom one). But for some reason my posts get overridden instead of displaying new data. This is the setup I have right now
     <?php global $post;      $category_id=get_the_category($post->ID);          $announcements = new WP_Query();      $announcements->query('showposts=1&cat=$category_id');     while ( $announcements->have_posts() ) :  $announcements->the_post(); ?>
Published by:<?php echo      get_post_meta($post->ID, 'Publisher','true');?>
          <?php endwhile;?>


is there any limit of length on creating custom taxonomies?

I am using custom taxonomy plugin. And I have custom Post type "Product". When I am creating new taxonomy **"home and garder Appliances Washin"** and attaching it to **Post** or **"Product"** it's not registering with these while If I am adding just **"home and garder Appliances Washi"** and attaching with either **Post or Product** it is working fine. Is there any length restriction when Creating Custom Taxonomies?


Writing less unnecessary code with WordPress

I've got a simple homepage, that pulls content for 4 different categories. To do this, I'm writing 4 different WP_Query, and only the category name is changing (and as a result, the WP_Query name, etc). Is there a more efficient way to do this? Is it possible to put WP_Query inside a foreach loop — or is there a better way of just renaming variables rather than writing WP_Query 4 times? Here is an example of the code. This is repeated 4 times, with just the 'category_name' changing, along with some variable names:               <?php     $fashion_cat = array(         'category_name' => 'fashion',         'posts_per_page' => 4,         'post_type' => 'post',         'post_status' => 'publish',         'orderby' => 'date',         'order' => 'DESC',         'post__not_in' => $already_posted,         'category__not_in' => $private_categories     );          $fashion_query = new WP_Query( $fashion_cat );     if ( $fashion_query->have_posts() ):         $i = 0;     while ( $fashion_query->have_posts() ):         $fashion_query->the_post();         $images = get_field( 'gallery' );     if ( $images ):     $i++;     ?>          <?php  if ( $i == 1 ): ?>

                         <a href="<?php the_permalink(); ?>"><img src="<?php  echo $images[0]['url'];?>">     <?php top_note(); ?>

          <?php elseif ( $i == 2 || $i == 3 ): ?>
                         <a href="<?php the_permalink(); ?>"><img src="<?php  echo $images[0]['url'];?>">     <?php top_note(); ?>
          <?php elseif ( $i == 4 ): ?>
                         <a href="<?php the_permalink(); ?>"><img src="<?php  echo $images[0]['url'];?>">     <?php top_note(); ?>
          <?php     endif;     endif;     endwhile;     endif;     wp_reset_postdata();          ?>      And this is my attempt at putting it into a foreach loop, but it only calls once:               <?php     $home_cats = array( 'fashion', 'beauty', 'lifestyle' );     foreach ( $home_cats as $key ):         echo $key;          $key_cat = array(         'category_name' => $key,         'posts_per_page' => 4,         'post_type' => 'post',         'post_status' => 'publish',         'orderby' => 'date',         'order' => 'DESC',         'post__not_in' => $already_posted,         'category__not_in' => $private_categories     );          $key_query = new WP_Query( $key_cat );     if ( $key_query->have_posts() ):         $i = 0;     while ( $key_query->have_posts() ):         $key_query->the_post();     $images = get_field( 'gallery' );     if ( $images ):         $i++;     if ( $i == 1 ): ?>

                         <a href="<?php the_permalink(); ?>"><img src="<?php  echo $images[0]['url'];?>">     <?php top_note(); ?>

          <?php elseif ( $i == 2 || $i == 3 ): ?>
                         <a href="<?php the_permalink(); ?>"><img src="<?php  echo $images[0]['url'];?>">     <?php top_note(); ?>
          <?php elseif ( $i == 4 ): ?>
                         <a href="<?php the_permalink(); ?>"><img src="<?php  echo $images[0]['url'];?>">     <?php top_note(); ?>
          <?php     endif;     endif;     endwhile;     endif;     wp_reset_postdata();          endforeach;          ?>


Filter on widget-title does not work with custom links

I added a filter to my widget titles and it looks like the filter doesn't apply on links, which are created with the links-sidebar. It does work perfectly on the blogroll or search widget Here's a Screenshot, to illustrate what I mean.               add_filter('widget_title', 'new_title', 99);     function new_title($title) {         $title = 'text';         return $title;     }      I disabled all plugins and tried the same the default wordpress themes and got the same results.


Display custom taxonomy posts of custom post types

I have created a custom post type "Portfolio" and a custom taxonomy "Kind" which includes "Websites", "Graphics", "Programming". What I want to do is to create 3 different pages "Websites", "Graphics" etc. that will display the appropriate items as a list. This is my code to display "Portfolio" posts :               <?php query_posts( array( 'post_type' => 'portfolio') ); ?>         <?php if( is_tax() ) {             global $wp_query;             $term = $wp_query->get_queried_object();             $title = $term->name;         }  ?>

                         <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                         <?php $categories = get_the_category(); ?>                         <article id="post-<?php the_ID(); ?>" <?php post_class('clearfix single-post'); ?> role="article" itemscope itemtype="http://schema.org/BlogPosting">                                                              <?php the_post_thumbnail( 'wpbs-featured' ); ?>

<?php the_title(); ?>

                                 <?php the_content(); ?>

                               <?php endwhile; ?>                                   <?php else : ?>                         <?php endif; ?>

       Unfortunately, I can't manage to display only "graphics" or "websites" posts.


How can I prevent wordpress from sending emails

I would like to stop all email functionality in my wordpress installation. Is this possible with a global flag? or maybe by forbidding this installation to use the php `mail` function at all in htaccess?


Custom taxonomy widget in admin area

I have a custom taxonomy set up on a custom post type and the box it uses is the same as categories, except I wanted to make it easily searchable using a filter script and then also allow the user to only select one and not multiple. I managed to get the search/filter working and to get it to display on the sidebar under the custom post type in the admin area and then I managed to hide the old box, but now I can't seem to get the term that is associated to a specific "post". So none of them is returning as selected once you update the page. Code below:               function my_client_box() {         add_meta_box(             'clients_section',             'The title',             'clients_box',             'cars',             'side'         );     }     add_action( 'add_meta_boxes', 'my_client_box' );          function clients_box() {         echo '
<input id="livefilter-input" type="text" value="" placeholder="Search names" autocomplete="off">';         echo '
';         echo '
';              $terms = get_terms("client", 'orderby=name&order=ASC&hide_empty=0');         $count = count($terms);         if ( $count > 0 ){             foreach ( $terms as $term ) {                 echo '
<input type="radio" name="tax_input[client][]" value="' . $term->term_id . '"> ' . $term->name . '
';             }         }              echo '
';         echo '
';         echo '
';         echo '                                              ';     }      When I `print_r` the `$term` var there doesn't seem to be any indication about if the specific name should be checked or not. How would I go about doing this?


Preventing Canonical Redirect for CDN

I want to run my entire WordPress site through a CDN to improve performance (HTML, not just static CSS/JS/media). Lets say the origin server is example.com and www.example.com is the URL where traffic will go through the CDN set-up as an origin-pull. The problem is an infinite loop will be created when visiting www.example.com which passes the request to WordPress which will look at the request and say "Actually this should be www.example.com according to the home_url and site_url defined in the Settings" Sooo... 1) Is there an easy way make WordPress stop redirecting to www under a certain condition (like checking for the x-forwarded-for headers which will be added to requests coming through the CDN)? 2) Am I going to have to set a constant to change the site URL for requests from the CDN and then set-up some sort of output buffering callback to replace http://example.com to http://www.example.com ? I know there are plugins out there that handle this. I'm looking to roll my own so I can figure out how this all works. Any guidance would be much appreciated.


Video Embed in Sidebar Widget with Links to Others in Category

I am trying to re-create the sidebar widget found here: http://www.clinicalforensicpsychology.org/ The links below the shown video are linked to the post category "videos". I have tried most every sidebar widget but I'm unable to find something that does the same thing. Does anyone have a suggestion? Thanks in advance!


Wordpress article with 50 000 words loading slow - 100% cpu

I have a wordpress article with 50 000 words. After a debug I realised that the CPU is 100% when I read the post / open the category page. I have a quad core server with 8gb ram (the ram level is below 1%), so the problem is the CPU. I opened putty and entered the command: top This is the first line:               20961 zzz  20   0  278m  41m 8712 R  100  0.5   0:05.49 php53.cgi      where 100 is the CPU usage. The page loads after 1 minute. I searched on google for a solution to this problem and I found this solution: http://wordpress.stackexchange.com/a/43830/21370 The accepted solution for the above link was:               Change the recursion limit to 200x normal, that is, set: pcre.recursion_limit=20000000          Change the backtrack limit to 100x normal, that is, set: pcre.backtrack_limit=10000000      The problem is that it's not working. I changed recursion_limit and backtrack_limit to lower and higher values. But I still got the same problem. Please give me a solution to my problem. Thanks.


get main product category list woocommerce

I am using woo commerce theme for my site. I am trying to display a list of main product category list. I tried this code. But it returns all the main and sub categories.               $product_category = wp_get_post_terms( $post->ID, 'product_cat' );      I need to display just the main product category list. How to do that?


How to get a notification when the plugin is installed?

I'm making a WordPress plugin to get a notification when the plugin is installed. I'm using `is_plugin_active` but I still do not understand...


Can I make my widget of my video only automatic on the homepage?

I have a video that is automatic when someone logs onto my website homepage (wordpress). But I only want it to be automatic on the homepage. It is automatic on every page. How can I turn it so that it is only automatic on the home page?


User can post only one comment per day on one page

This code count comments per day on all pages. I want that will count only on one page for 1 day. So my case: on a page with an ID of `1`, a user can comment with out any limit, but on a page with an ID of `2`, the same user can only comment once per day.               <?php      global $wpdb,$current_user;     $limit = 5; //this is limit per day per user     $comment_count = $wpdb->get_var( $wpdb->prepare("         SELECT count(*)         FROM wp_comments          WHERE comment_author = '%s'             AND comment_date >= DATE_SUB( NOW(), INTERVAL 1 DAY );",             $current_user->user_login     ) );          if ( $comment_count < $limit ) {         comment_form();     }        else {         echo 'exceeded comments limit - '.$limit;     }


Having a widget only show up in print

I have a Wordpress blog at http://rlc.vlinder.ca on which I show a QR code containing the URL of the current page. I'm using the "QR Code Widget" for that and it works fine, mostly, except that it doesn't show up if the page is printed. I have another QR code plug-in installed on the blog, "WP Page QR", which does show up in print (with a slight change to the CSS), but doesn't look nice at all in the browser. I've tried activating them both, but they both use the same PHP class library to generate the QR image, so activating the second simply crashes (which is caught by WordPress, which promptly deactivates the plug-in again). What I'd like is to show the QR code from the "QR Code Widget" in the browser, and show the one from "WP Page QR" in print, or do something similar to put the QR code on the printed page where it is most useful) -- not necessarily using the two plug-ins. Is there a plug-in that would already allow me to show the QR code in the widget area (on the right) in the browser, and print it somewhere on paper when printing? Is there a plug-in that would allow me to "simply" format the printed version? I am currently planning to edit the "WP QR Code" plug-in to allow me to activate it while "QR Code" is also active, but I'd like to avoid forking off a plug-in if I can..


Making plugin output customizable

I am writing a plugin that will display a timeline of historic events, and I am looking for ways to make the output customizable. I was considering including a template/example within the plugin folder that can be overridden inside the theme folder. My idea was to make sure WP looked in the theme folder first for a customized template before resorting to the one I create. If this is not good practice, let me know! What functions can I use to do the above functionality?


Are widgets meant to be used outside of sidebars? My case: I have this html block which I want to use every time I display a post with category of "Story". I was going to make a widget to reduce duplicate code. Is there a better way to apply this html block to every displaying of a "Story" post?


Trying to get custom js files in my admin header

I'm trying to add a java script file to my admin header and use admin-ajax.php to use ajax in my wp-admin (still learning a lot about the process). I've created a custom folder in my theme_directory/js called custom with the file I need to add to the admin header but it doesn't seem to be working. here's the code:               add_action('admin_enqueue_scripts', 'my_admin_enqueue_scripts');          function my_admin_enqueue_scripts() {         global $current_screen;         if ( 'page' != $current_screen->ID )             return;         wp_register_script('my-scripts', get_template_directory_uri() . '/js/custom/my-scripts.js' );         wp_enqueue_script('my-scripts');         wp_localize_script('my-scripts', 'wp_ajax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' )));     }      Despite this I'm not seeing a reference in my header to my custom js file. I've even tried `add_action('admin_header', 'my_admin_enqueue_scripts');` with no avail. I only need this script file in my wp-admin. What am I missing? Thank you!


Getting content from a single *page* of a post

What function can I use to fetch content of a single page within a post? Let's say I want to split my post into 5 pages - how can I get content of, say, page 3? Can't seem to find this in Codex...


create parent post using wp_insert_post

how can i create php function where i can create a post in one custom post type also create a child post type, i have already create a parent post type, i.e               post type "a = car"     post type "b = user"      i want to create a post in custom post type `"a = car"` but also add new post in post type `"b = user"` using `wp_insert_post` this is the closest i have found http://wordpress.org/support/topic/setting- post_parent-during-wp_insert_post


Fixing YARPP plugin FULLTEXT MySQL indexing

I just found out that the Yet Another Related Posts plugin (YARPP) uses FULLTEXT indexes on the wp-posts table, which greatly slows down sites with a large amount of posts. Can I can just delete the plugin, or do I have to clean out the wp-posts table of those indexes in order to fix the issue?


How to change attachment data?

When i uploading images in wp i change it's name by post name, but in media list image titles still is original. How to change it on upload? I tried `wp_generate_attachment_metadata`, `wp_handle_upload_prefilter`, `sanitize_file_name`


Updating seperate database when post attachment is changed

I have a seperate database with lists of users, brochures and brochure URL's, and timestamps of when a brochure was ordered, but I want my database to update everytime a brochure (PDF) attachment is updated in the admin back end of wordpress. When a user requests a brochure they receive a reminder after a few days wiuth a link to the PDF they requested. I have most of it figured out I just need to know how this link can constantly link to the latest PDF of the brochure they requested. Thanks :)


Moving wordpress from /dir to main folder

I have a simple question. I want to move my wordpress installation from www.xclo.co.uk/dir to www.xclo.co.uk Please can someone tell me how to do this.


Novice WordPress Installation issues

I am trying to install WordPress on www.000webhost.com I have uploaded the most recent version of WordPress to the server and created a MySQL database. However, When I visit my site, I select the WordPress folder and it gives two error messages: > Warning: require_once(/home/username/public_html/wordpress//wp- > includes/class-wp-error.php) [function.require-once]: failed to open stream: > No such file or directory in /home/a5558093/public_html/wordpress/wp- > load.php on line 48 > > Fatal error: require_once() [function.require]: Failed opening required > '/home/username/public_html/wordpress//wp-includes/class-wp-error.php' > (include_path='.:/usr/lib/php:/usr/local/lib/php') in > /home/username/public_html/wordpress/wp-load.php on line 48 What do these mean? How can I solve these issues?


How to synchronize The Loop with the max post per page?

I know I can use get_posts() and then specify to only get a certain number of posts, but I don't know how to use the value that the site admin has set in his settings.


Category pagination not working

My category page navigation doesn't seem to be showing up at all, what am I missing in my coding?               <?php get_header(); ?>

           <?php if ( have_posts() ) : ?>

                 <?php                             printf( __( '%s', 'rsi' ), '' . single_cat_title( '', false ) . '' );                         ?>

             <?php                             $category_description = category_description();                             if ( ! empty( $category_description ) )                                 echo apply_filters( 'category_archive_meta', '
' . $category_description . '
' );                         ?>                            <?php wp_pagenavi() ?>           <?php /* Start the Loop */ ?>           <?php     $args = array( 'category' => 5 );     $lastposts = get_posts( $args );     foreach($lastposts as $post) : setup_postdata($post); ?>
             <?php if (has_post_thumbnail( $post->ID ) ): ?>             <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>             <a href="<?php the_permalink(); ?>">             <div id="custom-bg" style="background-image: url('<?php echo $image[0]; ?>')">
                          <?php endif; ?>

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

               <?php the_excerpt(); ?>

 Posted on:               <?php the_date(); ?>

           <?php endforeach; ?>           <?php else : ?>

                 <?php _e( 'Nothing Found', 'rsi' ); ?>

                 <?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'rsi' ); ?>
               <?php get_search_form(); ?>

                           <?php endif; ?>                 <?php wp_pagenavi() ?>

           <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Right Sidebar')) : ?>           <?php endif; ?>

     <?php get_footer(); ?>


Wordpress admin never finishes saving page on site with large page count

I have a Wordpress install with a very large amount of pages (a few hundred thousand), and over time it has gotten to the point where editing a page takes an extremely long amount of time. It would take several minutes just to open the edit screen, but I found out that it was wp_pages used in generating the parent page selection dropdown that caused that, so I removed it via a hook in my theme's functions.php and so now the edit screen loads just fine. Now the problem I have is that when updating/editing a page, it never seems to complete whatever it is doing. The page keeps on loading after hitting update, but it does successfully edit the page within a couple of seconds (I can verify that on the frontend), but in the admin it just keeps going until I just manually refresh the page. Any one know what wordpress function might be causing this sort of timeout on saving a page? I have wordpress 3.5.1 and I've tried to disable any running plugins. Any ideas? Just to add, eventually I get a 500 server error after letting it run for about 30 minutes. Here is the server's log:               [Sat Jan 26 13:11:12 2013] [warn] [client 76.189.45.243] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server, referer: http://www.server.com/wp-admin/post.php?post=18173&action=edit      [Sat Jan 26 13:11:12 2013] [error] [client 76.189.45.243] Premature end of script headers: post.php, referer: http://www.server.com/wp-admin/post.php?post=18173&action=edit      [Sat Jan 26 13:11:12 2013] [warn] [client 76.189.45.243] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server, referer: http://www.server.com/wp-admin/post.php?post=18173&action=edit      [Sat Jan 26 13:11:12 2013] [error] [client 76.189.45.243] Premature end of script headers: admin-ajax.php, referer: http://www.server.com/wp-admin/post.php?post=18173&action=edit


How can i list random post from multiple category?

I have an author page, and I want to list posts from current author's categories. e.g. I'm viewing John's page, and John wrote in Sport, Tech, News, Computer categories. Then my code list from this (Sport, Tech, News, Computer) categories list random 10 post. But something is going wrong: Those 4 categories have 25 posts. But my code isn't listing 10 posts, it's just listing 1 post. And i need random post list My code:               <?php global $post, $wpdb;     $author_id = $post->post_author;     $categories = $wpdb->get_results("         SELECT DISTINCT(terms.term_id) as ID, terms.name, terms.slug         FROM $wpdb->posts as posts         LEFT JOIN $wpdb->term_relationships as relationships ON posts.ID = relationships.object_ID         LEFT JOIN $wpdb->term_taxonomy as tax ON relationships.term_taxonomy_id = tax.term_taxonomy_id         LEFT JOIN $wpdb->terms as terms ON tax.term_id = terms.term_id         WHERE 1=1 AND (             posts.post_status = 'publish' AND             posts.post_author = '$author_id' AND             tax.taxonomy = 'category' )         ORDER BY terms.name ASC     ");          foreach($categories as $category) :          $catnumber = $category->ID.',';     endforeach;?>     <?php           $args = array(     'category__and' => array( $catnumber )     , 'showposts'=> '10'     );          $my_query = new WP_Query( $args );     ?>
     <?php while ( $my_query->have_posts() ) : $my_query->the_post(); ?>
             <a href="<?php the_permalink(); ?>"><?php the_title(); ?>
     <?php endwhile; ?>
     <?php wp_reset_postdata(); ?>


How to list menu-item- ids in order for wp_nav_menu

I have a nav menu call: 'primary', 'container_class' => 'primary-menu' ) ); ?> The output looks something like this:

RSS

Contacto

Facebook

Twitter

Site Info

      I'm trying to apply a different background color to each menu item, so #1 would get one color, #2 a second color. I would like the theme work for whatever menu items someone wants to set up- so it would be preferable it the #id on each li went in order. Eg:

List item

List item

List item

List item

      Any help would be appreciated.


Twitter bootstrap tabs

Does some know how to do shortcode for Twitter bootstrap tabs or any other tabs? I found this tutorial http://michaelwender.com/blog/2010/11/01/creating- wordpress-shortcodes-for-jquery-tools-tabs/ but it doesn't work. thx for your time


Multisite - big hosting package or several hosting packages?

When I want to create a mutlisite on which I can create mutliple sub-sites with different domain names, do I have to buy a hosting package for each of these sub-sites or can I just link the domain name to the corresponding sub- site of Wordpress MU


Can i login with only one account to different top leveled domain wordpress web sites?

I am using Wordpress 3.3.1. I have 3 different blog. For example www.a.com www.b.com www.c.com Different top level domains. My visitors want to login my blogs with same accounts. Is there a way that users register account only one blog and then they can use same account different blog ? Like a passport ? In this scenario admin and visitor is me. I need to ask my questions different blogs with same account. But i dont want to register same account each blog. Please help! If my question can not understood and then -> Detailed Explanation 1-I have 3 wordpress blog in different top level domains. 2-I want to register myself like a visitor to first site. 3-I want to login with this account to third site Is that possible ? Please help!


WordPress memory on 3.X

I'm using the WP_Overview plugin to view WordPress' memory limit. It's showing `Mem: WP 32M (def) Usage 25% 32.59M of PHP Limit 128M`. However, in my `functions.php`, I have the following line of code: `define('WP_MEMORY_LIMIT','96M');`. I've also installed the Change Memory Limit plugin and tried updating the figure from there, again to 96M. Despite this, the Overview plugin is still showing 32M. Three questions in one:   1. Which gets used, the PHP limit or the WP limit?   2. Is this plugin a good way of checking the limit, or should I try a different method?   3. Is this potentially a problem with WP 3.X? I found this post on WP Support which might imply that it is. Their solution suggests moving the `PHP.INI` but I'm not particularly keen on doing that - surely it can't be safe? Thanks in advance,


Post publish only hook?

Is there any hook which is fired only when the post is "published" for the first time. I dont want to execute my code when the post is "updated" or when its status is set to "not-published" and then "published" again. EDIT:               add_action('draft_to_published','func_tion');          function func_tion($post){         $post_id = $post->ID;                 if ( !get_post_meta( $post_id, 'mycoderan', $single = true ) )         // run code to manipulate data         wp_enqueue_script('plugin_name',plugin_dir_url(__FILE__ ).'script.js');         $params = array() // set parameters         wp_localize_script('plugin_name', 'params', $params );         update_post_meta( $post_id, 'mycoderan', true );     }


Error "preg_match_all" with Wordpress SEO by Yoast plugin

I hope someone could realy help me... I get this error message :               "error Warning: preg_match_all() [function.preg-match-all]: Unknown modifier 'I' in /home/sulistyo/public_html/wp-content/plugins/wordpress-seo/admin/linkdex/linkdex.php on line 476"       when I enter/write a focus keyword on wordpress seo meta box. I don't know what to do to solve the error. I hope someone or the developer of the plugin (Joost de Valk) could help me with this error - thanks. I really need your help...


Who owns the content posted on .wordpress.com blogs?

If I sign up for a Wordpress blog that is hosted for free by Wordpress here, who will own the content I post, and how much storage will I have? I know I could ask their customer support, but I don't trust companies (their lawyers specifically).


Time limited file download upon form submit

The basic of what I need; A public page where the visitor have to fill out a form in order to be able to download a large file (the one and the same file for all downloads/users). The file should only be available trough something like a temporary url for a specific amount of time from when the form was submitted. In other words, time limited access to the file for a specific user. To create and setup the form is no problem, but making the file accessible for a limited amount of time to the user whom submitted the form is a completely different story. I have no good ideas on how to create time limited access. Don't know where to start. Any ideas on how to create this with WordPress? Plugin suggestions are welcome too.


How Can I List Categories by Date?

This question isn't specifically about categories, but any taxonomy. I registered a taxonomy called `issue`. I want to list these `issue`s by year. I'm currently using the function:               wp_list_categories( array('taxonomy' => 'issue') );      I'm not sure how I could output these in a way that would let me view all 'issues' for a given year. Has anyone done anything like this before?


How to quickly/easily make an analysis (reverse engineering) of Wordpress?

For me Wordpress is totally unknown. I would like to know what tools and techniques do you use to analyze unknown code of Wordpress. If more specifically that for the following tasks: **1**. To locate the file (s) html template layout of the output to the browser.   **2.** Identifying the mechanism of routing on the URL that is both on the basis of the URL, the system determines which content and form in which to display or put in short - a mechanism _controller_ in the pattern of MVC.   **3.** Identifying the mechanism of the assembly of the main content of the modules, and work with a database that is everything for which usually must meet model in the pattern of MVC.   **4.** Determination of the mechanism of assembly of the entire html page before. That is, view in the pattern of MVC. For example, for me, it's probably become traditional: Xdebug, IDE for PHP (Eclipse). Also a very special service helps to visualize the trace files Xdebug - Recognizer. It is good because it builds a comfortable working sequence diagram of a trace log. Maybe enough for someone to read documentation, view the source code or running in the debugger, but for me chart tracing helps to form in my head for the system and has become a really convenient way of analysis. What else can you advice? Encourage effective tools and techniques for quick/easy analysis (reverse engineering)?


Auto insert More tags in all posts

I have a theme for my mobile site that requires the `<!--more-->` tag in my posts for it to display an excerpt of my post's content. I've got over 2000 posts already, and its going to take forever to add the tag in all my posts. I don't want to use a plugin, cause I've used one that wasn't stable at all. I just need a snippet I can hook up in my theme's files that will add the more tag after a specific character or word count in all my posts, and in every post I publish after that. Thanks!


How can I make updates to a site, on a development copy, but then move updates back without overriding live site's evolving database?

I've tried to be as descriptive in the title as possible, and I know this question has been asked in before in various forms but I could not find good answer to it and it's are to imagine that no one has solved this issue. It's simple, once a WP site is live, if it is not a static one then it keeps updating it's database by having new posts added, new woocommerce orders, new user accounts etc' If I want to make some major changes and updates to the site, the simplest and easiest way to do this is by making a copy either to a local install or to another development domain, and making all the changes there. Once all the changes are done I want to copy them back to the live site. If the changes are to files only, like theme and css, that's somewhat easy. However, if the changes involve changes in the database, like adding new plugins and adding content that connects/relate to these plugins, then I no longer can just copy the site back, because it will override any new changes that got added to the live site's database. all new posts, new orders, new image uploads, will all be erased. Now I know that different case scenarios have different solutions, but isn't there a method that address all cases? For example, if the only changes that were made to the live site were new posts, then I can export and import the posts to the dev site and then move the entire site over. Same with some other items, but not every kind of item. And the other problem with this is that the export and import function in wordpress is abysmal. It is so rudimentary and you have very little options to select and export only specific items. I've probably tried every "advanced import/export" plugin out there and nothing has yet to solve this issue. So in another thread, someone pointed out this plugin to basically install and work on a theme on the live site, while the regular users still see the existing theme, but that still doesn't solve all types of changes. because if you want to make changes to content, let's say the footer or nav menu, it is things that will still reflect in the existing viewable theme/site and might look ok on the new test theme but not the live one. Is there no way to develop a "branch" of a site on the same site/database and then switch? or is there no way to develop on a dev site but then actually merge databases in a non-destructive way? If you know which components and things you affected, wouldn't there be a way to do that? or would you need to be a MySQL master to attempt such a thing. I can't be the only one having this conundrum. I can't imagine there is no solution for this issue. How can this be done? Thanks in advance.


learning OOP with wordpress plugin

I used to develop in functional design so far and I am now learning OOP. I stumbled upon following problem. Sometimes in OOP a function needs to send and argument as an array. Example. I want to add an admin page for a plugin in Wordpress. In functional design the function looks like this:               function myclass_plugin_admin_add_page() {         add_options_page('MyClassPlugin Page', 'MyClassPlugin Menu', 'manage_options', 'do_myclass', 'myclass_plugin_options_page');     }      In OOP the last argument has to look like this:               function myclass_plugin_admin_add_page() {         add_options_page('MyClassPlugin Page', 'MyClassPlugin Menu', 'manage_options', 'do_myclass', array($this, 'myclass_plugin_options_page'));     }      How the heck will I ever know which argument I have to change to an array when writing the same function in OOP???


Order by custom field date?

I've created a category "Expire Soon" and i want to insert and sort the posts by custom field "expiration_date". I use this code but the posts are sorted by custom field "expiration_date" but not by the date. The posts are sorted by the numbers in the date. Such as: 31/12/2012   28/01/2013   15/01/2013   04/12/2012 and i want to be like: 04/12/2012   31/12/2012   15/01/2013   28/01/2013 The code i use to insert the custom fields (creating them with Advanced Custom Fields) is:               <?php                                                 if( get_field( "dwra_diagwnismou" ) ): ?>
Δώρα διαγωνισμού:   <?php the_field( "dwra_diagwnismou" ); ?>
                                                 <?php endif;                                                      if( get_field( "kathgoria-diagwnismou" ) ): ?>
Κατηγορία διαγωνισμού:   <?php the_field( "kathgoria-diagwnismou" ); ?>
                                                 <?php endif;                              if( get_field( "diorganwths_diagwnismou" ) ): ?>
Διοργανωτής διαγωνισμού:   <?php the_field( "diorganwths_diagwnismou" ); ?>
                                                 <?php endif;                              if( get_field( "hmeromhnia_lhkshs" ) ): ?>
Ημερομηνία λήξης:   <?php the_field( "hmeromhnia_lhkshs" ); ?>
                                                 <?php endif;                              if( get_field( "wra_lhkshs" ) ): ?>
Ώρα λήξης:   <?php the_field( "wra_lhkshs" ); ?>
                                                 <?php endif;                              if( get_field( "periorismos_perioxhs" ) ): ?>
Περιορισμός περιοχής:   <?php the_field( "periorismos_perioxhs" ); ?>
                                                 <?php endif;                              if( get_field( "apaitei_logariasmo_facebook" ) ): ?>
Απαιτεί λογαριασμό Facebook:   <?php the_field( "apaitei_logariasmo_facebook" ); ?>
                                                 <?php endif;                              if( get_field( "syxnothta_diagwnismou" ) ): ?>
Συχνότητα διαγωνισμού:   <?php the_field( "syxnothta_diagwnismou" ); ?>
                                                 <?php endif;                              if( get_field( "link_diagwnismou" ) ): ?>
Link διαγωνισμού:   <a href="<?php the_field( "link_diagwnismou" ); ?>"><?php the_field( "link_diagwnismou" ); ?>
                                                 <?php endif;                              if( get_field( "oroi_diagwnismou" ) ): ?>
Όροι διαγωνισμού:   <?php the_field( "oroi_diagwnismou" ); ?>
                                                 <?php endif;                              if( get_field( "plhrofories_diagwnismou" ) ): ?>
Πληροφορίες διαγωνισμού:   <?php the_field( "plhrofories_diagwnismou" ); ?>
                                                 <?php endif;                                                   ?>      I use it in the loop.php If anyone can help me sort by date i would be grateful! @s_ha_dum This is the code i use in the functions.php to insert the data from the submitted form to the custom fields meta-box in the post edit:               /* ------------------------------------------------        QuForm Plugin - Form to Post     ------------------------------------------------ */          add_action('iphorm_post_process_1', 'mytheme_create_wp_post', 10, 1);          function mytheme_create_wp_post($form)     {         $title = $form->getValue('iphorm_1_1');         $content .= 'Δώρα διαγωνισμού: ' . $form->getValueHtml('iphorm_1_30') . '       ';         $content .= 'Κατηγορία δώρων: ' . $form->getValueHtml('iphorm_1_39') . '       ';         $content .= 'Ημερομηνία λήξης: ' . $form->getValueHtml('iphorm_1_8') . '       ';         $content .= 'Ώρα λήξης: ' . $form->getValueHtml('iphorm_1_9') . '       ';         $content .= 'Διοργανωτής: ' . $form->getValueHtml('iphorm_1_36') . '       ';         $content .= 'Περιορισμός (περιοχή): ' . $form->getValueHtml('iphorm_1_15') . '       ';         $content .= 'Απαιτεί λογαριασμό Facebook: ' . $form->getValueHtml('iphorm_1_26') . '       ';         $content .= 'Όροι διαγωνισμού: getValueHtml('iphorm_1_32') . '">' . $form->getValueHtml('iphorm_1_32') . '       ';         $content .= 'Πληροφορίες διαγωνισμού: ' . $form->getValueHtml('iphorm_1_35') . '       ';         $content .= 'Link διαγωνισμού: getValueHtml('iphorm_1_11') . '">' . $form->getValueHtml('iphorm_1_11') . '       ';                   $post = array(             'post_title' => $title,             'post_content' => $content          );                  // Insert the post         $post_id = wp_insert_post($post);             // Insert the Custom Fields         add_post_meta($post_id, 'dwra_diagwnismou', $form->getValue('iphorm_1_30'));         add_post_meta($post_id, 'kathgoria_diagwnismou', $form->getValue('iphorm_1_39'));         add_post_meta($post_id, 'diorganwths_diagwnismou', $form->getValue('iphorm_1_36'));         add_post_meta($post_id, 'hmeromhnia_lhkshs', $form->getValue('iphorm_1_8'));         add_post_meta($post_id, 'wra_lhkshs', $form->getValue('iphorm_1_9'));         add_post_meta($post_id, 'periorismos_perioxhs', $form->getValue('iphorm_1_15'));         add_post_meta($post_id, 'syxnothta_diagwnismou', $form->getValue('iphorm_1_31'));         add_post_meta($post_id, 'apaitei_logariasmo_facebook', $form->getValue('iphorm_1_26'));         add_post_meta($post_id, 'link_diagwnismou', $form->getValue('iphorm_1_11'));         add_post_meta($post_id, 'oroi_diagwnismou', $form->getValue('iphorm_1_32'));         add_post_meta($post_id, 'plhrofories_diagwnismou', $form->getValue('iphorm_1_35'));


What are the advantages and disadvantages of Option Tree over the Customization API?

I'm relatively new to WordPress theme development, and I had to create a theme with options available. I did a Google search to see what are the possibilities, and I read articles about such, and read about frameworks, and I came across Option Tree, which was recommended as a framework to develop with. What my question is, when I'm developing themes to sell, what are the advantages and disadvantages of Option Tree over the Customization API built into WordPress?


How to use add_settings_error in register_setting callback

public function database_name_check($input){         //debug         add_settings_error('notice', 'lol', 'lol');         if($this->wpdb->get_var($this->wpdb->prepare('SHOW DATABASES LIKE %s', $input)) == $input)             return $input;         else{             add_settings_error('notice', 'lol', 'lol');             return FALSE;         }     }      I can not understand why the error does not exceed, any suggestions?


Display further content in file media attachment

When i see the image attachment in full size I need to show text in `wp- content/uploads/2014/08/filename.jpg`. Also I need to show go back button, and others info about the image opened in full size. I suppose that I have to change link of the image `esc_url( wp_get_attachment_url() )`, because function `wp_get_attachment_url()` open the image in the browser. Anyway               <?php     $metadata = wp_get_attachment_metadata();     printf(       __( 'Published  <time class="entry-date" datetime="%1$s">%2$s</time> at %4$s × %5$s in %8$s.', 'twentytwelve' ),       esc_attr( get_the_date( 'c' ) ),       esc_html( get_the_date() ),       //esc_url( wp_get_attachment_url() ),       esc_url( '' . site_url() . '/wp-content/themes/Tema-SK3/new-file.php' ),       $metadata['width'],       $metadata['height'],       esc_url( get_permalink( $post->post_parent ) ),       esc_attr( strip_tags( get_the_title( $post->post_parent ) ) ),       get_the_title( $post->post_parent )     );     ?>      I have changed:               esc_url( wp_get_attachment_url() ),      in               esc_url( '' . site_url() . '/wp-content/themes/Tema-SK3/new-file.php' ),      Question is: How I edit this new-file.php to show related image? What should be done this new-file.php?


Permission error on plugin save

When I pass a quote to the input field and save it I get this error message in wordpress - I'm using the latest installation version. Error "You do not have sufficient permissions to access this page." The code I'm getting the error in is for a plugin that I'm developing its my first attempt at something like this.                  <?php          /*idea to develop further would be, add a text box that the user can input the quote in     this then gets added to the DB and passed to the $quotes array. From here the results get     output the same way*/     /*     Plugin Name: Random Quotes     Plugin URI: xxx     Description: This Plugin randomly generates Quotes input by the user.     Version: 0.0.1     Author: xxx     Author URI: xxx     License: GPL2     */          /*          Function Reference      is_numeric() - Finds whether a variable is a number or a numeric string     unserialize() - takes a single serialized variable and converts it back into a PHP value.     isset() - tests to see if a variable isset     array_values($array) - Return all the values of an array input                    */          add_action('admin_menu', 'dw_quotes_create_menu');          function dw_quotes_create_menu() {         //create custom top-level menu         add_menu_page('Quotes Settings', 'Quotes Styling', 'manage_options', __FILE__, 'dw_styling_quotes_settings');     }              //generating the random quote     function dw_get_random_quote() {         $quotes = get_option('dw_quotes', null);          $quotes = unserialize($quotes);         $rand_quotes = array_rand($quotes);         $result_quote = $quotes[$rand_quotes]; // assigns $result_quote the random quote              return $result_quote; //output               }         //styling the admin menu     function dw_styling_quotes_settings() {              // load quotes         $quotes = get_option('dw_quotes', null);         $quotes = unserialize($quotes); // unserialize the data from the $quotes array              if (is_null($quotes)) {             $quotes = array();         }              if (isset($_GET['delete']) && is_numeric($_GET['delete'])) { // $variable is set and its numeric             unset($quotes[$_GET['delete']]); // remove that quote from the array             $quotes = array_values($quotes); // reorder the keys             update_option('dw_quotes', serialize($quotes)); // store results             echo '
Quote Deleted
';         }              if ($_POST && isset($_POST['random_quote']) && $_POST['random_quote'] !== '') { //???             array_push($quotes, $_POST['random_quote']);             update_option('dw_quotes', serialize($quotes));             echo '
Quote Added
';         }              ?>
             <?php global $wp_version;                 if ($wp_version < 3.1 ) {                     screen_icon( 'plugins' );             } ?>
Quotes Page
                       <form action="admin.php?page=wse140202.php" method="post">                 Add Quote:  <input style="width:600px;" type="textarea" name="random_quote" value="" />
<input type="submit" />             </form>

Current Quotes

             <?php             if ($quotes !== null) { // checks if $quotes is not set to 0                 $index = 0; //counter                 if (is_array($quotes)) { // checks if $quotes is an array to prevent error                 foreach ($quotes as $quote) {                     echo '
[ Delete ]  ' . $quote . '
';                     $index++; //increment counter                     }                 }             }?>

A Random Quote
             <?php // echo dw_get_random_quote();     }          ?>      it seems to be this page causing the permission error `admin.php?page=wse140202.php`


Functions.php not working in 2013 Child Theme

I have created a child theme base on the new twentythirteen theme. I made a style.css file and put a few styles in it. I've selected the child theme and my css styles are working. No problem there. Next I created a functions.php file and put a few simple functions in it. But, none of them are working. So, I stripped it down to just one function to test it out and it's still not working. WP does not seem to be seeing my functions.php file. So, now, the only thing in my child theme function file is the following code. Can anyone give me any advice as to why this code is not showing up in the page head?                function watercolor_add_typekit() {             echo '<script type="text/javascript" src="//use.typekit.net/xxxxxx.js"></script>     <script type="text/javascript">try{Typekit.load();}catch(e){}</script>';     }          add_filter( 'wp_enqueue_scripts', 'watercolor_add_typekit' );       Thank You!


How to handle change the appearance of 'categories' box on dashboard?

I have a site with hundreds of categories, and when I come to edit some menu on `wp-admin/nav-menus.php` it is really difficult, because in the `categories` box there a few pages, with something like 20 categories names on each page, so I can not see all the categories. (Also I use a plugin that presents the category list (on dashboard) in a tree view, and a dividing on pages, damages the plugin activity).   So what is the way to display all the categories as one single page?


Hide Pages WooCommerce

I would like a condition such as the following: 1) User is logged. Select Page Shop and displays all content. 2) If user is not logged. Select Shop page, they are redirected to another page, for example Sign Up page. I hope it is possible. I have tried many plugins but failed. At the moment the only one that works with WooCommerce is s2Member, but it is overkill for my purpose. Thanks in advance for any help.


Categories filtering in new post

I have a website with post types that have subtitles for movies. That files are on a specific custom post type using http://www.wpdownloadmanager.com/ pro. Because all custom type posts are movies we have a lot of categories. 744 for now. We have Letter Cattegory including Movie or Series Name and sub categories with Season. I am wondering if there is an easy way to select categories and sub categories in Backend when a users creates an new post so there is no need to look on a 744 categories to find the movie. Maybe somekind of filtering or by selecting a main category and filtering child categories ( Movi name ) and after that by filtering sub child categories (Seasons). Otherwise user needs to seach on 744 Categories to check them.


Custom Post Loop pulling all custom posts, not just one

I'm having an issue with a loop pulling every custom post in my template and not the one that has been requested. This can be seen here: http://i.imgur.com/1YKeLtV.png Here is the code I'm using to display the custom post:               <?php /*Template Name: Game Listing Page */ ?>     <?php get_header(); ?>
         <?php         $mypost = array( 'post_type' => 'games_database', );         $loop = new WP_Query( $mypost );         ?>         <?php while ( $loop->have_posts() ) : $loop->the_post();?>             <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
                         <?php the_post_thumbnail( array( 100, 100 ) ); ?>
                                               Title: <?php the_title(); ?>
                     Platform(s):                      <?php the_terms( $post->ID, 'games_database_game_platform' ,  ' ' ); ?>
                     Genre:                      <?php the_terms( $post->ID, 'games_database_game_genre' ,  ' ' ); ?>
                     Publisher:                      <?php echo esc_html( get_post_meta( get_the_ID(), 'game_publisher', true ) ); ?>
                     Developer:                      <?php echo esc_html( get_post_meta( get_the_ID(), 'game_developer', true ) ); ?>
                     Review Score:                      <?php echo esc_html( get_post_meta( get_the_ID(), 'game_rating', true ) ); ?>

<?php the_content(); ?>

              <?php endwhile; ?>

     <?php wp_reset_query(); ?>          <?php get_sidebar(); ?>     <?php get_footer(); ?>      I have no idea where I have gone wrong :( Any help would be hugely appreciated. Cheers.


Problem Installing a Premium Theme-- File Permission Issue on a Mac, Local Machine?

I tried to install a premium theme called Superb. I'm new to WordPress and I'm having a bit of a problem. I think that it has to do with permission settings, but I'm not sure. This is my situation: I'm on a Mac running MAMP Pro. I've setup WP on my local machine. When I open my site in a browser, I see the default WordPress page. So far, so good. I unbundled the Superb zip file and put the directory in wp-content --> themes. I went to WP's dashboard Appearance--> Themes, but Superb was not visible. There was no picture of the theme and no nothing to activate. So I changed the Superb directory's permissions to Me: Read & write, Everyone: Read only. Now, the Superb theme is visible. I activated the theme. When I opened the browser, I got these error messages at the top of the page and then the default page styled with the Superb theme:               Warning: include(recaptchalib.php) [function.include]: failed to open stream: Permission denied in /Users/myname/Sites/mysite/wp-content/themes/Superb/uContact/contact.php on line 136          Warning: include() [function.include]: Failed opening ‘recaptchalib.php’ for inclusion (include_path=’.:/Applications/MAMP/bin/php5.2/lib/php’) in /Users/myname/Sites/mysite/wp-content/themes/Superb/uContact/contact.php on line 136      Now, I can't even login into wp-admin and there are lots of warnings as above. I think that I'm doing something wrong with the permissions. Maybe I made some other idiotic mistake. If someone can give me detailed instructions on how to solve this problem on a Mac, I would be psyched. Thank you! -Laxmidi


How to extend parent theme sections and settings to Options Tree

I am developing a child theme based on a theme that use Option Tree for it's options. Is it possible to add a new section with my child theme settings to the already defined sections by parent theme ? The only reference I found was https://github.com/valendesigns/option-tree- theme/issues/3 but I couldn't implemented. I also read a lot the Option Tree code but couldn't find the appropriate filter.


Get post by page name or slug

I know this is very avant-garde, but bear with me. I've read that one is able to query a page by the page/post name or slug. I'm trying to do this because I need information from a page with a similar title/slug and will not have the ability to get the page id (unless there's a way to convert a title to an ID). I've tried multiple variations without success. This seems like the most reasonable way of handling this, but it's simply not working.               <?php          $args = array(         'pagename' => 'CM-145',         'post_type' => 'page',         'posts_per_page' => 1,         'numberposts' => 1     ); ?>
         <?php             query_posts( $args );             get_template_part( 'loop' );             wp_reset_query();         ?>
      The Loop               <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>                          <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>                         <?php if ( is_front_page() ) { ?>
<?php the_title(); ?>
                         <?php } else { ?>
<?php the_title(); ?>
                         <?php } ?>
                             <?php the_content(); ?>                             <?php wp_link_pages( array( 'before' => '
' . __( 'Pages:', 'twentyten' ), 'after' => '
' ) ); ?>                             <?php edit_post_link( __( 'Edit', 'twentyten' ), '', '' ); ?>

                          <?php comments_template( '', true ); ?>          <?php endwhile; // end of the loop. ?>      I've also tried `'name' => 'CM-145'`, I'm not sure if this is the correct or reasonable way to perform this action. Ultimately I simply need to pull the page's thumb and excerpt so if you have a better Idea don't hesitate to let me know. Thanks in advance.


The entire content of my Wordpress page has disappeared

I have a blog installed on my site using Wordpress. Last week I upgraded Wordpress from 2.6 to 3.0.4 (I had to do this manually). All went well, or so I thought, but I have just noticed that the content of an existing page has vanished. The page URL still works, but all content has disappeared - doctype, html tags, body tags, everything. Please note, this is specific to pages - posts are still displaying fine. I have since created a brand new page which does not display the content either. Things I have tried include               * Switching to a freshly installed theme     * Reverting the page to an older version     * Deactivating all plugins     * Setting the problem page to draft, and back again     * Deleting the .htaccess file      I suspect it's a database problem and have contacted my hosting company who have said the only thing they can do is restore the DB from a backup, but that I should consider it a last resort. Does anyone have any further ideas what to try?


Combine multiple plugins into one?

I've collected a few plugins that each have specific functionality I need for what would otherwise be a single large plugin. Is it possible to bundle these into a single installable zip?


Extra TinyMCE editor strips <p> and <br> tags?

Hey guys, I've added a TinyMCE to some textareas that are displayed in a custom meta box. All of the formatting works perfectly fine, except that the editor will not save `<p>` or `<br/>` tags. It doesn't preserve the line breaks. The TinyMCE is setup like this:               wp_tiny_mce(true, array('editor_selector' => $field['class'] ) );          '<textarea name="', $field['id'], '" class="', $field['class'], '" id="', $field['id'], '" cols="60" rows="8" style="width:97%">', $meta ? esc_html($meta) : $field['std'], '</textarea>';      And that all works perfectly fine. All the formatting buttons work fine, except for the `<P>` and `<BR>` tags. I'm not sure if the editor is stripping them out before or after the post meta is saved. Ideas?


How can I get on the same row two post of different categories?

Let me explain better, I have two categories and I want to show a page with two columns one for each category, after this I like to show in the same row each post of each category on each column, just to apply the same background color independently of the length of the text. What is the easy and right way to do some like that? Thanks in advance, Regards! Edit: add the queries I use.               <?php                 // for a given post type, return all                 $post_type = 'evento';                 $tax = 'categorias-eventos';                 $tax_terms = get_terms($tax);                 $post_counter = 0; // reset so we can generate columns                  $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;                          if ($tax_terms) { ?>
                              <?php foreach ($tax_terms as $tax_term) {                          $args = array(                         'post_type' => $post_type,                         "$tax" => $tax_term->slug,                         'post_status' => 'publish',                         'posts_per_page' => 6,                       //'posts_per_page' => -1,                       //'paged' => $paged,                         'orderby' => 'title',                         'order' => 'ASC',                         'caller_get_posts' => 1                         ); // END $args                              $my_query = null; // clear the query variable                         $my_query = new WP_Query($args);                              if( $my_query->have_posts() ) { ?>

<?php echo $tax_term->name; ?>

                                  <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
                                 <div class="retailer_wrap retailer_id-<?php the_ID(); ?>">
<?php the_title(); ?>

<?php echo get_post_meta($post->ID, 'eventdate', true);?>

<?php echo get_post_meta($post->ID, 'eventplace', true);?>

                             <?php $post_counter++; ?>                                  <?php if ( 0 == $post_counter % 6 ) { ?>

                     <?php } // END if $post_counter ?>                   <?php                   endwhile;                   //wp_pagenavi( array( 'query' => $my_query ) );                  } // END if have_posts loop                 wp_reset_query();                    } // END foreach $tax_terms ?>
             <?php } // END if $tax_terms             ?>      Edit 2: add the image of the final result I want to approach. Two columns of two categories, each post of each category respect the same row height, how to do this? Like I don't have enough permission to post an image this is the link to the image. enter link description here


wp query with multiple taxonomy?

Hello I want to get all the posts that belong to multiple taxonomies. I saw on codex but it is having only static(2) taxonomies but in my case I have variable number of taxonomies. On Codex website this is the code...               $args = array(         'post_type' => 'post',         'tax_query' => array(             'relation' => 'AND',             array(                 'taxonomy' => 'movie_genre',                 'field' => 'slug',                 'terms' => array( 'action', 'comedy' )             ),             array(                 'taxonomy' => 'actor',                 'field' => 'id',                 'terms' => array( 103, 115, 206 ),                 'operator' => 'NOT IN'             )         )     );     $query = new WP_Query( $args );      but taxonomies can be more than 2 or can be just 1. So How to loop for variable number of taxonomies. I want like this http://software.pricegrabber.com/office-suites/p/169/ Please help!!


Adding jQuery timepicker to contact form

I currently have a contact form on my WordPress site. I have date and time inputs, for the date input I'm currently using the "jquery-ui-datepicker" and have it working in the following setup. In my **functions.php**               wp_enqueue_script('jquery-ui-datepicker');     wp_enqueue_style('jquery-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css');      and in my **form.php** I'm applying the jQuery to my form               <fieldset class="usp-date">     <?php _e('Date of News'); ?>     <input name="user-submitted-date" type="text" value="" placeholder="<?php _e('7/4/12'); ?>" required="required" id="MyDate">     </fieldset>      The jQuery               jQuery(document).ready(function() {     jQuery('#MyDate').datepicker({         dateFormat : 'm-d-y' ,         minDate: 0     });     });          </script>      What the best way to apply http://plugins.jquery.com/jt.timepicker/ to my time fieldset               <fieldset class="usp-starttime">     <?php _e('Start Time'); ?>     <input name="user-submitted-starttime" type="text" value="" placeholder="<?php _e('11:00 am'); ?>">     </fieldset>      Download from github, and call the css/js in my functions.php? Then I'm unsure how to call the jQuery in my form.php


Tags break custom Excerpt function

Quick question here. I have a function that echoes out the post-type's content (if none available, the excerpt). It looks like this:               function era_excerpt($post, $length = 11, $ext = ' ..') {         if(is_int($post)) { $post = get_post($post); } elseif(!is_object($post)) { return false; }         if(has_excerpt($post->ID)) { $the_excerpt = $post->post_excerpt; } else { $the_excerpt = $post->post_content; }         $the_excerpt = strip_shortcodes(strip_tags(stripslashes($the_excerpt), ''));         $the_excerpt = preg_split('/\b/', $the_excerpt, $length * 2+1);         $excerpt_waste = array_pop($the_excerpt);         $the_excerpt = implode($the_excerpt);         $the_excerpt .= $ext;         $post = $post->ID;              return apply_filters('the_content', $the_excerpt);     }      I realized this function had a major issue: users starting a post-type with a special HTML tag, such as `<em>`, `<a>` and/or `<strong>`, broke the whole layout. Assuming this was caused by the "allowed tags" parameter of *strip_shortcodes*, I changed the function to:               function era_excerpt_new($post, $length = 11, $ext = ' ..') {         if(is_int($post)) { $post = get_post($post); } elseif(!is_object($post)) { return false; }         if(has_excerpt($post->ID)) { $the_excerpt = $post->post_excerpt; } else { $the_excerpt = $post->post_content; }         $the_excerpt = strip_shortcodes(stripslashes($the_excerpt));         $the_excerpt = preg_split('/\b/', $the_excerpt, $length * 2+1);         $excerpt_waste = array_pop($the_excerpt);         $the_excerpt = implode($the_excerpt);         $the_excerpt .= $ext;         $post = $post->ID;              return apply_filters('the_content', $the_excerpt);     }      Sadly, this has not prevented users from breaking the layout whenever they start* _º_ * a post-type's content with (and probably other tags I am not aware of). **º** I say _start_ because, so far, adding tags in-between text has not broken anything. **My question is** , how can I allow my users to use any tag they want when publishing a post-type, and echo the contents of it without breaking my site. Thank you!


Is it possible to work on localhost but have the upload folder linked remotly for dev?

I would like to develop my website locally on my computer WAMP server but the thing is that all images and stuff are on the remote server in the uploads folder. Is there a way to work locally for files and link the upload folder to the remote server for media content ? Maybe a vhost setting or something like that.


How to share repeated fields across multiple pages?

I am loving the ACF (Advanced Custom Fields) plugin repeater field but I have two pages in my WordPress site that have sections which share exactly the same data. Obviously one of the key aspects of a CMS is that when such a situation as the one above arises, the client should only have to update that shared data in one place. I'm wondering how I can do this though? I have found the below:               <?php     $include = get_pages('include=120' );     $content = apply_filters('the_content' ,$include[0]->post_content);     echo $content;     ?>      This works for 'the_content' but I am not sure how to substitute it for my repeater field data which looks like this:               <?php           if( get_field('treatments' ) ): ?>          <?php      $i = 0;     while( has_sub_field('treatments' ) ):      $i++;     ?>          <div class="treatments" id="treatment-<?php echo $i; ?>">          <img src="<?php the_sub_field('image' ); ?>"  />     <?php the_sub_field('description' ); ?>     <a href="<?php the_sub_field('link' ); ?>">Read More >
           <?php endwhile; ?>          <?php endif; ?>


Why is contact form not working?

I am using a custom contact form plugin from code.tutsplus but it is not working. It looks as if the form is sent because I get the confirmation badge, although I receive no email (I have tried different email adresses as well). I am thinking it could perhaps be my host? Not even contact form 7 is working. Although they have made a special plugin to make contact form work on their host.... Than I thought it was my theme or my other plugins but when I have tried on a different site with twenty twelve and almost no other plugins activated! What else could it be?