Posting comment returns 404

I've been tracking an issue in one of our WP installations and keep coming up short of a solution. One of our websites is installed in a sub-directory of our main website. Both are WP installations. We noticed several weeks ago that in the child site, when a user (logged in or otherwise) posts a comment, he is returned a 404 for wp-comments-post.php. The file does indeed exist, and I've tried replacing it with a known working copy, chmod values, etc. The only thing that I can do to get comments working is to remove (entirely) the .htaccess file. Assuming it was a permalink issue, I started playing with settings there. If I change the permalinks setting to default, I can indeed get comments working alongside the .htaccess file. Any other permalink format and I'm back to the issue (until I delete the .htaccess file of course). The default permalink setting isn't a viable solution as we have so many linked blog posts out in the wild. We don't want to risk breaking those. I've played with various .htaccess rewrite rules to see if I can get around this, but keep coming up with nada. The vanilla .htaccess settings that get generated when I save permalinks doesn't help. I have a hunch that it's related to the nested directory structure - the child site living within another WP installation directory. All the literature I find says that shouldn't be a problem though. The site in question is a Genesis theme put together by a designer who is stumped. Another oddity, is that we randomly get 404 errors while navigating the admin side of things. When that happens, if I refresh the page, the 404 goes away and the admin page I'm trying to get to shows up. Any leads would be appreciated.


$wpdb->get_var - What value is returned when zero records are found?

I have the following code:               $queryPermission = $wpdb->get_var(  $wpdb->prepare("SELECT Active FROM testers                                                    WHERE user_id = '$user_id' "));         if($queryPermission == NULL OR $queryPermission == 0) {              header ('location: noaccess.php');         } else {              }      When the SQL returns records the $queryPermission variable is set to 1 which is great. However when the SQL returns no records the variable $queryPermission returns nothing. I then want to try and pick up on this and redirect the user when that variable contains nothing. I have tried "NULL" and "0" but neither of those seem to work. I was wondering, how can I pick up the case where nothing is returned by SQL using get_var? Thanks :)


How to prefill comment-author, -site and -mail inputs when user writes a second comment? I think it is saved in a cookie. Are there some functions? THX


Getting titles from an array of IDs

I have two custom post types called actors and movies. In movies, I have a custom meta box that got data from actors post type. When an actor is selected in movie post, the values (post_id, meta_key and meta_values) are stored in postmeta table. So I build a page to show all movie info. Fot that, I'm using WP_Query:                    <?php             $args_movie = array('post_type' => 'movie','posts_per_page' => -1);             $movie_posts = new WP_Query($args_movie);                  if($movie_posts->have_posts()) :                 while($movie_posts->have_posts()) :                 $movie_posts->the_post();          ?>
<?php the_title() ?>
               <?php endwhile; else: ?>             Oops, there are no posts.          <?php endif; ?>      This works fine for me. Now I'm trying to show all actors associated with each movie. This script return an array of IDs:               $actors= get_post_meta( get_the_ID(), 'actors'); print_r($actors);       But how can I using this array to get actor's titles? **SOLVED**               $args = array('post_type' => 'actors','orderby' => 'ASC','post__in' => $areas);      more info


Theme customizer live preview JS- Trying to bind to an html image url without luck

I am having a little trouble binding the theme customizer live preview javascript to an HTML `<img src>`- more specifically it is my logo. Here how the html looks on the page(which is fine and dandy):               <img src="<?php echo mytheme_theme_mod( 'footer_logo' ); ?>" />
      Now my problematic part is the JS - Here are my first two attempts. Both not working.               Attempt 1:              /** Footer logo */     wp.customize( 'mytheme_footer_logo', function( value ) {         value.bind( function( to ) {             $( '.footerlogo img src' ).html( to );         } );     } );      Attempt 2:               /** Footer logo */     wp.customize( 'mytheme_footer_logo', function( value ) {         value.bind( function( to ) {         var footer = $( '.footerlogo img' );               footer.attr( 'href', to );              } );     } );      Can anyone give me assistance on this?


Is there any way to give all users access to one blog in a multisite network without using a plugin?

I know there are various plugins out there to help with multisite user management, but we have a policy of avoiding plugins for a) overzealous security policies, and b) interfering with our already heavily-modified WordPress installation (this has bit us before). Also, simply adding all ~10,000 users to this one blog seems inelegant. That's a _lot_ of new entries in `wp_usermeta`. Is there any filter or action I can intercept to say "if this is blog X, then let any registered user through"? The `admin_init` action hook lets me _restrict_ users according to arbitrary criteria, but I don't know how to let them through.


After deleting a post are terms, and custom meta deleted?

I have a custom post type setup with a custom taxonomy. Once a post is created with custom meta data and terms in the custom taxonomy. If I delete the post does it delete the terms and custom meta?


Exclude javascript in certain page url and all following url's after forward slash

I'm trying to exclude javascript from a couple of pages. But I want to target all the pages after the forward slash. So I want to to target: `www.website.com/page-name/..` So the page-name itself, alswell as all the siblings ever to come after it. So this url `www.website.com/pagename/word/` but also `www.website.com/page- name/00/word/name/` To in- and exclude my javascript I use the following in my `functions.php`:               function enqueue_scripts() {              wp_deregister_script('jquery');              wp_register_script( 'jquery', get_template_directory_uri() . '/includes/js/jquery.js', false, null, true);         wp_register_script( 'script_bootstrap', get_template_directory_uri() . '/includes/js/bootstrap.min.js', false, null, true);         wp_register_script( 'script_mmenu', get_template_directory_uri() . '/includes/js/jquery.mmenu.min.all.js', false, null, true);         // ... etc              global $blog_id;                if( $blog_id == 3 && is_page( 17 ) || is_page( 20 ) || is_page( 22 ) || is_page( 24 ) )         {             // no js         } else {             wp_enqueue_script('jquery');             wp_enqueue_script('script_bootstrap');             wp_enqueue_script('script_mmenu');             // ... etc         }       }      add_action( 'wp_enqueue_scripts', 'enqueue_scripts' );


wordpress check wp_head and wp_footer

I am creating a plugin to add some javascript to Wordpress's theme header and footer. I'm doing this through the following wordpress hooks:               add action(wp_head,function_name)     add action(wp_footer,function_name)      However my plugin can't add script if the clients theme does not have `wp_head()` and `wp_footer()` functions. Is there any possibility that I can use `if-else` in my plugin to check to see if the client's theme has `wp_head()` and `wp_footer()` functions. Or is there any possibilty to add my javascript before `</head>` and `</body>` tag without using `wp_head` and `wp_footer` hooks.


Add more tables under wp_term_taxonomy

How do I add default fields/columns in the taxonomy terms? I can add custom fields using plugins like ACF but I have no idea on how to query them from the database. I can query the name, slug, and description because they are stored in the db by default.               $result = $wpdb->get_results("                 SELECT wpterms.*, wptaxonomy.*                     FROM $wpdb->terms wpterms, $wpdb->term_taxonomy wptaxonomy                     WHERE wpterms.term_id = wptaxonomy.term_id                     AND wptaxonomy.taxonomy = 'clients'             ");       How do I add custom fields in my taxonomy so that it will also insert in the database? Ideally in `wp_taxonomy_terms` table.


Modify function Shortcode_atts

