maintaing consistent layout wordpress dashboard

I am developing a functionality in WordPress so that once user updated any information admin can approve/reject the information only after which it should get published in the front users,in specific terms functionality is much similar to e,g Comment approval. i am new to PHP as well Word press, though i have developed the functionality and its working fine. but i have created simple table in the dashboard where admin can see the things he/she needs to approve/reject. i want to give it a consistent look like other functionality in word-press e.g Comment   1. Admin can do bulk operations delete/approve with the build in panel.   2. Admin can quick edit/delete any individual comment what i observe that there seems to be a single design pattern on which this is implemented as i can see same type of features for post/pages or any other place in dashboard where items are being displayed in list. is there a way to achieve this.i will appreciate if some one help me to understand this. attaching a screen shot for better clarification. ![common navigation area](http://i.stack.imgur.com/ldBeX.png)


Rewrite rule for custom parameter

I'm stuck with rewrite rules regex. I have this kind of link:               http://www.xyz.com/page-1_b/page-3_d/page-0_a/box-page-3_d      I need to add rewrite rule for this link so that it extracts what's after 'box-' and treats rest of the link as a standard WP link. I have this expression from another SO question:               (.+?)/box-([^/]+)      It returns what's after the `'box-'($matches[2])` and also the whole WP link($matches[1]) but I need something that will fit into:               index.php?pagename=$matches[1]&box=$matches[2]       Do you have any ideas?


no posts or pages showing on mirror domain

alright this is a tricky one bear with me a while back i developed a site for someone and he just pointed his DNS nameservers to my host which is dreamhost. later he decided to change the DNS back, and i was effectively stuck without being able to view the site or modify it. what dreamhost suggested, which made sense, is to make a mirror domain and new SQL user so that i could access the database, this worked fine and ive backed up the database - its huge btw about 300Mb. i have been able to get the site back up on the mirror and can administer wordpress but there are no posts or pages showing in the admin panel. the theme works fine, all images are broken of course...due to the old URL being hard coded all over the database. i figured i could sort this out using a script to find and replace all of the old URLs in the database, which did work. but posts and pages are still absent. ive done the usual regeneration of permalinks and all that, no joy. i am treating the mirror address as if it was the primary URL, like when i re deploy a site when i move them which i do all the time, this has never happened... as a last resort i was wondering about changing the A records to point another domain to this one for the time being. that might show what the score is. could it be a plugin.. i didnt get that far. the other solution is to re deploy the site on another clean install of wordpress, but with a database this large it is difficult. can someone tell me a simple step by step way to get this done... i use putty so can use command lines, although never have with dreamhost. i was thinking to upload the SQL file first via ftp then run a command, can someone explain exactly how i would do that? is it via php myadmin? thanks J


Pre-install widgets in WP-Admin

When a user activates the TwentyEleven theme in the admin widgets area, the user already has the Main Sidebar populated with a few standard widgets. Could someone explain or point me in the right direction about how I could implement the same behavior for my widgets on another theme?


Using php to overwrite or replace title tag, while using yoast

I use yoast for my seo, indexing, title, sitemap etc. But I have one issue, for my product pages I want to use costum taxonomy data and yoast doesnt support that. Now I got the code to echo the exact title I want in the product pages but how do I let it overwrite the title set by yoast, or how do I replace the title set by yoast for this specific post type?


Let visitors post comments on category page

I'm looking for a way to let users comment categories on category.php, but I haven't been able to find one. Simple pasting didn't do the trick (didn't really expect it to.) For clarification, I'm not looking for users to comment posts in category.php, but rather to comment the category itself. Is it possible?


Overflow and Comments

Go to this link and click where it says "2 comments" in the sub-title: http://themeforward.com/demo2/2011/01/17/lobortis-tellus-diam/ **When the link that brings the user to the comments is clicked it doesn't just scroll users down the page, it brings them to what APPEARS TO BE a separate page (even though it isn't a separate page). This is caused by the extreme margin/padding I am using in #sidebar and #post_content which I am using for equal height columns...http://www.positioniseverything.net/articles/onetruelayout/equalheight Any fixes for this (while still using the equal height columns css)?** THE CSS:                   #container {             overflow:hidden;             margin:35px auto         }         #sidebar {             width: 410px;                display:block;             padding-bottom: 32767px;             margin-bottom: -32767px;             float:right         }         #post_content {             display:block;             padding-right:25px;             padding-bottom: 32767px;             margin-bottom: -32767px;             margin-right:25px;             border-right:1px solid #EEE;             float:left;             width: 660px         }     #commentlist {         list-style:none;         width:100%     }      THE LINK:               <?php comments_number( 'No comments', 'One comment', '% comments' ); ?>


How can i manually relate pages?

I've got a custom post type called Products, which underneath i've got a related products section using a plugin called http://wordpress.org/extend/plugins/related-posts-thumbnails/. I need to be able to create some more post types for example called Accessories and Supplies. I need to be able to relate some accessories to products. How can i make it so when i add an accessory or supply i can say this relates to a certain product and shows in the related products section.


Best way to programmatically link to multiple categories (union/intersection)

This question assumes that you know about the various complex taxonomy queries available from the WP_Query API. I know about `tax_query` as well as about things like `category__and`, which allow you to run multi-term queries inside a template. It also takes for granted the knowledge that you can manually create links, both pretty (`/category/mac+mobile/`) and ugly (`/?cat=2+3`) that will generate the results similar to many of the `tax_query` (or at least `category__and`) options. The question is: What is the best way to generate such links within code, so that a theme can automatically link to screens showing complex mixes of categories.   * The solution should be forward compatible and use standard WP if possible.   * It should ideally work with any possible permalinks and category-permalink configuration.    * Ideally it would work with any order of categories, as well as with categories nested inside a hierarchical taxonomy.   * It should accomodate both intersections (a+b only posts in both categories are returned) and unions (a,b any post in one or the other category works). As far as I can tell there is no built-in function that can achieve this. The similar function is `get_term_link()` but it only accepts a single term. Ideally core would have something like `get_tax_query_link()` that accepted a tax_query and rendered a link that would show the desired results.


dynamic_sidebar not rendering sidebar

I have the following code               // in functions.php     register_sidebar(array(         'before_widget' => '
',         'after_widget' => '
',         'before_title' => '
',         'after_title' => '
',     ));          // in sidebar.php     if (!function_exists('dynamic_sidebar') || !dynamic_sidebar()) : ?>         // static sidebar here ..      I find that the static sidebar is what renders even if I add widgets in the dashboard. I'm not sure if WP3.2 caused it as I never tried using dynamic sidebar before updating


Tinymce/Wordpress is removing all line-breaks?

