Trigger custom action when setting button pressed

This is my first wordpress plugin and I'm running a lot of trouble making it work, it almost work fine but I don't find a way to accomplish this specific thing. Basically I've my custom setting page for my plugin, it saves all with no trouble at all, but the question its, how can I can my other button (inside the same setting page) to trigger, in this case, a sync action. Because my plugin after configured it trigger another action that create/update records on a table, but the first time I need to run a sync to create/update the records from the old posts of the wordpress. **Edit:** Plugin source code on wsd-parse-api.


Help needed renaming custom post

I really have very little Wordpress knowledge and I need help with the following: I have a theme which uses a custom post called 'services'. I needed another custom post created which worked exactly the same as services so I went through all the code and copied and pasted wherever I found references to services and changed it to "signage". This worked ok, however on the WP admin screen, "signage" is called "posts" as is the original "posts", and I cant work out how to change the name to signage. I have been able to change the original "posts" name but not the custom post.


Get foreach for meta_query value

How can i get meta_box foreach value inside meta_query value, here is code:               $my_id = get_post_meta(get_the_ID(), "artist_name", true);     $artistNames = array();       foreach($my_id as $id) {         $artistNames[] = $id;     }     $artists = implode($artistNames,", ");          $args = array(         'post_type' => array ( 'songs', 'videos' ),         'meta_query' => array(             array(                 'key' => 'artist_name',                 'value' => array( $artists )             )         )     );          $query = new WP_Query($args);      do this possible ?!


Why is multisite site address restricted to [a-z] and [0-9]?

I don't have much history with WP - I've never used single site, and have just a few months using subdirectory MultiSite under 3.7.1 and 3.9. The first item on the network admin screen to add a new site is labeled "Site Address" with a fixed value consisting of the concatenation of the values of DOMAIN_CURRENT_SITE and PATH_CURRENT_SITE, followed by an input box that says 'Only lowercase letters (a-z) and numbers are allowed.' And indeed, the screen enforces that restriction. But I've used the NS Site Cloner plugin to create a couple of template sites with names containing underscores and had no problems with them. Am I courting disaster down the road? To the minimal extent that I've browsed core sources and seen urls, I can't imagine why underscores (or minus signs) are prohibited. Does anyone know the reason for this? The restrictions make it somewhat difficult to distinguish special-purpose sites (e.g. template sites, technical support site, etc) from ordinary sites created by/for users of the network. BTW, I note that I can edit a site after creating it under the Draconian alphabet, and in the Info tab I can change the Path field to contain minus or underscore characters, leave the boxes checked to update the siteurl and home, and it works fine.


Custom post type hierarchical loop in Homepage

I read this: Display posts of custom type in hierarchical order But didn't understand if and how to use the answer. This what i would like to achieve: if_user_logged_in show user's created cpost in hierarchical order Is it possible to list custom posts in Homepage with this structure? ![enter image description here](http://i.stack.imgur.com/CyRPq.png) No problems in backend: ![No problems in backend](http://i.stack.imgur.com/TAxom.png) Customer 1 (parent) the_title() - the_permalink() - edit_post_link()   * Item 1 belongs to Customer 1 Children of Customer 1 the_title() - the_permalink() - edit_post_link()   * Item 2 belongs to Customer 1 Children of Customer 1 the_title() - the_permalink() - edit_post_link()   * Item 3 belongs to Customer 1 Children of Customer 1 the_title() - the_permalink() - edit_post_link()   * Item 4 belongs to Customer 1 Children of Customer 1 the_title() - the_permalink() - edit_post_link() Customer 2   * Item 1 belongs to Customer 2 Children of Customer 2 the_title() - the_permalink() - edit_post_link()   * Item 2 belongs to Customer 2 Children of Customer 2 the_title() - the_permalink() - edit_post_link()   * Item 3 belongs to Customer 2 Children of Customer 2 the_title() - the_permalink() - edit_post_link()   * Item 4 belongs to Customer 2 Children of Customer 2 the_title() - the_permalink() - edit_post_link() And so on, I think you have the point :) This is how I registered my cPost:               /*Custom post clienti */     add_action( 'init', 'register_cpt_cliente' );          function register_cpt_cliente() {              $labels = array(              'name' => _x( 'Clienti', 'cliente' ),             'singular_name' => _x( 'Cliente', 'cliente' ),             'add_new' => _x( 'Aggiungi nuovo', 'cliente' ),             'add_new_item' => _x( 'Aggiungi un nuovo cliente', 'cliente' ),             'edit_item' => _x( 'Modifica cliente', 'cliente' ),             'new_item' => _x( 'Nuovo client', 'cliente' ),             'view_item' => _x( 'Guarda cliente', 'cliente' ),             'search_items' => _x( 'Cerca cliente', 'cliente' ),             'not_found' => _x( 'Nessun cliente trovato', 'cliente' ),             'not_found_in_trash' => _x( 'Nessun cliente eliminato', 'cliente' ),             'parent_item_colon' => _x( 'Cliente superiore:', 'cliente' ),             'menu_name' => _x( 'Clienti', 'cliente' ),         );              $args = array(              'labels' => $labels,             'hierarchical' => true,             'description' => 'Un archivio per gestirli tutti (Cit.)',             'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'page-attributes' ),             'taxonomies' => array( 'category', 'post_tag', 'page-category', 'abruzzo', 'basilicata', 'calabria', 'campania', 'emilia-romagna', 'friulli-venezia-giulia', 'lazio', 'liguria', 'lombardia', 'marche', 'molise', 'piemonte', 'puglia', 'san_marino', 'sardegna', 'sicilia', 'toscana', 'trentino-alto_adige', 'umbria', "valle_d'aosta", 'veneto' ),             'public' => true,             'show_ui' => true,             'show_in_menu' => true,             'menu_position' => 5,             'menu_icon' => get_template_directory_uri().'/images/cli20.png',             'show_in_nav_menus' => true,             'publicly_queryable' => true,             'exclude_from_search' => false,             'has_archive' => true,             'query_var' => true,             'can_export' => true,             'rewrite' => true,             'capability_type' => 'post'         );              register_post_type( 'cliente', $args );     }      This is my loop that, obviusly works but has no hierarchical structure:               <?php if ( is_user_logged_in() ) {;?>
             <?php global $current_user;                 get_currentuserinfo();                 $idutente = $current_user->ID;                 $loop = new WP_Query( array(                     'post_type' => 'cliente',                    'posts_per_page' => -1,                    'author' => $idutente)                  );?>
                      <?php if (have_posts()) { ?>                 <?php while ( $loop->have_posts() ) : $loop->the_post();?>

                                 <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">                                     <?php the_title(); ?><?php edit_post_link('Edit', ' | ', ''); ?>

                     <?php endwhile;                 }else{echo 'No posts here';};?>

     <?php };?>


help me about my slide bar

i my website them has a sildeshow in this slideshow show 5 newsest post! i need chane newpost to a Specific catagory for exp news catagory? my slideshow code is:

         <?php     $the_query = new WP_Query(array('order' =>'descending','orderby' =>'ID','posts_per_page' =>'5'));        while ($the_query->have_posts()) : $the_query->the_post(); ?>
           <?php     if ( has_post_thumbnail() ) {     the_post_thumbnail('large');     }     else {     echo '';     }     ?>
             <?php the_title(); ?>

         <?php endwhile; ?>         <?php wp_reset_query(); ?>

      plz help me soon! tnx alot


wordpress localization extending

I am using a .mo file in my language directory of wp-content. But It doesn't trnslate some words and all the numerical contents of the site. How can I add these to the .mo file? Or is there any other way to translate those contents?


How do you add thumbnail support for custom post types?

the thumbnail support is working for post, but I have another post type called product and it is not working for this. I am trying: `add_theme_support( 'post-thumbnails', array( 'post', 'product' ) ); `I am also using the multiple post thumbnail plugin.


Custom view counts not updating correctly