function get_date_posts($params, $content){             $default_params = array(                 'post_type'     => 'post',                 'order'         => 'asc',                 'orderby'       => 'meta_value',                 'posts_per_page'=> 5,                 'meta_key'      => 'fl_date_picker'             );                  if (isset($params['type']) && !empty($params['type']) && post_type_exists($params['type']))                 $params['post_type'] = $params['type'];                  if (isset($params['taxonomy']) && !empty($params['taxonomy']) && taxonomy_exists($params['taxonomy'])                  && isset($params['slug']) && !empty($params['slug']))                 $params[$params['taxonomy']] = $params['slug'];                            foreach(array('type', 'slug', 'taxonomy') as $key)                 if (isset($params[$key]))                     unset($params[$key]);                  $params = wp_parse_args($params, $default_params);                  $params['meta_query'] = array( array(                     'key' => $params['meta_key'],                     'value' => date("Ymd"),                     'compare' => '>=',                     'type'=> 'date'                 )             );                  $transient_hash = 'get_date_posts_'.substr(md5(serialize($params)),0,10);                            if (false === ($html = get_transient($transient_hash))){                 add_filter('query', 'q');                 global $request_sql;                      // init                 $html = '';                      $rp = new WP_Query($params);             //  $html .= '
START
';             //  $html .= '
'.var_export($params, 1).'
';             //  $html .= $request_sql.'
';              if ($rp->have_posts()){                          $html .= '
';                     while ( $rp->have_posts() ) {                          $rp->the_post();                          $html .= "
";                              if (($thumb_id = get_post_thumbnail_id())){                             $thumb = wp_get_attachment_image_src($thumb_id, 'panel-small', false);                             $flag = get_field('fl_country');                             $html .= "
";                             $html .= "" ."";                         }                         $html .= "".get_field('fl_event_date')."";                         $html .= "".get_field('fl_event_title')."";                              //  debug                            //  $html .= "".get_post_meta(get_the_id(), $params['meta_key'], 1)."";                              $html .= "

";                     }                     $html .= '
';                 }                      if (!empty($html))                     set_transient($transient_hash, $html, 60);                  }             return $html;         }      The function above sorts posts by date using a custom field `'fl_date_picker'` I need to modify this function so that the user specifies the number of posts to show in the shortcode. For that I tried using:                 extract( shortcode_atts( array(             'post_type'     => 'post',                 'order'         => 'asc',                 'orderby'       => 'meta_value',                 'posts_per_page'=> 5,                 'meta_key'      => 'fl_date_picker'         ), $atts ) );      However the `fl_date_picker` does no longer work if I do this and post order is not retained.


How to load jQuery in the footer - nothing works for me

I tried all the solutions I found on the internet, including the ones I found here, but nothing works on my theme - jQuery always load in header. I try to use the one from Google, but I would be happy to use the local one too, only in footer. This is what I have now:                  function my_init() {         if (!is_admin()) {             wp_deregister_script('jquery');             wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js?ver=1.10.2', false, '1.10.2', true);             wp_enqueue_script('jquery');                  // load a JS file from my theme: js/theme.js             //wp_enqueue_script('my_script', get_bloginfo('template_url') . '/js/theme.js', array('jquery'), '1.0', true);         }     }     add_action('init', 'my_init');      Any ideas why no solution works for me?


Search a specific custom field values in a specific custom post type

Hello WordPress developers, In my site, I have created a custom post type called "BOOKS". And In that custom post area there's a custom data field called "Author". Now, what I want is add a search bar on a custom template and allow users to search "Books" by typing the "Author" name. I mean, when they type "William Shakespeare" and hit search button, that page should list books(my custom post type) written by only William Shakespeare. I found a code almost for doing this but, it does not recognize Custom Data field values. It only cares Post content. ![Please see attached picture.](http://i.stack.imgur.com/qzUi8.png) It was from this tut:   **Search Specific Post Type WordPress** - StudioNashVegas Is this possible?


"Parse error: syntax error, unexpected" and the Wordpress Theme Editor no longer working!

I knew I made a syntax error or something which Wordpress showed error after I added code to functions.php : Parse error: syntax error, unexpected 'Lucida' (T_STRING), expecting ',' or ';' in /home1/[name]/public_html/wp-content/themes/[name]/functions.php on line 49 The problem now is that, how am I supposed to rectify the problem when I tried clicking on any part of my website now, it will just show that error message without allowing me to even edit back the code? I hit the 'back' button, and managed to go back to the theme editor, and removed all changes, to restore to its default and click 'update file'. It still showed me the same error. I can't even enter my admin page of the Wordpress. Can anyone help on this? Nothing I can do now? **I FIGURED OUT THE SOLUTION** I'm tired of waiting. I've fixed it on my own. Looking somewhere at Wordpress.org support forum and there were people suggested to ftp to the website, and edit back the functions.php file. So the steps:   1. If you have control panel on your web hosting, you can either use File Manager on your control panel or ftp to your website using ftp client such as FileZilla.   2. Remove whatever faulty from the functions.php, and if you have to, restore to its default.   3. Click 'Save' and you are done. My problem fixed.


Full Domain Mapping with WP3 in Multiuser Mode

You may have learned already to reconfigure your WP3 so that it loads in MU mode, and set it for subdomains. Evidently my Dallas client claims that **instead of just subdomains** , there are some tricks you can do (cpanel? wp-admin? plugin? config file change?) **to make a full domain like example.com for a subdomain, instead of having a subdomain like blog1.example.com**. Is this true? How is it achieved? Does it have any caveats that you can think of?


Automatically going to the first page in a hierarchy?

Let's say I have a website about different types of cars. The structure is a little like this:               -Home     -Cars (shows a submenu with a list of cars, ie Volvo 850, Porsche 911 )      -Volvo 850 overview (the page you get when you click Volvo 850 on the Car page)      -Volvo 850 tech spec (the three Volvo pages are shown as submenu links on any Volvo page)      -Volvo 850 pictures      -Porsche 911 overview      -Porsche 911 tech spec      -Porsche 911 pictures      What's the best way of doing this? I guess what I'm asking is how to **automatically** make the Cars page list the different Cars, and link to the overview page and not the others. And then on the individual car pages, have more sub-menus for overview, tech spec, and pictures page. I could have a structure like this:               -Cars (shows a submenu with a list of cars, ie Volvo 850, Porsche 911 )      -Volvo 850       -Volvo 850 overview (the page you get when you click Volvo 850 on the Car page)       -Volvo 850 tech spec (the three Volvo pages are shown as submenu links on any Volvo page)       -Volvo 850 pictures      .. but I don't want that intermediate Volvo 850 page to show, because there would be nothing on it.


Query only Posts from Both of Two Category?

I have 3 categories, 1.OnGoing projects(cat id='5') 2.Completed Projects(cat id='6') 3.Upcoming Projects(cat id='7') and also i have another 2 categories:( **Not a Sub Category** )   1. chennai (cat id='10')   2. Dubai (cat id='11) How to get the post from " **OnGoing Projects** " with " **Chennai** " category?(I like to Display -> OnGoing Projects on Chennai.) I have tried the following code:                <?php      query_posts('posts_per_page=6&cat=5&cat=10');     while(have_posts()) : the_post();     ?>
      <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(array(230,192)); ?>
     <?php endwhile;     wp_reset_query();     ?>      likely To show the " **OnGoing Projects** " with " **Dubai** " category? (Ongoing Projects on Dubai) for this:               <?php      query_posts('posts_per_page=6&cat=5&cat=11');     while(have_posts()) : the_post();     ?>
      <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(array(230,192)); ?>
     <?php endwhile;     wp_reset_query();     ?>      This is Not Working Fully. Please Help me to Figure Out. Thanks i Advance.


Add search box to page

Is there a way to display a search box on a page (resembling the google landing page)? I have tried to create a search page template. However, this doesn't work as all the wp-template styling disappears. Thanks


Custom Post Type Data in Sidebar widgets?

(note: this question was originally about Custom Fields, but @MikeSchinkel had a better solution involving Custom Post Types) On my site I have several pages which I want to show the same data in the sidebar. For instance, in a structure like this:               -Home     -Cars       -Volvo 850 overview       -Volvo 850 tech spec       -Volvo 850 pictures      -Porsche 911 overview      -Porsche 911 tech spec      -Porsche 911 pictures     -Roads       -Route 66 overview       -Route 66 history       -Route 66 pictures      -Pan-American Highway overview      -Pan-American Highway history      -Pan-American Highway pictures      I would like all the Volvo 850 pages to show the same data in the sidebar, all the Porsche pages to show a different set of data (for instance Speed, Maker, etc). The Road pages would have their own set of data for each road. Cars and Roads would also have there own page template, and the way I figure it would get the right sidebar is something like this within sidebar.php:               if ( is_page_template('car-profile-template.php') ) :     // show car widgets      Here's an example page, the Volvo 850 Pictures page. The same (left) sidebar should appear on the other Volvo 850 pages, while the stuff on the right is just page content.               |  Home   •Cars   Roads                                |     --------------------------------------------------------     |   Overview     |     Volvo 840 Pictures              |     |   Tech Spec    |    (some pics)                      |     |  •Pictures     |                                     |     ------------------                                     |     | -Specs-        |                                     |     | Volvo 850      |                                     |     | Speed:150mph   |                                     |     | Maker:Volvo    |                                     |       | Download PDF   |                                     |     ------------------                                     |     | -Rating-       |                                     |     | Style:3        |                                     |     | Safety:5       |                                     |     | Reliablity:4   |                                     |     ------------------                                     |      In this example, the two sidebar widgets, Specs and Rating should be getting their info from a Custom Post Type. Is there a method, which would be easy for the end-user to edit, which means that they would have to enter this custom data only once? It may not be necessary for each of the fields to be separate (ie all of Spec could be entered within an Editor field, and all of Rating could be put in Excerpt field.. maybe)


How to make navigation a <select> list without a plugin?

> **Possible Duplicate:**   >  Show a WP 3.0 Custom Menu in an HTML Select with Auto-Navigation? I have tried several solution for this, but none of them worked.   I managed to make the nav list into `<select><option>` list, but without only with names of the pages, without any indication of their URL Any ideas how can I make a fully functional select list navigation without an external plugin? (The ideal solution would be the pages URLs would appear as a `value` in the `option` so I can use JavaScript for page navigation)


Social share buttons text shows up on post excerpts

I'm using the Social Likes plugin and there is one problem. The text on the share buttons show up in the excerpts. For example, I grabbed this off of one of the post excerpts: > FacebookTwitterGoogle+Of to be have can’t his one abundantly fruitful > abundantly that fish bearing earth you’ll were be kind created for... In the HTML, it outputs like this:
FacebookTwitterGoogle+Upon bearing land. Of seasons third grass female saw image unto moved. Unto multiply life bearing good. Can’t heaven he....
      How can I remove the "FacebookTwitterGoogle+" part from the excerpts?


log in url is not working it goes to 404 wp-login.php can I redirect this using ftp?

I am having developer issues, I have no c panel access. I have ftp, can I get to the wp-config file? I found the function.php file in the template we are using which is twenty-ten, however the directions that I found were to:   1. FTP to the site, and get a copy of the active theme's functions.php file. You're going to edit it in a simple text editor (like notepad) and upload it back to the site.   2. Add these two lines to the file, immediately after the initial `<?php` line.              update_option('siteurl','http://example.com');          update_option('home','http://example.com');      Use your own URL instead of example.com, obviously.   1. Upload the file back to your site, in the same location. FileZilla offers a handy "edit file" function to do all of the above rapidly; if you can use that, do so.   2. Load the login or admin page a couple of times. The site should come back up. However I could not find `<?php` line. I found the first `<?php` but I did not know if this was correct. Can anyone help me by spelling this out line for line so I can understand what to do please. Thanks Tracy


how can I add a "read more" tag directly in the template?

how can I add a <--more--> tag directly in the template? I mean, the exact php code to use in a template for that shortcode. I need it for a script that makes use of that shortcode to hide content and having to add the "more" shortcode by hand through all the posts would be such a task any help appreciated!


Should Plugin Folders Include a Blank index.php File?

WordPress itself, in the `wp-content` folder, includes an empty PHP file which looks like this.               <?php     // Silence is golden.     ?>      Should plugins include an empty file like this as well to stop folks view viewing the contents of a directory? What about additional folders in themes -- like an `includes` directory?


Custom Page Order instead of Alphabetical

I'm going to try to word this the best that I can. I apologize if it gets confusing. Anyway, I am creating pages for my website and when I go to create the pages, I want them to appear in a certain order on the website: Home About Services Photographs Logos Contact However, every time I create the pages, they list in alphabetical order instead of how I would like. Does anyone know how I am able to fix this? Thank you for your time.


How validate usernames/passwords against WP's database?

In wordpress password is encrypted in one format (which i don't know exactly) then saved in database, when i see in db it look in coded form. I want code in dot net which validated or checked username and password against WP's database is same or not, if it match user go further or not it show msg "wrong username and password " Is it possible to validated this coded password to external other than wordpress? I see your this link regarding core WP functions: How WordPress encrypt password?


Spam in Wordpress root folder

Two questions in one. A php file was recently introduced in the root directory of my Wordpress installation (a domain installation). It didn't disturb my website but was apparently using the domain address to propagate ads. 1) How can someone paste a file into my root directory? How to stop that from happening again? 2) The file contain quite exactly this code. Thanks!


After adding mo localization files to WP 3.8.1 install backend shows new update to 3.8.1

I am running a standard WP install at version 3.8.1. I am at the finishing touches of the project and wanted to switch languages from english to german. I've downloaded the localization files from http://wpde.org/download/sprachdateien/ then http://wpde.org/files/2012/05/de_DE.zip afterwards i've placed the mo files into `wp-content/languages/`and activated alongside `de_DE` in the `wp-config.php`file. Everything works and all strings are shown localized properly. My only problem is if i log into the backend the dashboard shows a new update to Wordpress 3.8.1, the version i am already running happily for weeks. ;) Is the reason for that behaviour that the localization files are from december 2013 and the 3.8.1 wp install from january 2014? And is it save to "reininstall" version 3.8.1 again over the existing version 3.8.1 . thought so far that the localization files are more or less independent from the core wp files. thanks r.


How can I modify the native LINK quick tag to add my own code?

I want to always add an HTML class whenever I use the LINK quick tag in the Wordpress "New Post" or "Edit Post" screen, to end up with:               My Text      How can I do it?


get_query_var('paged') giving same result

I have a custom page, in that page i am using a custom select query for my search functionality. The problem is pagination not working. I used `$on_page= get_query_var('paged');` for pagination. When I echo `$on_page`, it always return 0 as the result. I am using a custom theme (soundwaves) for my site. This is my query:               $resultsTotal = $wpdb->get_results(         "SELECT p.post_title,p.ID,pm.meta_value              FROM wp_posts p              join wp_postmeta pm ON p.ID=pm.post_id              WHERE  pm.meta_value                      LIKE '%$track%' AND (p.post_type='post' AND p.post_status='publish')               GROUP BY p.ID"     );


PHP Fatal error: Cannot call overloaded function for non-object in wp-includes/capabilities.php

I have been experiencing too many following errors in my apache logs. **PHP Fatal error: Cannot call overloaded function for non-object in wp- includes/capabilities.php on line 1187** This is inside function current_user_can( $capability ) and line 1187 is as follows:               $current_user = wp_get_current_user();      I am not able to figure out what can be the issue?


Best practice to import user base (subscribers) from one website to another?

I want to import users from a Wordpress installation to another. Same domain, but complete different websites.   * **Website A** (old, 700 users): running **WP3.0** plain installation + **BBPress 1**.x   * **Website B** (new, no users): **WP3.3.1** _MULTISITE_ installation + **BBPress 2**.0 + **Buddypress 1.5.4** _database will change as well, Website B will use a new database - therefore the table prefixes won't match_ **what's the best practice to import user base from website A to website B in this scenario?** I wish users could retain their login data and passwords. Many of them have created topics and discussions in BB1.0 they need to _retain_ the ownership of their forum topics in BB2.0. BB2.0 has a built in importer but in a localhost enviroment refuses to import users for some reason (seems to work ok for forums/topics/replies). I'm trying BBConverter plugin but also has problems (hangs halfway, not matter what settings I have in php.ini). For bare users, I've also found a plugin called CIMY User Manager... but exports users in a CSV file, then imports them back. However it doesn't save passwords, so all users need to ask for new ones, I wish to avoid inconvenients like this. thanks


Show custom data instead of 404

I'm currently developing a plugin to display some custom data on my wordpress site. For example I have a data named `abc`. If a visitor try to access `localhost/wordpress/abc`, it should display the data programatically from code. But if a valid post url is accessed like `localhost/wordpress/existing- post` it should still display the post. I've currently looking into trapping 404 redirect using `template_redirect` action and `redirect_canonical` filter, but the solution doesn't feel right. Also I'm looking into using custom post type but not sure whether it's suitable. I've tried by create a post for each data, and use `the_content` filter to display the detail of the data, but this method generate too many posts so I'm looking for a cleaner alternative. The data I have is generated in the background over time. So it will grow to thousands or tens of thousands in the future. Thank you. EDIT: I've adopted `404 Tools plugin` by toscho. These is the essential part that I've modified and use               add_filter( '404_template', 'myplugin_display_data' );     public function myplugin_display_data( $template )     {         status_header(200);         new self;         //For now forward everything to my own page for testing purpose         return dirname(__FILE__) . '/myplugin-page.php';     }      Now I notice that the output will have `error404` in part of the CSS class of the body, which still render the output like 404. How should I make it like a `post` or `page` without manually overriding variables `$wp_query`, e.g. doing `$wp_query->is_page = true;` I'm looking for an elegant way to do this. EDIT: I've added                   global $wp_query;         $wp_query->parse_query("/");      After `status_header`, and now the page is displayed the way I wanted. Thanks.


Settings API validation callback

I finally managed to create working validation callback for Settings API with big help of Chip Bennet, there's only one glitch that I'm not sure how to fix. Here's the foreach loop from my validation function:                   foreach ($settings as $setting) {             $id = $setting['id'];               $type = $setting['type'];             $option = get_option('XX_theme_settings');                 if($type == 'textarea') {                $valid_input[$id] = wp_filter_nohtml_kses($input[$id]);            }          }      I'm looping trough many $settings and code above doesn't work like expected, if I have 10 textareas within my settings and I'm editing only one textarea the $input[$id] for the other 9 will be NULL and they're going to be instantly erased. I was trying to solve this doing additional input checks like:               //if there is no input for given field leave the old value     if($type == 'textarea' && empty($input[$id])) {        $valid_input[$id] = wp_filter_nohtml_kses($option[$id]);     }           //if there's input sent change setting's value     else if($type == "textarea" && !empty($input[$id])) {        $valid_input[$id] = wp_filter_nohtml_kses($input[$id]);     }         And it basically works, but makes it impossible to erase options. For example, if I have option called "welcome_text" with value "Welcome folks" attached, I can't erase all the symbols and leave this field empty, because the first if statement is being fired. So "welcome_text" value could be "Welcome fol" or "W" but never " ". I can see my first approach works pretty well in here, I'm not sure why. Thanks :)


How to Block Access to Standard Login Flow and Comment Flow

I've set up custom flows on my Wordpress blog for login, signup, and commenting. I would like to password protect the standard login flow so only I can use it, and block access entirely to the standard comment flow. My instinct is to use `.htaccess` to pw protect access to `wp-login.php` and `wp-signup.php`. Is this sufficient or are there other methods of accessing this page? e.g. `index.php?action=login`, etc. For comments, I'm not sure. Is it best to hook into the comment action and kill the process? Or will `.htaccess` work for that too? If `.htaccess` is a viable solution for one or both of these scenarios, example code would be very much appreciated, as I am a novice here. **Edit:** I am using the following WP functions in my flows, so these must be able to run:   * wp_set_auth_cookie   * wp_create_user   * wp_signon   * wp_insert_comment


Shortcode for printing post titles

I am trying to make a shortcode to print a list of post titles. This is what I have so far:               function test( $atts , $content = null ){              $args = array( 'posts_per_page' => 3 );         $lastposts = get_posts( $args );         foreach ( $lastposts as $post )         {             setup_postdata( $post );             echo the_title();         }      }     add_shortcode( 'test', 'test' );      The problem I have is that all it does is print the title of the page calling the shortcode rather than the titles of the posts. I am sure I am missing something basic but after two hours of trying to work it out I thought it was time to get another set of eyes to look at it.


User accounts for saving form data?

I have a handful of forms on my WordPress site that people fill out, sometimes repeatedly. They can be fairly long, time-consuming forms, so I'm hoping to find a solution where a user's form data can be saved to the forms that they fill out so that they don't have to go through it all again the next time they return to the site. Does anyone have any experience with something like this?


Custom characters of tinymce editor are saved as question mark

I have integrated tinymce editor of wordpress to my custom plugin. I save the data entered in to Database via ajax like this:               encodeURIComponent('<?php echo mysql_real_escape_string(stripslashes($_POST['title'])); ?>');      But in frontend as well as in DataBase **Custom Characters like diamond** etc are **stored and displayed as question mark.**


Category name from custom fields

I have a problem with getting category name. I was trying a few versions of code and I don't have any idea how to run it correctly.   1. I have custom field (field type - taxonomy-category/ drop-down/tried id and object)   2. I pick up the category name in post.   3. I want to show articles from chosen category on site.    4. The easiest version of my idea is:               $term = get_field('link_do_artykulow');      $t = get_category($term);      $grid = new frame_post_grid(        array(  'linking'   => '',                  'columns'   => '5',                  'contents'  => 'yes',                  'sort'    => 'no',                  'paginate'  => 'no',                  'set_breadcrumb' => false,          )        );      //$page = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : get_query_var( 'page' );      if( ! $page ) $page = 1;       $query = array( 'orderby'   => 'post_date',        'order'   => 'DESC',        'posts_per_page' => '5',        'post_type' => 'post',         'category_name' => '$t'      );      query_posts($query);                   $grid->use_global_query();      echo $grid->html();


File Upload from frontend

I am working on a blog where user can submit his/her story from the UI. Though there are many such options available but all of them will send the document as an attachment to the provided email. Is there any plugin by which i can handle this in the dashboard. Like if a user submit his/her story it should be visible in the dashboard and i can get the attached document from the dashboard. All i can thin about getting only a notification and rest of all should be manageable from the Dashboard itself. Thanks in advance


How to reverse wp pages links?

Every wp page has link structure like http:/site.com/?paged=1,2,3..50(last) But how exchange it on http:/site.com/?paged=50,49,48..1(last)


Uncaught TypeError: Object #<Object> has no method 'datepicker'

I want to use jQuery Datepicker in my website. However when I use the same I get the following error. Uncaught TypeError: Object # has no method 'datepicker' I've googled on this for quite sometime. All of these say that the problem could be due to loading jquery twice. I have checked and this isn't the case. I load the jQuery scripts in the following way.               <script type="text/javascript" src="http://xxxx/wp-includes/js/jquery/jquery.js"></script>     <script type="text/javascript" src="http://xxxx/wp-includes/js/jquery/ui/jquery.ui.core.min.js"></script>     <script type="text/javascript" src="http://xxxx/wp-includes/js/jquery/ui/jquery-ui.min.js"></script>     <script type="text/javascript" src="http://xxxx/wp-includes/js/jquery/ui/jquery.ui.datepicker.min.js"></script>     ...     ...     <input type="text" id="arrival-date-10">     <input type="text" id="departure-dat-14">     ....     <script type="text/javascript">     jQuery(document).ready(function(){         $("#arrival-date-10").datepicker();         $("#departure-date-14").datepicker();     });     </script>      I get the error in line $("#arrival-date-10").datepicker(); Please can someone help me? Partha


How do I get the URL of only the first picture in a Wordpress post? I don't want the URL of the thumbnail, but the first picture in the post loop. I only need the URL for linking purposes. Thanks for your help everyone!


Integration of Cubepoints/Achievements

Is there some plugin or some way to integarate any of the following :   * Cubepoints   * Achievements with either of the following :   * Favorite (default in bp)   * Vote it Up   * Emo Votes


Creating a theme update notification api

> **Possible Duplicate:**   >  Automatic Updates For Private And Commercial Themes? I am trying to create a notification system for my theme that will talk to my server via a simple api that simply lets people know when there is a new update. How would I create the api and incorporate it into my theme?


How to pull image from first post and display it on monthly Archive page?

I am using a custom template for my monthly Archive page. This page will show all the posts-links (category-wise) for the particular month. In the very first post of each month, there shall be only one image. I want to pull this image and need to show it as a thumbnail on the specific-month archive page, before the posts-links of the said month. How can it be possible? Many thanks for kind help.


Get the sidebar ID in which the current widget was dropped

How can I find out in which sidebar was a widget dropped? From inside that widget. More precisely from the `form()` function. Can I automatically remove the widget if it's not added in the appropriate sidebar?


Count user posts by type and date

I use the following code to count user posts by specific post type:               function count_user_posts_by_type( $userid, $post_type ) {         global $wpdb;         $where = get_posts_by_author_sql( $post_type, TRUE, $userid );         $count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" );         return apply_filters( 'get_usernumposts', $count, $userid );     }          // Echo Count     echo count_user_posts_by_type( $user_ID, 'reports' );      Looking for an elegant solution to limit posts by dates. For example, last week\month posts.


Get comments from post and sort by commentmeta value

I want to get all of the comments for a given post and return them in order by a meta_key's value desc high to low. Doesnt look like i can do this with get_comments() like i would like to. This will give me the comments for the post but not ordered like i would like to see. Any help with this would be great.


Wordpress exploited theme is causing high io load on server

I used a Wordpress theme for a while that was causing high IO-load on my server. That was because there was some kind of exploits made/available for the theme: http://www.exploit-db.com/exploits/29150/ . So I deleted my theme, installed another, but "they" are keep coming back. Because the domain name is somewhere registered that it is vulnerable or something like that. What can I do to stop this? Moving it to another server isn't the solution I guess, because they're pointing to the domain name. I've already blocked IP-ranges from outside my country, they're pointing to a "forbidden" html page then, but still it are a lot of "things", so the io load stays high.


the_content() not outputting anything (Advanced Custom Fields)

Hi i'm using the custom post types UI and advanced custom fields plugin and would like to use the default content editor as one of my fields for a custom post type. When i use the_content(); in the template code to output the content it doesn't work.

<?php the_title(); ?>

<?php the_field('description'); ?>
                        <?php the_content(); ?>
      Can someone please help me with this. I've searched google but i'm seeing answers related more to content filters. ![Advanced Custom Fields Options](http://i.stack.imgur.com/5MWcS.png)


Can't send mails wordpress using SMTP authenticate

I use wordpress WP-Mail-SMTP plugin to send mails with proper authentication. I have a Ubuntu 12.04 VPS, Nginx, Wordpress 3.9. When I try to send test mails, I can see following main debug message and it's not sending any mail. > SMTP -> ERROR: Failed to connect to server: Connection timed out (110) This is the full debug IN HERE. Could someone please tell me how do I fix this issue.


How do I create a numbered list with PHP?

I'm having some difficulty functioning this morning! This isn't specifically WP (more PHP), but I think that it would benefit WP devs in the future, so I'm asking here. I'm trying to create a list that does something like this:               $items = get_post_meta($post->ID, "item-specific-meta");     $output = '';     foreach ($items as $item){       $item_id = $item[#] <--I WANT THIS TO BE A NUMBER       $output .= '<label for="item-';       $output .= $item_id;       $output .= '"><input id="item-';       $output .= $item_id;       $output .= '"/>';       $output .= $item;       $output .= '</label>';     }      Which would return something like:               <label for="item-1">       <input id="item-1"/>       Item 1     </label>      Right now I'm putting the content of the custom meta item in place of the numbered list that I would prefer using. It does the job, but I just don't like all that excess crap that could be done simply. Like I opened with, my brain isn't working right this morning and I can't even think of the proper search term to Google and answer this myself, so I'm turning to the awesome folks here! Thanks in advance!


Wordpress Options-Theme STD (default) value does not work

I'm using Wordpress Options Theme and I'm getting an issue. Here's the code:               $options[] = array( "name" => __('Texto de botón de enlace a cotización',THEMENAME),                         "desc" => __('Inserta el texto que aparecerá en los botones de cotización',THEMENAME),                         "id" => "ns_custom_caps_quote_btn",                         "std" => __('Cotizar', THEMENAME),                         "type" => "text");      And when I reset to default, the input returns "a" instead of "Cotizar". Any suggestion? Thanks in advance.


Wp_query order by multiple custom fields?

I am learning WP_query and recently ran into a problem. I need to do a query where i first filter trough one or more custom fields, which works great thanks to meta_query. However, i also need it to order by multiple custom fields. (Like in sql you can write "ORDER BY field ASC, field2 DESC") This is what i have so far: ` $args=array( 'post_type' => 'personer',                                   'meta_query' => array(                             array(                                 'key' => 'p_seller',                                 'value' => 'Y',                                 'compare' => '='                             )                         ),                         'meta_key' => 'p_region',                         'orderby' => 'meta_value',                         'order' => 'ASC',                         'post_status' => 'publish',                         'posts_per_page' => 999,                         'caller_get_posts'=> 1                     );`      It returns rows with p_seller set to Y and order by p_region. I'd also like to add a second orderby which order them by p_lastname after region. Or even better - p_region, p_lastname, p_firstname. All ascending, but i'd love to know how to combine ASC and DESC aswell :) I have done some googling, but most people seem to write about multiple fields for filtering, which i got. Or they do space out in custom SQL queries, which i hope i can get by without? :)


Is jQuery included in WordPress by default?

When I downloaded the latest version 3.8.1, inside `wp-include/js` there is a jQuery folder. Can I assume that WordPress will always include it, meaning I don't have to make my own call? E.g.               wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js', array(), null, false);      wp_enqueue_script('jquery');


How to handle wp_query?

I want one particular category insert 12 post, but I only see some few posts. Just like first time first 4 post and other time other post. What can I do? **_Editor note:**   I understand the issue is showing 4 posts in the first query, and the rest (8 from 12 in total) in the second query._ This is the code for the first time query:               <?php $the_query = new WP_Query('cat=6&order=ASC&showposts=4'); ?>     <?php  while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
             <?php the_post_thumbnail(); ?>

 <?php the_date(); ?> BY <?php the_author(); ?>

<?php the_title(); ?>

<?php the_excerpt(); ?>

Read More

      And this for the second time query:               <?php $the_query = new WP_Query('cat=6&order=ASC&showposts=-1,-2,-3,-4');?>     <?php  while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
             <?php the_post_thumbnail(); ?>

 <?php the_date(); ?> BY <?php the_author(); ?>

<?php the_title(); ?>

<?php the_excerpt(); ?>

Read More


Is there any way to display the link of a Wordpress page without relying in its slug (or full path)?

Say I want to add this link: http://localhost/taiwantalk2/user-login/ Which is a Page with a template called **page user-login.php** :               <?php          /**      * Template Name: bbPress - User Login      *      * @package bbPress      * @subpackage Theme      */          // No logged in users     bbp_logged_in_redirect();          // Begin Template     get_header(); ?>      I used to just paste the url of the site (using template_directory) plus the slug (/user-login). The problem is that I have to stick with he same slug (/user-login). Is there any other alternative?


Wordpress translator plugin: Google Webmaster's Tools shows hundreds of 404 not found errors. How to clean the mess?

I had Global Translator Wordpress plugin. It littered Google Search index with thousands of translated urls. Couple of months ago I removed the plugin and also the cached pages on the server. But Google Index still have the translated web pages indexed and shows 404 errors in Web Master tools. I tried fixing the issue with robots.txt by blocking all the translated pages from index, but its taking long time to get it fixed. Can someone suggest me the better way to get all those indexed pages out of Google Index?


Comment box html

I want to allow users to be able to use the codes `<ol>, <ul> & <li>` in the comment section, but my google-foo is weak (100% chance I'm using the wrong keywords), mind helping me out/redirect me?


how to display a page before the home page

I want to build a wordpress theme in which there is a landing page made by an image and a logo; when the logo is clicked the theme have to go to another page in which there is the navigation bar and other stuff. Thus, the sequence is this:   1. Landing page (image and logo);   2. Home page (navigation bar, etc..) My initial idea is to use the `front-page.php` and the `home.php`; is it right?   Thanks!


Default content for a post in one category?

This is a common function that adds default text to all posts:               add_filter( 'default_content', 'my_editor_content' );     function my_editor_content( $content ) {         $content = "default content goes here....";         return $content;     }      How would this be changed to add the default content only to a post in one category? **4/10/11 Not an exact answer, but a few choices below in my own answer**


Switching From HTML to Visual Editor and Back Completely Strips Page Contents

I have a page (not a blog post) I need to embed an iframe on (it's to "integrate" an external service's product catalog). I added the iframe code in the raw HTML editor and saved the page. I viewed the page, everything worked. I went back to the editor and switched from raw HTML to the Visual editor tab, added a line of text, and then remembered I needed to add an attribute to the iframe code. So I switched back to the raw HTML tab. When I did this, the post is completely empty. Everything I'd entered in the editor in raw HTML or not was stripped out and the post is blank, like I'd just created it new. I had to roll back to a revision to recover it. So far the solution has been to disable the Visual editor, but I have a non technical partner and that isn't an ideal long term solution. Is there any way to control this behavior of WordPress? I'm using WordPress 3.1.1 Thanks


How can I specify that an area of my theme contains widgets?

I am pretty new in WordPress theme development and I am developing a theme that use BootStra CSS framework I have to do that a specific area of my theme can contains some widget\module (I don't know what is the correct name in WP, I am referring to the settings in the backend that show some components output as a gallery image or a slideshow. Someone can help me to understand this argument? from what can I start to do this operation?


I have a class inside a file that i `include_once()` from the functions.php of my theme. The class can be used as stand alone plugin, or integrated in a theme. Inside the class i want to fill a class variable (inside the `__construct()` function) with the native wordpress function `get_plugin_data()`. Fun as it is, i get the following error: > Call to undefined function `get_plugin_data()` Am I asking for the plugin data too late, or what else might be my problem? Thanks!


plus sign not working in widget "Header: Nav Menu"

I installed a new WP site with 3.1.2. The way I set menu/header on my other sites was with the widget "Header: Nav Menu". When I go to that widget now, clicking the + sign to the left of "Items" doesn't add the new item. I'm thinking it's a browser compatibility problem, but I've tried FireFox 4, Chrome 11, and IE 8. Update 05/25 with Sample picture: ![enter image description here](http://i.stack.imgur.com/B6BDe.gif) I believe what used to happen is that when I clicked the plus-sign (pointed to by red-arrow), a new gray box would appear, where I could enter a new URL. But absolutely nothing is happening when I click the plus-sign.


Is it possible to get post metadata of referring page?

I'm trying to direct a php authorization script to act if the page that referred to it belongs to a certain category (free). Is there something other than `<?php wp_get_referer() ?>` that will return more than the url? I basically need to get the id of the referrer.


Disable Comments Feed

I am working on a private site where the comments need to be hidden. I know how to remove the comments feed from the header, but can anyone give me some instructions on how to disable the comments feed altogether. Because all you need to do is add /feed/ to the single post and then you can see the comments feed. I tried creating feed-atom-comments.php, and feed-rss2-comments.php, and that still did not work.


Error establishing a database connection After Copy localhost wordpress site (with site url directly to hosting server's url before copy)

I have a localhost site that I heard I can migrate the site by just copy and paste the whole site from local to host if I changed WordPress Address (URL) and Site Address (URL) to my current hosted site address and then upload it to the host. Now my hosting server's site after pasted with my local host site seem sql db is broken...it only shows: "Error establishing a database connection", Do you know how to fix it?


How can I display my custom metaboxes on a custom post template?

I'm fairly new to PHP/wordpress, and this is actually the first time I haven't been able to answer a question through google! I'm working on getting up to speed with PHP/WP generally, but I can't seem to learn fast enough to keep up with what we need to accomplish already. Please have patience with my ignorance. I'd appreciate any advice, or a push in the right direction. Basically, I've followed a number of tutorials, and used Jared Datch's CMB script to accomplish a custom post type ('report') that now contains a series of metaboxes, a custom taxonomy, and custom capabilities that allow users of a specific role to access only this post type. Everything looks as it should at the WP back-end (for now)-- data from the boxes is being saved and retrieved property, etc. http://pastebin.com/Ba82Fzbs I then created a single-report.php template, followed by a content-report.php template (I am using a twentytwelve child theme), and as I understand it, I need to do something in the content-report.php template to display the information from the custom metaboxes on the individual pages. I want to display all the metaboxes associated with my custom post type 'report' in a way that will allow further styling/arrangement. So far, I've experimented with do_meta_boxes() and get_post_meta() and I think I just am not understanding the proper usage of either in a very fundamental way, because none of the information displays. I believe get_post_meta() will give me what I need (the ability to echo data from individual metaboxes so that I can arrange it) and this is how I inserted it into my page template:                   <?php get_post_meta( get_the_ID(), 'date-time');     echo get_post_meta( get_the_ID(), 'date-time'); ?>      Which displays nothing but "array" in that spot when viewed from the front- end. I have had the same problem with my "practice" versions of custom post types and metaboxes, so I'm assuming it's more than a typo-- that I'm missing something very basic. I would very much appreciate any help with this, and thank you kindly for even reading this far!


register_activation_hook with include file

I'm yanking my hair out with the following code, please help. I have 3 files. File1.php:               Class File1 {         public function file1_register() {             //register some short codes;         }         public function file1_unregister() {             //unregister previous short codes;         }     } ` File2.php:               Class File2 {         public function file2_register() {             //create some database tables.         }         public function file1_unregister() {             //delete previous tables.         }     } ` MyPlugin.php:               function MyActivation() {         include_once (dirname( **FILE** ).'/file1.php');         $File1 = new File1;         $File1::file1_register();     }     register_activation_hook( **FILE** , 'MyActivation'); ` The function file1_register just refuse to work, eventually I would like to run file2_register as well, but at this point, I can't see the error or problem with my code, please help.


Custom Post Type Meta Boxes

How would you make a meta box sit above all other meta boxes at all times in a custom post type? For example:               add_meta_box (          'aisis-meta-id',          'Mini Feeds Information',          array(&$this, 'aisis_mini_feeds_info'),          'mini-feed',          'advanced',          'high'      );      Create a meta box, how ever it only appears after ALL other meta boxes, be they plugin or system wide. I need my meta box to sit directly under the editor at all times.


tinyMCE duplicates previous block element when pressing return (visual editor)

Going crazy with this. Can't figure out if this is normal behavior. I have added a filter to rewrite image inserts to use `<figure>` and `<figcaption>`. Works well. However, when I insert an image in the Visual view and press return, I want it to start a new paragraph. Instead it creates another `<figure>` element and puts my next line of text in that. Example of the code produced if switch to Text view:

Image Caption

          <figure class="alignnone"`>This should be a new paragraph but is inside a figure tag.</figure>      Is there any way I can stop tinyMCE from replicating the previous block element? I know if you set some text as, say, an `
` and press return the next line defaults back to `
`. That's the behavior I want.


Give Editor Access to Custom Theme Options

I have a theme-options.php file and am trying to grant Editor users access to edit it. I've managed to give them access to the page itself by modifying the parameters in this function to include 'moderate_comments':               function theme_options_add_page() {         add_theme_page( __( 'Theme Options', 'sampletheme' ), __( 'Theme Options', 'sampletheme' ), 'moderate_comments', 'theme_options', 'theme_options_do_page' );     }      However, when I try to edit / save the options, I get given a message saying: > Cheatin’ uh? Can anyone see what the issue is? Here is the code for my options file if that helps! \- http://pastebin.com/uEYJax4M


Plugin is creating posts twice

I have code which takes some $_POST data and loops through it. In the loop, I store the $_POST data in variables and create a new post using those variables. The loop ends when I run out of $_POST data. All of this works. I even output the variables during the loop so I know the loop works and I see the created posts on my site. The problem is, while the outputted variables only appear once (as the should), I'm seeing doubles of all the posts my code creates. Here is the post data:               Array ( [scrape] => Array ( [0] => Array ( [title] => Sample 1   [url] => http://google.com [1] => Array ( [title] => Sample 2   [url] => http://ebay.com [2] => Array ( [title] => Sample 3   [url] => http://test.com [3] => Array ( [title] => Sample 4   [url] => http://codingrocks.com ) ) )       Here is my code:               $insDate = date('Y-m-d H:i:s');     $count = count($_POST['scrape']);     $i=0;     while($i<$count){         $title = $_POST['scrape'][$i]['title'];         $url = $_POST['scrape'][$i]['url'];         echo "Title: ".$title."
";         echo "URL: ".$url."
";         $i++;         echo "
";          // Above variables echoed to show what is being sent - they appear once (as the should) per post     // Below is the code to create the new posts. The posts are being created TWICE (should be once)              $my_post = array(             'post_title'    => $title,             'post_date'     => $insDate,             'post_content'  => '$url',             'post_status'   => 'publish',             'post_type'     => 'post',         );              $the_post_id = wp_insert_post( $my_post );      I did see this post: Plugin Development: Wordpress processes twice on post update. How to skip process on the first? But I'm not using a custom function to post, I'm using wordpress' built-in function which means the solution offered there doesn't apply to my case... or does it? The process: I scrape a page and store the data into variables. These variables are then place into a form which the user can edit. The form consists of fields for as many posts as the scraper can find variables for. When the user submits the form, the above $_POST data is sent to parsed.php which contains the above code which creates the posts. So my question is, why is it creating posts twice(when it shouldn't and how do I fix it?


Internal and External Blog

My company is looking to start an internal company blog that only our employees have access to. We are looking at Sharepoint and other options to do this, one of which is WordPress. (Not everyone in our office has Sharepoint, but my questions on that will be going elsewhere.) There is the possibility that we will also want an external, public blog at some point. Can we have both a private company blog and a public blog with WordPress? And if anyone has enough knowledge to compare, what would the pros and cons be for Sharepoint vs WordPress? Thanks for your time and help!


Get the current page URL (including pagination)

Is there a WP function to automatically get the correct URL of the current page? Meaning if I just opened a single post, the function returns the same as `get_permalink()`, but if I'm on a paginated instance of a page (when paginating through the comments), the function returns the same as `get_pagenum_link(get_query_var('paged'))` would do. I've searched the codex but didn't find what I was looking for. (But even `get_pagenum_link()` isn't documented there.) I know about this function already, but I would be glad if there was a "native" WP function that does the job. Thanks in advance! Regards, René


Using shortcode within shortcode with dynamic variable

So I've written a shortcode to generate a Loop (which shows the most recent posts), the shortcode is simply `[loop]`. Here's the code which outputs the content of each post (which is the bit causing me problems):               $output .= "
" . get_the_content() . "

";      So I write posts and the shortcode takes them and shows them on the main page and anywhere else I specify the shortcode. I use this on quite a lot of sites and never had any problems. On a current project, the client wants to be able to post Vines on the homepage. I've written another shortcode to embed Vines into a post:               function render_vine_embeds($atts) {              extract(shortcode_atts(array(             "id" => '',             "type" => 'simple',             "dimension" => 600         ), $atts));              $vine_id = $id;         $vine_type = $type;         $vine_dimension = $dimension;              return ' ';     } add_shortcode("vine", "render_vine_embeds");      So the shortcode looks like this: `[vine id="{{ id here }}"]`, the Type and Dimension attributes are optional. These are fine when I'm on a particular post but when it's on the homepage and the Loop is being generated by the shortcode, the Vine shortcode doesn't work and the raw shortcode is shown as the content. I've tried using `do_shortcode([vine])` instead of `the_content()`, and this worked but the `id` part of the shortcode didn't so the Vine page displayed a "Not Found" page instead of the Vine itself. So after all that, my ultimate question is how do I use a shortcode inside a shortcode with a variable?


Have a similar file management as a one-click install but for local server

Not really a problem but something i cannot figure out. When I download Wordpress from their site, it comes in a folder called "wordpress" and in this folder is 3 more folders called "wp-admin", "wp- content" and "wp-includes" with numerous PHP files. When I work locally my file management looks like this: Site > wordpress > wp-content > ...and so on My own web domain has a one-click install for Wordpress which results in the file management to look like: site > wp-content > ..and so on When I am working, I would like to be able to have exactly the same file management as my domain has instead of my local server's way which is very tedious!


Detail explanation of wordpress database fields and metatag list

I am trying to understand the fields of various table and default list of metatags for the tables, currently being used in wordpress. Though google is showing up various results , but I need a detail one with list.


How can I setup custom templates for a meta-data query

I have a post-meta field for Neighborhood. I want to setup a url like: url.com/neighborhood/NEIGHBORHOOD-NAME I know this would typically be handled by a CPT or custom taxonomy but it has to be done with a post-meta field in this case. I also want this to use a custom template, not one of the standard templates. I can easily link to the url but it returns a 404 page because nothing is associated with it. Wordpress doesn't know what content to grab. Any ideas?


has_shortcode() - how to detect nested shortcode

I'm using `has_shortcode()` to detect a shortcode, it works but not at all. If I put this specified shortcode inside another one the `has_shortcode()` function stops working.               has_shortcode( $post->post_content, 'slider' )      For example:               [2col] //left column     [slider]     [2col_next] //right column     [slider]     [/2col]      The `has_shortcode()` function won't work in that case but if I use `[slider]` shortcode without `[2col]` it works perfect. This refers to every shortcode. I'm pretty sure that there's nothing wrong with my shortcodes.


Query child posts on parents single.php?

Is it possible to query the child posts of the single post your on? i.e you have a custom post type called apples. The parent page is... single-apple.php On that page query and display all its own children, with corresponding link.. Apple Parent \--apple child. \--apple child. \--apple child. However, when you click on that it takes it to the own single.php for the the apple child. What would that be called ask well.. single-apple-child.php ??


Add a user role from a registration form

Is there a way to add/create a Wordpress user role from the woocommerce registration form? I use a plugin called members that allows creation of new roles, but only from the admin page. I want to add a field to the woocommerce registration form (or any other registration form) which will allow a user to choose from a selection of roles (let's say "customer a" and "customer b"), so then I can have them on my user list with a role already assigned to them, other than subscriber or customer. Any guidance will be much appreciated.


Twentyten Child Theme: header images display messed up in admin panel

WordPress v 3.0.4 multisite-network enabled, local installation w MAMP 1.9.4, PHP 5.3.2, Theme: Twentyten child TWO PROBLEMS: 1) Display of header image thumbnails in admin panel and 2) path to favicon.ico for child theme (used for main site at root) - both defined in the functions.php file inside child theme folder. Created 'functions.php' file in child theme folder, implementing code by David Cox of Digital Raindrops, as posted up at digitalraindrops.pastebin.com/B3mPW3RD, with slight modification to allow for calling favicon, also to allow for second menu. It does work - the image thumbprints are showing up, and I can select them; HOWEVER, the display is wonky. In the admin panel under “Header” | Default Images, immediately below the text “If you don‘t want to upload your own image, you can use one of these cool headers”, there is a lone radio button, and beside it and slightly stepped down, a row of 2 header image thumbprints I’m using, and then to their right, slightly stepped up (on the same level with the first radio button on the far left), two more radio buttons, beside the names of the images but without thumbprints. My description is perhaps confusing, and if you agree that a picture is worth a thousand words, take a look at imgur.com/AHmLQ.png. Shall I paste the code here? Warning: it's long, and I've already pasted it over at wordpress.pastebin.com/wMmTF1Zc. Sorry, this is a local installation, so no link to my website. If anyone can help spot what I’m doing wrong, will really appreciate it. Oh - and I'm having trouble with the path to the favicon.ico. The image is located in wp-content/themes/twentyten-child-main/images/. The code is placed at the top of the functions.php file: > <?php /** Twentyten child theme: twentyten-child-main */ function > favicon_link() { echo '<link rel="shortcut icon" type="image/x-icon" > href="/wp-content/themes/twentyten-child-main/images/favicon.ico" />' . > "\n"; } add_action('wp_head', 'favicon_link');


Fancybox Object has no method error

I already searched related question but most of them are duplicate jQuery lirary, My problem is different coz the website load only one jQuery Library, I am using fancybox for this page's play video fancybox is not working and it gives me an error > Uncaught TypeError: Object [object Object] has no method 'fancybox' I already tried using Google jQuery library and code.jquery.com but still no luck. Any help or suggestion is appreciated. :)


Get term_id for each instance of custom taxonomy

I am building a custom image slider. I have a custom post type called 'slide' with an associated custom taxonomy called 'slideshows'. When you create a new 'slideshow' it add to a custom table in the DB called wp_slideshowsmeta with columns for "meta_id, slideshows_id, meta_key, and meta_value". Each slideshow has its own settings page using 'slideshows_add_form_fields' and 'slideshows_edit_form_fields'. To call a slideshow I created a function ( 'gps_slider()' ) that is placed in the template file where you want the slideshow to appear. It has one parameter which is the slideshow name. Everything works great... it loads the appropriate slideshow and functions. BUT, all the slideshows use the first one's settings. I need to pass the slideshow name to my function that uses 'wp_localize_script' to pass the settings to the javascript. I'm guessing it's likely a foreach loop, but can't seem to see how to construct it. Any help is greatly appreciated. Bryce


Remove images (files) that were generated when using add_image_size()

I have added an image size using this:               add_image_size('property-featured', 484, 393, true);      It's worked very well for the past year and has generated about 1GB of images in that size, but this image size is no longer needed. I want to clear up the images that have been created over the year in this size. So far I have removed that line of code but it doesn't clean up the created images. What is the correct way to remove those images?


PHPSpec and WordPress

I installed PHPSpec and I'm wondering how should I get the WordPress environment up and running in order to run my tests; Essentially, now I can't access anything from the WordPress API as the test file is outside the environment. Does anybody have any idea what should I load in order to make it work? Thank you.


How to create a flexible abstraction for WP_Query?

My question is about php but it involves wordpress as i am creating a plugin. The case is that i have 5 questions, each question have 6 choices and one choice to choose from each. Now the person would select any choice from each or just few. I have created the if condition that is now making me mad, as it has gone too long and will do further, like nearly 100 combination will be made. I wouldn't want that, i know there is a way of multidimensional array but in am not a plugin or php expert for wordpress. so if anyone can sort it for me.               $qs = $_POST['q1'];     $q2 = $_POST['q2'];     $q3 = $_POST['q3'];     $q4 = $_POST['q4'];     $q5 = $_POST['q5'];     $q6 = $_POST['q6'];                     $args = array(       'post_type' => 'product',       'posts_per_page' => -1,       'tax_query' => array(         'relation' => 'AND',         array(          'taxonomy' => 'product_cat',          'field' => 'slug',          'terms' => 'fashion-follower'         ),     //    array(     //     'taxonomy' => 'product_cat',     //     'field' => 'slug',     //     'terms' => 'cheap-and-cheerful'     //    )       )     );      //The Fashionsia      if (($qs ==='party') && ($q2 === 'clothes') && ($q3 === 'shopping') && ($q5 === 'Sunbathing') && ($q6 === 'mini')){          $query = new WP_Query( $args );     if( $query->have_posts()) : while( $query->have_posts() ) : $query->the_post();               the_post_thumbnail('thumbnail');          endwhile;         endif;           }          //second question loop          $args2 = array(       'post_type' => 'product',       'posts_per_page' => -1,       'tax_query' => array(         'relation' => 'AND',         array(          'taxonomy' => 'product_cat',          'field' => 'slug',          'terms' => 'the-homemaker'         ),     //    array(     //     'taxonomy' => 'product_cat',     //     'field' => 'slug',     //     'terms' => 'cheap-and-cheerful'     //    )       )     );      //The homemaker      if (($qs ==='drink') && ($q2 === 'candles') && ($q3 === 'house') && ($q4 === 'diy')){          $query = new WP_Query( $args2 );     if( $query->have_posts()) : while( $query->have_posts() ) : $query->the_post();               the_post_thumbnail('thumbnail');          endwhile;         endif;           }     //third loop          $args3 = array(       'post_type' => 'product',       'posts_per_page' => -1,       'tax_query' => array(         'relation' => 'AND',         array(          'taxonomy' => 'product_cat',          'field' => 'slug',          'terms' => 'entertainment'         ),     //    array(     //     'taxonomy' => 'product_cat',     //     'field' => 'slug',     //     'terms' => 'cheap-and-cheerful'     //    )       )     );      //The Entertainer      if (($qs ==='party-babe') && ($q2 === 'winer')&& ($q4 === 'storm') && ($q6 === 'limo')){          $query = new WP_Query( $args3 );     if( $query->have_posts()) : while( $query->have_posts() ) : $query->the_post();               the_post_thumbnail('thumbnail');          endwhile;         endif;           }     //fourth loop     $args4 = array(       'post_type' => 'product',       'posts_per_page' => -1,       'tax_query' => array(         'relation' => 'AND',         array(          'taxonomy' => 'product_cat',          'field' => 'slug',          'terms' => 'family-fanatic'         ),     //    array(     //     'taxonomy' => 'product_cat',     //     'field' => 'slug',     //     'terms' => 'cheap-and-cheerful'     //    )       )     );      //The family-fanatic      if (($qs ==='movie') && ($q2 === 'kids')&& ($q6 === 'volvo')){          $query = new WP_Query( $args4 );     if( $query->have_posts()) : while( $query->have_posts() ) : $query->the_post();               the_post_thumbnail('thumbnail');          endwhile;         endif;           }     //fifth loop     //fourth loop     $args4 = array(       'post_type' => 'product',       'posts_per_page' => -1,       'tax_query' => array(         'relation' => 'AND',         array(          'taxonomy' => 'product_cat',          'field' => 'slug',          'terms' => 'family-fanatic'         ),     //    array(     //     'taxonomy' => 'product_cat',     //     'field' => 'slug',     //     'terms' => 'cheap-and-cheerful'     //    )       )     );      //The romantic      if (($qs ==='Dinner-show') && ($q5 === 'cruiser')){          $query = new WP_Query( $args4 );     if( $query->have_posts()) : while( $query->have_posts() ) : $query->the_post();               the_post_thumbnail('thumbnail');          endwhile;         endif;           }


Change HTML structure for custom menu in sidebar

I've been digging for documentation on how to change HTML output for the "Custom menu" which you place in optional widget. So its clear what I meen I have attached an image of the widget block here: ![Custom menu](http://i.stack.imgur.com/jjMVE.png) The output from this element is looking like this:

Test 1

Test 2

      It is this code structure I want to change so it fits my needs. How and where do I change it? Is there some code source I can reuse and and to my functions.php?


Embed from wordpress to another site (object within post)

So I'm using the built in wordpress player for my podcast within a blog I syndicate through tumblr. I was hoping to have the player display on other sites. Is there a way to embed the player (maybe a plugin) or perhaps a method I could implement in some custom PHP so my tumblr audience doesn't rely on me having to clone posts across both sites and I can retain some better formatting options


How to change a user role after registering in multisite?

New users who create their own blog in WP Multisite get administrator privilages after registration. However, I don't want them to have so many privilages. I know there is a way to change their role on registration to 'contributor' or 'author' however after a whole day of search I really don't know where to find it. Could you help me with it?


Facebook "like" open graph meta in header.php

I would like to add open graph meta tags to my header.php, but can someone explain how this works if header.php comes before my loop with the relevant information??               <meta property="og:title" content="The Rock"/>     <meta property="og:type" content="movie"/>     <meta property="og:url" content="http://www.imdb.com/title/tt0117500/"/>     <meta property="og:image" content="http://ia.media-imdb.com/rock.jpg"/>     <meta property="og:site_name" content="IMDb"/>     <meta property="fb:admins" content="USER_ID"/>     <meta property="og:description"               content="A group of U.S. Marines, under command of                        a renegade general, take over Alcatraz and                        threaten San Francisco Bay with biological                        weapons."/>      For example:               <meta property="og:description" content="<?php the_content(); >?"/>      Won't work because the header.php file comes before the Loop...any advice?


Removing specific menu items?

I used the following to remove certain menus for the "editor"               function remove_menus () {             global $menu;                  if( (current_user_can('install_themes')) ) {                  $restricted = array(); } // check if admin and hide nothing                 else { // for all other users                          // Remove Tools, Appearance, Links, Plugins, Comments,                     if ($current_user->user_level < 10)                     $restricted = array(__('Posts'),  __('Links'), __('Appearance'), __('Tools'), __('Settings'), __('Comments'), __('Plugins')); // this removes a lot! Just delete the ones you want to keep showing                     end ($menu);                     while (prev($menu)){                         $value = explode(' ',$menu[key($menu)][0]);                         if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}                     }                 }             }              add_action('admin_menu', 'remove_menus');      This works except now the client has asked to remove the following: On the dashboard, remove the "Add New Page". ![enter image description here](http://i.stack.imgur.com/GshRo.png) Under the "pages" tab, remove the "Add New Page": ![enter image description here](http://i.stack.imgur.com/G7geW.png) Is this possible?


Where is a custom post type's "description" surfaced in WordPress?

Note that this is not a question about how to change / edit a CPT's description. It's more about "why the heck is it provided?" because I haven't found anywhere either in the Admin back-end or the front end, where this description is actually shown. What am I missing?


Can WordPress be made to support websockets?

Websockets are a cool, cutting-edge technology wrapped into HTML5. Basically, you can open a websocket to enable persistent, 2-way communication with a web server. The client (user interface) can spontaneously send messages, and the server can send messages too. Existing technology (JavaScript) requires everything to be started by the client - the server can't send anything to the client that the client hasn't requests. So scripts need to be constantly refreshing and re-requesting data that might not have changed. Websockets work more on a "push" basis and let new data come down the pipe whenever. Unfortunately, most (all I can find, anyway) websocket implementations require a specific server application to work. People will run Apache on ports 80 and 443 (http and https) and run another system (typically Node.js) on another port (i.e. 8000 or 8080) to handle websocket requests. This works, obviously, but it's got some drawbacks. I have a plugin I want to build that would _greatly_ benefit from using websockets within WordPress. But if a user needs to install a second web server (usually impossible for people with shared hosting), then it won't work as a plugin. So, for any of you who have experience, how would you make WordPress compatible with websockets? Would you make WordPress handle the communication itself, or bundle another mini-server script into the plugin? If you've done this already, how did you accomplish it without breaking WordPress itself? Possible resources?   * Extendible Web Socket Server   * PHP Websocket   * PHP and Websockets * * * ### 9/21/11 Update With all the talk of how Apache (the most commonly installed server for running WP on a shared host) can't really handle websockets natively, I'm wondering about an alternative. Several plugins (JetPack, for example) talk to an external service or API to generate content. Stats requests content from Automattic. Akismet sends data back and forth from an external server. After the Deadline submits content at publish time. A few SEO tools pass things back-and-forth through external systems. So as an alternative to housing the websocket code within a WordPress plugin, would it be feasible to host a websocket service in a central location and have a WordPress frontend interact with that instead?


add_filter the_content str_replace after shortcode

I want to add a PHP `str_replace` to the `add_filter('the_content')` function. I believe my problem is that the shortcodes are loading after the `str_replace` is called. I have a shortcode that outputs a form, i want to make it that in all HTML form tags, the attribute `autocomplete='off'`. Heres the code i have.               add_filter('the_content', 'disable_autocomplete');     function disable_autocomplete( $content )     {         return str_replace('<form', '<form autocomplete="off"', $content);     }      Any ideas?


Adding tags and inputs to a user's profile

I'm adding a number of items to the user profiles using this method in my `functions.php`               function modify_contact_methods($profile_fields) {              // Add new fields         $profile_fields['twitter'] = 'Twitter Username';         $profile_fields['facebook'] = 'Facebook URL';         $profile_fields['gplus'] = 'Google+ URL';              return $profile_fields;     }     add_filter('user_contactmethods', 'modify_contact_methods');      The above seems ideal for adding text input under the contact area of the profile. I'm also curious how I can add a text area or checkboxes to a user's profile? Additionally, is there a way to add tags from the blog as a field in the user profile? Ideally, I'd have a field labeled "Specialties" or "Areas of Expertise" which would be blog tags. And when the tags are used on the front end, this particular user's profile will show up among those results.


How To Hide The Visual And Html Editor Completely?

I have some clients that are going to be using wordpress for their sites. I created custom fields for them to input data in so they don't have to use the editor. How do I hide the page editor completely? I want it completely hidden so they don't accidentally muck things up. Thanks!


Multiple widgets in wordpress

I have created a wordpress widget. It has a drop down in widget options. The dropdown contains "facebook" and "twitter". If admin selects "twitter", then twitter follower count is displayed inside the widget, similar case for facebook. The count is displayed inside a div with id "social-count" using jquery. When page loads, jquery ajax will fetch the count and insert it into "social- count". The problem is that it works fine for single instance. But if 2 instances are added to sidebar, the latest count is shown in both instances as i am using $('.social-count').html(count); Now how can i assign count to corresponding widget areas using jquery?


How to display childrens custom fields?

I need help, I have a page that I want to display content from the page children, I get the content but not the custom fields! I've tried this but it dosnt work, what am I doing wrong?               <?php     $pages = get_pages('child_of='.$post->ID.'&sort_column=post_date&sort_order=desc&parent='.$post->ID);         foreach($pages as $page) {     ?>          <?php echo apply_filters('the_content', $page->post_content); ?>          <?php echo apply_filters('the_content', get_post_meta($page->post_content, 'custom_tagline')); ?>               <?php } ?>      Please HELP!


How to display posttypes and taxonomy in standard posts, not in a separate label?

I want to display some taxonomies directly in "Posts" label, as standard post, not in a separate label like "Books" for exp., but i don't know how. Is there a way to do this? This is the code: class PostTypes {               var $types = array();     var $taxonomy = array();          function __construct($types = array(), $taxonomy = array()){         $this->types = $types + $this->types;         $this->taxonomy = $taxonomy + $this->taxonomy;         $this->init();     }          function init(){         add_action( 'init', array(&$this, 'register_post_type',) );         add_action( 'init', array(&$this, 'register_taxonomy',) );     }               function register_post_type(){         global $options;              foreach ($this->types as $k => $v){             $vowels = array('a', 'e', 'i', 'o', 'u');             $a = 'a';             $slug = $v['slug'];             $name = $v['name'];                  $plural = $name.'s';             $menu_name = $plural;             if(isset($v['menu-name']))                 $menu_name = $v['menu-name'];                  $labels = array(                 'name'                  => __( $plural, 'post type general name' ),                   'singular_name'         => __( $name, 'post type singular name' ),                   'add_new'               => __( 'Add New', strtolower( $name ) ),                   'add_new_item'          => __( 'Add New ' . $name ),                   'edit_item'             => __( 'Edit ' . $name ),                   'new_item'              => __( 'New ' . $name ),                   'all_items'             => __( 'All ' . $plural ),                   'view_item'             => __( 'View ' . $name ),                   'search_items'          => __( 'Search ' . $plural ),                   'not_found'             => __( 'No ' . strtolower( $plural ) . ' found'),                   'not_found_in_trash'    => __( 'No ' . strtolower( $plural ) . ' found in Trash'),                   'parent_item_colon'     => '',                   'menu_name'             => $menu_name                  );                       $supports = array('title','editor','thumbnail', 'comments');                  if(isset($v['supports'])){                 $supports = $v['supports'];             }                  $args = array(                 'labels' => $labels,                 'public' => true,                 'publicly_queryable' => true,                 'show_ui' => true,                 'show_in_menu' => true,                 'query_var' => false,                 'rewrite' => array('slug' => $slug),                 'capability_type' => 'post',                 'has_archive' => false,                 'hierarchical' => false,                 'menu_position' => 5,                 'taxonomies' => array(),                 'supports' => $supports             );             register_post_type($k, $args);                   }     }               function register_taxonomy(){              foreach ($this->taxonomy as $k => $v){                  $taxonomy_slug =  $v['slug'];                  $name = $v['name'];             $plural = $name.'s';             $types = $v['post-types'];                       $labels = array(                 'name' => __( $name, 'taxonomy general name' ),                 'singular_name' => __( $name, 'taxonomy singular name' ),                 'search_items'          => __( 'Search ' . $name ),                  'popular_items' => __( 'Popular '.$name ),                 'all_items' => __( 'All '.$name ),                 'parent_item' => null,                 'parent_item_colon' => null,                 'edit_item' => __( 'Edit '.$name ),                  'update_item' => __( 'Update '.$name ),                 'add_new_item' => __( 'Add New '.$name ),                 'new_item_name' => __( 'New '.$name.' Name' ),                 'separate_items_with_commas' => __( 'Separate '.$name.' with commas' ),                 'add_or_remove_items' => __( 'Add or remove '.$name ),                 'choose_from_most_used' => __( 'Choose from the most used '.$name ),                 'menu_name' => __( $name ),             );                    if($v['type'] == 'category'){                      register_taxonomy($k, $types, array(                     'hierarchical' => true,                     'labels' => $labels,                     'show_ui' => true,                     'query_var' => true,                     'rewrite' => array( 'slug' => $taxonomy_slug, 'with_front' => false),                 ));                  }elseif($v['type'] == 'tags'){                 register_taxonomy($k, $types, array(                     'hierarchical' => false,                     'labels' => $labels,                     'show_ui' => true,                     'update_count_callback' => '_update_post_term_count',                     'query_var' => true,                     'rewrite' => array( 'slug' => $taxonomy_slug, 'with_front' => false),                 ));                       }                 }               }      }


Free shipping for certain items only - or get local pickup as option if item is set to virtual

I'm currently setting up a woocommerce driven shop. I use the fedex shipping calc. extension to get the shipping costs calculated. I wanna ship all items that are under 200$ for free. never mind if the cart total is above the 200$. Means you can add 4 or 6 or never mind how much items to the cart if each of the items is below the 200$ the shipping is free. So what I did is I have set all that (below 200$)items up as "virtual" items. That way they skip the fedex shipping calc. The problem is that I also wanna offer LOCAL PICKUP as a shipping option. But customers are not able to select that option if they have virtual items only in their cart. Is there a way to enable the local pickup option anyway? Or is there a smarter solution to get that idea done? EDIT: i have also tried to the following:   1. I have created a special shipping class named it "free shipping".   2. I have disabled the "virtual" option for one of the items wich has a price below the 200$. And i added that "special class "free shipping" to that item.   3. I have then activated the FLAT RATE shipping method and set the shipping cost on that to 0.00    4. I told that FLAT RATE shipping option to be active for my previously generated class (free shipping) only.   5. I renamed the option from FLAT RATE to FREE SHIPPING so that it is listed as FREE SHIPPING on the checkout page   6. So far so good, now if i add that item to the basket i see both options the FREE SHIPPING (the original flat rate i have renamed) and the "LOCAL PICKUP" option. so far so good. that works fine ... the problem is as soon as i add an another item to the cart with an price over 200$ fedex take affect and will calculate the shipping cost and a few fedex options are displayed. i also see the local pickup BUT AND THAT IS THE PROBLEM I ALSO SEE THE FREE SHIPPING OPTION CUZ THE the item i have given the special class is still in the basket. means people are able to select free shipping and that is not what i am looking for. As soon as a item with a price of over 200$ is in the basket the free shipping should be gone. I FOUND THE FOLLOWING SNIPPED HERE ON WPA Here's a snippet colleted from some Gists out of a GitHub issue discussion linked by @Ewout in another answer. I added a var_dump(), so you can uncomment and check what exactly you want to remove.               $available_methods is an array of:          $available_methods as $method_id => $method     Compare against $method_id if you need more specific checks.          // Hide standard shipping option when free shipping is available     add_filter( 'woocommerce_available_shipping_methods',         'wpse90835_hide_standard_shipping_when_free_is_available' );     /**      *  Hide Standard Shipping option when free shipping is available      *       * @param array $available_methods      */     function  wpse90835_hide_standard_shipping_when_free_is_available($available_methods )     {     // Developers!: Dump this to see what you can unset     # var_dump( $available_methods );          // remove standard shipping option     if (          isset( $available_methods['free_shipping'] )          AND isset( $available_methods['flat_rate'] )     )         unset( $available_methods['flat_rate'] );               return $available_methods;     }      can somebody tell me how to use the "Compare against $method_id if you need more specific checks."


Admin menu links just refresh the page

I'm using add_submenu_page() function to add some options to my plugin. On Linux hosting everything works like it should, on Windows hosting those 5 sub- menus have same link somehow and when I click on them page just reloads. What can be issue? Both hosts are using same PHP version. Here is the code               $this->page_hooks['link1'] = add_submenu_page(__FILE__, __('link1', 'domain'), __('link1', 'domain'), $acl_table['manage_link1'], 'wp-plugin-link1', array($this, 'on_manage_link1'));     $this->page_hooks['link2'] = add_submenu_page(__FILE__, __('link2', 'domain'), __('link2', 'domain'), $acl_table['manage_link2'], 'wp-plugin-link2', array($this, 'on_manage_link2'));     $this->page_hooks['link3'] = add_submenu_page(__FILE__, __('link3', 'domain'), __('link3', 'domain'), $acl_table['manage_link3'], 'wp-plugin-link3', array($this, 'on_manage_link3'));     $this->page_hooks['link4'] = add_submenu_page(__FILE__, __('link4', 'domain'), __('link4', 'domain'), 'manage_options', 'wp-plugin-link4', array($this, 'on_link4'));     $this->page_hooks['link5'] = add_submenu_page(__FILE__, __('link5', 'domain'), __('link5', 'domain'), 'manage_options', 'wp-plugin-link5', array($this, 'on_link5'));


Shortcode outputs at the top of the_content

The shortcode produced by this function - a list of all sites in a multisite - outputs above the content in the loop, no matter where it is placed in the editor. I've looked at the other related questions and answers on WPSE and realize that it has to do with the function using `echo` instead of `return`, but it's not as easy as replacing the instances of `echo` with `return` in the function below. Or adding `echo=0` with a WP function like `wp_list_pages()` Any ideas? Where is the function that needs to be returned instead of echoed?               // Output a single menu item     function projects_menu_entry($id, $title, $link_self)     {         global $blog_id;         if ($link_self || $id != $blog_id) {             echo '
';             if ($id == $blog_id) {                 echo '';             }             $url = get_home_url($id);             if (substr($url, -1) != '/') {                 // Note: I added a "/" to the end of the URL because WordPress                 // wasn't doing that automatically in v3.0.4                 $url .= '/';             }             echo '' . $title . '';             if ($id == $blog_id) {                 echo '';             }             echo '
';         }     }          // Output the whole menu     // If $link_self is false, skip the current site - used to display the menu on the homepage     function projects_menu($link_self = true)     {         global $wpdb;              echo '
';              projects_menu_entry(1, 'Home', $link_self);              $blogs = $wpdb->get_results("             SELECT blog_id             FROM {$wpdb->blogs}             WHERE site_id = '{$wpdb->siteid}'             AND spam = '0'             AND deleted = '0'             AND archived = '0'             AND blog_id != 1         ");              $sites = array();         foreach ($blogs as $blog) {             $sites[$blog->blog_id] = get_blog_option($blog->blog_id, 'blogname');         }              natsort($sites);         foreach ($sites as $blog_id => $blog_title) {             projects_menu_entry($blog_id, $blog_title, $link_self);         }         echo '
';     }          // Adds a [bloglist] shortcode          function bloglist_shortcode($atts)     {         projects_menu(false);     }          add_shortcode('bloglist', 'bloglist_shortcode');


login with email and no password

I am designing a site that the client wants to only have members use their email to login and no password. Here is the old site and they want something like this. Is this possible with wordpress. I'm also using wp-members plugin. http://waiscon.com/planRoom.htm