In my wordpress theme, I have a custom options panel with textareas that utilize the tinymce script included with wordpress. This was working fine until I upgraded to the latest version of wordpress (3.2). Now the editor still works, however it is removing all paragraph and line-break tags once I save my code. While putting my text into the editor, it looks great and shows all line breaks in the preview, but once I save it those are all gone. Other tags (b, img, a) seem to be working fine. Now this may be an issue with wordpress, but on the same hand the wordpress upgrade also included the newest and latest version of Tinymce, so that may be causing the issue. When I disable the Tinymce editor and use standard textareas, all the tags and line breaks get saved no problem. > EDIT: Got it working. Needed to wrap my output values in wpautop() before > saving. So now my value is wpautop($output[$option_array['id']]); Here is the code I am using to initiate the Tinymce editor:                   <?php     wp_tiny_mce( false , // true makes the editor "teeny"         array(             'theme' => 'advanced',             'skin' => 'default',             'theme_advanced_resizing' => 'false',             'theme_advanced_path' => 'false',             'theme_advanced_buttons2' => '',             'theme_advanced_buttons1' => 'code,bold,italic,underline,|,justifyleft,justifycenter,justifyright,forecolor,fontsizeselect,link,unlink,image',              'width' => '650px',              'media_strict' => 'false',     'valid_elements' => '*',     'extended_valid_elements' => '*',     )     );               ?>


How to remove/hide Yoast's "SEO" tab in admin panel?

I don't want this shown to members who register for my website as it's confusing and irrelevant for them. I assume some code added to `functions.php` will do the trick but what code?


Get current page number of splitted article

I am trying to find a way to get the current page number of an article that has been splitted into several pages with the use of:               <!-- nextpage -->      There is an example that can be found here: http://codex.wordpress.org/Conditional_Tags#Testing_for_paginated_Pages But this doesn't work for me – it always returns 0:               $paged = $wp_query->get( 'paged' );     echo $paged;      Any idea? Thank you!


Can I use wordpress for a non-blog site?

I'm starting a website (more complicated than a blog) and would appreciate advice on which framework to use. A person on my team uses wordpress and is enthusiastic about its possibilities, but a friend who works on rails is lobbying against it ("But it's for blogs!"). Both can help me get started so I'll probably chose either wordpress or rails because of that. The question is : which? What I want to do : The site is centered around comparing and commenting constitution articles. Users will browse articles by country and by topic, comment and vote on the articles, suggest topics for the articles (=tag them), post their suggestions of articles. Users will create polls (like Facebook questions more or less) that other users can answer. I'd also like a forum section where they can start discussions about a given article or a topic. Users will also post links/documents relevant to an article or topic. I want my users to be registered, give me certain info (gender, age, country…) and then get statistics about who voted/commented on what articles (It will be helpful for research). Wordpress looks cool because of how easy it looks to get something together and integrate plugins, even for a non-technical person, and there's a huge number of plugins. But it's designed for blogs so I'll probably run into trouble and do dirty hacks because what I want to do is not a blog. Rails looks cool because it's designed to do things like that so I can get precisely what I want, but there aren't as many plugins, and it will require longer to code. I'll be spending the next 2 months on this, and when I leave the the person who has to take care of the site has little technical background (except wordpress), and I don't want to have to do heavy maintenance after I leave. I'm not scared of learning, but I do have limited time and I'm the only developer (though I might get help from volunteers.). I might not get all the functionality I want before I leave, but I do need to get something together. What is your opinion here? Thanks for your help!


Is it possible to include an HTML flat-file website inside a WordPress theme?

Is it possible to include an entire flat-file HTML site (.html, folders/ and CSS) inside WordPress? Essentially, I want to host an HTML site, but have access to WP functions and plugins. Not to interested in a iframe solution as that would break the look of the URLs on the browser address bar. Can I include the html site in WP? Or perhaps include WP in the HTML (with some PHP .htaccess extension magic)?


How to change tag Title to its name?

i have previously asked it in stackoverflow, but there was no answer!   I wish to change the title of Tags pages of my wordpress blog. What I want to do is to keep the Tag name as it's title only. For example: If a tag name is "Wordpress Tag Pages Tutorial" then that tag should have the same title "Wordpress Tag Pages Tutorial" instead of "Blog Name - Wordpress Tag Pages Tutorial" so what to change in this code? I have tried but showing errors like only variables name in wordpress title.               <title>     <?php if (is_home () ) { bloginfo('name'); }elseif ( is_category() ) {     single_cat_title(); echo ' - ' ; bloginfo('name'); }     elseif (is_single() ) { single_post_title();}     elseif (is_page() ) { bloginfo('name'); echo ': '; single_post_title();}     else { wp_title('',true); } ?>      please see this screen-cast i.stack.imgur.com/Ai9JU.png


How to reorder billing fields in WooCommerce Checkout template?

I'm creating a madlib style checkout form using WooTheme's _Customizing checkout fields using actions and filters_. Billing fields in the checkout template `form-billing.php`are displayed with this call:               <?php foreach ($checkout->checkout_fields['billing'] as $key => $field) : ?>     <?php woocommerce_form_field( $key, $field, $checkout->get_value( $key ) ); ?>     <?php endforeach; ?>      How can change the order the fields appear? The current (default) field order is:   first name   last name   company (hidden for me)   town/city   zipcode   country   state   email   phone _Default order:_   ![screenshot](http://i.stack.imgur.com/imhxW.png) I want the fields to be in a more natural order for Americans (where I live), so:   first name   last name   company (hidden for me)   town/city   state   zipcode   country   email   phone How can I best do this?


Display Categories in Search Results

I couldn't find anything pertaining to my question. How difficult would it be to display the category of search results, without a plugin - if possible. So it would be something like this: > Category One > > Search results from category one > > Category Two > > Search results from category two > > and so on. Any help would be greatly appreciated. I don't necessarily need anyone to do the work for me, I'm a PHP/Wordpress beginner, but I'd like to think I'm fairly competent in understanding code. Unfortunately, I haven't been able to find something that points me in the right direction when searching google and stackexchange.


Displaying tags associated with posts in Custom Post Type

I have a custom post type called 'camps', which has tags associated with it, registered as 'camps_tag' I have managed to list all of the posts from a certain category within the 'camps' cpt, but how can I list the tags associated with the post? Any help would be greatly appreciated.


Register Custom Post Type from Plugin

I'm trying to register a CPT from a plugin upon activation but seem to have hit a wall... Anyone see anything im missing? I don't get any errors but the CPT doesn't show up in the dashboard links....                   function ctg_cpt_init() {         register_post_type( 'ctg_questions',             array(                 'labels' => array(                     'name' => __( 'Questions' ),                     'singular_name' => __( 'Question' )                     ),             'public' => true,             'has_archive' => true,             'rewrite' => array( 'slug' => 'questions' )             )         );     }     add_action( 'init', 'ctg_cpt_init' );          function ctg_rewrite_flush() {         ctg_cpt_init();         flush_rewrite_rules();     }     register_activation_hook( __FILE__, 'ctg_rewrite_flush' );      Thanks,


How to create Page templates for showing Blog posts in different layouts?

I'm creating a Wordpress Theme, and I want to create few Page Templates for creating Blog pages with different layouts. So for example, I want to have blog-4-column.php, blog-3column.php and blog-list.php, for giving the user 3 different layout options for having a Blog Page. Now I'm able to list blog posts in my index.php file using this code:               if (have_posts()) : while(have_posts()) : the_post(); ?>       <?php get_template_part('content', get_post_format()); ?>     <?php endwhile; else : ?>       <div id="post-<?php the_ID(); ?>" <?php post_class('no-posts'); ?>>
No Posts found

     <?php endif;      Where I have content.php, content-link.php, content-gallery.php to display posts of different Post Formats. Now the only way I know how to do this in a page template is by using WP_Query, as the post type in the page template would be 'pages' and using the above code will list the registered Pages and not Posts. I just want to know if there is anyway I can use the same 'content- _post- format_ ' files for this, as I don't want to create 3 or 4 'content- _post- format_ ' files for each individual Blog Page Template that I would create. I've searched around for this and one I found most useful was on Tutsplus, but still it doesn't cover having different 'content- _post-format_ ' files and also having few different Page Templates for listing Blog posts in different ways. Please let me know about this and thank you.


WP query by custom post type slug/name

I am running a simple wp query to retrieve just one post. But the post is a custom post-type post, not a normal post               $ajaxBike = $_GET['varbike'];           $bikeProfile = new WP_Query(array(              'name'          => $ajaxBike,         'meta_query'    => array(             array(                 'key' => 'app_visibility',                 'value' => 1,                 'compare' => '='             )         )          ));      or...               $ajaxBike = $_GET['varbike'];           $bikeProfile = new WP_Query('name='.$ajaxBike);      But I think the **name** parameter only works for posts. But I'm struggling to find anything to work with a custom post type slug. Can you anyone help work out how to query a custom post type using the slug?    Thanks in advance!


How to Create a Custom Plugin Permalink

I wrote a simple plugin that will redirect the users to a page on a certain date. (in this case it's for the Blackout against SOPA here in the US) Right now I'm using the line `wp_redirect(plugins_url( 'simple-sopa- blackout/blackout.php'),302 );` to redirect the users on the given date. The problem is it makes a nasty URL like `http://example.net/wp- content/plugins/simple-blackout/blackout.php` It would be great to just make this `http://example.net/blackout` I Following what I thought was the proper codex I tried this:               add_filter( 'rewrite_rules_array','my_insert_rewrite_rules' );     add_action( 'wp_loaded','my_flush_rules' );          // flush_rules() if our rules are not yet included     function my_flush_rules(){         $rules = get_option( 'rewrite_rules' );              if ( ! isset( $rules['blackout/?$'] ) ) {             global $wp_rewrite;             $wp_rewrite->flush_rules();         }     }          // Adding a new rule     function my_insert_rewrite_rules( $rules )     {         $newrules = array();         $newrules['blackout/? $'] = plugins_url( 'simple-sopa-blackout/blackout.php');         return $newrules + $rules;     }      Any help would be awesome, the full source is here EDIT: Here's what I have now, it works if access the page with the query vars `index.php?blackout=stop-sopa` but not if i go to `blackout/stop-sopa` it also seems to be creating a loop and timing out if the date is true                   //create your rewrite rule     add_action( 'init', 'wpse38978_init' );          function wpse38978_init() {          add_rewrite_rule('blackout/(\d*)$', 'index.php?blackout=$matches[1]', 'top');     }          // add blackout to the whitelist of variables it wordpress knows and allows     function my_plugin_query_vars($query_vars) {         $query_vars[] = 'blackout';         return $query_vars;     }     add_filter('query_vars', 'my_plugin_query_vars');               function my_plugin_parse_request($wp) {         if (array_key_exists('blackout', $wp->query_vars)                  && $wp->query_vars['blackout'] == 'stop-sopa') {             include( dirname( __FILE__ ) . '/blackout.php' );     exit();         }          }     add_action('parse_request', 'my_plugin_parse_request');          if(!function_exists('wp_redirect')) {          require(ABSPATH . WPINC . '/pluggable.php');     }          $current_time =  current_time('mysql', '0'); //get current blog time     $ts =strtotime($current_time); //parse the sql blog time to a php useable format     $check_date = date('m/d/Y', $ts);  // put the date in a format we can check     $check_hour = date('H', $ts);  // put the date in a format we can check     $blackout_day = "01/15/2012"; // should we black out the site?     $blackout_day_time_start = "08"; // when should we start (hour in 24 hour format)     $blackout_day_time_end = "20"; // should we black out the site?          if((!is_admin()) && ($check_date == $blackout_day && ($check_hour >= $blackout_day_time_start || $check_hour < $blackout_day_time_end))){         wp_redirect(get_bloginfo('url').'/blackout/stop-sopa',302 );           exit();          }


wp_schedule_event / cron_schedules - custom recurrence time not working in Plugin

I am trying to add custom intervals for the WP cron in a plugin. It run with "hourly", "daily" default recurrence time. It dont' run when I add my own custom recurrence time for the function wp_schedule_event. I want to execute a function every X hours (defined by users). Thanks. Here is the code:               <?php     /*     Plugin Name: Test Cron     Description: Plugin to Test Cron Jobs.     Version: 1.00     */     class WP_TestCron {         function __construct()         {             register_activation_hook(__FILE__, array($this, 'TestCron_cron_activate'));             register_deactivation_hook(__FILE__, array($this, 'TestCron_cron_deactivate'));             add_filter('cron_schedules', array($this, 'TestCron_cron_update_schedules'));             add_action('TestCron_cron_eventOne', array($this, 'TestCron_cron_fct'));             add_action('TestCron_cron_eventTwo', array($this, 'TestCron_cron_fct'));         }              function TestCron_cron_activate()          {             // Run => In Schedule Cronjobs              if (!wp_next_scheduled('TestCron_cron_eventOne')) { wp_schedule_event(time(), 'hourly', 'TestCron_cron_eventOne'); }                  // Dont't Run => Not in Schedule Cronjobs              if (!wp_next_scheduled('TestCron_cron_eventTwo')) { wp_schedule_event(time(), 'in_per_minute', 'TestCron_cron_eventTwo'); }         }              function TestCron_cron_deactivate()          {             wp_clear_scheduled_hook('TestCron_cron_eventOne');             wp_clear_scheduled_hook('TestCron_cron_eventTwo');         }              function TestCron_cron_update_schedules()          {             return array(                 'fively' => array('interval' => 300, 'display' => 'Once in Five minutes'),                 'in_per_minute' => array('interval' => 60, 'display' => 'In every minute'),                 'in_per_ten_minute' => array('interval' => 60 * 10, 'display' => 'Once in Ten minutes'),                 'three_hourly' => array('interval' => 60 * 60 * 3,  'display' => 'Once in three hours')             );           }              function TestCron_cron_fct()          {             $testCcron_post = array();             $testCcron_post['post_title'] = 'Cron Update - '.date('d/m/y \a\t h:i A');             $testCcron_post['post_content'] = 'WP-Cron job is working!';             $testCcron_post['post_status'] = 'publish';             $testCcron_post['post_author'] = 1;             $testCcron_post['post_category'] = array(1);                  wp_insert_post( $testCcron_post );           }        }          if (is_admin()) $wpTC = new WP_TestCron();          ?>


Engadget Like most commented plugins

i am looking for a most commented plugin like that of in engadget website and propakistani. I would be very thankful if someone could help me out with it. Thanks ![enter image description here](http://i.stack.imgur.com/HzQTW.png)


wp_postmeta store multiple values in one key

I am currently storing some data in a custom field like this:               $get_ref = $_SERVER['HTTP_REFERER'];     $ref = get_post_meta($post->ID, 'page_ref', true );     $ref[] = $get_ref;     update_post_meta($post->ID,'page_ref', $ref);      The above updates the post_meta but doesnt overide it. I would like to save additional data to the same value that is saved above. The above produces this:               Array ( [0] => http://test.com [1] => http://website.com )      I would like something like this:               Array ( [0] => array(http://test.com, 14/04/2014) [1] => array(http://website.com, 10/01/2014));      Any ideas how i can achieve this?


How to create media library for each user?

In my project there are three types of users, teacher, student, and admin. Each user has the provision to add posts. But my problem is that each user need each media library for add images into post. When I create a post adding space outside admin which done but the editor shows all the images inside my site. How can I create media library for each user? I am newbie in wordpress coding.


Overriding Gallery Margin

Continuing the build on a free theme. Working on the gallery CSS. Wordpress automatically adds a left margin to the gallery. Example: http://themeforward.com/demo2/features/gallery-2/ So, how do I get rid of that nasty margin?               /* Gallery */     .gallery {     margin:30px auto auto;     text-align:center     }     .gallery-item {     float:left;     margin-top:10px;     text-align:center;     width:33%     }     .gallery img {     border:1px solid #E6E6E6!important;     margin-bottom:27px;     padding:5px     }     .gallery img:active {     margin:1px 0 0     }     .gallery-caption {     display:none;     font-size:.8em;     margin-left:0     }     .gal_img {     margin:20px auto 0!important;     text-align:center     }     .gal_caption p {     font-size:1.3em!important;     font-weight:700;     text-align:center;     font-family:Arial, Helvetica, sans-serif!important     }     .gal_description p {     font-size:1.1em!important;     text-align:center     }


Pagination on Custom Tax Pages Removes Spaces from Query Vars

I've got a weird problem that's very similar to this one: Why does Wordpress Pagination Remove the Spaces from my GET Variable?. Except that mine isn't withn search results pages--it's with custom taxonomy pages. Here's the problem: clean WP install with no plugins. I add a custom taxonomy like so in my functions file:               register_taxonomy(         'my-categories',         array(             'post',         ),         array(             'hierarchical' => true,             'label' => 'My Categories',             'query_var' => true,             'rewrite' => array( 'slug' => 'my-categories' ),         )     );      I've created a term in this taxonomy called "test one". If I go to the taxonomy page and add a custom var to the query string, everything seems fine (like so: /my-categories/test-one/?something=one+two). Here's where it gets weird: if I add in some pagination vars (manually changing the URL to /my-categories/test-one/page/2/?something=one+two), the resulting page actually rewrites my URL, stripping out spaces from the custom var (the resulting URL is /my-categories/test-one/page/2/?something=onetwo). Adding my custom var to the vars list using the query_vars filter has no effect. There is obviously a bad rewrite happening somewhere in the WordPress core (I assume in the register_taxonomy() function?), but I don't know enough about WP's rewriting API to figure out what it is. Anybody have any ideas? I'll file an issue in Trac if it is indeed a bug, but I need to know how to patch it short-term.


Custom post type media upload error with custom user role

I have created a custom post type named `product` and assigned a new role `manager` for it. Everythign works fine, except the media uploader for `product`. I can even upload images without any error directly in the `add media` section. So, I started to test with default `author`, and still same error! Amazingly `author` can upload images successfully, when they are in a default `post`, not in `product`! The error message says: **An Error occurred in the upload. Please Try again later.** Below is the code for custom post type:               function cpt_product() {         $slug = 'product';         $labels = array( //all the custom labels );              $args = array(             'labels' => $labels,             'public' => true,             'menu_position' => '5.1',             'public' => true,             'has_archive' => true,             'supports' => array( 'title', 'editor', 'author', 'excerpt', 'custom-fields', 'revisions' ),             'exclude_from_search' => false,             'publicly_queryable' => true,             'show_ui' => true,             'capability_type' => $slug,             'capabilities' => array(                 'edit_post' => 'edit_' . $slug,                 'read_post' => 'read_' . $slug,                 'delete_post' => 'delete_' . $slug,                 'edit_posts' => 'edit_' . $slug . 's',                 'edit_others_posts' => 'edit_others_' . $slug . 's',                 'publish_posts' => 'publish_' . $slug . 's',                 'read_private_posts' => 'read_private_' . $slug . 's',                 'delete_posts' => 'delete_' . $slug . 's',                 'delete_private_posts' => 'delete_private_' . $slug . 's',                 'delete_published_posts' => 'delete_published_' . $slug . 's',                 'delete_others_posts' => 'delete_others_' . $slug . 's',                 'edit_private_posts' => 'edit_private_' . $slug . 's',                 'edit_published_posts' => 'edit_published_' . $slug . 's'             ),             'map_meta_cap' => true         );              register_post_type( $slug, $args );          }      Below is the code for custom role `manager`               function add_manager () {     $role_manager = 'manager' ;     $displayname_manager = 'Manager';     $capabilities_manager = array (         'read' => true,         'edit_product' => true,         'read_product' => true,         'delete_product' => false,         'edit_products' => true,         'edit_others_products' => true,         'publish_products' => true,         'read_private_products' => true,         'delete_products' => false,         'delete_private_products' => false,         'delete_published_products' => false,         'delete_others_products' => false,         'edit_private_products' => true,         'edit_published_products' => true,         'edit_posts' => true,         'upload_files' => true         );                   create_custom_role ( $role_manager, $displayname_manager, $capabilities_manager );     }     add_action('admin_init', 'add_manager');               function create_custom_role ( $rolename, $roledisplayname, $capabilities ) {         if ( get_role ( $rolename ) ) {             return 0;         }         else {             add_role ( $rolename, $roledisplayname, $capabilities );         }     }      Now I am completely lost here, and can't find a solution! Can anyone please help me and tell me what I missed, or did wrong? :(


Conditional Shortcode image display

Got a problem with a shortcode.. i probebly dont know where & how to set the condition so it will display the right image according to the topic / category of the toturial.. Help Plz :)               function postInfoBoxSc( $atts ) {         extract( shortcode_atts( array(             'subject' => 'Category type',             'difficulty' => 'User Types',             'completiontime' => 'completion Time'         ), $atts ) );                  // Set image acorring to guide type             if ($subject == 'wordpress') {                 $subjectImg = '';             } elseif ($subject == 'web design') {                 $subjectImg = '';             } elseif ($subject == 'facebook') {                 $subjectImg = '';             } elseif ($subject == 'RSS') {                 $subjectImg = '';             }              return '

             '. $subjectImg .'
Guide information:

Category: '. $subject .'

User Lever: '. $difficulty .'

completion Time: '. $completiontime .'

         ';     }     add_shortcode( 'postInfoBox', 'postInfoBoxSc' );      **The Problem** For some reason the value of $subject doesent get updated like the othere values and isnt being passed trough the shortcode and the image isn't changing because of that **What Am I Doing Wrong ??** (just added per request) this is the shortcode i am entreing in wordpress editor when writing a post:               [postInfoBox subject="somthing" difficulty="hard" completiontime="2-5 minuts"]


Delete post revisions on post publish

_Is it possible to delete post/page revisions from the database when a post/page is published?_ **11/05/12 Answer: See the plugin below by _bueltge_** I want to do this on a site with 5,000 posts and 125,000 comments; it's on a VPS and can handle the wp_posts table size - before I deleted all revisions, the table was 1.5 gigs - but I still want to keep the overall database size to a minimum by preventing revisions. But, the client tells me he lost a big post due to a browser freeze, so: is it possible to delete post/page revisions from the database for each post/page when it is published? What hook would be used? Is `save_post` the correct one? http://codex.wordpress.org/Plugin_API/Action_Reference/save_post I have the autosave parameter set in wp-config.php, but according to the docs, that autosaves the post/page as it is being worked on, and overwrites each autosave. What I want to do is have revisions accumulate for drafts - however many, depending on how many times "Save" and "Update" are used by the author - but once the draft is published, delete all revisions. There will only be revisions for the one post, but rather than try and parse the post_ID, the SQL query can run through all posts. This is what I'm trying in functions.php, but I get a `Call to a member function query() on a non-object` error.               function delete_revisions_on_publish( $post_id ) {              if ( !wp_is_post_revision( $post_id ) ) {          remove_action('save_post', 'delete_revisions_on_publish');              $wpdb->query(          $wpdb->prepare(          "DELETE a,b,c         FROM wp_posts a         LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id)         LEFT JOIN wp_postmeta c ON (a.ID = c.post_id)         WHERE a.post_type = 'revision' "             )     );             }     }     add_action( 'save_post', 'delete_revisions_on_publish' );


Non Wordpress Folder in a Wordpress Site

On localhost (WAMP server) I have installed wordpress in the root directory (examplesite.com). I have an application that needs to run outside of Wordpress, so I would like it in the folder /application (examplesite.com/application). I created the folder “application” in the root, but when I go to the url examplesite.com/application, I get the message “Forbidden you don't have permission to access examplesite/application/< on this server”. I found a solution suggesting to add the following to my htaccess, but it didn’t work for me.                   <IfModule mod_rewrite.c>         RewriteEngine On         RewriteBase /         RewriteCond %{REQUEST_URI} ^/application/(.*)$ [OR]         RewriteRule ^.*$ - [L]         </IfModule>         # BEGIN WordPress         <IfModule mod_rewrite.c>         RewriteEngine On         RewriteBase /         RewriteRule ^index\.php$ - [L]         RewriteCond %{REQUEST_FILENAME} !-f         RewriteCond %{REQUEST_FILENAME} !-d         RewriteRule . /index.php [L]         </IfModule>              # END WordPress`      Any advice? Thank you in advance!


How can I UN-attach media from a post?

I'm having a trouble un-attaching media from a post without deleting it entirely from my site. Is there a simple way to unattach an image from a post for instance?


woocommerce: How can I show all the subcategories from a specific category?

I need to show all subcategories using               $product_category = wp_get_post_terms( $post->ID, 'product_cat' );      actually I use:               <?php                          global $post;                              $terms = get_the_terms( $post->ID, 'product_cat', 'hide_empty=0'  );                                        foreach ( $terms as $term ){                         $category_id = $term->term_id;                         $category_name = $term->name;                         $category_slug = $term->slug;                              echo '
slug, 'product_cat') .'">'.$category_name.'
';                                   }                                       ?>      it's ok but it shows only the parent category and only one subcategory... how to fix that?


Output Sanitation

I've read the WP codex and several tutorials about data validation and sanitation in WordPress. Now I've got this simple example code: `$title = "<script>alert('Test')</script>"; echo esc_html($title);` According to the tutorials and the codex this should be the output: `<script>alert('test')</script>` But on my website I get this: `<script>alert('Test')</script>`. Am I doing something wrong? Because the XSS isn't being executed, so the esc_html filter is working correctly. Thanks in advance!


Getting Custom Post Type content from main-site of a Multisite

I have a multi-site network with 3 sub-sites: ![enter image description here](http://i.stack.imgur.com/qJ1pt.png) Is it possible to "link" or include custom post to all 3 sites from the main site? By include or link I don't mean to make other sites to edit them, I'm asking for the visual solution. If possible, could I do that without using a plugin?


Interrogate a page within a loop to check template type or custom meta data (Pages vs Posts)

I've spent a few days researching working with WP static pages - as separate from posts. Although I've found useful guidance, I can't seem to find any good tutorials or worked examples that show me how to work with pages using a modified WordPress Loop that will enable me to filter on specific page criteria and extract relevant content. I am creating a site that will be used annually for events. I want to have a page type (or custom post type) for Calls to Action. My expectation is that there will only ever be a limited number of call to action pages: typically only a few, and likely to be no more than 10 for the site. I'd like the home page to list a summary of the content on these pages, and build that using a loop: but I want to filter this loop by both the specific page content type (e.g. CallToAction), as well as a status indicator, such as "sticky" or active. I'd like to either interrogate the page by its template, or use some other indicator such as a custom field that I check. Being able to set the desired order of the content pages, and sorting their appearance by that order is also a requirement, and I'd like these pages to be shown in the site menu: probably under a parent menu of Calls To Action. Due to the limited number of pages and the relatively static nature of them, static pages feel like a good approach, however my reading so far indicates that what I want to do with the loop control could be challenging, maybe impossible. My main question is can I interrogate a page to find out about template type or custom meta data within a loop? A custom post type seems like a solution that will work, but having a separate post type seems overkill. Suggestions? [Edited 14 May 2013 to simplify/ clarify]


Some images suddenly not appearing

I'm having trouble with some images not showing up. These were fine and then suddenly stopped working for no apparent reason. A couple of examples: http://coachmi.com.au/blog/2012/11/how-to-build-a-strong-organisational- culture/ http://coachmi.com.au/blog/2012/11/the-path-creating-your-mission-statement- for-work-and-life-book-review/ I've tried deleting and reinserting the images but it doesn't seem to make any difference. The images appear in the dashboard when I am editing the post but not when it's previewed or published Any suggestions/help would be appreciated!


How do I check if a post is private?

What I am looking to do is check if a page is private, give the users the option to register and see the page. Here is what I have now:               <?php     if (have_posts()) :         /* Print the most as normal */     else :        if ($post->post_status = 'private')         {          /* Print login/register box */         }       else         {          /* Print page not found message */         }     endif; ?>      My problem is that it is always falling through and displaying the login box even when the page does not exists. How do I fix this?


WooCommerce : Direct Checkout Page

I would like to redirect to the checkout page directly upon clicking the "add to cart" button. Or a Direct Buy Now Feature. How can this be done? Thanks


How to query custom db table?

I am creating my first ever plugin for a membership site. I have a custom table named `subscription` with a `subscr_user_id` column whose values are taken from `$current_user->ID`. So when a current user subscribes, a new record is inserted into the table where `subscr_user_id` gets the value of the current user's ID. How do I query(INSERT AND SELECT) the table from a template(I don't know of any other means to test queries)? I have this SELECT query: Note that I have preinserted one record into table subscription with subscr_user_id = 1 which means the user is an administrator. I did that thru sql console.               //Somewhere in between the body of the template.     //This query will be used for a code that checks if a user ID is already subscribed to avoid duplicate records.     global $current_user;     global $wpdb;          $user_id = $wpdb->get_row("SELECT * FROM $wpdb->subscription WHERE subscr_user_id = $current_user->ID");          echo '<p> Current user ID is:'.$user_id->subscr_user_id. '</p>';      Before I viewed the page that uses that template, I logged in as an administrator to make sure the ID is `1`. Unfortunately I didn't get any result? Could anyone also please show me a sample of INSERT statement?


Managing and Playing Large videos

I am implementing a blog to share courses, lectures, tutorials or talks. The video sizes might be bit a bit big - so i was wondering what is a good quality plugin for wordpress that would allow to play videos smoothly , with different dpi settings and such. I want to host the files on my hosting - and play them. Is that a bad option, should i go to youtube ? 3rd party ? what are the + and - of each. Are there any copyright issues, limits, "fair usages", forced ads ? Any tips on the video thing is extremely welcomed. I live in one of the top 5 countries with slowest internet, so optimizing this can be crucial. Thanks for any advice you guys can share Regards


How can I create an alternative home page?

I'm working on a site which has a fully customized front page. Now I'm asked to add a more classic looking blog type page which will be reacheable at `http://domain/blog`. I tried creating a custom (empty) page called `blog` and put some code into `page-blog.php`, but the problem is that I can't get The Loop to work in there: the page render aborts right where the display of The Loop should start. Is a custom page the wrong way to do it?


Making a custom upload form and page in the admin section

so I've built this standalone php script which allows my users to upload a CSV which updates JSON data for a feature on our site, but I want to put the script inside of the wordpress admin section for obvious reasons. So as a standalone script it works just fine, I can upload a CSV which the script converts to JSON and then it updates the file in the appropriate directory inside the wordpress theme. Once moving this into WP however, Im getting errors because WP has already sent out headers (so I cant have my upload script redirect the use to the previous page) and probably related, I cant seem to open/create the JSON files any more.               failed to open stream: No such file or directory in blah blah blah.      Here is the code Im using to open/create the new JSON files:               $root_dir = dirname( dirname(__FILE__) );          if( $format == 'map'){              $new_file = 'grading-data-'.$year.'.js';         $target = $root_dir.'/js/reportcard/data/'.$new_file;      }else{              $new_file = 'states-data-'.$year.'.js';         $target = $root_dir.'/js/reportcard/data/states/'.$new_file;         }                    $handle = fopen($target, "w+");     fwrite($handle, $output);     fclose($handle);      The script by the way, is located inside the theme folder. ie: theme> lib > upload_data > script.php Now, because this is wordpress Im sure theres a very wordpressy way to do this but Im not sure where to look.


WordPress picks parent theme's home page template instead of the child theme one

I have a child theme with its own home custom page template called "template- home.php" (Template Name: Home Template). I have a "Home" page which uses this template. Everything works fine as long as my Settings > Reading > Front Page Displays is set as "Your latest posts". But if I set Front page as a static page and I set this page as the "Home" page (which uses the home page template), then WordPress picks the Home page template of the parent theme. Why is that? Extra info: the parent theme has the same "template-home.php" attached to the same "Home" page, and has not any home.php or front-page.php file.


Is wp-app.php or wp-apps.php needed for Wordpress?

A few Wordpress blogs I overlook have suddenly generated 3 PHP files in their top folder: wp-app.php, wp-apps.php, and wp-register.php, not of which existed before. Checking their contents against a few Google searches suggests I have been infiltrated by a common Wordpress exploit. Since they keep regenerating, I thought about blanking them and setting file permissions to readonly or less. But if they're needed by WP I don't want to compromise site functions.


Only show content before more tag

I am using the Siren Template. In homepage.php this code is used to display the portfolio content               print_excerpt(200);      But I to need show the content only before `<!--more-->` I have used this:               the_content( $more_link_text, FALSE);      but it is not working. It shows all the content


jQuery "on" handler does not fire on newly inserted widgets

I have a jQuery script attached to the widget.php page via an add_action('admin_footer') call. The jQuery executes fine on widget items that were in place when the page loaded. However, on newly installed widgets (widgets that are added to the sidebar after the page has loaded), the handler does not fire. Any ideas how to work around this issue?               if ($pagenow == 'widgets.php'){         add_action('admin_footer', 'my_load_widgets_script');         function my_load_widgets_script()         {         wp_enqueue_script('jquery');         ?>                  <?php         }     }      HTML               Show Advanced Options


Programmatically schedule post with wp_update_post function

I schedule posts in a wp plugin (WP 3.8) with the following function. My posts seem to be in the correct status after scheduling them (when editing them, date time and status are good), and also after a database check with phpmyadmin, where the record in the post table seems coherent with another record corresponding to a post scheduled with wp classic edit interface. But the post is never published, and stays in the scheduled status. Second problem, the date retrieve by strtotime('now') is one hour late (here is why i do 'strtotime('+1 hour')') repecting to the local time (displayed on my server with 'date' command) Can you help please ?               function updatePostDate($blog_id, $post_id, $post_date) {         $status = strtotime($post_date) > strtotime('+1 hour') ? 'future' : 'publish';         switch_to_blog( $blog_id );         $operation = 'edit';         $newpostdata = array();         if ( $status == 'publish' ) {             echo ' ' .strtotime($post_date) .'('.$post_date. ') < '. strtotime( "now" ) ,"\n" ;             echo 'cannot publish artilces from here, only schedule, dates in future';             return;         } elseif ( $status == 'future' ) {             echo '
SCHEDULING: ' .strtotime($post_date) . '>'. strtotime( "today" ) .'\r\n';             $newpostdata['post_status'] = $status;             $newpostdata['post_date'] = date( 'Y-m-d H:i:s', strtotime($post_date) );             $newpostdata->edit_date = true;              // Also pass 'post_date_gmt' so that WP plays nice with dates             $newpostdata['post_date_gmt'] = gmdate( 'Y-m-d H:i:s', strtotime($post_date) );             echo '
SCHEDULING: ' . $newpostdata['post_date'] . ' / GMDate : ' . $newpostdata['post_date_gmt'];         }              if ('insert' == $operation) {             $err = wp_insert_post($newpostdata, true);         } elseif ('edit' == $operation) {             $newpostdata['ID'] = $post_id;             $err = wp_update_post($newpostdata);       //echo "wp_update_post::Error return: ".$err ."\r\n";         }     }      Thank you very much!


How to install a wordpress website template on an existing website?

I just downloaded a template called Senna for my website. It's a responsive wordpress template, and I don't have knowledge of how to use wordpress templates. My currently website is html based on 117.boxhost.me ... The website has auto install feature of installing wordpress to folder(s)... I installed wordpress to a subdirectory: /wordpress. Currently I've kept the main site in html, and I post blog posts on the wordpress. I need to combine the main site with the wordpress and don't want to disturb the directory /wordpress. That's because I've already posted the blog links elsewhere on the internet and so anyone trying to read the articles won't be able to find the pages if I move the blogs from subfolder to main folder. I'm trying to keep the index.html of root website as a redirect page with `"meta=refresh"` tag. So the main site would then be at : `117.boxhost.me/wordpress/` But I don't know how to change the current set of pages to a webpage form. What I know about wordpress templates is: Install wordpress > Upload the images and content of the pages > And then upload the zip file as a theme for the wordpress. After that I don't know if it's easy to create the pages in the new theme/template or would that disturb or damage the blogs posts or their permanent-url... Also, the downloaded file doesn't contain any zip files, only a 5 folders including a folder Senna, with subfolders (templates, etc) That's mostly all I need to ask. Thanks for any help.


How to add modified php in child theme?

I have lot of modification in my php parent theme. How to save it to the child theme that I have? So, if ever the theme have some new version the php files that I modified would not affect. Thank you


new page redirect to old page which had the same permalink

I had a page on /features/   and a newer page on /features-2/   I wanted the newer page to get the more pretty slug /features/   So i did the following:   /features/ => /features-old/   /features-2/ => /features/   But when I go into /features/ now I'm sent to /features-old/


How to create a custom image gallery in the footer?

I need to add sponsor images, thumbnails, in the footer of a Wordpress website. I'd like the possibility to just upload images through the native Wordpress media gallery and then having a way to select those pictures. Is there a way to do this? A way to mark some uploaded pictures so that I can select them for the footer? Right now I'm using the image widget. It works, but I'm not totally satisfied. I would prefer to get images from the php code and customize them as I want and possibly not having to use a plugin.


change add to cart button link

I'm new to WordPress and the WooCommerce plugin. I'm creating a plugin to change the add to cart button link if it hits a desired stock quantity. For example if stock qty is above 50, I would like to change the link for special payment. I've searched for hours in the internet and found no solution or idea on how to do it.   Is it possible? Can you give me ideas on how to start and implement it.


Add Media Button Stops Working After Publishing The Post. It works fine for the first time when I try to create a post or page. Once I publish the post, it stops working. It is not just Add Media, all types of JavaScript and jQuery popups gets automatically disabled. See there is one more thing that I noticed: If I do not add any image, and publish it. It works. Once I add an image in the post, it stops working. I have tried default theme. I had uninstalled all the plugins. Nothing worked. I hope somebody would give me a clue to solve this problem. This is happening to all my sites on the same shared server.


Is the front-page.php template reserved in wordpress twenty twelve theme?

I'm writing my first twenty twelve child theme and came across (what I think) is a strange quirk. I modified front-page.php to have a slider using sliderjs, afterwards I decided I did not want to use this as a front page template, so I'd much prefer to call it something else for a different page. To my surprise, the moment I renamed front-page.php to text-carousel.php and changed the Template Name in the docblock to something else the page changes from displaying my content in full width and the widgets below to a 2 column version similar to my blog, but with the widgets assigned to front-page. So, is front-page.php a reserved template in twenty twelve? is it possible to duplicate its look and feel into a different template? For reference here's my code:               <?php     /**      * Template Name: Text Carousel Page Template      *      * Description: A page template that provides a key component of WordPress as a CMS      * by meeting the need for a carefully crafted introductory page. The front page template      * in Twenty Twelve consists of a page content area for adding text, images, video --      * anything you'd like -- followed by front-page-only widgets in one or two columns.      *      * @package WordPress      * @subpackage Twenty_Twelve      * @since Twenty Twelve 1.0      */          get_header('nonav'); ?>

             <?php              $args = array(                             'posts_per_page'  => 5,                             'orderby'         => 'post_date',                             'order'           => 'DESC',                             'post_type'       => 'post',                             'post_status'     => 'publish',                             'suppress_filters' => true );                              $myposts = get_posts( $args );                         foreach( $myposts as $post ) :  setup_postdata($post); ?>

<?php the_title(); ?>

<?php echo get_the_excerpt(); ?>

<a href="<?php the_permalink(); ?>" class="link">Leer articulo

                         <?php endforeach; ?>

     <?php get_sidebar( 'front' ); ?>     <?php get_footer(); ?>      It works fine if the file is called twentytwelve/page-templates/front-page.php with **Template Name: Template Name: Front Page Template** , but it goes 2 column as twentytwelve/page-templates/text-carousel.php with **Template Name: Text Carousel Page Template** I had posted this question in stackoverflow, but it didn't seem to be getting too much success so I decided to open an account here and move it across.


watermarking gallery items

How can I add an image watermark to only those images which are to be published in gallery using a function in `functions.php`? Images can be in `.jpg`, `.png`, `.gif` format. I also found this snippet which serves the same but it watermarks all the uploaded images.


How to display only some widgets of a sidebar?

I would like to break up a sidebar over three containers. Each container should hold up to three widgets of the sidebar. Therefore, I need to find the HTML for only the widgets 0 to 2, 3 to 5 and 6 to 8 separately. Normally, I would use `dynamic_sidebar()` to display the sidebar, but this function doesn't accept parameters to specify that I only want a range of the widgets of the sidebar. Moreover, I found `wp_get_sidebars_widgets()`, but it is not intended to use for themes. How can I get only the widgets in a given range of a dynamic sidebar? For example, this is what I think of.               // functions.php     // display range of widgets of a sidebar     function dynamic_sidebar_range($name, $from, $to)     {         $widgets = get_dynamic_sidebar($name); // this function doesn't exist!         for ($i = $from; $i < count($widgets) && $i < $to; ++$i ) {             $widget = $widgets[$i];             echo $widget['before_widget']                . $widget['before_title']                . $widget['title']                . $widget['after_title']                . $widget['content']                . $widget['after_widget'];         }     }      ****               // frontpage.php     // consists of blocks of three posts or widgets alternatingly     for ($sections = 0; $sections < 3; ++$sections) {         // display three posts         for ($i = 0; $i < 3 && have_posts(); ++$i) {             the_post();             // ...         }         // display three widgets         $from = $sections * 3;         $to = $from + 3;         dynamic_sidebar_range('name', $from, $to);     }


Properly customizing login/register form

I'm working on a customized login form for WordPress. I noticed that it's pretty difficult to achieve what I wanted. Here's the HTML of the form:               <form method="post" action="<?php bloginfo('url') ?>/wp-login.php">

<input type="text" name="log" id="user_login"  value="" placeholder="<?php _e('Username'); ?>"/>

<input type="password" name="pwd" id="user_pass" value="" placeholder="<?php _e('Password'); ?>"/>

                 <input name="rememberme" type="checkbox" id="rememberme" value="forever"  <?php checked( $rememberme ); ?> />                 <?php esc_attr_e('Remember Me'); ?>
             <a href="/nojs.html" class="loginbox_button form_submit" title="<?php esc_attr_e('Log In'); ?>"><?php esc_attr_e('Log In'); ?>

                     Not registered?	                     	                     Forgot password?

                     <a href="<?php echo get_permalink(); ?>?action=register" class="loginbox_stdbutton" title="Register">Register	                     	                     <a href="<?php echo get_permalink(); ?>?action=lostpassword" class="loginbox_stdbutton" title="Reset Password">Reset Password

     </form>      Due to style requirement, I put `div` wraps around `input` boxes and the submit button is an anchor tag. According to the document, `wp_login_form` and its hooks will not be able to implement this design. So I followed the suggestions on this question (I asked) Custom user profile, registration, login page with theme , and got something close to http://digwp.com/2010/12/login-register-password-code/ . Basically, it allows you to put the login form anywhere you want, but still points back to `wp- login.php` when submitted. But it has one major flaw. When login is incorrect, it points you back to `wp- login.php`. Like this demo, if you click "Login" without entering anything, it leads you back to the default `wp-login.php` form. I'm currently putting the above form in one of the custom pages. I had a filter hooked to `template_include` and used this HTML code as the login form. I only wanted to change the style, I'm not planning on adding functions. What does it take to implement this login form design? Shall I start from wp- login.php and change it? If so, how do I start (in terms of putting in the theme and form)?


single.php fires more than once after clicking on any post to view with different post id each time

I am now experiencing a wired problem with my wordpress installation. I was surprised when I saw post view counter of another post also increased including the the post on which I clicked to try and check the result. I also observed that it increments the post view of another post from the same user. For more information: I am calling a function from single.php while passing post id to it to display post counter at the bottom of post. In order to trace the issue I used netbeans IDE and found that single.php runs more than once and it passes different post id at first run and subsequently it passes correct post id at the end. In order to get post id on single.php I used: `<?php $newpostid = get_the_ID(); ?> Total Views <?php echo_views($newpostid); ?` echo_views() is a function which directly used to output the updated number using echo statement within it. Hope someone can help me out of this issue. Thanks.


Unable to get wp_redirect() working after adding a CPT via the front end

I am attempting to learn PHP by creating a relatively simple application built on wordpress, it is a basic CRM and I've made decent progress but have been stuck on some of the finer points. I've been having some serious 'headers already sent' problems with getting wp_redirect() working after a user creates a new customer. Here is an example of what I want to do:   * /new-customer.php : Create a new Custom Post Type via the front end and then redirect to that particular customer's single post page. Here is the code:                  <?php             $address_line_1      = $_POST['address_line_1'];             $address_line_2      = $_POST['address_line_2'];             $suburb              = $_POST['suburb'];             $state               = $_POST['state'];             $post_code           = $_POST['post_code'];             $country             = $_POST['country'];             $email               = $_POST['email'];             $first_name          = $_POST['first_name'];             $last_name           = $_POST['last_name'];             $phone_number        = $_POST['phone_number'];             $progress_identifier = '1';                      // PROCESS THE FORM                 if ('POST' == $_SERVER['REQUEST_METHOD'] && !empty($_POST['action']) && $_POST['action'] == "new_customer")                 {                          $new_customer = array(                         'post_title'  => wp_rand(100,999).'-'.wp_rand(),                         'post_author' => $user_ID,                         'post_status' => 'publish',                         'post_type'   => 'customer'                     );                          $pid = wp_insert_post($new_customer);                          add_post_meta($pid, 'address_line_1',      $address_line_1,      true);                     add_post_meta($pid, 'address_line_2',      $address_line_2,      true);                     add_post_meta($pid, 'suburb',              $suburb,              true);                     add_post_meta($pid, 'state',               $state,               true);                     add_post_meta($pid, 'post_code',           $post_code,           true);                     add_post_meta($pid, 'country',             $country,             true);                     add_post_meta($pid, 'email',               $email,               true);                     add_post_meta($pid, 'first_name',          $first_name,          true);                     add_post_meta($pid, 'last_name',           $last_name,           true);                     add_post_meta($pid, 'phone_number',        $phone_number,        true);                     add_post_meta($pid, 'address',             $address,             true);                     add_post_meta($pid, 'progress_identifier', $progress_identifier, true);                          $survey_post = array(                         'post_title' => $pid . '-' . wp_rand(),                         'post_author' => $user_ID,                         'post_status' => 'publish',                         'post_type' => 'survey'                     );                          $survey_id = wp_insert_post($survey_post);                          global $wpdb;                     $wpdb->insert(                         $wpdb->p2p,                         array(                             'p2p_from' => $survey_id,                             'p2p_to' => $pid,                             'p2p_type' => 'survey_to_customer'                         )                     );                     wp_redirect(home_url());                     exit();                 }         ?>      This code is placed after the HTML form. I know wp_redirect() has to be called before the page starts outputting anything but I am unsure how to make that happen because I have tried putting it further up in the page but it doesn't get me anywhere. Feel free to abuse me for the terrible code and ambiguous question but if you could possibly point me in the right direction to accomplish what I am trying to achieve that would be great! I have tried to break things up into functions to get called via the 'save_post' hook but no luck with that either. Thanks for reading!


Create a Network of Different websites with wordpress

I followed wordpress instructions of creating network of websites.   I created two subdirectories; `/site1` and `/site2`.   Why doesn't WordPress create different folders for both the subdirectories in `/theme` folder?   I want to build a network of websites with different theme but some Functionality will be same and some might not, that is why I need folders to change it.


How To Add WordPress Style Toggle Boxes

How to add a WordPress style toggle box with custom text in a plugin. Here's a example of it from All in one SEO plugin: ![enter image description here](http://i.stack.imgur.com/SWkkN.png)


Use mapped URL on images

I have wordpress installed on my own webspace and have the blog on some native URL like https://user.foo.bar/wordpress/, but I don't want this URL to be public. Instead I want to use a mapped URL for all public content. **What I've tried so far:** On the server I have mapped my own (sub)domain like `blog.foobar.com` to this URL, which works fine. The blog is reachable at `blog.foobar.com` and all post show this URL. In the WP settings I have then set "WordPress Address (URL)" to the original URL and "Site Address (URL)" to my domain, which I want to use for public access. However, when I put an image in a post with no link URL, and I tell my browser for example to copy the image URL or to open the image in a new tab, the URL is something like `user.foo.bar/wordpress/wp-upload/content/bla/image.jpg`. But I want it to show only the mapped domain, e.g. `blog.foobar.com/image.jpg` or similar, so that my native server/user URL is not exposed. Is that possible? I have also tried to use a link on the file, which also gives me the original URL. I checked the advanced settings of the image, where the Source address also is the original URL (with seems to be the core of the problem). When I then manually replace the source URL `user.foo.bar/wordpress/wp-upload/content/bla/image.jpg` by the mapped url `blog.foobar.com/bla/image.jpg`, it works. Then, the browser shows the image to reside at the mapped URL. Is there a way to make this the default? To use the mapped URL for all public content? As I figured, setting both "WordPress Address (URL)" and "Site Address (URL)" to the mapped URL would probably do this. However, I need to keep "WordPress Address (URL)" at the original server URL because that has HTTPS access which I want to use for administrating WP and the mapped domain does not. Any ideas if this is somehow possible? Otherwise I have to replace the source URL for every image manually.


How to add menu to Dashboard that can be viewed by all users

I am able to add Menu to the Dashboard using the below code, it can be viewed by an administrator. That menu doesn't appear when logged in as an Author or a Subscriber. How to make sure every user can view the custom added menus.               //Add Menu Page               add_action( 'admin_menu', 'register_my_custom_menu_page' );          function register_my_custom_menu_page(){     add_dashboard_page( 'custom menu title', 'Test', 'manage_options', 'custompage', 'my_custom_menu_page', plugins_url( 'test/images/icon.png' ), 6 );      }               function my_custom_menu_page(){     echo '

';         echo '
Test
';         echo 'Test';          echo '
';     }


Website Preview Graphic for Wordpress Site

No idea how to ask this... so I'll give it my best. I have a Wordpress site, self hosted. When I post a link to a post on Facebook, Facebook tries to detect a preview graphic to show along with the post (see screenshot) ![Example](http://i.stack.imgur.com/ez1ZX.png) For whatever reason, Facebook always picks up the Stumbleupon share button for the graphic. It's not the first graphic on the page, and it's not the last either, so I'm not sure why. But more importantly, my question is... when I am not using a Featured Image for the post (sometimes I do, sometimes I do not), how can I make sure that previews such as this pick a different image? The site uses a favicon, but that doesn't seem to work in this instance. Is there an image, or something I can set in code, that would allow me to specify what image gets picked up when a site tried to create a preview like this?


Displaying Page as Custom Post type landing Page

Custom Post-Types are awesome and a PAIN at the same time. Basically, I need to have a landing page, with the list of the direct child elements of the post type (think product categories), but also some information copy at the top as well. I initially created a top-level post called "Products" and have the hierarchy tree underneath that, but that was making the link http://example.com/products/products which is obviously not what I want. I know I can create an archive page and a custom template to display JUST the child elements, but I'm not sure how add the extra content (I.E. the informational content) at the top of the page without hard-coding it into the template. Any way to do this?


Adding a list of social media links

I want to add a list of my social media pages. What ways are there to do this? Are there widgets designed for this?


How do I add new post formats to twenty fourteen theme?

I haven't used WP since 3.5 so forgive my rustiness. I am trying to customize a child theme of twenty fourteen for WP 3.9.1 to make it more like a corporate site rather than a magazine site. **My goal:** For the marketing department to simply login, add a product (post) and select the matching post format. In SLT3, I did a `Find Advanced > In Parent Folder` and duplicated the image custom post format code in `taxonomy-post_format.php`, `languages/twentyfourteen.pot`, `inc/widgets.php` and added a `content- product.php` with no luck. _In addition to the default Standard, Aside, Image, Video, Audio, Quote, Link and Gallery, how do I add more custom post formats e.g. products?_ **From content-product.php:**               <?php     /**      * The template for displaying posts in the product post format      *      * @package WordPress      * @subpackage Twenty_Fourteen      * @since Twenty Fourteen 1.0      */     ?>     ...
                                      <a class="entry-format" href="<?php echo esc_url( get_post_format_link( 'product' ) ); ?>"><?php echo get_post_format_string( 'product' ); ?>      **From widgets.php:**               public function widget( $args, $instance ) {         $format = $instance['format'];              switch ( $format ) {             case 'image':                 $format_string      = __( 'Images', 'twentyfourteen' );                 $format_string_more = __( 'More images', 'twentyfourteen' );                 break;             ...             case 'aside':             default:                 $format_string      = __( 'Asides', 'twentyfourteen' );                 $format_string_more = __( 'More asides', 'twentyfourteen' );                 break;             case 'product':             default:                 $format_string      = __( 'Products', 'twentyfourteen' );                 $format_string_more = __( 'More products', 'twentyfourteen' );                 break;         }      **From twenty fourteen.pot:**               #: inc/widgets.php:84 taxonomy-post_format.php:45     msgid "Products"     msgstr ""          #: inc/widgets.php:85     msgid "More products"     msgstr ""      **From taxonomy-post_format.php:**
                         <?php                             if ( is_tax( 'post_format', 'post-format-aside' ) ) :                                 _e( 'Asides', 'twentyfourteen' );                                  elseif ( is_tax( 'post_format', 'post-format-image' ) ) :                                 _e( 'Images', 'twentyfourteen' );                             ...     elseif ( is_tax( 'post_format', 'post-format-product' ) ) :                                 _e( 'Products', 'twentyfourteen' );                                  else :                                 _e( 'Archives', 'twentyfourteen' );                                  endif;                         ?>
                       Most closely related WPSE question here ![The default Post Formats are Standard, Aside, Image, Video, Audio, Quote, Link and Gallery](http://i.stack.imgur.com/XlY4X.png)


I want to edit documents on my blog without the need to download and upload files again

Would that be possible? Basically, I need something which will enable me to edit files directly at the server... any help would be much appreciated....


URL/Permalink customization for Taxonomy/Term archive & post

I have a CPT called "Provider", taxonomy called "State" and a term called "Alabama". Is it possible to change the following URL structure from:               1. http://localhost/state/alabama     (to view all the providers from Alabama)          2. http://localhost/providers/some-provider-in-alabama     (added a post under CPT provider and choose AL from State)      to               1. http://localhost/alabama     2. http://localhost/alabama/some-provider-in-alabama      I am using: - WP 3.9.2 - Taxonomy Template "taxonomy-state.php" - WCK - Custom Fields and Custom Post Types Creator (To create CPT and Taxonomy)


Theme change only in CSS and a few images

We created a theme that has a lot of changes in it. Now we want to enable that theme on our site in different colors, and a few images different: ![enter image description here](http://i.stack.imgur.com/N77sV.png) What we're doing is duplicating the theme, and then making a few changes in the CSS, and change a few images. But it seems an overkill - to copy the all the theme files just to make so few changes. Moreover, if we ever have to change something functional in the theme, we'll have to go through all the duplications and apply it. Is there a way to give users the option of changing colors & images, without duplicating the theme?


Is it possible to change the image in the default theme 'Twenty Eleven'? If yes, how is this done?


Gettext details

I've got a few `gettext()` questions that are not covered anywhere in WordPress Codex but I think they are important.   1. `__('string')` in THEME should be used for strings that are likely to be present also in main WordPress translation file. No textdomain necessary. Examples: one, two, submit, cancel, remove and other common words. Correct?   2. `__('string', 'textdomain')` in THEME should be used for strings that are theme-specific. Examples: 'this option enables X feature'. Correct?   3. I think it's better to make one textdomain for front-end of theme and another for back-end. Like `__('string', 'textdomain')` and `__('string', 'textdomain-admin')`. Not everyone wants to spend hours to translate 100 additional admin panel strings. Correct or it's bad practice?   4. Each PLUGIN should have its own textdomain: `__('string', 'plugin-name')`. Correct?   5. I think that setting CONTEXT for THEME string is very, very useful but nobody does this. Why? Like: `_x('add item', 'add slide text', 'textdomain')` and `_x('add item', 'shopping cart', 'textdomain')`.   6. How to translate comments, dates, currencies, hours, numbers?      1. Example: one comment, two comments, but in some languages it may be: one comment, two comments, three commentsX, four commentsXY, five commentsXYZ, six commentsABXY (a lot more different plural forms with complex patterns).     2. Example: nearly all themes use `the_time(get_option('date_format'));` - shouldn't it be `echo date_i18n(get_option('date_format'), strtotime($post->post_date));` or `echo date_i18n('F jS, Y'), strtotime($post->post_date));`?     3. Example: English uses 12,345.12, but some languages may use 12.345,12.


RSS Feed to contain posts from 1 category only

I am using a theme with many custom post types but I would like my main RSS feed `www.domain.com/feed` to show posts and custom post types from one category only. The categoy is defined within `Posts / Categories`.   1. How can I do this?    2. Is this bad for SEO?  In any case, I have noticed that my posts take a few days to be indexed by Google even if they are included in the RSS feed.


Conditional loading of CSS for my plugin

I'd like to continually load the stylesheet needed by my plugin depending on whether a particular shortcode is present on the post or page. The presence of the shortcode would indicate that the user is using the plugin on that post or page and therefore we need to load the JS and CSS. Is this possible?


Upload Directory question

Happy New year! So I am having a big of a problem, currently one of our php files that we bought points to the default uploads directory for wordpress and we would like to change this to our own uploads directory. We are still using the default uploads directory for wordpress but we want to change the directory where this custom php file uploads to. Currently the code looks like this:               $upload_dir = wp_upload_dir();     $upload_dir['basedir'].'/downloads/encrypted/'.$item.'/*'));      It currently looks like this "www.example.com/wp- content/uploads/downloads/encrypted/" We want it to point to "www.example.com/downloads/encrypted/" Have looked into the arrays for `wp_upload_dir();` but cannot seem to go a folder back. Any tips or help? Thanks


Adding page subdirectory dynamically, as like buddypress does

I have a page with slug/name **charts**. So the url looks like `http://domain.tld/charts/` for the Charts page. When i type the url to `http://domain.tld/charts/(something)` or `http://domain.tld/charts/(something)/(something)`, i got error not found, logically it should as there is no sub page with the given names. Now what is want is, when is visit to `http://domain.tld/charts/(something)` or `http://domain.tld/charts/(something)/(something)`, it should still query the Charts page, and also add the single or multiple occurred `(something)` into wp query var so that i can access it with get_query_var function. The (something) would return as an array ofcourse. The `(something)` could be any Alphanumeric characters, and not needed to be a valid one. Just need it so that WordPress Still makes query for the Chart page, and all the extra url path are added to wp_query Object. Your help is strongly needed.


Set a hard-coded page-template (post-type-archive) as home/front-page of my wordpress blog?

under Settings->Reading I can set which page should appear immediately when visiting my site as "home-page". In my case I want the archive of my custom-post-type named "events" as home/front-page of my site. So I have a hardcoded item in my navigation that says "Events" that links to /events and uses my custom-post-template to loop through my custom-post-type. How could I (and what is the best way) set this archive as the automatic home/front-page of my site? I want to avoid unnessecary routing on my page. So when calling "www.mypage.com" I want the archive to appear immedeately. Any ideas on that? Preferrably even as setting in my "Settings->Reading" section in the backend. Thank you in advance. Matt


Using wp_handle_upload and media_handle_sideload with ajax

I'm struggling to figure out how to use wp_handle_upload() with ajax when processing a form. What I'm doing here is using a form to allow users to edit posts from the front end so they can do some things like change the image for a post so we'll start there. I'm gonna leave out chunks of this function to keep it simple including the error checking.                // Process the edit form      add_action('wp_ajax_process_edit_form', 'process_edit_form');        function process_edit_form() {              require_once(ABSPATH . "wp-admin" . '/includes/image.php');         require_once(ABSPATH . "wp-admin" . '/includes/file.php');         require_once(ABSPATH . "wp-admin" . '/includes/media.php');              $image_file = $_POST['imageFile'];         $image_file_name = $_POST['imageFileName'];               $post_to_edit = get_post($_POST['postId']);              // Set Image File         if ($image_file["size"] > 0) {             $cover_art_id = media_handle_sideload( $album_cover, $pid );             wp_set_object_terms( $cover_art_id, 'cover_art', 'category');             update_post_meta($pid,'music_art',$cover_art_id);         }                 }      And a basic html form               <form enctype="multipart/form-data">       <input type="file" name="image_file" id="image_file" />       <input type="submit" value="Save Changes" tabindex="6" id="submit" name="submit" data-id="<?php echo $post->ID; ?>" />     </form>      And now some jquery. Note that the script this jquery has been localized and everything else in the form works correctly using my methods. The only thing that doesn't work is the file upload on submit.               $(document).on("click","#submit", function(e) {         e.preventDefault();         $this = $(this);         postId = $this.data("id");         imageFile = $this.closest("form").find("#image_file").val();         if (imageFile != "") {           imageFileName = $this.closest("form").find("#image_file").val().split('\\').pop();         } else {           imageFileName = "none";                        };            data = {           action: 'process_edit_form',           postId : postId,           imageFile : imageFile,           imageFileName : imageFileName        };        $.post(ajaxurl, data, function (response) {        });     });      I might have made some errors transferring this over but this is basically what I'm doing. So why does this not work? I saw this answer that says I need to use some type of ajax upload plugin but I'd like to do it without and if I don't understand how I'm using them to save the upload as an attachment. Straighten me out!


Custom Meta Box white screen

I'm trying to create a simple Custom Meta Box for a film post. I need a text box for Title and Director and a textarea for Description. Everything seemed to working until I added the textarea, I wasn't sure how to create the html.
             Description             <textarea name="meta_box_desc" id="meta_box_desc" col="100" row="5"><?php echo $desc; ?></textarea>
      The text boxes and textarea display in WP but when I click Update I get a white screen Can anyone see what I'm doing wrong.                   <?php         add_action( 'add_meta_boxes', 'cd_meta_box_add' );         function cd_meta_box_add()         {             add_meta_box( 'my-meta-box-id', 'Film Credits', 'cd_meta_box_cb', 'post', 'normal', 'high' );         }              function cd_meta_box_cb( $post )         {             $values = get_post_custom( $post->ID );                  $title = isset( $values['meta_box_title'] ) ? esc_attr( $values['meta_box_title'][0] ) : '';             $director = isset( $values['meta_box_director'] ) ? esc_attr( $values['meta_box_director'][0] ) : '';             $desc = isset( $values['meta_box_desc'] ) ? esc_attr( $values['meta_box_desc'][0] ) : '';                  wp_nonce_field( 'my_meta_box_nonce', 'meta_box_nonce' );                  ?>
                 Film Title                 <input type="text" name="meta_box_title" id="meta_box_title" value="<?php echo $title; ?>" />

                 Director                 <input type="text" name="meta_box_director" id="meta_box_title" value="<?php echo $director; ?>" />

                 Description                 <textarea name="meta_box_desc" id="meta_box_desc" col="100" row="5"><?php echo $desc; ?></textarea>
             <?php            }                   add_action( 'save_post', 'cd_meta_box_save' );         function cd_meta_box_save( $post_id )         {             // Bail if we're doing an auto save             if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;                  // if our nonce isn't there, or we can't verify it, bail             if( !isset( $_POST['meta_box_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_nonce'], 'my_meta_box_nonce' ) ) return;                  // if our current user can't edit this post, bail             if( !current_user_can( 'edit_post' ) ) return;                  // now we can actually save the data             $allowed = array(                  'a' => array( // on allow a tags                     'href' => array() // and those anchords can only have href attribute                 )             );                  // Probably a good idea to make sure your data is set             if( isset( $_POST['meta_box_title'] ) )                 update_post_meta( $post_id, 'meta_box_title', wp_kses( $_POST['meta_box_title'], $allowed ) );             if( isset( $_POST['meta_box_director'] ) )                 update_post_meta( $post_id, 'meta_box_director', wp_kses( $_POST['meta_box_director'], $allowed ) );             if( isset( $_POST['meta_box_desc'] ) )                 update_post_meta( $post_id, 'meta_box_desc', wp_kses( $_POST['meta_box_desc'], $allowed ) );         }         ?>


javascript and css links not working on sever

I have some Jquery links in my header. First off I am probably not using the proper wordpress function to do this. Right now on my site the code that is below is not working. These links aren't there, but in my ftp directory they exist. I am not sure what I am doing wrong? I can link to the live site if needed.               <link type="text/css" href="http://fiftyfity.com/wp-content/themes/fiftyfityNew/jQuery-ui-1/css/pepper-grinder/jquery-ui-1.8.17.custom.css" rel=stylesheet />     <script src="http://fiftyfity.com/wp-content/themes/fiftyfityNew/jQuery-ui-1/js/jquery-1.7.1.min.js"></script>     <script src="http://fiftyfity.com/wp-content/themes/fiftyfityNew/jQuery-ui-1/js/jquery-ui-1.8.17.custom.min.js"></script>      and here is the code before output                <?php $url = content_url();?>     <link type="text/css" href="<?php echo $url; ?>/themes/fiftyfityNew/jQuery-ui-1/css/pepper-grinder/jquery-ui-1.8.17.custom.css" rel="stylesheet" />      <script src="<?php echo $url; ?>/themes/fiftyfityNew/jQuery-ui-1/js/jquery-1.7.1.min.js"></script>     <script src="<?php echo $url; ?>/themes/fiftyfityNew/jQuery-ui-1/js/jquery-ui-1.8.17.custom.min.js"></script>


How do I / Is it possible to execute an external PHP file / function inside Wordpress?

On my set-up, there is the regular website which consists of a header and content (both printed from separate PHP files located in `domain.com/includes/`) and a Wordpress blog based in a subdirectory (`domain.com/blog/`). I want to include domain.com/includes/header.php on the main Wordpress skin. I have tried `require_once`, `include`, specifying the `ABSPATH` in the `wp- config`, and various other techniques but none of them have worked for me. Printing the header.php contents to Wordpress skin is vital and there is no compromise for it in my workflow. I would greatly appreciate any advice as to how I can get this script working, whether it be through a plugin or some edit to the core files, without having to change the location of `domain.com/includes/header.php`. Thanks in advance.


Wordpress theme ajax have_posts()

My goal here is to load the blogroll into my theme via ajax. But all that I can get as response is 0 (if I omit the die() line, else I get a blank response). Here is my code: js ajax:               $.ajax({         url:"http://domain.com/wp-admin/admin-ajax.php",         type:'POST',         data:'action=load_men_blog',         //dataType:'html',         //cache: false,         success: function(html){             $("#b_contentwrapper").empty();             $("#b_contentwrapper").append(html);         }     });      PHP (functions.php) :               function implement_ajax() {         while (have_posts()):           echo "azerty";         endwhile;         die();     }     add_action('wp_ajax_load_men_blog', 'implement_ajax');     add_action('wp_ajax_nopriv_load_men_blog', 'implement_ajax');      Since I have posts in my database, I expect azerty to be returned. But yet I receive a blank response or 0 if I comment the die() line. If I place any echo outside the while loop I get the echo in the expected div, which means that the javascript is working. Anyone can point me in the right direction?


Password recovery URL has error - but not found in code or db

On a multisite/network install, all of a sudden my password recovery URL has a problem:                http//my.domain.com/wp-login.php?action=lostpassword      Note the lack of a colon following the 'http'. A grep of the database and codebase does not reveal any culprits (although it must be in there somewhere). Any idea what might cause the problem? The site domain settings all seem correct. Here's the multisite config:               /* Multisite */     define('WP_ALLOW_MULTISITE', true);     define('MULTISITE', true);     define('SUBDOMAIN_INSTALL', true);     define('DOMAIN_CURRENT_SITE', 'http://my.networkdomain.com');     define('PATH_CURRENT_SITE', '/');     define('SITE_ID_CURRENT_SITE', 1);     define('BLOG_ID_CURRENT_SITE', 1);     define( 'SUNRISE', 'on' );


Load wordpress content in other domain

I've made some researches on google but can't get the right answer. I need to get my wordpress loops outside a domain using php file. For example: I have a website hosted with **www.mysite.com** using wordpress. And an other one is **www.secondwebsite.com** using only php. I would love to use something like the wp-load.php to use my loops in my php files. Thanks a lot, jhon * * * I can't get the server path rightly... Any ideas? Here are my different path: PHP FILE THAT NEED TO LOAD wp-load.php: `/home/faver/domains/facebook.faver.be/www/lili` Folder where the wp-load.php is: `/home/lbpl/www/` I tried this:               <?php     //Include WordPress     define('WP_USE_THEMES', false);     require('../../../../../lbpl/www/wp-load.php');               query_posts('showposts=1');     ?>          <?php while (have_posts()):           the_post(); ?>
<?php the_title(); ?>
           <?php the_excerpt(); ?>
<a href="<?php the_permalink(); ?>">Read more...
     <?php endwhile; ?>      But not working. I think I can't go to the `/home` directory cuz of the FTP rights. Thanks for the help Jhon


how can i integrate nexmo with my wordpress site?

I've been looking for something that will enable me send sms messages from my wordpress site to subscribers to my blog (it's not on wordpress.com. I got the files from wordpress.org and uploaded it to my own server). Finally I came across Nexmo.com. I've signed up but now I don't know where to begin from here. I've had a look at the documentation they provided at nexmo but I don't really understand what to do with it. Could anyone help me with how i can successfully integrate nexmo with my wordpress site? If it helps I'm using the theme graphene on my site.


Help! Turn php link data into url OR hide edit link in post admin OR hide drafts for all users except admin?

My website allows users to upload events via an upload process incorporated into a customised front end page. As an event uploader, I also want users to have access to the dashboard where they can view the events they have posted. > I ideally want to remove access to edit.php - I don't want users to be able > to edit / or reach post.php, at all through their dashboard. I only want > them to upload events through the customized front end upload. ### SOLUTION POSSIBILITY 1 I could disable edit for the contributor role completely and still have a way to show posts to the event listers from their dashboard, if I could just learn how to add this info to the menu in the admin side bar in the form of a button in the dashboard (for all users). This code came from a link I found in a widget:               <a href="<?php echo get_author_link( $echo = false, $current_user->data->ID; ?>LINKED TEXT HERE      I tried to add it using AG Custom admin add menu button funtion, but it didn't work. The above would be the ideal solution for me as there'd be no access to edit.php through url link for this role. One set back is that showing the posts in the fron end, shows an edit button when the post is still a draft. I would like to remove the EDIT button from the front end page they view, I think it only appears in draft status as this role can't edit published posts (I will have to double check that). Even if it's the users post I don't want them to be able to edit it once it has been submitted, as I only want what I originally approve to be published. I reckon I could work that out myself (In single probably?)bugt if anyone can help whilst I think of it that would be great! ### SOLUTION POSSIBILITY 2 So - if I use role manager to completely prevent editing, that removes all access to the edit.php. which is fine in the instance above (if I can add that link to show all authors posts into the admin sidebar). But I really do want event uploaders to be able to view a list of their events and view each one. Edit.php seems a good second best place for that to happen if I can't link to a list in the front end as in the exp above, as the events are already listed at edit.php, as is the view facility. I just don't want to allow a link through to edit, and there is that link in the title of the post until I have approved it!! I thought if I could disable the link through to edit a post. (through to post.php) which is incorporated into the title of each row in the table of posts (or events in my case) then that would stop people from accessing that screen. BUT I would then, though, have to solve that the screen would still be accessible if they pasted in '/edit.php' to the url. I have removed quickedit and edit, and edit from the bulk filter at the top of edit.php. ### SOLUTION POSSIILITY 3 Another possible fix takes advantage of the fact that once a post is published (approved by me) by a contributor, this link on the post title in edit.php screen actually disappears! So alternatively, if someone knew a code I could paste into functions within the theme or even the core files, (i don't mind, either way, I'm desp!) to make it possible for only admins to posts of draft status in their post list in edit.php, so once a contributor posts an event in the front end, it doesn't appear in their own post screen until it becomes published (when I have approved it), then that would also solve my problem! Thank you so much for your time! I utterly am stuck, I can't find a solution to any of these options, this as far as I can get with each! I would be so SO grateful if there was anyone out there who could help me with this challenge, I am truly stumped. I'm not a php expert, but I'm handy and have a reasonable grasp, and am good at finding solutions and amending ones from others to match my unusual needs, etc. I have spend ages on this one and just had to wave the white flag! I'll eagerly look out for any tips from our there in the big wide world ! Thanks again Kaye ....................................................................................... Other notes:   * I'm using wordpress v3.1.1   * I use manage readers own posts   * I have hidden the media library so contributors see only their own piccies.   * I use role manager to deal with role limits   * I also use rolescoper to deal with category limits   * I use adminize and global screen options to tailor screen   * I use AG custom admin to help tailor admin screen   * Along with a heap off other functions and plugins. I would very much like to allow event uploaders access to a dashboard, so I don't want to hide the whole dashboard as a solution to this problem of hiding access to editing (or POST.php) in the back end.