I'm trying to add some custom views/filters to the list of posts for a custom post type in the admin. However, the query that counts the number of posts is updating the number of posts for all filters at once, only if I am on one of those custom filters. This is how I've set up the query that gets the number of posts:               add_action( 'views_edit-movies', array($this, 'custom_views') );     public function custom_views($views) {         //$directors is a valid array returned from seperate function, removed for clarity         foreach ($directors as $key => $value) {             $director = $value;             $query = array(                'post_type' => 'movies',                'meta_key' => 'director',                'meta_value' => $director             );             $result = new WP_Query($query);                  $class = ($wp_query->query_vars['meta_value'] == $director) ? ' class="current"' : '';             $views["$director"] = sprintf(__('' . $director . ' (%d)'),             admin_url('edit.php?&post_type=movies&director='.$director),             $result->found_posts);         }//end foreach     }       This works fine if I am on the "All", "Published", or "Trash" default views, and each director filter has the correct number of posts on those views. When I then click on a director, all other directors have the same number of posts as the one as I am currently on. Is this because I'm assigning the views within a foreach loop, based on a variable? Or because I'm changing the query to display the view with the code below? Here is the code that actually displays the views:               add_action( 'pre_get_posts', array($this, 'filters') );     public function filters($query)     {         if ( isset($_GET['director']) ) {             $query->set( 'meta_key', 'director' );             $query->set( 'meta_value', $_GET['director'] );         }         return $query;     }


Plugin with custom domain

OK I will try to explane my problem better. What I need to do is to create a kind o service for my WordPress. From some external web sites I like to send some data to my main WordPress web site through the URL. Lets say I have the web site http://www.mysite.ext/ On mysite.ext I will install my plugin. Some external web sites can send my ocasionaly some data by a URL (ie: http://www.mysite.ext/getdata/data_are_here/) In that case my plugin must recognize a query variable from the URL and analize the data Note: It is not important to return any information to the external web sites. Just I have to collect the inrormation and process it.


How to use the <form method=GET> in WP

I have a page that shows a products list. I need that when a user click on a product image a product page is shown. If I use this in my form:               $retval .= '<form method=post action="'. str_replace( '%7E', '~', $_SERVER['REQUEST_URI']).'">';      and               $retval .= '<input type="hidden" name="fcf_getClubDetails" value="Y">';      I can then catch the action using                if($_POST['fcf_getProdDetails'] == 'Y') {        When i try to switch to the GET method, just changing POST to GET does not work. I see the parameter are passed to the URL but I don't know how to set the correct URL, because I'm sent back to the home page. Thanks


New Genesis child theme or revise current Genesis child theme

I've been asked to make some fairly significant changes to our web site, but the site will overall have the same feel. I'm wondering if I should modify the current customized Genesis child theme, or if I should create a new child them. Any thoughts?


Different rewrite rules for taxonomies and cp in multisite?

I´m making a multilingual site with multisite and I`m wondering if you can specify different rewrite rules for taxonomies and custom posts for the different sites, that are using the same theme. Maybe check if a certain subdomain is used and then use different rewrites? Suggestions?


Warning/Error in Admin Panel while developing theme

I am developing a theme for my website. As soon as I activated the theme, the following errors/warnings shows up on the top of the admin panel on every page.               Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method WPEditorAdmin::removeDefaultEditorMenus() should not be called statically in C:\Users\...\wp-includes\plugin.php on line 406          Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method WPEditorAdmin::buildAdminMenu() should not be called statically in C:\Users\...\wp-includes\plugin.php on line 406          Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method WPEditorAdmin::addThemesPage() should not be called statically in C:\Users\...\wp-includes\plugin.php on line 406          Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method WPEditorAdmin::editorStylesheetAndScripts() should not be called statically in C:\Users\...\wp-includes\plugin.php on line 406      I am wondering how do I solve these errors and not have this happen anymore? Here's a screenshot. ![enter image description here](http://i.stack.imgur.com/2VEFh.png)


How do I add a custom post type to the Featured Content in twenty fourteen theme?

This wpmudev post sums up my feeling exactly about twenty fourteen: > Featured Content does not support custom post types – only posts are > selected even if the custom post type supports the Tags taxonomy I've added two CPT that share a custom taxonomy. I've tried tagging them without any luck, looked at `inc/featured-content.php`,`js/slider.js` and `functions.php`. How can I add these post types so they display in the Featured Content slider on homepage? related QA on WPSE


Can this be done? Create 50x50 thumbnails of all existing featured images?

Just trying to get a scope of work estimation for a project I need done. My wordpress theme has a custom menu that works best with featured image thumbnails that are 50x50 pixels in size. If the user builds their site after installing my theme, its no problem, since I'm ensuring that all uploads create a 50x50 thumbnail image. However, if the user installs my theme into an existing site, I have no way of knowing what size their thumbnails are. Is it possible to create a loop over the thumbnails and do this?


When in a archive, display the posts by hierarchical taxonomy term.

All of my posts belong to hierarchical taxonomy (a) but not all belong to taxonomy (b) and (c). How would one go about displaying the list of posts in any archive in a manner of taxonomy (a)'s hierarchical structure. For instance, instead of an archive listing:   * post   * post   * post   * post I want collapsible menu list of the posts of the archive to be in taxonomy (a)'s structure such as the following:   * Taxonomy Term      * Post   * Taxonomy Term (Parent)      * Taxonomy Term (Child)        * Post    * Taxonomy Term (Parent)      * Taxonomy Term (Child)        * Post       * Post


Have Wordpress post redirect to url when accesed from iPad (Safari)

Since the Ipad doesn't work nicely with issuu I'm trying to set up a system where if users would acces one of my blog post from an ipad device they get redirected to the a pdf file which is on my server. For this I'm guessing I would have to include some kind of HTML code at the beginning of each post. However I'm not familiar with HTML. Is it possible to redirect visitors from my wordpress blog based on their browser (safari) or device (iPad)? It tried this but it didn't work:                     Hope you guys can help!


Can't login after my site was moved to a new server

I'm working on a site which is not attached to a domain name yet, so I access to it through an ugly URL like old_server.something.myprovider.co.uk/.../.../ My provider moved me to a new server so I now have to type : new_server.something.myprovider.co.uk/.../.../ Problem is, when trying to access wp-admin, WordPress performs some sort of redirection to the old address and of course it doesn't work anymore. So I can't access the login page. Is there a way to change the server URL in WordPress without accessing the dashboard ?


How to keep a textarea and stop tinymce?

If I run this code then I no longer get the toolbar but I still get a word count and visual/html tabs and when I save the post my content gets wrapped in <\p> tags.               jQuery(document).ready(function() {         jQuery('#content').removeClass('theEditor').addClass('mceNoEditor');              tinyMCE.init({           mode: "none",           editor_deselector : "mceNoEditor"               });      What is the correct way to keep a textarea and not let tinymce override it?


Uploading files using the Settings API

I've used the Settings API in the past to output text inputs and checkboxes but am unsure if I can use file inputs. My add_settings_field() is:               add_settings_field( '1', 'File 1', array( $this, 'my_callback' ), 'files', 'files' );      My callback function:               public function my_callback() {              echo '<input type="file" name="file" />';     }      I assume the next step is to handle the image upload. My problem is how do I do this using the Settings API? I am aware I can set a callback function as the 3rd parameter in register_setting() so my guess is I can use wp_handle_upload() in that callback. I'm looking for some guidance or confirmation that this is the approach I should take. Thanks in advance.


Creating new blog on multisite programatically without hacks?

I'm attempting to create a new blog ( on localhost testing ) and I can't seem to find a straightforward way to do it. It appears this is not fully supported yet, but I want to make sure. This is what I have:               wpmu_create_user( 'new_user', 'somepass', 'someone@url.com' );     global $user_id, $current_site;          wpmu_create_blog( $current_site->domain, 'test-1', 'This is a test...', $user_id , array( 'public' => 1 ), $current_site->id );      Yet when I look at the site created in the admin area, the link is to some butchered version of the url like httplocalhostwpinstallthenewsite Can't figure it out :D Of course the web is presently filled with all sorts of workarounds (I know this comes with wp-multisite territory) but I'm just double checking that there is not a supported way to pragmatically create a blog without hacks.


Taxonomy with_front causes all

I have a custom taxonomy, which sets the with_front to false to try and get the URLs to look like `/%type%/%brand%/%product%/`, degrading as we go down. This however is driving me nuts. Everything in the code works, this works, but it causes every other page on the site to 404. I'd imagine the reason is something like with_front makes it think all requests are for elements of this taxonomy. But I can't work out how to fix it. Just FYI, make labels is my lazy function that produces the labels we require for this.               register_taxonomy ('types','brands',        array(            'hierarchical' => false,            'labels' => make_labels('Type'),            'show_ui' => true,            'query_var' => true,            'rewrite' => array( 'with_front' => false, 'slug' => false)        )     );          $types = get_terms('types');          foreach($types as $type) {         add_rewrite_rule("^$type->slug/([^/]*)/([^/]*)/?","index.php?hd_types=$type->slug&brands=\$matches[1]&products=\$matches[2]",'bottom');         add_rewrite_rule("^$type->slug/([^/]*)/?","index.php?brands=\$matches[1]&types=$type->slug",'bottom');     }      Then we create the custom post types brands and products. Driving me nuts! Thanks in advance.


Buddypress Followers

how to identify the current_user is following displayed_user , by means o the user_id or something with the Buddypress followers plugin               if(following(current_user, displayed_user))     { /*do something*/ }


What's the difference between home.php and index.php?

If I create a home.php file, it seems that WP will use that instead of index.php, so index.php is never used? What are the differences between these two template files (located in the theme folder)? Do they both behave the same way, the only difference being the priority of home.php?


How can i display category title over thumbnail?

I am trying to implement a slider on my site but i cannot find out how to display the category for each post displayed. I want it to display over the thumbnail. is there a code i can enter to display category?


Plugin to host auctions on your site

Hello what free plugins are for hosting auctions on your site. I saw wp- auction but i want the auction to be embedded in a page.


Paid member plugin with some specific features

I was wondering if anyone knew of a paid membership plugin that streamlined the peyment/registration process into a single step. Ideally there would be a signup page. This page would have the typical fields (email address, possibly a user name and password) as well as the paypal button (only active when all required fields are filled). I want the new user to be able to enter their info, then go straight to paypal to pay, then upon payment confirmation (via IPN) the plugin would create the user ID and send a confirmation link to the email address entered. The biggest problem I had with the plugins I tried (S2Memeber, Members) was the fact that users had to first create an account, then subsequently purchase a membership. It was causing a lot of confusion, very few users actually went through the whole process without emailing the site for help. Many thought there was a problem when the account creation page had no payment options and emailed for support. I can try to work around it by offering more instructions on the account registration page, but ideally I'd like to consolidate these two steps into a single process. The plugin doesn't need to manage content restrictions, I can handle that myself. All I want is an automated system for user/payment management that will automatically demote users when there subscription lapses or payment fails.


Pagination doesn't work for home page custom post type query

I've spent hours trying to figure this out, tried TONS of different methods and all failed in their own way. What I'm trying to do: Limit home page custom post types (woo_estate) to 6 and then paginate the rest. What happens: Not only the home page custom post types don't get limited, no pagination is added. Current template code that loads in home page: http://codepad.viper-7.com/oVYI4D


Can't find link to add content to pages

I'm new to wordpress and I'm facing a problem. On one site I'm using wordpress v3.5.1 and I am using links in the sidebar to add content and images to several pages: ![Left sidebar with links](http://i.stack.imgur.com/31VRk.png) As you can see on the left I have: Dagaanbieding, Winkels, Outlets, Assortiment. This site was made by another guy, so I don't know how it's made exactly. Now I've installed a new wordpress (3.8.1) and Copied the files over because the website has to be the same. I've already exported and imported the contents and pages from the other website, but there are no links (Dagaanbieding, Winkels, Outlets, Assortiment) in the left sidebar. How do I create them? ![left sidebar with links 2](http://i.stack.imgur.com/AoJON.png) Hopefully it's not a big problem. EDIT: First website (wordpress 3.5.1) Activated: >   * Advanced custom fields >   * Contact form 7 >   * Cookie control >   * Dashboard widget sidebar >   * Easy WordPress Mailchimp Integration >   * Social media widget >   * Super RSS reader >   * Types - Complete Solution for Custom Fields and Types >   * Twitter Widget > Deactivated: >   * Child Pages Shortcode >   * Featured Post > Second website (wordpress 3.8.1) Activated: >   * Advanced Custom Fields >   * Social Media Widget >   * Super RSS Reader >   * WordPress Importer > Deactivated: >   * Hallo Dolly >   * Child Pages Shortcode >   * Attachment Files Importer >   * Akismet > NOTE: I had Dashboard widget sidebar installed, but then I got an error with some kind of foreach loop in the plugin. When I disabled it, the error was gone.


Replace taxonomy term with an image in a custom loop

Just as the title says i want to replace the term from a custom taxonomy with an image, but **only in one custom loop** and not in the main loop. So i have a custom taxonomy named Tax1 that has two terms: Term1 and Term2. I use the following code to list the terms (i.e. Term1 or Term2) in the main loop: `echo get_the_term_list( $post->ID, 'Tax1', ' ', ', ', '' );` But for my custom loop i would like to have **an image** instead of the text term. I think this should be possible but i'm no good with php. **So how can i achieve this?** Thanks!!!


Post reviews about post/pages on google plus by own site

I want to post review/rating about post/pages on google plus. I want a button on our site so that i can submit rating/review from our site. If user is not login then must be login through google plus and then able to post review, I have tried author hreviews, rich-reviews but nothing happend. Please suggest some option, i will complete this from our side.. Please help


How do I enable Multisite on WP 3.7.1?

(Using Wordpress 3.7.1) Adding the string `define(‘WP_ALLOW_MULTISITE’, true);` to my `wp-config.php` file isn't giving me the 'Network' choice in the Tools menu, even after multiple logouts and waiting a bit. I didn't anticipate ever needing this feature, but...well..ya know. Can anyone help me out with this? I can't seem to find anything helpful. There are lots of tutorials, but they all seem to pretty much say the same thing. Thx! -C


Previous and Next Post link doesn't work

In single.php I tried to add inside the loop the `previous_post_link` and `next_post_link`. But nothing is rendered when a view the source of the site. I added the `previous_post_link` inside an `h4` tag to see it better. Normally I'll add it in `pagination-bottom`. Why is this happening? Here is my code                   <?php if (have_posts()) : ?>         <?php while ( have_posts() ) : the_post(); ?>

                         <?php the_post_thumbnail('news-thumb-single-post') ?>

<?php echo get_the_title(); ?>

<?php echo get_the_date(); ?>

<?php the_content(); ?>

<?php previous_post_link('%link', 'Pre Post', TRUE); ?>

                     Προηγούμενο

Επόμενο

            <?php endwhile; ?>     <?php endif; ?>


Link to custom WP_Query page

Is it possible to get link to the page which display all posts from the custom WP_Query class? I have tried `http://domain.com?post_type=post&сat=5&tag=discount` and for some parameters it really works, but I could not understand how wordpress choose templates for such pages.


How to calculate total number of comments made by a particular user

When I use the following custom query               $wp_comments = $wpdb->get_results("SELECT COUNT(*) FROM wp_comments WHERE userid=$userid")      If I use               print_r(wp_comments)      I get the following printed               Array ( [0] => stdClass Object ( [COUNT(*)] => 10 ) )       10 is the count I am expecting, how to print out the value? Is there any other way to get the number of comments made by the user on the whole site?


How to insert multiple checkbox values into post as custom fields from frontend

I need to use a form in the front-end that allows people to post. I have tried to keep the minimum code in order to focus only on the issue (mentioned below) at hand. **EXAMPLE FORM** :                   <form method="POST" id="test_form" name="test_form" enctype="multipart/form-data" action="">
LOCATION : <input type="text" name="location" id="location"/>

CHECKBOXES :               <input type="checkbox" name="fruits[]" value="orange"/>Orange
              <input type="checkbox" name="fruits[]" value="apple"/>apple
              <input type="checkbox" name="fruits[]" value="banana"/>banana
           <input type="hidden" name="action" value="post_action" />      <input type="submit" name="submit" id="submit" value="PROCEED"/>      **EXAMPLE PROCESSING** :               if( 'POST' == $_SERVER['REQUEST_METHOD'] &&  !empty( $_POST['action'] ) && $_POST['action'] == "post_action") {              if (isset($_POST['submit'])) {             $error = "";                  if ($_POST['location'] != null) {             $location = trim(strip_tags($_POST['location']));             } else {             $error .= 'Put location.
';             }                    }                       $fruits= $_POST['fruits'];                  if (empty($error)) {                $new_post = array(   //insert form inputs, set var and define array             'post_title'    =>  $location,              'post_content'  =>  $description,             'post_status'   =>  'draft',             'post_author'   =>  '2',             'fruits'        => $fruits,             'post_type'     => 'post'               // assigning tags and categories are no issue             );                  $pid = wp_insert_post($new_post);              //ADD OUR CUSTOM FIELDS          add_post_meta($pid, 'fruits', $fruits, false);                                        }      }      **THINGS TRIED** : I have searched a lot on net, results were either overly complex or too project-specific. Also most of the results in this forum search came out related either to custom-post-types, custom fields or meta-boxes only. I now have a partial solution though. I have followed this tutorial and was able to get a single custom-field key-value pair in my post by using `add_post_meta($pid, 'fruits', $fruits, false);`. **ISSUE** : So basically what I am looking is to get **all the values** of the checkboxes, _whichever is ticked_. I shall greatly appreciate any solution suggested in an uncomplicated manner. Thanks.


Get plugin directory from a theme

Does anyone know a non-hacky way of getting the plugin directory path from within a theme's functions.php? I've used plugin_dir_path( **FILE** ), but because its called in the theme's functions.php it returns the path to that file. Not the plugins directory. I could string manipulate it and add the plugins path, but that feels nearly as bad as hardcoding the whole path. I have got it working using:               require_once( ABSPATH .'/wp-content/plugins/ehu-events/event-widget.php' );      But I know that's so oldschool and wrong and I'd probably be shunned from the wordpress community for using it! Is there a standard wordpress function I can use for this?


Letting users sort posts

I'd like to create a page for filtering posts based on a number of criteria. I can work with wp_query and deliver posts quite easily, my problem is that I can't figure out (nor can i find any answers online about this, believe me I looked) how to let users do this. Take this for example, returns the posts in order of price (custom field meta value)from highest to lowest with 33 posts.               <?php           $featuredPosts = new WP_Query( array(     'posts_per_page' => 33,        'meta_key'=>'Price',          'orderby' => 'meta_value_num',         'order' => DESC     ) );           ?>          <?php if ( $featuredPosts->have_posts() ) : ?>          <?php while ( $featuredPosts->have_posts() ) : $featuredPosts->the_post(); ?>          <article <?php post_class('item-post block'); ?> id="post-<?php the_ID(); ?>">     <h2 class="price-title"><?php the_title(); ?> </h2>          </article> <!-- end div post -->          <?php endwhile; wp_reset_query(); ?>          <?php endif; ?>      Now, even after reading and googling, I'll be god damned if I can figure out how I'd implement this on the front end for users to filter posts. I mean, I know you can append URL's in wordpress to alter the order of posts, but in this context I'm totally lost. What I'm trying to achieve is actually quite simple as well, let the user choose the category, choose the price range (guessing I'd write something in jquery to deliver a value into an field), set the number of results they'd like to be returned. I've tried googling EVERYTHING under the sun I can think of for this, no dice.


User unable to see a scheduled post via the url?

My users aren't able to see scheduled posts. Instead they get shown a `404` error. I'd like to show scheduled posts as well.


Replace query_posts with pre_get_posts

I have a static front page that checks if the user is logged in, and if he/she is a number of x posts from a specific category is displayed. For that I was using this code:               query_posts('cat=2&showposts=5'.'&orderby=date&order=desc');     while (have_posts()) : the_post();     the_content();     endwhile;      Now I found out that's not right to use `query_post` and that I should use `pre_get_posts` instead. I've tried to do this but somehow my page breaks down saying that my server is configured incorrectly.


Trouble understanding apply_filters()

In apply_filters()               apply_filters( $tag, $value, $var ... );      I'm having trouble wrapping my head around the `$value` and `$var`. I read the codex and it sounds like the `$value` can be modified, `$var` not, but I haven't found any examples of this in the wild. It seems to be used as a way to pass a variable. In which case, what's the difference between that and the `$var`?


Call to undefined function error after adding add_filter to wp-config

I am getting               Fatal error: Call to undefined function add_filter() in example.com/wp-config.php on line 20      after adding               add_filter( 'auto_update_plugin', '__return_true' );      to wp-config.php My plugins.php file is present and add_filter() is defined inside of it. I just want to enable automatic updates for core, plugins and thems. What am I doing wrong?


Display posts from a category

I am trying to display a bunch of posts from a single category on the category page, using multiple loops.
          <?     // assign the variable as current category     $categoryvariable = $cat;     echo($cat);     ?>               <?php query_posts('$cat'); ?>     <?php $posts = get_posts('numberposts=1&offset=0&category=$cat'); foreach ($posts as $post) : start_wp(); ?>     <?php static $count1 = 0; if ($count1 == "1") { break; } else { ?>

<?php echo get_the_date('d.m.Y'); ?>

<?php the_terms( $post->ID, 'regions' ,  ' ' ); ?>

<?php the_category(', ') ?>

                 <?php if(has_post_thumbnail()) :?>
                     <?php the_post_thumbnail( 'featured-image', array( 'class' => 'featured-image' ) ); ?>
                 <?php else :?>                 <?php endif;?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
                 <?php the_excerpt();?>
          <?php $count1++; } ?>     <?php endforeach; ?>      What am I doing wrong as its not displaying the articles for the category page I am on.


Conflict in the urls of Taxonomy and Post Type

I have added a Custom Post Type "Review" with this code:               //     // Review post type related functions.     //          add_action( 'init', 'ci_create_cpt_review' );     if( !function_exists('ci_create_cpt_review') ):     function ci_create_cpt_review()     {         $labels = array(             'name' => _x('Reviews', 'post type general name', 'ci_theme'),             'singular_name' => _x('Review Item', 'post type singular name', 'ci_theme'),             'add_new' => __('New Review Item', 'ci_theme'),             'add_new_item' => __('Add New Review Item', 'ci_theme'),             'all_items' => __( 'Tous les tests', 'ci_theme' ),             'edit_item' => __('Edit Review Item', 'ci_theme'),             'new_item' => __('New Review Item', 'ci_theme'),             'view_item' => __('View Review Item', 'ci_theme'),             'search_items' => __('Search Review Items', 'ci_theme'),             'not_found' =>  __('No Review Items found', 'ci_theme'),             'not_found_in_trash' => __('No Review Items found in the trash', 'ci_theme'),              'parent_item_colon' => __('Parent Review Item:', 'ci_theme')     );              $args = array(             'labels' => $labels,             'singular_label' => __('Review Item', 'ci_theme'),             'public' => true,             'show_ui' => true,             'capability_type' => 'post',             'hierarchical' => false,             'has_archive' => true,             'rewrite' => array('slug' => 'tests'),             'menu_position' => 5,             'supports' => array('title', 'editor', 'thumbnail', 'comments', 'author', 'excerpt')         );              register_post_type( 'review' , $args );          }     endif;      Custom Taxonomy "Genre"               //     // Include all custom post types here (one custom post type per file)     //     add_action('after_setup_theme', 'ci_load_custom_post_type_files');     if( !function_exists('ci_load_custom_post_type_files') ):     function ci_load_custom_post_type_files()     {         $cpt_files = apply_filters('load_custom_post_type_files', array(             'functions/post_types/review'         ));         foreach($cpt_files as $cpt_file) get_template_part($cpt_file);     }     endif;               add_action( 'init', 'ci_tax_create_taxonomies');     if( !function_exists('ci_tax_create_taxonomies') ):     function ci_tax_create_taxonomies() {         //         // Create all taxonomies here.         //         $labels = array(             'name' => _x( 'Genres', 'taxonomy general name', 'ci_theme' ),             'singular_name' => _x( 'Genre', 'taxonomy singular name', 'ci_theme' ),             'search_items' =>  __( 'Search Genres', 'ci_theme' ),             'all_items' => __( 'All Genres', 'ci_theme' ),             'parent_item' => __( 'Parent Genre', 'ci_theme' ),             'parent_item_colon' => __( 'Parent Genres:', 'ci_theme' ),             'edit_item' => __( 'Edit Genre', 'ci_theme' ),              'update_item' => __( 'Update Genre', 'ci_theme' ),             'add_new_item' => __( 'Add New Genre', 'ci_theme' ),             'new_item_name' => __( 'New Genre Name', 'ci_theme' ),         );           register_taxonomy(             "genre",              array('review'),              array(                 "hierarchical" => true,                  "labels" => $labels,                 'rewrite' => array('slug' => 'tests'),             ));          }     endif;      I have tried to have : `www.website.com/tests/name-of-reviews` **AND** `www.website.com/tests/name-of-genre`, with never same name of reviews/genre. After updated the permalink in the WordPress admin. I have a 404 Error in all reviews :/. It is sincerely possible to have same rewrite url for the Custom Post Type **and** his Custom Taxonomy ?


Pingback is not working

I'm currently testing the blog post I'm currently working on. I'm trying to link the post. The problem here is that the pingback is not working when I post the link to the test site (aaaatemplate). I have to make the pingback work so that I can use it in Discussed section here I enabled setting to allow pingback and trackback notifications on both blogs The post I'm trying to link is a custom post type named 'paper'. I used Custom Post Type UI UI plugin and set the setting


Cannot control wp_nav_menu properly

I'm having a little issue which looks like a bug but probably isn't. Here we go: I simply have this:               <?php wp_nav_menu( array('theme_location' => 'primary', 'container' => false, 'menu_class' => 'nav')); ?>      Now, my issue is that I expect my output to be:

My link

      instead I'm getting:

My Link

      I can't assign my nav class to the ul. How do I do that? Many thanks!


Custom search using custom fields, post type, and custom taxonomy

> **Possible Duplicate:**   >  Include custom taxonomy term in search I need to create a search on a certian post type and then be able to have a checkboxes and dropdowns to search custom fields and custom taxonomies (categories and tags). I have started off by creating a form that has a field in it that when sent i use that to filter the search. So far i can get it to search just that one post type but i do not know how to do multiple custom fields or how to search the taxonomies. Can anyone help?


Is calling function_exists() faster or slower that apply_filters() ... or is the difference so small that it should not be considered? I did a bit of testing based on Kaiser's and it showed that function_exists() is ~3 times faster where both the function and filter exist. and ~11 times faster if the filter does not exist. Was not expecting this.               function taco_party() {         return true;     }          add_filter( 'taco-party', 'taco_party' );          timer_start();     for ( $i = 0; $i < 1000000; $i++ )  {         $test = apply_filters( 'taco-party', '' );     }     echo( 'Seconds: ' . timer_stop( 0, 10 ) . '
' );          timer_start();     for ( $i = 0; $i < 1000000; $i++ )  {         if ( function_exists( 'taco_party' ) ) {             $test = taco_party();         }     }     echo( 'Seconds: ' . timer_stop( 0, 10 ) . '
' );      Bear in mind that this is running each method 1,000,000 times which is quite a lot. Each method ran once completes very, very quickly:               Test 1: 0.0000491142     Test 2: 0.0000140667      I would conclude that the difference is not an issue.


Sitemap Plugin for WordPress Network

Is there a plugin similar to the Google Sitemap plugin that works for a mutli- site install?


custom field in admin columns

Im trying to understand how to get the custom field incr_number into admin columns. However im failing to understand and im googling but not finding a direct answer. It cant be that hard surly?                  <?php                  /*-----------------------------------------------------------------------------------*/        /* WooThemes supportpress Custom Post Types Init */        /*-----------------------------------------------------------------------------------*/            function woo_supportpress_post_types_init() {              add_option('tickets_slug', 'tickets');           register_post_type( 'ticket',         array(             'label' => __( 'Ticket', 'woothemes' ),             'labels' => array(                 'name' => __( 'Tickets', 'woothemes' ),                 'singular_name' => __( 'Ticket', 'woothemes' ),                 'all_items'   => __( 'All Tickets', 'woothemes' ),                 'add_new' => __( 'Add New', 'woothemes' ),                 'add_new_item' => __( 'Add New Ticket', 'woothemes' ),                 'edit' => __( 'Edit', 'woothemes' ),                 'edit_item' => __( 'Edit Ticket', 'woothemes' ),                 'new_item' => __( 'New Ticket', 'woothemes' ),                 'view' => __( 'View Tickets', 'woothemes' ),                 'view_item' => __( 'View Ticket', 'woothemes' ),                 'search_items' => __( 'Search Tickets', 'woothemes' ),                 'not_found' => __( 'No tickets found', 'woothemes' ),                 'not_found_in_trash' => __( 'No tickets found in trash', 'woothemes' ),                 'parent' => __( 'Parent Tickets', 'woothemes' ),             ),             'description' => __( 'This is where you can create new tickets for your site. Tickets can also be created from the front-end.', 'woothemes' ),             'public' => true,             'menu_position' => 4,             'show_ui' => true,             'capability_type' => 'post',             'publicly_queryable' => true,             'exclude_from_search' => true,             'hierarchical' => false,             'rewrite' => array( 'slug' => get_option('tickets_slug'), 'with_front' => false ),             'query_var' => true,             'has_archive' => 'tickets',             'supports' => array( 'title', 'editor', 'custom-fields', 'author', 'comments' ),         )     );                    register_taxonomy( 'ticket_status',         array('ticket'),         array(             'hierarchical' => true,             'labels' => array(                 'name' => __( 'Ticket Statuses', 'woothemes'),                 'singular_name' => __( 'Ticket Status', 'woothemes'),                 'search_items' =>  __( 'Search Ticket Statuses', 'woothemes'),                 'all_items' => __( 'All Ticket Statuses', 'woothemes'),                 'parent_item' => __( 'Parent Ticket Status', 'woothemes'),                 'parent_item_colon' => __( 'Parent Ticket Status:', 'woothemes'),                 'edit_item' => __( 'Edit Ticket Status', 'woothemes'),                 'update_item' => __( 'Update Ticket Status', 'woothemes'),                 'add_new_item' => __( 'Add New Ticket Status', 'woothemes'),                 'new_item_name' => __( 'New Ticket Status', 'woothemes')             ),             'public' => true,             'show_ui' => true,             'query_var' => true,             'rewrite' => array( 'slug' => 'ticket-status', 'with_front' => false ),         )     );          register_taxonomy( 'ticket_priority',         array('ticket'),         array(             'hierarchical' => true,             'labels' => array(                     'name' => __( 'Ticket Priorities', 'woothemes'),                     'singular_name' => __( 'Ticket Priority', 'woothemes'),                     'search_items' =>  __( 'Search Ticket Priorities', 'woothemes'),                     'all_items' => __( 'All Ticket Priorities', 'woothemes'),                     'parent_item' => __( 'Parent Ticket Priority', 'woothemes'),                     'parent_item_colon' => __( 'Parent Ticket Priority:', 'woothemes'),                     'edit_item' => __( 'Edit Ticket Priority', 'woothemes'),                     'update_item' => __( 'Update Ticket Priority', 'woothemes'),                     'add_new_item' => __( 'Add New Ticket Priority', 'woothemes'),                     'new_item_name' => __( 'New Ticket Priority', 'woothemes')             ),             'show_ui' => true,             'query_var' => true,             'rewrite' => array( 'slug' => 'ticket-priority', 'with_front' => false ),         )     );          register_taxonomy( 'ticket_type',         array('ticket'),         array(             'hierarchical' => true,             'labels' => array(                     'name' => __( 'Ticket Types', 'woothemes'),                     'singular_name' => __( 'Ticket Type', 'woothemes'),                     'search_items' =>  __( 'Search Ticket Types', 'woothemes'),                     'all_items' => __( 'All Ticket Types', 'woothemes'),                     'parent_item' => __( 'Parent Ticket Type', 'woothemes'),                     'parent_item_colon' => __( 'Parent Ticket Type:', 'woothemes'),                     'edit_item' => __( 'Edit Ticket Type', 'woothemes'),                     'update_item' => __( 'Update Ticket Type', 'woothemes'),                     'add_new_item' => __( 'Add New Ticket Type', 'woothemes'),                     'new_item_name' => __( 'New Ticket Type', 'woothemes')             ),             'show_ui' => true,             'query_var' => true,             'rewrite' => array( 'slug' => 'ticket-type', 'with_front' => false ),         )     );          register_taxonomy( 'ticket_tags',         array('ticket'),         array(             'hierarchical' => false,             'labels' => array(                     'name' => __( 'Ticket Tags', 'woothemes'),                     'singular_name' => __( 'Ticket Tags', 'woothemes'),                     'search_items' =>  __( 'Search Ticket Tags', 'woothemes'),                     'all_items' => __( 'All Ticket Tags', 'woothemes'),                     'parent_item' => __( 'Parent Ticket Tag', 'woothemes'),                     'parent_item_colon' => __( 'Parent Ticket Tag:', 'woothemes'),                     'edit_item' => __( 'Edit Ticket Tag', 'woothemes'),                     'update_item' => __( 'Update Ticket Tag', 'woothemes'),                     'add_new_item' => __( 'Add New Ticket Tag', 'woothemes'),                     'new_item_name' => __( 'New Ticket Tag', 'woothemes')             ),             'show_ui' => true,             'query_var' => true,             'rewrite' => array( 'slug' => 'ticket-tag' ),         )     );                 }              add_action( 'init', 'woo_supportpress_post_types_init', 0 );                /*-----------------------------------------------------------------------------------*/      /* Admin columns for post types */      /*-----------------------------------------------------------------------------------*/           function woo_supportpress_ticket_columns($old_columns){          $columns = array(          'cb' => '<input type=\"checkbox\" />',     'title' => __('Ticket Title', 'woothemes'),     'incr_number' => __('Ticket ID', 'woothemes'),     'status' => __('Status', 'woothemes'),     'priority' => __('Priority', 'woothemes'),     'type' => __('Type', 'woothemes'),     'author' => __('Submitted by', 'woothemes'),     'assigned' => __('Assigned to', 'woothemes'),     'comments' => $old_columns["comments"],     'date' => __('Date', 'woothemes'),     );          return $columns;           }          add_action( 'custom_woo_supportpress_ticket_columns',    'custom_woo_supportpress_ticket_columns', 10, 2 );          function custom_woo_supportpress_ticket_columns( $column, $post_id ) {     global $post;          switch( $column ) {              /* If displaying the 'incr_number' column. */         case 'incr_number' :                  /* Get the post meta. */             $incr_number = get_post_meta($post_id, 'incr_number', true );                            break;          }      }           add_filter('manage_edit-ticket_columns', 'woo_supportpress_ticket_columns');           function woo_supportpress_ticket_custom_columns($column) {     global $post;          $ticket_details = woo_supportpress_get_ticket_details( $post->ID );          switch ($column) {         case "status" :             echo get_the_term_list($post->ID, 'ticket_status', '', ', ','');         break;         case "priority" :             echo get_the_term_list($post->ID, 'ticket_priority', '', ', ','');         break;         case "type" :             echo get_the_term_list($post->ID, 'ticket_type', '', ', ','');         break;         case "assigned" :                  if ($ticket_details['assigned_to']->ID>0) :                 $link = get_author_posts_url( $ticket_details['assigned_to']->ID );             else :                 $link = add_query_arg('assigned_to', '0', get_post_type_archive_link('ticket'));             endif;                  echo ''.$ticket_details['assigned_to']->display_name.'';              break;         case "id" :             echo '#'.$post->ID;         break;     }      }     add_action('manage_ticket_posts_custom_column', 'woo_supportpress_ticket_custom_columns', 2);


Cannot get pages or posts to display

I am trying to set up Wordpress for a client who uses XO Communications as a host. However, getting Wordpress set up is driving me nuts. I keep getting this error message _(wrapping message for clarity)_ :               Warning: main(./wordpress/wp-blog-header.php)      [function.main]: failed to open stream:      No such file or directory in /web/wordpress/index.php on line 17      I have manually installed the latest release of WP. The admin area is working fine. I set my general configurations as:   * WP: http://newyorkharborschool.org/wordpress   * Site: newyorkharborschool.org/wordpress I modified the index file with this code: `require('./wordpress/wp-blog- header.php');` I checked and wp-blog-header exists and is in the wordpress directory. I have tried reinstalling Wordpress. None of that worked. I tried downgrading Wordpress: XO offers a one-click installation of an old (2.2.3) version of Wordpress. After downgrading, pages and posts displayed. However, when I upgraded I get the above error message. Thank you for any help. This is driving me nuts! Jeff


What it means <link rel="profile" href="http://gmpg.org/xfn/11"> is it support HTML 5 or not?

While doing the integrate HTML for my new WordPress Theme , I stumbled across a new meta tag `<link rel="profile" href="http://gmpg.org/xfn/11">` what it means or is it necessary to mention and i think it is not support HTML5 how can i supportable to HTML5


Allow user access to Dashboard only!

Update: This snippet below removes the menu also for my admin account:               function remove_menu_items() {              global $menu;         global $user_ID;               if( $user_ID ) :                  /* Dashboard only acccess */             if( current_user_can( 'Dashboardvisitors' ) ) :                      $restricted = array(                     __('Posts'),                     __('Media'),                     __('Pages'),                     __('Links'),                     __('Appearance'),                     __('Tools'),                     __('Users'),                     __('Settings'),                     __('Comments'),                     __('Plugins')                 );                  endif;              endif;                end ( $menu );              while ( prev( $menu ) ) :             $value = explode( ' ', $menu[key($menu)][0] );             if( in_array( $value[0] != NULL?$value[0]:"" , $restricted ) ) :                 unset( $menu[key($menu)] );             endif;         endwhile;          }     add_action('admin_menu', 'remove_menu_items');      How can I give a user access to the dashboard only? More specifically, I want them to be able to see the wordpress stats widget and the google analytics widget. That's it. I've created a new user with the role dashboardvisitors using the plugin USER ROLE EDITOR. Now **level 0 plus read access** doesn't cut it. The dashboard is just empty. Adding **edit dashboard** doesn't change anything. Still nothing there (but I don't want them to be able to edit the dashboard anyways). How can I make this happen? It's very important, so thanks a lot!


As soon as I add a custom query_var using the filter, my pages point to an archive page - why?

There are a million posts on the topic in this stack exchange, and yet for some reason I cannot get this to work for me. I wonder what I'm doing wrong? In my functions.php I define this:               add_filter('query_vars', 'add_quote_query_vars');     function add_quote_query_vars($qv){         $qv[] = 'xx-quote';         return $qv;     }      Then later, on front_page.php I provide a link that embeds this into the URL:               echo  '<a href="'.add_query_arg('xx-quote', $quote->ID).'">';      Two things go wrong. 1: if, on my template page I `print_r($wp_query->query_vars);`, my 'xx-quote' doesn't appear in the list 2: as soon as I actually try to include that in the URL (by clicking the link, the URL is `http://mysite.com/blog/?xx-quote=555`) I'm taken to an archive page, rather than the expected front page. What's interesting about #2 is that as soon as I remove the `query_vars` filter and click the link again, I'm taken correctly to the front page as expected. Am I just not understanding the role of the query_vars? Is this expected behaviour? Or am I calling the filter at the wrong time (I've tried wrapping it in an init action, or even bare inside functions.php)? I know I can just ignore all this, since I'm dealing with the front_page.php anyway, and just use $_REQUEST['xx-quote'] but that doesn't seem like a best practice at all, and I'm trying to do it "the WordPress way"... Needless to say, the following code produces no results:               global $wp_query;     echo $wp_query->query_vars['xx-quote'];      And that is the basis of my confusion. I've read all the related posts on this SE and I _seem_ to be doing everything right. Clearly I'm not - what's gone wrong?


Create a page selector using taxonomies

I have created a custom post type and assigned a term from a custom taxonomy to each page within this CPT.   1. I want to create two select boxes on the front end of my site.   2. I want the 1st select box to display the custom taxonomy terms.   3. Once someone has selected a term, I want the 2nd select box to display the pages assigned to that term.   4. I then need a button that will take me to this selected page. If anyone could help with this, that would be great.


change default option in wp_dropdown_categories

I'm using **wp_dropdown_categories()** to output a dropdown. In default view (without having clicked it) it shows the name of the _first category_ in the list. I'd like it to say _"Categories"_. Is this possible? Thanks in advance


Maintain custom post types and taxonomies in all themes

When I change the theme in dashboard, activated plugins that use custom post types, stay in the menu. But my own custom post types that I created myself disappear. Logically, It is because I create custom post types (and taxonomies) in `functions.php` of the current theme. For reference I use the code below:               function post_type_aya_bi_aya() {         $labels = array(                 //...         );         $args = array(             'labels'        => $labels,             'public'        => true,              );         register_post_type( 'aya-bi-aya', $args );       }          add_action( 'init', 'post_type_aya_bi_aya' );          function taxonomy_aya_bi_aya() {         $labels = array(                //..         );         $args = array(             'labels' => $labels,             'hierarchical' => true,             'public' => TRUE,              'show_ui' => TRUE,             'query_var' => 'sowar',          );         register_taxonomy( 'sowar', 'aya-bi-aya', $args );     }     add_action( 'init', 'taxonomy_aya_bi_aya', 0 );      **My question is:** What is the best way to maintain custom post types after change of the theme. Do I need to create a plugin responsabile of creating them, or do I need in addition to execute some functions? If else, if you have a better approach, I thank you very much for your valuable time.


Multi-language module in Wordpress or Google sites

Which is an easy software for creating a simple multi-language website? I'd like a button to switch from English to German, for example. I don't want to write code, possibly. Thanks, Carlo


I want to remove the links from the term list returned by get_the_term_list

I want to keep this category title on my pages, but I don't want it to be a link.               <?php echo get_the_term_list( get_the_ID(), 'portfolio_cats', ' ', ' , ', ' '); ?>      Can anyone help? Thanks


WPML taxonomies not translated

I'm using WPML for multi-language website. It works really well except for custom taxonomies. In admin, I can only join foreign posts to foreign taxonomies (which is exactly what it should do) but on the public area, when retrieving taxonomies it seems that the current language is ignored: I get all taxonomies. Any help would be greatly appreciated ! Thanks.


I want to print a message in post " After one month from publish date"

I need to showing message in post , but after one month from publish date. I try to make it before ask you, but I can't this is my code                               $publish_date =  $post->post_date_gmt;             $today = date('d-m-Y h:i:s');             $nextMonth = mktime(0 , $publish_date('m')+1 , 0 , 0 , 0,0);             echo 'Publish Date:'.$publish_date.'
';             echo 'Today Date:'.$today.'
';             echo 'Next Month:'.$nextMonth;             if($today => $nextMonth){                 echo 'One Month or more for publish post';             } else {                 echo '';             }


Wordpress menu: How to make www.link.com/#name never contain current_page_item class?

I am using the wordpress menus on a website, but the problem is that one of the links on that menu is www.homepage.com/#order So, when I am on the homepage, both "home" and "order" links on the menu contain the class current_page_item, which with my css it makes them appear both as the active button. How can I make it so the #order link never contains that the current_page_item class? Here's a screenshot of how the menu looks when visiting the homepage and how I set it up on the admin panel: http://img87.imageshack.us/img87/7666/screenshotrq.png On the firebug panel you can see that both www.homepage.com and www.homepage.com/#order menu links contain the current_page_item class. This is the php code I am using to display the menus:               <?php      $args = array(         'menu' => 'Top Menu',          'sort_column' => 'menu_order',          'container_class' => ' '     );     wp_nav_menu($args);      ?>


Accessing post->ID outside of the loop for listing child pages

I'm wanting to list child pages of my current page in the sidebar of theme. However my sidebar (left side) is before the loop in the template and the post->ID won't return anything if it's before the loop. My current code:               <?php          wp_list_pages('title_li=&child_of='.$post->ID);           ?>      I've read something about calling a global variable to access this but haven't had any luck thus far. Any help would be appreciated.


Timed content and flagging content as viewed by user?

I'm trying to put together a site with membership functionality and i'm having most of what i need together. However, what's still missing in the mix are two things: 1) I need to be able to display content starting from a certain date and stop displaying it starting from a certain date (or give it an expiration time). 2) I'd like to be able to have content flagged as viewed by individual users so i can then display it in a different section of the site for that user. How that's done (if via taxonomies or whatever) i don't really care and the 'putting it somewhere else' i can do myself. Are there any good, simple (do one thing only, but do it right), free plugins that cater for the above?


Using query_vars filter

I am trying to link out from the WP admin to view posts in a specific way. The url structure for this is `example.com/post123/?my-preview=456` `/post123/` is the regular permalink for a post. The `?my-preview=456` allows a section of that post to retrieve information based off of the my-preview value. I understand that WP strips `$_GET` parameters from the url, so I tried using `add_filter('query_vars','my_query_vars');` and               function my_query_vars($query_vars){         $query_vars[] = 'my-preview';         return $query_vars;     }      On the actual section where I need to get that value, I tried using:               global $wp_query;     var_dump($wp_query->query_vars);      Even with a url like the example above, the 'my-preview' pair is nowhere to be found in the $wp_query->query_vars array. Am I not doing the correct steps to register an additional query_var for use later on? If I am, why does it not stick around? EDIT: I have also tried: `add_action('init', 'add_query_vars');`   with               function add_query_vars() {         global $wp;         $wp->add_query_var('my-preview');     }      and `wp_die(var_dump(get_query_var('my-preview')));` gives `string(0) ""`


Can I set and show "important" post in my blog?

I have the following doubt related to the WordPress posts showed in the home page. I know that in the home page I can show the latest published posts. But can I also show (before the latest posts) a specified number of "important" posts? What can I do to implement this feature in my blog? Tnx


WP-CLI Cannot Connect to Database due to Vagrant

I am running the most recent version of WP-CLI on my mac. I do all WordPress development within Vagrant, but would like to run WP-CLI commands in the host machine. I have a domain alias from "dev.mysite.com" to the IP of my server so it can be accessed through my web browser through an HTTP request. When trying to run a WP-CLI command, I get an "Error Establishing a Databse Connection" error mesage because it is trying to connect via "localhost" when it really should be "dev.mystie.com" or the Vagrant VM's IP Address. Is there any way I can access my site through WP-CLI without having to SSH into the guest?


Importing Existing Users with Passwords

I have an existing legacy PHP site of 15000 users with base64 hashed passwords , I would like to import all these users into the new wordpress site with their passwords , What would be the best approach to realize this? Praveen


Modernizr check first, then move on to wp_register_script()/wp_enqueue_script

I've been playing with Modernizr in WordPress lately and here's something that i'm trying to achive. I'm adding an HTML5 input field in a custom options page, specifically:               <input type="number" />      Now with Modernizr i can test if the browser supports it like this:               Modernizr.load([     {     test: Modernizr.inputtypes.number, // this is the test     nope: [ load js,css etc ] // if it's not supported load your custom lib     complete: function() {       // do something      }]);      Would it be possible instead of manually loading my custom libraries in the "nope" method, to invoke the wp_register_script()/wp_enqueue_script functions? I mean i could just register/en-queue my custom libraries but i'd like to do that only if it's necessary (if the browser doesn't have native support for this kind of input type. Any ideas?


How do I limit the status options for bulk/quick edit to only Published and Draft?

For my custom post type, I only want to have "Published" and "Draft" as the available options in the bulk edit and quick edit screens, i.e. ![screenshot](http://i.stack.imgur.com/0GilD.png) I tried hooking on to the filter `quick_edit_dropdown_pages_args` but it doesn't seem to get fired. I inserted a `wp_die()` in my callback but the admin screen lists all posts like nothing changed. Any idea? Thanks in advance.


add classes to wordpress menu links

As the title already says, I am trying to add classes on the WordPress menu item links (so not the `li`, but the `a` element). If it is possible to achieve something similar to WordPress its own function for adding classes to each `li` through the GUI it would be great because I need diffrent classes on each `a`. Does someone know how to achieve this? do I really have to use Walker or is there something diffrent, like a simple function I can write. Thanks P.S. I am not looking for the build in css class screen option in WordPress, this because the html/css is build in a way it has to remain. in each a is a diffrent icon given by css classes.


WP_Query order result by date AND meta_value

I have searched but not found an answer to my problem. I have posts with a meta key used for ordering. I want to order post by this value. If they have same value I want them to be ordered by date. I guessed that this was the query to use:               new WP_Query( array(         'post_type' => array ('post', 'aggregato'),             'cat' => '-1',             'posts_per_page' => 12,             'orderby' => 'meta_value_num date',             'order' => DESC,              'meta_key' => 'mb_home',             'meta_query' => array(                                     array(                                             'key' => 'mb_home',                                             'value' => 0,                                             'compare' => '!=',                                     )                             )              ));      (the `'cat' => '-1'` is just another check to exclude a specific category) Now, this query returns posts that has a 'mb_home' value different than 0. And it orders them by that value. BUT completely ignores 'date'. If I have two posts with same mb_home value and different dates, it just goes date ASC instead of date DESC as expected. Any pointers? What am I doing wrong here? EDIT: This is the dump. `SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) INNER JOIN wp_postmeta AS mt1 ON (wp_posts.ID = mt1.post_id) WHERE 1=1 AND ( wp_posts.ID NOT IN ( SELECT object_id FROM wp_term_relationships WHERE term_taxonomy_id IN (1) ) ) AND wp_posts.post_type IN ('post', 'aggregato') AND (wp_posts.post_status = 'publish' OR wp_posts.post_author = 1 AND wp_posts.post_status = 'private') AND (wp_postmeta.meta_key = 'mb_home' AND (mt1.meta_key = 'mb_home' AND CAST(mt1.meta_value AS CHAR) > '0') ) GROUP BY wp_posts.ID ORDER BY wp_postmeta.meta_value+0,wp_posts.post_date DESC LIMIT 0, 12`


I have a term_taxonomy_id -- is there an API call to get the taxonomy?

**Issue** : I have the term_taxonomy_id, I do not have the taxonomy name, I want to retrieve the term object without doing a direct database query. **Thoughts:** Well the API docs for get_term_by say that taxonomy is required and the wp_term_taxonomy table schema makes it pretty simple to get the taxonomy if I have the term_taxonomy_id so this should be pretty simple -- however I don't seem to see any API calls that can achieve this. I could just call the database using something like:               select taxonomy from wp_term_taxonomy where term_taxonomy_id={ID}      But would prefer not to do a direct query to the database. Is there an API call that can achieve this? or a better way to get the term object from the term_taxonomy_id? Thanks


Changed my email. Locked out

I changed my email address and don't have the original password. When I try to reset my password it looks like Wordpress is sending the link to my old defunct email account which doesn't exist anymore. How do I set up a new login so I can access my blogs? Help!


How to reduce spam

I installed WordPress along with a few add-ons to combat spam. Both are for registered and non-registered members posting comments. I added a standard Captcha as well as a mathematical challenge question (5 + what = Eleven). I have tried different Things and software, but the result is the same. I receive daily spam emails. It serves the spammer no good, as I review all comments, but that does not stop comments. Do spammers now have humans go to the same website daily and try to just sent out spam (unlikely) or is it just a software program. In the latter case, why is the WordPress add-ons not stopping spam comments. Do others have the same issue? Did I miss something, when setting up WordPress?


Using a database view = evil incarnate?

I'm at a point in doing some WordPress plugin development where from what I can tell I either have to create an entirely new plugin or I can create a database view. The client wants some simple logs of downloads by user and then wants to be able to export these logs to CSV. The logging is easy enough and done. My plan for exporting the logs to CSV is just to use a table export plugin that should export the logs. The client is happy with a basic interface. However the logs are split into two tables, with the log 'categories' being sensibly normalised into a separate table - but that makes no sense to a user. I can fix this super easy with a database view:               CREATE VIEW wp_my_evil_export_view AS      SELECT  `e`.`id`, `l`.`log_name` as 'category',`l`.`description`, `e`.`date`, `u`.`user_email` as 'email', `e`.`text`     FROM    `wp_wls_entries` as `e`,             `wp_wls_logs` as `l`,             `wp_users` as `u`     WHERE   `e`.`log_id` = `l`.`id`         AND `e`.`user_id` = `u`.`id`      This then shows up happily as a separate table in the plugin, the client can click on this and it exports nicely as CSV. However this makes me feel slightly dirty. Its a complete hack, totally non- WordPress in any aspect and no-one else seems to even consider creating views in Google searches. Nevertheless its simple, relatively unlikely to break unless the underlying plugin changes its database structure. So if this is **REALLY** bad, let this question be a warning for others who fall here. **Otherwise does it make sense in this case or is there some other simple method I've missed for solving this issue?**


Second ezSQL initialization for MSSQL

We are trying to pull data from a second database into Wordpress. The secondary database is used internally to store data, and Wordpress (also only used internal) is partially used to display some of this data. I did not find a reliable way to install Wordpress on SQL Server and thus decided to install it separately on MySQL (as intended) and pull in the extra required data from SQL Server. `INSERT` and `UPDATE` statement are also expected to be needed. After some research online the 'best' I could find was to integrate a second ezSQL with a connection to the SQL Server. Can I just use the default ezSQL 'configuration'?   Is this even possible, without resulting in compatible / interference issues? **ezSQL**               $db = new ezSQL_sqlsrv($db_user, $db_password, $db_name, $db_host);     $current_time = $db->get_var("SELECT " . $db->sysdate() . " AS 'GetDate()'");      **Wordpress**               $wpdbtest_maindb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);     $current_time = $wpdbtest_maindb->get_results("SELECT " . $db->sysdate());      Thanks.


Using mysql queries to delete custom post types based on meta_value

I am trying to create a cron job to run on my server which deletes a custom post_type (post_type = event) from my databse based on a meta_key (st_date) and a meta_value (the date the event took place ie. 2013-04-30). I want it to automatically delete any event that took place over 30 days ago from the current date. I have been unsuccessful so far, with trying to use the DATEDIFF() > 30 function. My issues so far have been with creating the mysql query to delete the events.                 DELETE FROM 'wp_posts', WHERE 'post_type' = 'event'       INNER JOIN 'wp_postmeta' ON 'wp_post.post_id' = 'wp_postmeta.post_id'       AND 'meta_key'='st_date'        AND 'meta_value'= '(DATEDIFF(NOW()) > 30)'      Any help would be appreciated.


Custom comments form

I've got the following code:               function pietergoosen_persoonlike_kommentaar_velde($fields) {              $commenter = wp_get_current_commenter();         $req = get_option( 'require_name_email' );         $aria_req = ( $req ? " aria-required='true'" : '' );              $fields =  array(            'author' =>     '
' . __( 'Naam', 'pietergoosen' ) .     ( $req ? '*' : '' ) . ' ' .     '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) .     '" size="30"' . $aria_req . ' />
',            'email' =>     '
' . __( 'E-pos Adres', 'pietergoosen' ) .     ( $req ? '*' : '' ) . ' ' .     '<input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) .     '" size="30"' . $aria_req . ' />
',            'verwysing' =>     '
' . __( 'Waar het jy van die webtuiste gehoor', 'pietergoosen' ) . '' .     '<input id="verwysing" name="verwysing" type="text" value="' . esc_attr( $commenter['comment_author_verwysing'] ) .     '" size="30" />
',     );     return $fields;     }           add_filter('comment_form_default_fields','pietergoosen_persoonlike_kommentaar_velde');      I got this code from a tutorial. I want to edit the 'Leave a reply', 'Your email address will not be published. Required fields are marked *' and the comment box and 'post a comment' button. How do I edit this code and include the changes i want to do. I'm stuggeling to understand how to implement what is given in the codex. I'm using Twenty Twelve child theme


Is "get_template_part" hierarchy possible?

I'm build a custom Wordpress theme using get_template_part to call tiny bits of code. I have file called "masthead.php" that is called using this code:                <?php get_template_part( 'masthead' ); ?>      This works as expected. However, I would like to create some kind of file hierarchy inside my theme's folder. For example, if there's a file called "custom-masthead.php" use that file first but if the file does not exists, then use "masthead.php". Is this something that can be accomplished? _**EDIT_** Following @sabreuse's code I'm trying to make things a little bit more complicated. I would like to print the theme's folder name instead of the $name variable so the folder's name is my main variable before falling into the fallback. I tried this code:                    <?php           $theme_name = wp_get_theme();          get_template_part( 'masthead', 'echo $theme_name->Template;' ); ?>      But this doesn't seem to work. Maybe it's not possible? _**EDIT_** Got it working:                    <?php           $my_theme = wp_get_theme();          get_template_part( 'masthead', $my_theme->Template ); ?>      Thanks a lot! Johann


Setting up wordpress categories URLs

I am working on a wordpress applications. I have created a custom page for articles landing page. The permalink for articles is working fine but I have problems when I click on a category name. For example: If I click on "jobs" category the URL looks like http://www.mysite.com/category/articles/jobs/. I want it to look like http://www.mysite.com/jobs/. I am not sure if this is something I did that is causing this or just default wordpress behaviour. So, any ideas/suggestion how I can fix this? Thanks.


MailPress plugin: table inline style tag removed when sending the newsletter

I have coded my own MailPress theme for my newsletter using tables and inline styling for good look and feel of my newsletter. I have in the files header.php and footer.php html table code with inline style tags. Something like this:
      It looks just fine in the email preview, but when sending it and looking at the newsletter from my gmail the tables are without the style tag I wrote. Seems like MailPress is stripping me out all the style="...." stuff? The above code looks in my email just with this:
      "style" and also "id" tags are being completely removed. Where or how to avoid this happen? Is there some filtering around there where I can place code to allow the style tag in the newsletter content?


Categorising posts/pages into years published

I have a lot of posts/pages, and I would like to create a list in my sidebar, showing all of the years that I have created posts/pages in, so for instance, if I have 5 posts/pages that were spaced out over 5 years, from 2006 to 2011, each year having one post, I would like 2005, 2006, 2007, 2008, 2009, 2010 and 2011 to show as list items in the sidebar, as links to all of the posts/pages created that year. Any idea of how I can achieve that? Thanx in advance!


Follow post plugins for WordPress

I'm running a Q&A site with wordpress. I am wondering if there is any plugins that add a "follow" button at the end of a post like Quora such that users can follow the post or follow the topic. Thank you. **Example page with follow button:**   http://www.quora.com/Is-Quora-planning-an-API


rewrite file to wordpress

I have in my plugin dir a endpoint.php and need to rewrite like this:               http://domain.com/API/endpoint.php      This is the code I've used:               add_rewrite_rule( 'API/endpoint.php', 'myplugin-path/endpoint.php', 'top' );      When I print the `$wp_rewrite` global I got this:               [non_wp_rules] => Array         (             [API/endpoint.php] => http://mydomain/myplugin-path/endpoint.php         )      But still not work, any Ideas?


Multiple Users Logged In Causing Incorrect Account Returned

I have a plugin that I have written that has a front-end login and I have had reports by multiple users that state that when they login (presumably at the same time???), they see someone else's profile in my plugin. How does authentication work in WordPress? I am using the WordPress function `wp_signon` and passing it credentials. By using this method, does it not create a cookie locally to determine your user session? Or is this all handled on the server? Any help would be greatly appreciated. If I cannot figure this out, my plugin will be a complete failure. **UPDATE:** Including some code as I've had more reports that if multiple users are using the same wireless router (at the same location), that one person clicks on our "dashboard" and as the next person clicks the menu option to visit the dashboard, they are automatically logged in as the previous user. Only code I have running is the following:               function user_dashboard_shortcode()     {         global $current_user;         $memberid = $wpdb->get_var( "SELECT id FROM " . $wpdb->prefix.SSM_TEAMMEMBER_TABLE . " WHERE user_id = " . $current_user->ID);          echo "
Team Member Info
";         echo "Current User ID: " . $memberid;     }      Now, the output on the page is the same ID for two users (one right after another).


Display Plugin information on specific url

So I created a WP plugin with its own unique DB tables. I chose this approach as opposed to using a custom post type because of relationships I needed between the tables. So I'm not even sure how to word this, but basically what I need to do is display my information when a user accesses a specific url such as (http://website.com/pluginname?query=number). I don't even know if you could do this with WP, and I know the easy way to do it would be with a shortcode or template file but I want to avoid that because I want this to be as simple as possible for the actual person using the plugin. Thanks for the help in advance


Custom Meta Boxes repeatable field show on single.php

I have some code that adds a Metabox, with repeatable fields to the edit screen of the WordPress backend. It looks like this: ![enter image description here](http://i.stack.imgur.com/gGZPu.png) The code, I have in the `functions.php`, looks like this:               function hhs_get_sample_options() {         $options = array (             'Option 1' => 'option1',             'Option 2' => 'option2',             'Option 3' => 'option3',             'Option 4' => 'option4',         );              return $options;     }          add_action('admin_init', 'hhs_add_meta_boxes', 1);     function hhs_add_meta_boxes() {         add_meta_box( 'repeatable-fields', 'Repeatable Fields', 'hhs_repeatable_meta_box_display', 'post', 'normal', 'default');     }          function hhs_repeatable_meta_box_display() {         global $post;              $repeatable_fields = get_post_meta($post->ID, 'repeatable_fields', true);         $options = hhs_get_sample_options();              wp_nonce_field( 'hhs_repeatable_meta_box_nonce', 'hhs_repeatable_meta_box_nonce' );         ?>

                 Name	                 Select	                 URL

         <?php              if ( $repeatable_fields ) :              foreach ( $repeatable_fields as $field ) {         ?>
             <input type="text" class="widefat" name="name[]" value="<?php if($field['name'] != '') echo esc_attr( $field['name'] ); ?>" />	                                   <select name="select[]">                 <?php foreach ( $options as $label => $value ) : ?>                 <option value="<?php echo $value; ?>"<?php selected( $field['select'], $value ); ?>><?php echo $label; ?></option>                 <?php endforeach; ?>                 </select>             	                  <input type="text" class="widefat" name="url[]" value="<?php if ($field['url'] != '') echo esc_attr( $field['url'] ); else echo 'http://'; ?>" />	                  Remove
         <?php         }         else :         // show a blank one         ?>
             <input type="text" class="widefat" name="name[]" />	                                   <select name="select[]">                 <?php foreach ( $options as $label => $value ) : ?>                 <option value="<?php echo $value; ?>"><?php echo $label; ?></option>                 <?php endforeach; ?>                 </select>             	                  <input type="text" class="widefat" name="url[]" value="http://" />	                  Remove
         <?php endif; ?>
             <input type="text" class="widefat" name="name[]" />	                                   <select name="select[]">                 <?php foreach ( $options as $label => $value ) : ?>                 <option value="<?php echo $value; ?>"><?php echo $label; ?></option>                 <?php endforeach; ?>                 </select>             	                  <input type="text" class="widefat" name="url[]" value="http://" />	                  Remove

Add another
         <?php     }          add_action('save_post', 'hhs_repeatable_meta_box_save');     function hhs_repeatable_meta_box_save($post_id) {         if ( ! isset( $_POST['hhs_repeatable_meta_box_nonce'] ) ||         ! wp_verify_nonce( $_POST['hhs_repeatable_meta_box_nonce'], 'hhs_repeatable_meta_box_nonce' ) )             return;              if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)             return;              if (!current_user_can('edit_post', $post_id))             return;              $old = get_post_meta($post_id, 'repeatable_fields', true);         $new = array();         $options = hhs_get_sample_options();              $names = $_POST['name'];         $selects = $_POST['select'];         $urls = $_POST['url'];              $count = count( $names );              for ( $i = 0; $i < $count; $i++ ) {             if ( $names[$i] != '' ) :                 $new[$i]['name'] = stripslashes( strip_tags( $names[$i] ) );                      if ( in_array( $selects[$i], $options ) )                     $new[$i]['select'] = $selects[$i];                 else                     $new[$i]['select'] = '';                      if ( $urls[$i] == 'http://' )                     $new[$i]['url'] = '';                 else                     $new[$i]['url'] = stripslashes( $urls[$i] ); // and however you want to sanitize             endif;         }              if ( !empty( $new ) && $new != $old )             update_post_meta( $post_id, 'repeatable_fields', $new );         elseif ( empty($new) && $old )             delete_post_meta( $post_id, 'repeatable_fields', $old );     }      What I want to do is output the information saved to the custom field - repeatable_fields - inside my `single.php` as list. How can I do that?


WordPress custom form action url

Is there any way to replace standard WordPress comments form action, which usually looks like this: `<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">` to something custom WITHOUT altering comments.php (i.e. for a plugin, so you don't have to make end-users edit their themes): `<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" some_java_script some_tag="some_value" method="post" id="commentform">`


Custom post type URL returns 404 error page

I have a post_type called "products" and inside it have two taxonomies "destinations" and "types". Inside destinations i have a list of countries as terms and inside types i have (hotels, cruises). I want to get hotels of a particular country like this : http://www.mydomaine.com/products/?destinations=alabama&types=hotels Normaly wordpress should list me hotels in Alabama, not? But for the reason i don't know it gets me 404 error page (always return back go home page). Somebody knows why? I have template strucutre like this : index.php taxonomy.php taxonomy-destinations.php taxonomy-types-cruise.php taxonomy-types-hotels.php Thanks a lot.


Does WordPress provide an API for scheduling posts?

I'm a database noob so I'm a little bit clueless as to how to make a scheduled post via a plugin. Basically, does WP provide a reference API that would allow a plugin to create a scheduled post, like a user can do through the dashboard?


qTranslate with my own theme and settings

Basically I have my own theme and my own settings page. In that settings page I have a textfield which contains a Welcome Text to show at the top of the website. Now, I want this theme to works with qTranslate. To make the content of this textfield multi-language, it would be easy just to let the user add the qTranslate tags by himself within it. However, internally, while I'm rendering the Welcome Text, which function of qTranslate should I call? It would be perfect if I could pass to it only the text (with the tags) in argument, and depending on the current language qTranslate would give me back the right part of the text. Thanks a lot for your help :)


Custom routing for plugins

I am making a plugin that needs a page that can be accessed from the outside, pretty much like an API, and have the url like so, http://xxxxx/custom_method?parameter=xxxxx&something=xxxx is there a clean way to do this? Thanks in advance.


wordpress custom password change problem

if ( !empty($_POST['pass1'] ) && !empty( $_POST['pass2'] ) ) {                 if ( $_POST['pass1'] == $_POST['pass2'] )              wp_update_user( array( 'ID' => $current_user->id, 'user_pass' => esc_attr( $_POST['pass1'] ) ) );                      else                 $error = __('The passwords you entered do not match.  Your password was not updated.', 'frontendprofile');         }      I have used the above code to change users password but the error was occured **"Warning: Cannot modify header information - headers already sent by (output started at /hermes/web02/b1441/moo.sharerecipesnowcom/sharerecipesnownet/wp- content/themes/recipe/header.php:13) in /hermes/web02/b1441/moo.sharerecipesnowcom/sharerecipesnownet/wp- includes/pluggable.php on line 720"**


Custom post types columns strange issue

I have 4 custom post types in my theme. When I add a description column (the_excerpt) for them I get some really strange behavior. The description column repeats 4 times on each post on every custom post type. Also get a PHP notice that I can't get rid of. Like this:               Notice: Trying to get property of non-object in H:\htdocs\wp-content\themes\mytheme\admin_includes\other\excerpt.php on line 10     Lorem ipsum dolor sit amet, consectetur adipiscing elit.          Notice: Trying to get property of non-object in H:\htdocs\wp-content\themes\mytheme\admin_includes\other\excerpt.php on line 10     Lorem ipsum dolor sit amet, consectetur adipiscing elit.          Notice: Trying to get property of non-object in H:\htdocs\wp-content\themes\mytheme\admin_includes\other\excerpt.php on line 10     Lorem ipsum dolor sit amet, consectetur adipiscing elit.          Notice: Trying to get property of non-object in H:\htdocs\wp-content\themes\mytheme\admin_includes\other\excerpt.php on line 10     Lorem ipsum dolor sit amet, consectetur adipiscing elit.      Here's my code for the custom post type. The code is the same for each one apart from the post type name.               <?php         add_action('init', 'testimonials_register');         function testimonials_register() {             $labels = array(                 'name' => _x('Testimonials', 'post type general name'),                 'singular_name' => _x('Testimonial', 'post type singular name'),                 'add_new' => _x('Add New', 'Testimonial'),                 'add_new_item' => __('Add New Testimonial'),                 'edit_item' => __('Edit Testimonial'),                 'new_item' => __('New Testimonial'),                 'view_item' => __('View Testimonial'),                 'search_items' => __('Search Testimonials'),                 'not_found' =>  __('Nothing found'),                 'not_found_in_trash' => __('Nothing found in Trash'),                 'parent_item_colon' => ''             );             $args = array(                 'labels' => $labels,                 'public' => true,                 'publicly_queryable' => true,                 'show_ui' => true,                 'query_var' => true,                 'menu_icon' => get_stylesheet_directory_uri() . '/images/icons/testimonials-admin.png',                 'rewrite' => true,                 'capability_type' => 'post',                 'hierarchical' => false,                 'menu_position' => null,                 'rewrite' => array(                     'slug' => 'testimonials',                     'with_front' => FALSE,                 ),                 'supports' => array('title','editor','thumbnail')             );             register_post_type( 'testimonials' , $args );         }              add_action("manage_posts_custom_column",  "testimonials_custom_columns");         add_filter("manage_edit-testimonials_columns", "testimonials_edit_columns");              function testimonials_edit_columns($columns){             $columns = array(                 "cb" => "<input type=\"checkbox\" />",                 "title" => "Testimonial Title",                 "description" => "Description"             );             return $columns;         }              function testimonials_custom_columns($column){             global $post;             switch ($column)             {                 case "description":                     the_excerpt();                     break;             }         }     ?>      I can't see why the description column would repeat for as many times as I have custom post types. Also I really can't figure out the PHP notice. I'm developing locally on LAMP server and my WP version is 3.3. Would really appreciate some help. Thanks!


Thesis Theme Custom Loop

I am building a website using Thesis theme and am using Thesis Custom Loop API with custom WP_Query . When I do this on single page it doesn't show the comments form. How can I add a comment form on the single post page


Wordpress CMS support for Multi Edit Sections in a single page

WordPress states that WP is a CMS. Having said that, why is it so difficult to create multiple editable sections for editing content of a single page ? Can you recommend best practices to achieve this behavior ? Thanks !


Would a "hub" page work better as a page or a post?

First of all, I don't know whether "hub" is the correct terminology, but it is how we've been describing it. I run a movie blog and would like to create a page for each movie we cover in depth. I want it to be more than just a tage archive, so I'm wondering how to get it done. For instance, What Culture employs a similar system. In the example link, there is a blurb about the movie and all related articles to that movie. If I were to do something in the same vain, should this be done via a page or a post? Any advice would be great. Thanks!


Search results to be only posts & children of page ID

I'm trying to have my search results show only results that are a child of the 'news' category or a child of the 'work' page (ID = 16). This is what I have so far:                   function SearchFilter($query) {             if ($query->is_search) {                 $query->set('category_name', 'news');                 $query->set('post_parent', '16');                              }             return $query;         }              add_filter('pre_get_posts','SearchFilter');       The problem is it only searches for posts that belong to 'news' AND have a parent page ID of '16', which is obviously no posts. So how do better refine search? I'd prefer not to use a plugin, that's why i am here. Thanks, Drew


How would I create a different permalink structure for pages and posts?

Right now I have pages like "about", "resources", etc and the urls are /about and /resources with a custom permalink structure as /%postname%. For "news" section it's the posts and it's at /news and that's great. The problem is I want the new stories to be /news/the-name-of-the-story not /the-name-of-the- story. Can that be accomplished in the wp admin area? Or is that a custom .htaccess trick? Also, news is in categories and /category/category-name lists the posts in that category and the story for those should be at /category/category-name/the-name-of-the-story. Is this even possible?


How can LDAP/Active Directory be integrated in WordPress?

I know there are a few plugins. I need to more than likely roll my own. But, I don't know enough about the WP security infrastructure. Where does WP authorization and authentication code go? I'm not really asking about a broad spectrum here, just a very basic answer to where the code is to begin editing so it looks at my AD.


Wordpress loop not working on blog.php page

Well, i'm creating a wordpress theme, but i can't get wordpress loop to work correctly for some reason. This code works fine in index.php :               <?php     if (have_posts()) :        while (have_posts()) :           the_post();           var_dump($post);        endwhile;     endif;     ?>      But, it does not work in my blog.php page(it's not a template, it's actually a shortcode). The shortcode works correctly for sure. But when the above code is executed it just prints NULL. If i try to grab the_content, the page loops indefinitely. Any idea why this can be happening ?


Translation some words in woocommerce

I'm trying to translate several tect from my shop. I downloaded po and mo files and uploaded to the site. After that with PoEdited translate all words. Some words like "Featured products", Recent products, items appear in english. I'm not sute what is the reason because almost everything was translated only several words stucked in english. http://prikachi.com/images/159/6579159u.jpg


Qtranslate + Advanced Custom Fields: how to have a multilanguage wysiwyg editor?

This is my setup:   * Wordpress: 3.4.2   * qTranslate: 2.5.32   * Advanced Custom Field: 3.5.1   * i've also installed qTranslate extension: 1.1.1 but I don't know how/if it works... How can I have a multilanguage WYSIWYG custom field edit area with tabs for each language as the main text editor? Thanks! Stefano