title: Get the name an the description of a link category

text:
I have a link category with the id `$id=23;` and the slug `$slug=friends;`. I managed to read all links from that category using `get_bookmarks($id)`. Now I also want to use the name and the description ob the link category. How geht I get these values? I tried for example:               $cat = get_the_category($id);     $output .= "
Description: ".$cat[0]->category_description."
";      unfortunately this (and other things) did not work. So how can I receive the name and the description ob the link category with the id=23? Is it also possible to recieve this via the slug of the link category? I tried `get_category_by_slug($slug)`, but this always gave an empty result,...


title: How to Check Disk Space used by Media Library

text: Is there any way to find out how much of disk space has been used by Media Library? My blog's media files stored in a separate folder named "media" rather than the default "wp-content/uploads". Thanks


title: How can I hide Home in my menu in a specific page?

text: I want to how can I hide the home in the menu without setting show_home in functions.php to false, I just want to do is hide it in a specific page. How can I do this? I am using the Twenty-Eleven Theme.


title: Use and get custom user metadata

text: I wanted to check if a post custom field matches the logged user's custom metadata. If it does then list only posts that match. I think that's possible.


title: conditionally display text - on nextGEN gallery pages only

text: I'd like to use functions.php to display some text via a hook on pages displaying a nextGEN gallery. I can't find any documentation for nextGEN code. something like:               // add note to nextgen gallery pages     add_action( 'woo_post_inside_after', 'gallery_note',30 );     function gallery_note () {          if( page_is('nextgen-gallery') ):               echo 'here is a lovely note';         endif;       }      I know I could add the note via the nextgen template but this way is more elegant / easier to maintain ;)


title: About to migrate site to new domain

text: I've been developing a WordPress site for a client on my own hosting and domain and within the next week I'll be moving it to theirs. I have a number of questions regarding this as this is my first time doing something like this.   1. Once i've moved all the files and uploaded the database I plan to use the Search & Replace plugin. So say currently the site is at mywpsite.com and i'm moving it to newsite.com. Will simply Search & Replacing mywpsite.com with newsite.com change all links in the database as well as links to posts, pages, images etc. and have the site functioning correctly?   2. I've heard about deleting a licence file to make it harder to compromise the site security. Where exactly is this file and will the file be recreated every time WordPress is updated?   3. While i'm uploading and fixing the new site I would like to take their current site - newsite.com and move it to subdomain.newsite.com and redirect to there. How would i go about doing this? I'm sure these questions are simple enough but, as I said, this is my first time doing something like this and I'd appreciate any help with it. Thanks.


title: Wordpress upload folder on separate server

text: I separate uploads folder from root to subdomain. It works on one server. If I move it to another server it doesn not work. I think profblem with Upload Path. I used this settings ftp://user:password@server.com/, but it do nothing. WHat should I do?


title: Have latest post and recent posts display differently

text:
I have a situation where I want the latest post to display with a larger image and more text than the recent posts which would display thereafter. So the most recent post might show about 500 characters of text and a large image. And any post thereafter would only have the thumbnail image and display 140 characters. This is the code for my posts currently:               <?php $query1 = new WP_Query( 'post_type=post&posts_per_page=1' );          while ( $query1->have_posts() ) {     $query1->the_post();     echo '
' . get_the_title( $query1->post->ID ) . '
';     echo '
' . get_the_post_thumbnail( $query1->post->ID, 'wpbs-featured-post' ) . '
';     echo '
' . get_the_content( $query1->post->ID ) . '
';          }     wp_reset_postdata();          $query2 = new WP_Query( 'post_type=post&posts_per_page=100&offset=1' );          while( $query2->have_posts() ) {     $query2->next_post();     echo '
' . get_the_title( $query2->post->ID ) . '
';     echo '
' . get_the_post_thumbnail( $query2->post->ID , 'thumbnail' ) .   '
';     echo '
' . get_the_excerpt( $query2->post->ID ) . '
';     }          wp_reset_postdata(); ?>       Is this possible?


title: wpColorPicker: How update colors on input value update?

text: **Setup:**   * An input field that has attached a `wpColorPicker` instance.   * An external event that changes the input value color. **Issues:**   * On value change the color shown by the colorpicker doesn't get automatically updated, neither the selection when user open up the colorpicker dialog box.   * `wpColorPicker` doesn't have neither`remove`, `destroy` nor `update` methods, so there is no simple way to do this.   * And lastly, they wrap the input field in a bunch of other tags to do the styling, so no simple manual removal can be done. **Question:**   * How can I update the color on the widget and its selection when user initiates interaction upon field value change?


title: Ajax not working in Wordpress but works fine elsewhere?

text: I'm using an image gallery plugin with WP theme twentyfourteen. I embedded a submit field in one of the plugin's files which executes just before the gallery is loaded and sorts the images. All the PHP and SQL modifications work fine. But I need to convert the form to ajax, and I am running into resistance. The problem seems to be wordpress because the ajax routines work fine outside of wordpress. Or when they are loaded on their own page. But when I try to embed the code somewhere in the plugin files or theme files, the form doesn't work. I've tried ajax plugins and they don't apply to the form I created. The page just refreshes. How can I get ajax to work in WP?


title: Check for uploaded file type wordpress way for multiple uploads

text: I have a form in the frontend that lets the user upload multiple images and other file types as needed. To process multiple files array I have followed this answer and here is the relevant. **PHP**               global $post;     if ($_FILES) {         $files = $_FILES['upload'];         foreach ($files['name'] as $key => $value) {             if ($files['name'][$key]) {                 $file = array(                 'name'     => $files['name'][$key],                 'type'     => $files['type'][$key],                 'tmp_name' => $files['tmp_name'][$key],                 'error'    => $files['error'][$key],                 'size'     => $files['size'][$key]                 );                      $_FILES = array("upload" => $file);                 foreach ($_FILES as $file => $array) {                     $newupload = wp_insert_attachment($file,$post->ID);                 }                                                }         }     }      **HTML** Please note that my form allows multiple images array eg. `upload[]`               <form method="post" id="attachment--form" action="" enctype="multipart/form-data" >     <input type="file" multiple="true" name="upload[]">     <?php wp_nonce_field('upload_attachments_nonce','secure_upload'); ?>     <input type="submit" id="upload_attachments_button" name="upload_attachments" value="UPLOAD">     <form>      * * * I would like to check filetype using native wordpress functions wp_check_filetypes, The codex doesnot say much about it. Please help me with an example.


title: Is it a bad idea to CHMOD 777 all the files on your site?

text: I think i heard that it might pose a security threat to your site, is that right? Makes it more vulnerable to it getting hacked? How should I undo this, which files should be `chmod` to what number?


title: What is 'term_group' for 'order_by' in get_terms()?

text: I was just reading the Codex regarding `get_terms();`. What exactly is the parameter `'term_group'`? You can use it in ( _example_ ): `'order_by'` for `get_terms();`. _Hint: I could be all terms that share the same names, but have different slugs._


title: Image not showing using a custom function and get_post_meta

text: I'm trying to create a function to display either a theme option or custom images based on user input. So basically, it's a custom meta box. The user selects either a display header image OR they can upload one they want to use. I've created a custom function to call later on the single page template. This is what I have so far.               //El display image     function el_display(){         global $post;         $eldisplay = get_post_meta($post->ID, '_cmb_el_theme', true);         $elcustomdisplay = get_post_meta($post->ID, '_cmb_custom_image', true);                  if(isset($eldisplay)){                 echo '';                     }elseif(isset($elcustomdisplay)){                     echo '';                 }else{                     echo '';                 }     }      When I call the function later (using el_display(); ), there is no display image showing. I'm a little stuck and have been trying to fix this for hours. Any help would be much appreciated, thanks! * * * **UPDATE** Ok, thanks to all for helping me out and pointing me in the right direction. I do have some code clean up to do and a possible all out change in code but I'll use this for now. I got it to work with the following code.               //El display image     function el_display(){         global $post;         $eldisplay = get_post_meta($post->ID, '_cmb_el_theme', true);         $elcustomdisplay = get_post_meta($post->ID, '_cmb_custom_image', true);                  if(!empty($eldisplay)){                 echo '';                     }elseif(!empty($elcustomdisplay) && isset($elcustomdisplay)){                     echo '';                 }else{                     echo '';                 }     }      Thanks again!


title: Missing WP Media Settings Fields

text: I have a WordPress-based website, that is causing a number of problems when I try to upload any media. Media Library: ![enter image description here](http://i.stack.imgur.com/LsTKo.png) After viewing my 'Media Settings', I've noticed that I am missing the default 'Store uploads in this folder' and the 'Full URL path to files' fields. Default Settings: ![enter image description here](http://i.stack.imgur.com/hQ4L3.png) My Current Settings: ![enter image description here](http://i.stack.imgur.com/4Jpo5.png) I previously removed the path/text in the field 'Store uploads in this folder' and then saved the settings which had caused the fields to be removed. My question is, how do I restore this back?


title: Get part of a page url

text: I've been searching for this, but I can't find the answer. What I want to do: Every post will have a link to a page and that page needs to get the content of the post (the current post from where the link has been clicked) So first I have to pass the post ID of the current post to the url of the page we will click on, and when we get to that page I need to get the ID from the current page url into the page's content so I can get the post content by ID example: I am viewing a post (that has the post id 12), www.example.com/current-post and somewhere in the post I have a dynamic link www.example.com/modify-post- here?post_id=`enter code here` would lead to www.example.com/modify-post- here?post-id=12 (currently the page will not pass the ID, it is removing this part of the url post-id=12, and only shows the question mark) and this page needs to take the content (just plain text) of the post I was viewing when I clicked the link (the post with id 12, in this case) , and make it editable so it can be sent in a form. Your help is much appreciated Thank you


title: Efficient way of saving plugin options

text: I'm considering the saving of options for a plugin I'm developing. The first obvious candidate is the wp_options table. While reading the Pro WP Plugin Development book I came across this: > Every option saved adds a new record in WordPress ’ option table. You can > simply store several options at once, in one array: This avoids cluttering > the database and updates the values in one single MySQL query for greater > efficiency and speed. On the other hand, I also imagine that if the plugin has a lot of settings it may hinder performance to store everything in one array. Would it therefore make sense to split options into separate records in such cases? Third option I can think of is to create custom tables to store the plugin settings, as I've seen some plugins do this as well. What are the rules/guidelines to decide which way to go?


title: Link from Post to Another Post Via Clicking on Words within Original Post

text: On WordPress (—-.wordpress.com), how can you write a post for example, but then within a post, create a link to another page on your website if someone clicks on a highlighted word? For example, if someone writes about pie and then uses the word cake in the post, can the person make it so that if people click (highlighted) cake, it will bring them to another article about cake on the website? If so, how?


title: Curly bracket shortcode in header.php

text: I am using a plugin which uses a short-code format with curly brackets `{` I want to display this short-code in the `header.php`. Usually the following code works: `<?php echo do_shortcode('[shortcode]'); ?>`, but because of the `{` brackets I can´t seem get it to work.


title: PHP error with shortcode handler from a class

text: Currently i am using the following generic flow for adding the shortcode for a plugin.               class MyPlugin {              private $myvar;              function baztag_func() {             print $this->myvar;                     }     }          add_shortcode( 'baztag', array('MyPlugin', 'baztag_func') );      Now when this class and it's method are called i get the following error. > Fatal error: Using $this when not in object context in ... (Line no is where i have printed the `$this->myvar`) Is this a problem on Wordpress's end or is there is something i'm doing wrong? It seems to be something really simple.


title: Can we give Pending as a Role to wp_insert_user?

text: Can we give role parameter the value of pending in wp_insert_user ?


title: Count > 1 Navigation Slider

text:
I have a post type `slider`, when you have more than one post to display navigation. My code:               <?php          $count_slider = wp_count_posts('slider');     echo $count_slider->publish;           ?>          <?php if($count_slider > 1): ?>

          <?php endif; ?>      But it doesn’t work. Why?


title: Using the 'draft_to_publish' hook (post status transition)

text:
I am trying to use the draft_to_publish hook (http://codex.wordpress.org/Post_Status_Transitions) to run a function when a post that is a draft becomes published. This hook does not appear to be working:               add_action('draft_to_publish', 'myFunction');      When I use this in my plug-in, myFunction is never fired. I have used/tested the function before. I know it is the hook, not the contents of myFunction. All 'solutions' I found just link to the Codex page above. Any ideas about why this hook is not working? **Edit:** Here is an example. It the email will not be sent, because the action never fires:               function myfunction () {             $to = "recipient@example.com";             $subject = "Hi!";             $body = "Hi,\n\nHow are you?";             if (mail($to, $subject, $body)) {               echo("
Message successfully sent!
");              } else {               echo("
Message delivery failed...
");              }         }     add_action('draft_to_publish', 'myFunction');


title: Custom database or Custom Post Types?

text: I have been searching throughout the web for the best way to implement what I need but just cannot find a best solution as there always seems to be some drawback. I'd prefer to do it right the first time and it's been weeks trying to find the best solution. On my current website, I need to add listings of businesses with their various information such as address, phones, URLs referring to the business, etc. There would be 30+ fields and as you can see with the example of the URLs there can be many URLs which refer to the business. I'll need another list with its own data which will be a many to many relationship to the businesses. I know SQL and could easily do this in C# ASP.NET but am trying to find the best way to do it with WordPress. I will be using the Genesis framework if that matters. It appears I have 3 solutions:   * create custom tables in the WP database   * use Custom Post Types with many custom fields   * rely on a plugin Custom tables: It seems easy to retrieve the custom table info via SQL code but it looks like I would have to create an admin and especially if I want it to appear in the admin dashboard for ease of use to modify the tables. Custom Post Types: They seem like they might work but then I'd need a way to do the many to many relationship and the solution there seems to rely on a plugin like Posts 2 Posts. Also I'm not quite sure how easily it is all managed since it seems like there would be many WP pages to navigate instead of having perhaps one UI. Plugin: I have seen some recommended but then you're at the mercy of hoping the author maintains the plugin and then what happens if it breaks hence killing your website. So to the more experienced WordPress users out there, if you were going to tackle this project, which method would you use? Thanks!


title: if statement display content even though no data

text:
I am trying to figure out why this page is showing content when the criteria isn´t being met. I am using this code, so if there is a website in the custom meta box if will display the DIV with the a href in it:               <?php $infos = get_post_custom_values('_url'); ?>     <?php the_content(); ?>
     <?php if ( $infos ) { ?>
<a href="http://<?php echo $infos[0]; ?>" target="_blank">Website →
     <?php } // endif ?>      If you look here: hhttp://globalicn.com/preview/regions/europe/#southern- europe the bottom Portugal link has no website, but the website link is there and shows `http:///` If I delete the tag associated with this post, then the website link doesn´t display, which is correct. So when I add the tag Souther-Europe it somehow still adds the link. Full code: http://pastebin.com/8taYL6Da


title: Getting hierarchical custom post type permalinks to work just like pages

text: I've dug through every question here on custom post type permalinks, but most seem to be either problems with custom taxonomy rewrites, or the obvious missing of flush_rewrite_rules(). But in my case, I'm only using a custom post type (no taxonomy), set to be hierarchical (so I can assign parent-child relationships), with the proper "support" for the attributes metabox, etc, etc. I've flushed rewrite rules a thousand different ways. I've tried different permalink structures. But child URLs always result in 404! I originally had independent custom post types for the "parent" and "child" elements (using p2p), and I probably would have had no trouble using a taxonomy for the "parental" grouping - I know those would be semantically more accurate. But for the client, it is easiest for them to visualize the hierarchy when the "posts" are displayed in the admin just like pages are: a simple tree where children appear underneath the parent, prefixed with a "--", and in the proper order. Also, various methods for assigning order via drag-n- drop can be used. Grouping via taxonomy (or p2p) results in a flat list of "posts" in the admin listings, which is simply not as visually obvious. So what I'm after is literally the exact same behavior as core "pages", but with my custom post type. I've registered the post type just as expected, and in the admin it works perfectly - I can assign a parent and a menu_order for each newsletter "post", they appear correctly in the edit listings:               Spring 2012     — First Article     — Second Article      And their permalinks _appear_ to be constructed properly. In fact, if I change anything about the structure, or even alter the rewrite slug when registering the post type, they automatically update correctly, so I know something's working:               http://mysite.com/parent-page/child-page/                  /* works for pages! */     http://mysite.com/post-type/parent-post/child-post/        /* should work? */     http://mysite.com/newsletter/spring-2012/                  /* works! */     http://mysite.com/newsletter/spring-2012/first-article/    /* 404 */     http://mysite.com/newsletter/spring-2012/second-article/   /* 404 */      I also have standard core "pages" with hierarchical relationships created, and they look just the same in the admin, but they actually work on the front-end too (both parent and child URLs work fine). My permalink structure is set to:               http://mysite.com/%postname%/      I've also attempted this (just because so many other answers seemed to indicate it was needed, though it didn't make sense in my case):               http://mysite.com/%category%/%postname%/      My register CPT args include:               $args = array(         'public'                => true,         'publicly_queryable'    => true,         'show_ui'               => true,         'has_archive'           => 'newsletter',         'hierarchical'          => true,         'query_var'             => true,         'supports'              => array( 'title', 'editor', 'thumbnail', 'page-attributes' ),         'rewrite'               => array( 'slug' => 'newsletter', 'with_front' => false ),      The only visible difference between my custom post type _children_ and normal _page_ children, is that my CPT has the slug at the beginning of the permalink structure, then followed by the parent/child slugs (where pages just begin with the parent/child slugs, no "prefix"). Why this would foul things up, I don't know. Plenty of articles seem to indicate that this is exactly how such hierarchical CPT permalinks should behave - but mine, though nicely formed, don't work. What also baffles me is when I examine the query_vars for that 404 page - they seem to contain the correct values for WP to "find" my child pages, but something's not working.               $wp_query object WP_Query {46}     public query_vars -> array (58)     'page' => integer 0     'newsletter' => string(25) "spring-2012/first-article"     'post_type' => string(10) "newsletter"     'name' => string(13) "first-article"     'error' => string(0) ""     'm' => integer 0     'p' => integer 0     'post_parent' => string(0) ""     'subpost' => string(0) ""     'subpost_id' => string(0) ""     'attachment' => string(0) ""     'attachment_id' => integer 0     'static' => string(0) ""     'pagename' => string(13) "first-article"     'page_id' => integer 0     [...]      I've tried this with various themes, including twentytwelve, just to be sure it's not some missing template on my part. Using Rewrite Rules Inspector, this is what shows up for the url: http://mysite.com/newsletter/spring-2012/first-article/               newsletter/(.+?)(/[0-9]+)?/?$               newsletter: spring-2012/first-article                page:      (.?.+?)(/[0-9]+)?/?$                pagename: newsletter/spring-2012/first-article                page:       how its displayed on another inspector page:               RULE:     newsletter/(.+?)(/[0-9]+)?/?$     REWRITE:     index.php?newsletter=$matches[1]&page=$matches[2]     SOURCE:     newsletter      This rewrite output would lead me to believe that the following "non-pretty" permalink would work: http://mysite.com/?newsletter=spring-2012&page=first-article It doesn't 404, but it shows the parent CPT item "newsletter", not the child. The request looks like this:               Array     (         [page] => first-article         [newsletter] => spring-2012         [post_type] => newsletter         [name] => spring-2012     )


title: Link blogname and blogdescription to the Options Framework

text: I'm putting together a _Theme Options_ page, where the user(s) I'm building this for would like to be able to edit a few settings directly from this page, including of which - the _Site Title_ and _Tagline_. With some fantastic help from brasofilo, I have the following... **/inc/options-framework.php:**               /**      * Validate Options.      *      * This runs after the submit/reset button has been clicked and      * validates the inputs.      */     function optionsframework_validate( $input ) {     /* code */         $clean[$id] = apply_filters( 'of_sanitize_' . $option['type'], $input[$id], $option );     /* code */      **options.php:**               $options[] = array(         'name' => __('Input Text Mini', 'options_framework_theme'),         'desc' => __('A mini text input field.', 'options_framework_theme'),         'id' => 'blogname',         'std' => 'Default',         'class' => 'mini',         'type' => 'text');          $options[] = array(         'name' => __('Input Text', 'options_framework_theme'),         'desc' => __('A text input field.', 'options_framework_theme'),         'id' => 'blogdescription',         'std' => 'Default Value',         'type' => 'text');      **functions.php:**               add_filter( 'of_sanitize_text', 'wpse_77233_framework_to_settings', 10, 2 );          function wpse_77233_framework_to_settings( $input, $option )     {         if( 'blogname' == $option['id'] )             update_option( 'blogname', sanitize_text_field( $input ) );              if( 'blogdescription' == $option['id'] )             update_option( 'blogdescription', sanitize_text_field( $input ) );              return $input;     }      If the user(s) add in their own blogname/Site Title and blogdescription/Tagline within the _Theme Options_ page and then click the Save button, it will output the information to the front-end of the site accordingly, and update the information within each of the text-fields within the WP API _Settings > General_ menu. **Theme Options:** ![enter image description here](http://i.stack.imgur.com/FoViP.png) **Settings > General:** ![enter image description here](http://i.stack.imgur.com/qJYWa.png) However, if the user(s) make any changes the other way around (within the WP API _Settings > General_ menu), the information is output to the front-end of the site, but wont update the fields within the options-framework/Theme Options page. As I'm fairly new to PHP and how this all works, I was wondering how would I be able to make this work the other way too?


title: How to add text editor in plugin menu?

text: Can I add a **text editor to my plugin menu**? So I can let users edit custom css file? Something like `/wp-admin/plugin-editor.php` but I want users to be able to edit only one file. The custome css file. Could this be done using **Wordpress standard functions**?


title: Admin menu success message

text: I have created a simple admin menu that allows users to enter in some basic information that is stored in the footer. When they click save the url appends `&settings-updated=true` Is there a way, using jQuery to show a success/fail message? Can anyone show me how or give me an example? Thanks in advance, George


title: Working with an Array inside Your Theme Options Array - Multiple Values

text: I apologize if this is covered extensively elsewhere, I'm not sure how to phrase my searches on the topic. Basically, instead of the following standard code to store data in WP- options...               $options = array (     array("name" => __('Font','mytheme'),         "desc" => __('Change the font face)','mytheme'),         "id" => "mytheme_font",         "std" => "Arial",         "type" => "text"),     array("name" => __('Alternate Font','mytheme'),         "desc" => __('Change the alternate font face)','mytheme'),         "id" => "mytheme_font_alternate",         "std" => "Tahoma",         "type" => "text"),     );      I would instead like to store multiple values in the "std" portion, with its own array - like this:                   $options = array (             array("name" => __('Font','mytheme'),                 "desc" => __('Change the font face)','mytheme'),                 "id" => "mytheme_font",                 "std" => array('size' => '10px', 'face' => 'Arial', 'color' => '#000000'),                 "type" => "text"),             array("name" => __('Alternate Font','mytheme'),                 "desc" => __('Change the alternate font face)','mytheme'),                 "id" => "mytheme_font_alternate",                 "std" => array('size' => '13px', 'face' => 'Tahoma', 'color' => '#FF0000'),                 "type" => "text"),             );      I would assume this is allowed, but given that it is, I am at a loss for how to: **1)** Know which name/id to use on the admin form inputs to signify to go into "size" and "face" and "color". For example, in the standard code without the multidimensional array I would usually use code like this:               <input name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" type="text" value="<?php echo stripslashes(get_option( $value['id'], $value['std'] )); ?>" />      I'm not sure what to place in the "name" and "id" sections for the input. **2)** How would I retrieve these values in the WP theme? I usually use code like this:               // Make values available     global $options;     foreach ($options as $value) {     $$value['id'] = get_option($value['id'], $value['std']);     }          // Print the actual value     <?php echo $mytheme_font; ?>;}      Any help is greatly appreciated! If anyone has any ideas or knows of any tutorials on this topic that would be excellent! Thank you!


title: Wordpress Rewrite

text: I'm trying to get http://example.com/site/vendors/?u=abc to rewrite to http://example.com/site/vendors/abc but I can't for the life of me figure out how to get the url rewrites to work. /site/ is the root directory for my WP installation /vendors/ is a page


title: permalink results to "page not found"

text: Whenever I change my permalink option from the default to /%postname%/, it results into my page cannot be found. Wordpress would complain that it cannot modify the .htaccess (because there was none), so I created it in /var/www/. The .htaccess has the same owner / permissions as my wordpress folder. Please help, I've been trying to fix this for 3 days now. Do I also need to change the mod_rewrite somewhere? EDIT: Solved! inside /var/www/.htaccess Add the line: Options +FollowSymLinks for the mod_rewrite problem: > Check for Apache Mod_ReWrite – Following lists all the loaded modules > > sudo apache2ctl -M Enable Mod_Rewrite > > sudo ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods- > enabled/rewrite.load Restart Apache view sourceprint? 1 sudo > /etc/init.d/apache2 restart courtesy of https://usingnix.wordpress.com/2010/12/21/apache-mod_rewrite-wp- permalinks/


title: How to delete all post and attachments of a user when I delete it?

text: When I delete a user, WordPress can just delete the post or page of this user, not his custom post and his attachments. An idea for a special hook?               add_action( 'delete_user', 'my_delete_user');          function my_delete_user($user_id) {         $user = get_user_by('id', $user_id);         $the_query = new WP_Query( $args );             if ( have_posts() ) {                  while ( have_posts() ) {                      the_post();                          wp_delete_post( $post->ID, false );                               // HOW TO DELETE ATTACHMENTS ?                 }             }     }


title: Add images to my theme with html

text: I've uploaded an image to my directory (themes/themename/images/file.png). I want this image to be displayed even if the directory preceding themes is changed (in case someone installs wordpress in a directory other than the home directory). What is the call I need to find the image? Simply using img src="/images/file.png" does not work.


title: 500 error when using virtual host

text: I've got a Wordpress MU install in a sub-directory of my webserver. When I point my virtual host at that directory I get my index page but no styling or access to any pages. It's like it can't access anything in the sub-directories of my WP root, I get the 500 error. When I check the Apache log it says, "Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace." From the research I've done it points to an htaccess problem. However, when I delete the virtual host everything works fine. I'm not sure what else I need to try. I'm using Turnkey Linux. Any suggestions? Here's my config,               RewriteEngine On     RewriteBase /examples/     RewriteRule ^index\.php$ - [L]          # uploaded files     RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]          # add a trailing slash to /wp-admin     RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]     RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]     RewriteRule . index.php [L]      I think I've narrowed it down to being something with the RewriteBase. Still no solution though. UPDATE: Getting closer. I tried changing the last RewriteRule to,               RewriteRule ^(.+)$ /index.php/$1 [L,QSA]      Now I'm not getting the 500 error anymore but the CSS for my main site isn't working and some image links. The second site works for the most part except a few broken links and such.


title: Hiding custom theme functionality using capabilities

text: have spent half an hour hunting around on Google to solve this so any ideas greatly appreciated! * * * I'm using a bought theme running wp3.2 and the theme includes a few extra features Testimonials, Portfolio and Slider (they show in the admin, but aren't plugins) I'm comfortable using `$role_objet->remove_cap();` in the funtions.php file to manage capabilities, but I'm not sure how to reference these features. Basically I'm want to hide these menu items off for Editors.


title: Standalone form does not post to the url when form fields are populated (otherwise it does)

text: So this is weird.... I have a form I've created myself (not a plugin, this is what I mean by standalone), and for some strange reason it does **not** post to the form's action when the form fields have data in them. However, when the fields are _empty_ it successfully posts to the other page. I have turned off all validators and really am not sure why this is happening. Do I need to hook into a Wordpress function to allow for my own form submission? I realized my permalink structure is `/%category%/%postname%/` so perhaps it cannot properly post to the URL since it's not an actual file. How can I achieve this? Thanks


title: Multiple Tax Query with Meta Key

text: I am trying to do a tax-query on a hierarchical taxonomy with no tags. I want to show results for the dealer state and brand being viewed by the user. For instance dealers in texas that also carry honda. I only want to show the results if the meta key value of wpcf-paid is 1 for the dealers. I have the below code, but it does not seem to work. Any suggestions? Thank you! `               $args = array(     'post_type'=>'dealers',     'meta_key'=>'wpcf-paid',     'meta_value'=> '1',          'tax_query' => array(     'relation' => 'AND',             array(                      'taxonomy' => 'dealerstate',                 'field' => 'id',                 'terms' => 'terms' => get_terms( 'dealerstate', array( 'fields' => 'ids' ) ),                 'operator'=> 'AND'             ),                  array(                 'taxonomy' => 'brands',                 'field' => 'id',                 'terms' => 'terms' => get_terms( 'brands', array( 'fields' => 'ids' ) ),                 'operator'=> 'IN'             )         )     );      query_posts( $args );`


title: How can I force users to a particular subdomain to log in for MU (Multisite)?

text: I have a Multi-Site installation of Wordpress, with multiple subdomains, but only one of the subdomains has an SSL certificate. The domains are such:               www.example.com     blog1.example.com     blog2.example.com          secure.example.com           `secure.example.com` is the subdomain which has a SSL cert installed. If someone types in `blog1.example.com/wp-admin/dashboard.php`, how can I force them to `secure.example.com/wp-admin` and then after they log in redirect them back to `blog1.example.com/wp-admin/dashboard.php`?


title: Best way to create multi-step form with data saved to user account for later updating?

text: I'm attempting to set up a fairly long multi-part form (~50 questions, a few questions per page) with conditional logic. I'd like to offer registered visitors the ability to save their data between each page/step and give them the option to return later to finish. I have Gravity Forms and thought that might work, but it sounds like this isn't functionality they offer yet. Does anyone have any advice/suggestions on other form plugins or code which might meet these requirements? Thanks in advance for all your help!


title: Does WordPress's HTTP API use any caching?

text: I'm working on a plugin to will retrieve data from a remote server and display it on the Dashboard. To do this, I'll be using the WordPress HTTP API but I'm not seeing any information on the HTTP API using any form of caching. As I don't want my plugin to cause problems for the admins of the remote server, I was wondering if I missed some documentation about the HTTP API doing caching or if I'll also need to use the Transients API to implement caching for my plugin?


title: Registering different Post Formats for Blog Post and CPT

text: I'm using following code to register post formats for my blog posts ...               add_theme_support( 'post-formats', array( 'gallery', 'video', 'audio' ) );      Now, i want to add post formats support for my CPT 'Portfolio' too, but using different set of post formats. Using this code will add post format support for my CPT ...               add_post_type_support( 'portfolio', 'post-formats' );      But i only want to register _gallery_ and _video_ post format for portfolio CPT. Using the code below does'nt work ...               add_post_type_support( 'portfolio', 'post-formats', array( 'gallery', 'video' ) );      What code should i use?


title: How can I make the "Preview Post" button save and preview in the same window?

text: When you choose "Preview", which is actually a link,               Preview      the post is saved and the preview opens in a new window. I'm sure there is a javascript event attached to this button, I'd like to override it so that it saves and then preview link opens in the same tab / window. ![Picture.png](http://img854.imageshack.us/img854/7986/picturek.png)


title: How can I automatically attach posts to a map?

text: I'd like to display a Google map of places relating to posts (eg, places I've visited). Is there a plugin or method available that will allow me to have a Google map on a page and when creating a post, I can put in an address or lat/long for the post, so that it automatically gets added to the map? I'm thinking of something a bit like Drupal's Location module, which adds nodes with lat/longs to a main map.


title: Problem with get_the_excerpt when using an add_action('the_content') containing script tags

text:
Because of the add_action I'm doing on get_content(), where I'm appending social media icons to the end of the post, it appears that calls to get_the_excerpt() are picking up the part of the javascript and appending it to the end of the text returned from get_the_excerpt(). I suppose this is caused by the fact that the "" tags are being stripped out (due to the fact get_the_excerpt() filters them out) as a partial answer. However, why is this being picked up by get_the_excerpt() in the first place? It results in the text: > Here is the excerpt.document.write('')...               if((get_option('myTest_facebook_like') || get_option('myTest_plus1') || get_option('myTest_tweet')) && !get_option('myTest_share_title')){         add_action('the_content', 'myTest_get_social', 10);     }               function myTest_get_social($myTest_share = '') {         global $post;              if((get_option('myTest_plus1') == '' && get_option('myTest_facebook_like') ==  '' && get_option('myTest_tweet') ==  '') || in_category("dont-show-social", $post ) || get_post_meta($post->ID, '_noShare', true)) return $myTest_share;              $myTest_share .= '
';              $myTest_permalink   = is_front_page() ? get_bloginfo('siteurl') : get_permalink();              if(get_option('myTest_plus1')){             $myTest_share .='';             global $post;             if(get_post_meta($post->ID, '_myTest_plus1_href', true)){$myTest_share .= '';}         }


title: Extra option in editor

text: I'm sure there's an easy solution to this, but I'm wondering how to add custom input fields in the Wordpress editor. My goal is to have an image uploader to the right of the main editor, when an image is uploaded, it puts the image url into a `custom field` that I an access in my theme. What's the best way to go about this? I've researched & tried plugins, but I'd rather create my own as they all produced bugs. Thanks for any help/advice. Shane


title: Subsite with different template, and content

text: I have a Wordpress blog hosted on a shared web server: http://martinnormark.com I would like to add a whole new "area" to this site, called Consulting. When navigating to http://martinnormark.com/consulting \- another template with different navigation should be used, and the frontpage should be blog posts for that specific area. This also means, that the blog posts I write for the Consulting area should not be displayed on the front page of the root domain. I use the Genesis framework, but I think that might be my problem. It doesn't seem to support this setup. Any suggestions for frameworks, themes, or plugins? **Code**               function exclude_category( $query ) {         if ( !$query->is_category('hardware')) {             $query->set( 'cat', '-1' );         }     }     add_action( 'pre_get_posts', 'exclude_category' );


title: Taxonomies not showing in WP Dashboard Right Now widget

text:
For some time I've been using this code snippet adding both custom post types and custom taxonomies to the WP Dashboard Right Now widget:               function dashboard_right_now_content_table_end() {         $args = array(             'public' => true,             '_builtin' => false         );         $output = 'object';         $operator = 'and';         $post_types = get_post_types($args, $output, $operator);         foreach ($post_types as $post_type) {             $num_posts = wp_count_posts($post_type->name);             $num = number_format_i18n($num_posts->publish);             $text = _n($post_type->labels->singular_name, $post_type->labels->name, intval($num_posts->publish));             if (current_user_can('edit_posts')) {                 $num = "name'>$num";                 $text = "name'>$text";             }             echo '
name . '">' . $num . '	';             echo 'name . '">' . $text . '
';         }         $taxonomies = get_taxonomies($args, $output, $operator);         foreach ($taxonomies as $taxonomy) {             $num_terms = wp_count_terms($taxonomy->name);             $num = number_format_i18n($num_terms);             $text = _n($taxonomy->labels->singular_name, $taxonomy->labels->name, intval($num_terms));             if (current_user_can('manage_categories')) {                 $num = "name'>$num";                 $text = "name'>$text";             }             echo '
name . '">' . $num . '	';             echo 'name . '">' . $text . '
';         }     }     add_action('right_now_content_table_end', 'dashboard_right_now_content_table_end');      Using this taxonomy:               function create_secondary_taxonomies() {         $labels = array(             'name' => _x('Mogelijkheden', 'taxonomy general name'),             'singular_name' => _x('Mogelijkheid', 'taxonomy singular name'),             'search_items' => __('Search Categories'),             'all_items' => __('All Categories'),             'parent_item' => __('Parent Category'),             'parent_item_colon' => __('Parent Category:'),             'edit_item' => __('Edit Category'),             'view_item' => __('View Category'),             'update_item' => __('Update Category'),             'add_new_item' => __('Add New Category'),             'new_item_name' => __('New Category Name'),             'menu_name' => __('Mogelijkheden')         );         register_taxonomy('mogelijkheden', array(             'portfolio'         ), array(             'labels' => $labels,             'hierarchical' => true,             'query_var' => true,             'rewrite' => array(                 'hierarchical' => true,                 'slug' => 'mogelijkheden',                 'with_front' => false             ),             'public' => true,             'show_ui' => true,             '_builtin' => true         ));     }     add_action('init', 'create_secondary_taxonomies');      This all worked great. Until recently. Currently it is still showing the custom post types, but it isn't showing the custom taxonomies anymore. Does someone notices any errors or things that could conflict with this code perhaps?


title: Display thumbnail from custom field

text: I have a custom field called `picture`. On the media settings page I've set thumbnail size to 100x100. If upload an image called `gecko.jpg`, Wordpress automatically resizes it and generates `gecko-100x100.jpg`. I want to use both the thumbnail size and original size, is it possible? With `<?php echo get_post_meta($post->ID, 'picture', true); ?>` I can only get the original size. Can anybody please assist me?


title: How do I allow users to sort posts?

text: > **Possible Duplicate:**   >  How do I sort multiples pages? I want to allow users to sort a long list of posts (that are displayed on multiple pages) by custom fields. Here is my form...               <form method="post" id="order">       <select name="sort" onchange='this.form.submit()'>         <option value="">Sort by</option>           <option value="zip">Sort by Zip Code</option>         <option value="type">Sort by Property Type</option>       </select>     </form>      I was told that I need to use sessions. However, I don't know how to code this. Could anyone give me an example based on the form above?


title: plugin install wants ftp (chown and 755 not enough)

text: I have root access in ssh to my install (and other wp install working) so im not sure what i missed... installing plugins through the wp-admin interface, it wants me to input ftp. i remember this from before, a long time ago. anyway, i tried already various things like chown and chgrp everything to the user. added user to www-data group chown'ed to www-data chmod 755 (even 777 the plugins dir to check!) nothing works! what did i miss?


title: wp_update_nav_menu_item not saving in multisite API

text:
I'm creating a script that automates build a wordpress site from another CMS. I've been able to change every setting: themes, options, subdomain, site title, etc. But what is eluding me is being able to create custom menus. The code below SHOULD be able to do it for me. However it is not, and I am completely stumped on what to do. This code is not being executed in the admin panel (Its not a plugin). Its actually sitting on top of wordpress and includes wp-load and wp-admin functions pages.               $mymenu = wp_get_nav_menu_object("Main Navigation Menu");     $menuID = (int) $mymenu->term_id;     $itemData = array(         'menu-item-db-id' => 0,         'menu-item-object-id' => $pageId,         'menu-item-object' => 'page',         'menu-item-type'  => 'post_type',         'menu-item-parent-id' => 0,         'menu-item-position' => $itemOrder,         'menu-item-title' => $pageData['title'],         'menu-item-url' => get_permalink($pageId),         'menu-item-description' => $pageData['post_content'],         'menu-item-attr-title' => $pageData['post_excerpt'],         'menu-item-status' => 'publish',
         'menu-item-target' => ''
     );     $thisMenuItem = wp_update_nav_menu_item($menuID, 0, $itemData);      $itemData is the result of data coming in from another CMS plus the result of saving it off a post in wordpress to produce the menu item that I want in my menu. Any help on getting the wp_update_nav_menu_item to save would be very helpful. Again this is creating a custom menu without the use of the admin panel.`


title: WPSC how do i output product per category on one page (wpsc-product-page)

text: I am trying to output and sort products per category, like:               Cat1     prod     prod          Cat2      prod          Cat3     prod     prod     prod      I am able to get the cat_ID per product, but how do i display               <?php while (wpsc_have_products()) :  wpsc_the_product(); ?>         <?php                  $wpsc_product_category = get_the_product_category( wpsc_the_product_id() );             $curr_cat = $wpsc_product_category[0]->name;             $cat_id = $wpsc_product_category[0]->cat_ID;             //print_r( $wpsc_product_category);             echo $cat_id;              ?>      Any tips, suggestions?


title: Different way to export data from WP?

text: does anyone one if there is any other way how to export all data from WP than than the default export plugin? I need it because I have JSON arrays in my custom fields and when I import XML file which was done via default WP plugin for export so it's not the same JSON array (string). It seems that Wordpress when exports custom fields delete all "\" from JSON array so after export it's broken JSON array. So that's why I'm searching for any alternative how to export all WP data. Or if you know solution how to fix this problem it would be the best. Thank you for all advices.


title: Query by meta_key and order by meta_value_num return orderby date

text: I'm trying to use the `orderby` and custom `WP_Query` features of wordpress. It works nicely to select item by their meta and to order by `date`. Unfortunately, it seems that I could not get the post result ordered by a `meta_value` numeric. Here is the args for the query :               $args = array(                     'post_status' => 'publish',                     'post_type' => 'participant',                     'order' => 'DESC',                     'meta_key' => 'participant_partage_class',                     'order_by' => 'meta_value_num,                     'meta_query' => array(                                  'key' => 'participant_partage_class',                                  'type' => 'SIGNED',                                  'compare' => '>',                             ),                     'posts_per_page' => '8',                     'paged' => $paged                 );      This result in the following query (token via request `$GLOBALS['wp_query']->request`) :               SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) WHERE 1=1 AND wp_posts.post_type = 'participant' AND (wp_posts.post_status = 'publish') AND (wp_postmeta.meta_key = 'participant_partage_class' ) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 8, 8      Which can not gave the list in order by meta_value. What I've seen is that this query :               SELECT wp_posts.*     FROM wp_posts      INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id)     WHERE 1=1       AND wp_posts.post_type = 'participant'       AND (wp_posts.post_status = 'publish')       AND wp_postmeta.meta_key = 'participant_partage_class'     GROUP BY wp_posts.ID     ORDER BY CAST(wp_postmeta.meta_value AS SIGNED) DESC     LIMIT 0, 8;      So my question is, how to handle this by simply using `WP_Query` object and not the default MySQL approach?


title: Custom Post Types and Child Themes!

text: OK here is my question.... I have a professionally purchased theme that has a custom post type of "PortFolio" built into the theme. The post type is ideal for what i'm trying to achieve in the website project but I wish to rename the actual post type to "Services" instead of "Portfolio". At the same time im planning to remove some of the fields in the post type but to also change the layout of the actual page too. Within the theme itself there has been a lot of custom modifications, and what im worried about is that if I change any of these settings, when it comes around to updating the theme, I presume the settings will be overwritten?? I have setup a child theme for this project, and wanted to know if I make any changes to the functions within the child theme, when I eventually update the theme, will the function updates change too? I know this may be a blindingly obvious question, but whats the best way to achieve this? Regards Tom


title: Nested WordPress shortcodes

text: Can I pass attributes from a shortcode to a nested one. Example:               [row $number_of_cols=4]         [col]             $width=total_width/$number_of_cols;         [/col]     [/row]


title: What hook can I use to modify custom post data before it is displayed on the page?

text: I need to check if a certain value is true in the post_meta right after the wp fetches a custom post from database, If it's false I need to modify/add some data to the post and then display the modified version, if it's true it should continue as usual. What would be the best hook and approach in general to accomplish something like this? Edit: Forgot to mention before, but I would HIGHLY prefer to do this inside a plugin.


title: How to load comment form with AJAX?

text:
We have a Wordpress website with a large number of logged in users. Hence, we cache as much as possible, which includes post pages. We've setup our website so that that the page is mainly dynamic, so it doesn't matter if you are logged in or not. The exception is the comment submission form, which shows logged in users submission forms to others, which is not good obviously. So I want to load the comment submission form -- and just the comment submission form, not the whole list of comments -- with AJAX to avoid this. Below is my code; it isn't working. Any help on what I'm doing wrong? Thanks!

      PHP function               add_action('wp_ajax_my_form_action', 'my_form_action_callback');          function my_form_action_callback() {     global $wpdb;     $comment_form = comment_form();     echo $comment_form;     die();     }


title: Is there a plugin to protect downloads with recaptcha?

text: Is there any plugin to protect a download via recaptcha?


title: Change search to outpout category name instead of Post type name

text:
Im using a ajax search which is great, however i would like to change it to show custom post type categorys instead of custom post type. I added the taxonomy for the custom post type categorys, and works great, but te titel is still "portfolio" which is the CPT, and i want the titels to be the categorys. The code:               if (!function_exists('sf_ajaxsearch')) {         function sf_ajaxsearch() {             $search_term = trim($_POST['s']);             $search_query_args = array(                 's' => $search_term,                 'post_type' => 'any',                  'portfolio-category' => 'fullvids',                              'post_status' => 'publish',                 'suppress_filters' => false,                 'numberposts' => -1             );             $search_query_args = http_build_query($search_query_args);             $search_results = get_posts( $search_query_args );             $count = count($search_results);             $shown_results = 5;                  $search_results_ouput = "";                  if (!empty($search_results)) {                      $sorted_posts = $post_type = array();                      foreach ($search_results as $search_result) {                     $sorted_posts[$search_result->post_type][] = $search_result;                     // Check we don't already have this post type in the post_type array                     if (empty($post_type[$search_result->post_type])) {                         // Add the post type object to the post_type array                         $post_type[$search_result->post_type] = get_post_type_object($search_result->post_type);                     }                            }                      $i = 0;                 foreach ($sorted_posts as $key => $type) {                     $search_results_ouput .= '
';                     if(isset($post_type[$key]->labels->name)) {                         $search_results_ouput .= "
".$post_type[$key]->labels->name."
";                     } else if(isset($key)) {                         $search_results_ouput .= "
".$key."
";                     } else {                         $search_results_ouput .= "
".__("Other", "swiftframework")."
";                                       }                          foreach ($type as $post) {                              $img_icon = "";                              $post_format = get_post_format($post->ID);                         if ( $post_format == "" ) {                             $post_format = 'standard';                         }                         $post_type = get_post_type($post->ID);                              if ($post_type == "post") {                             if ($post_format == "quote" || $post_format == "status") {                                 $img_icon = "fa-quote-left";                             } else if ($post_format == "image") {                                 $img_icon = "fa-picture-o";                             } else if ($post_format == "chat") {                                 $img_icon = "fa-comments-o";                             } else if ($post_format == "audio") {                                 $img_icon = "fa-music";                             } else if ($post_format == "video") {                                 $img_icon = "fa-film";                             } else if ($post_format == "link") {                                 $img_icon = "fa-link";                             } else {                                 $img_icon = "fa-pencil";                             }                         } else if ($post_type == "product") {                             $img_icon = "fa-shopping-cart";                         } else if ($post_type == "portfolio") {                             $img_icon = "fa-picture-o";                         } else if ($post_type == "team") {                             $img_icon = "fa-user";                         } else if ($post_type == "galleries") {                             $img_icon = "fa-picture-o";                         } else {                             $img_icon = "fa-file";                         }                              $post_title = get_the_title($post->ID);                         $post_permalink = get_permalink($post->ID);                              $image = get_the_post_thumbnail( $post->ID, 'thumbnail' );                              $search_results_ouput .= '
';                              if ($image) {                             $search_results_ouput .= '
'.$image.'
';                         } else {                             $search_results_ouput .= '

';                         }                              $search_results_ouput .= '
';                         $search_results_ouput .= '
'.$post_title.'
';                         $search_results_ouput .= '
';                              $search_results_ouput .= '
';                              $i++;                         if ($i == $shown_results) break;                     }                         $search_results_ouput .= '
';                     if ($i == $shown_results) break;                 }                      if ($count > 1) {                     $search_results_ouput .= ''.sprintf(__("View all %d results", "swiftframework"), $count).'';                 }                  } else {                      $search_results_ouput .= '
';                 $search_results_ouput .= '
'.__("No results", "swiftframework").'
';                 $search_results_ouput .= '
'.__("No search results could be found, please try another query.", "swiftframework").'
';                 $search_results_ouput .= '
';                  }                  echo $search_results_ouput;             die();         }         add_action('wp_ajax_sf_ajaxsearch', 'sf_ajaxsearch');         add_action('wp_ajax_nopriv_sf_ajaxsearch', 'sf_ajaxsearch');         }          if (!function_exists('sf_ajaxurl')) {         function sf_ajaxurl() {         ?>                      <?php          }         add_action('wp_head','sf_ajaxurl');     }     ?>


title: Order posts by years

text: I have posts (custom post type) on my site. I would like to create an archive page showing the archived posts ordered by years. e.g: 2010 * post 3 comes here * post 2 comes here * post 1 comes here 2011 * post 3 comes here * post 2 comes here * post 1 comes here with of course link to the post. I thought it's simple, however I couldnt find anything simple on the web. it also needs to be hand coded so I can style it easily. will appreciate any help Gil


title: Featured images, am I missing something?

text: *** edit *** \- Pretty new to wordpress here and I've been working on getting post-thumbnails working using featured images...My goal is to quickly apply the featured image as a post thumbnail, regardless of which theme I am using....I've been editing the Twenty Eleven theme and it seems that the featured images only applies to the main header image, or at least any post I have added a featured image to, the image doesn't show up as a thumbnail. I did a little research and I have found some people saying that featured images in Twenty Eleven only update the main header image...I have tried a couple of plugins that didn't work with a couple of different themes. Because I am new to WP and haven't really learned which features can easily be implemented via plugins and which require PHP editing, I have a couple of questions: Am I right to think that featured images work differently depending on which theme you have installed? Am I over looking something real easy, like a popular plugin that solves this issue? Any help would be greatly appreciated. - *** end edit ***


title: Adding the_date inside <p> tags around the_content

text: I am trying to get it so that all of my posts display the date at the beginning of the post content, such that each post begins as: > "August 28 - Lorem ipsum dolor sit amet..." However, if the code is just:               <?php the_time('F j - '); ?><?php the_content('Read More'); ?>      Then because Wordpress automatically adds p tags around the_content, it ends up displaying with a line break between the date and the rest of the content: > "August 28 - > > Lorem ipsum dolor sit amet... I want to insert the_date inside of the p tags around the_content, so there's isn't that line break. I have been looking around for possible solutions, but I haven't found anything short of removing the p tags entirely, which I don't want to do. Any suggestions?


title: Creating custom function in wordpress to return data from database

text: I have created a custom image uploader for my wordpress admin panel and need to retrieve the data from the wp_options table. I have wrritne the below function:               //function to get all slider images     function getSliderImages(){     global $wpdb, $theme_shortname;     $query = "SELECT * FROM $wpdb->options AS o1      WHERE o1.option_name LIKE '%".$theme_shortname."_header_image%'";     $imgs = $wpdb->get_results($query);          $images = array();     //loop through images and remove unusable results     foreach($imgs as $i){         $id = substr($i['option_name'],0,-1);         if(is_numeric($id)){             $images[] = $i['option_value'];         }     }          return($images);     }      How do I access the returned array in header.php on the front end? this function is currently in themes/themename/functions.php


title: New rewrite rules for custom taxonomy and reuse default

text: I have a taxonomy `location`. All terms except one are to be treated differently. That's why I have two php files   1. taxonomy-location.php   2. taxonomy-location-national.php Now, I want to make the URLs SEO friendly. If URL = example.com/localdeals/national, I want to redirect it to taxonomy- location-national.php If URL = example.com/localdeals/%any-other-term%, I want to redirect it to taxonomy-location.php Basically I do not want to write the name of above files in .htaccess. I want to, somehow, reuse the default WordPress rules. i.e. WordPress already directs example.com/?location=national and example.com/?location=boston correctly. I want to add new rules on top of these and want to reuse them. Is it possible?


title: Get post content from outside the loop

text: Is there a way to get the content from another outside the loop? The ID is 302 and I need to display the content of that on another page.


title: resize images not crop

text: Looking for a hack to resize images on upload (all forms of image uploads on wordpress) to exact dimensions, but **not to crop.** I will open a bounty for this question since I believe It can be of help for a lot of people. The ideal solution must be as a plugin and using the image dimensions already specified on the Media Settings Page (options-media.php / Thumbnail , Medium and Large) I know the ideal sometimes can't be done, so the closest answer will be the accepted one


title: How can I do syntax highlighting for files included with a custom shortcode?

text:
I'm writing a tutorial on using the R language to do some applied statistics. An example post is: http://mcmcinirt.stat.cmu.edu/archives/223 This answer taught me how to develop a custom shortcode so that I can include files stored on the webserver directly into the post. It works great. However, if possible, I'd like to have syntax highlighting too instead of 'just' the `<pre>` tag rendering. My initial attempt was to change the output of the shortcode function from:               return '
'.$file.'
';      to               return '
'.$file.'
';         so that the CSS defined for the Crayon Syntax Highlighter would take over. However, that doesn't work because Crayon seems to take a `<pre>` tag and replace it with a lot of other divs e.g. `<div class="crayon-line crayon- striped-line" ...>` which are what the CSS is actually for. Is there a way to force Crayon to run after my shortcode so that the text included by the shortcode gets appropriately processed? Or do I need a different solution entirely? Perhaps a different syntax highlighter? Also, FWIW, I'd rather have non-duplicated code than pretty code. I figure it doesn't hurt to ping the experts though.


title: Distinguish between publish and update?

text: > **Possible Duplicate:**   >  Check if post is being published for the first time, or is an already > published post being updated I'm writing a plugin which needs to grab posts as their published from one blog - but I'm finding that despite using the requirement that they be published and not revisions, when the post is updated, it's sending across a duplicate. Is there any way to determine whether a post has been published and is being updated? My alternative is to add a custom post meta field which says its already been grabbed by the plugin - but this isn't ideal in comparison to a solution that requires no additional fields.


title: How to modify post content?

text: I still haven't figured this out yet. Is this the right way? I tried `$_POST['content'] = "nothing"` and `$_POST['content'] = 0` neither work for me. I'm using following way               function changeContent() {          $_POST['content'] = "nothing";      }     add_action('publish_post', 'changeContent');      I want to change the content before it's written into the database.


title: add field comment

text: > **Possible Duplicate:**   >  Add Comment Custom Field Add Comment Custom Field I'm also interested with this, but where should I put those codes? help me guys..


title: 'Cheatin’ uh?' Error When Attempting to Upload Images After 3.4 Update

text: Since updating my WP Multisite to 3.4, my subdomain admins get the 'Cheatin’ uh?' error whenever trying to insert images into posts / custom posts. It seems to be a theme issue.


title: How to Remove Certain Screen Options and Table Columns from post type in wp_list_table?

text: On the page where we list all posts made: `example.domain.com/wp- admin/edit.php` There is a Screen Options tab in the upper right corner. Upon clicking this, a menu slides down. Contained within this slide down menu, are check boxes. When checking or unchecking these check boxes, certain columns in the post table are shown/hidden, depending on whether they are checked or not. I am looking for a way to programmatically obtain a list of all of these registered Screen Options for this post type (Default post type: post). Once I obtain a list of these registered screen options, I will check to see if a certain array of options are listed. If they match a listed item, I plan on removing those options. ![WordPress - Screen Options - List Posts](http://i.stack.imgur.com/7xy1f.png) Click Here For Full Size Screenshot **Question** How can I programmatically obtain a list of all registered Screen Options on post types (page with table listing each post)? Looking for a solution similar to the solution provided for removing certain screen options and meta boxes from add/edit post type.


title: Creating the modern 'single page' html5 css3 layout in wordpress

text: I am considering to develop a new portfolio website in the form of a single page website. I do not know if this is a new concept, but I see it becoming popular for portfolio websites, it is also quite a handy form. Now I want to create the about, portfolio, contact on one page, and have a normal blog on another page. So actually there is one single page, and one blog page. To give you an example of the single page, here is a link to a tutorial that creates such a single page. But this is just a normal static page. http://tutorialzine.com/2010/02/html5-css3-website-template/ Now is the best way to go about this to just create a single page, and have all my content displayed there just formatted in one big pile of html.   Or is there a more elegant solution to do this. Maybe with several custom post types on a single page, or is this not possible or not efficient. _I am pretty new to wordpress, sorry for if this is a stupid Q_


title: How to remove custom fields from the selector?

text: I want to remove some of those: ![enter image description here](http://i.stack.imgur.com/sZBaZ.png) So the user doesn't use them by mistake, Any idea howto? ( maybe looking into the wp database? )


title: how to display a string in admin_notices hook from a class plugin

text:
i'm trying to display a message in admin_notices hook upon plugin activation, using both a global variable or a static variable in my class ( $associati_error). i set the variable value into the register_activation_hook function: none of that is working. i'm very new to wordpress development and php, so excuse me if this is a simple question. also i found that the notification contains only the string set into installMenu() and not the string set into installDb(). finally my notification is'nt properly positioned into the notification area but is above it even using the update or error class for the div. here is my class plugin code :                   <?php         /*         Plugin Name: danceoften-associati         Plugin URI: http://danceoften.com         Description: gestione degli associati         Version: 1.0         Author: daniele ziccardi         Author URI: http://danceoften.com         */         class danceoften_associati {                  private $table_name;             private static $associati_error;             private static $associati_message;             private static $instance;                  private function __construct()               {                 global $wpdb;                 $this->table_name = $wpdb->prefix . 'associati';                     add_action('admin_notices', array($this, 'notifyMsg') );                         add_action('admin_menu', array($this, 'installMenu') );                  add_shortcode('associato', array($this, 'shortCodeAssociato'));                   add_shortcode('associato_search', array($this, 'shortCodeSearch'));               }                    public static function getinstance()             {                 // Get an instance of the                 if( null == self::$instance ) {                     self::$instance = new self;                 } // end if                 return self::$instance;             }                  public function register()             {                        $this->installDb();                  }             public function shortCodeAssociato($atts)               {               echo 'shortCodeAssociato';             }                     public function shortCodeSearch($atts)               {               echo 'shortCodeSearch';             }                     private function installDb() {                 try{                     global $wpdb;                     // check table NOT exists                     $sql  = "show tables like $this->table_name";                     if(!$wpdb->query($sql)){                         //Create table                         $sql  = "             CREATE TABLE $this->table_name (               `id` int(11) NOT NULL AUTO_INCREMENT,               `status` enum('active','draft','passive') NOT NULL DEFAULT 'draft'                   ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8             ";                                       $res = $wpdb->query($sql);                         //echo ( $wpdb->show_errors());                         self::$associati_message .= 'Creata tabella'. $this->table_name;                     }                     else{                     self::$associati_message .= 'Trovata tabella '.$this->table_name.': verificare contenuto';                     }                 }                        catch (Exception $e){                     self::$associati_error = 'exception '.$e->getMessage();                 }             }                  public function installMenu() {                 //this is the main item for the menu                 add_menu_page('associati', //page title                 'Associati', //menu title                 'manage_options', //capabilities                 'list_associati', //menu slug                 array($this,'listAll') //function                 );                      //this is a submenu                 add_submenu_page('list_associati', //parent slug                 'Nuovo associato', //page title                 'Nuovo associato', //menu title                 'manage_options', //capability                 'new_associato', //menu slug                 array($this,'newAssociato') //function                 );                      //this submenu is HIDDEN, however, we need to add it anyways                 add_submenu_page(null, //parent slug                 'Modifica associato', //page title                 'Modifica associato', //menu title                 'manage_options', //capability                 'update_associato', //menu slug                 array($this,'updateAssociato') //function                 );                 self::$associati_message .='Menu aggiunto
';             }                  public function notifyMsg() {                 self::$associati_message .= ' test ';                 if( isset(self::$associati_error)) {                     echo '
Attenzione: ',self::$associati_error,'
';                     //unset (self::$associati_error);                 }                 //else {echo '
noerror
';}                 if( isset(self::$associati_message)) {                     echo '
',self::$associati_message,'
';                     //unset (self::$associati_message);                 }                 //else{echo '
nomsg
';}             }                  function listAll () {             // code here             }                     function updateAssociato () {             //code here             }                  function newAssociato () {                 //code here              }         }         static $danceoften_associati_instance;         $danceoften_associati_instance = danceoften_associati::getinstance();         define('danceoften_associati_dir', plugin_dir_path(__FILE__));         register_activation_hook(__FILE__,array($danceoften_associati_instance,'register'));         ?>      the last doubt is that i'm not handling instantiation correctly with the static factory method getnstance() but except for notification everything seems working by now. thanx in advance to anyone wishing to help


title: 404 for children in hierarchical custom post type

text: I've tried all the solutions I can find on this and I'm still stuck. This post has a good thorough approach to debugging, but it hasn't helped. Part of the issue may be because I'm trying to get the Flatpack theme to change its behaviour. We're locked into this theme now. I'm doing this to make the portfolio and services CPTs hierarchical:               add_action( 'init', 'lf_modify_post_types', 999999 );     function lf_modify_post_types() {          if ( post_type_exists( 'portfolio' ) ) {              $args = get_post_type_object( 'portfolio' );         $args->rewrite['slug'] = 'portfolio';         $args->rewrite['with_front'] = false;         $args->hierarchical = true;         $args->supports[] = 'page-attributes';                 $args->query_var = true;         register_post_type( 'portfolio', $args );          }          if ( post_type_exists( 'services' ) ) {              $args = get_post_type_object( 'services' );         $args->rewrite['slug'] = 'services';         $args->rewrite['with_front'] = false;         $args->hierarchical = true;         $args->supports[] = 'page-attributes';                 $args->query_var = true;         register_post_type( 'services', $args );          }          }      As far as I can see, this works to make sure all the relevant CPT settings are right (including setting `query_var` to true, which seems to be a common "solution" to this issue). A dump of the portfolio CPT object at the end of the above gives this:               stdClass Object (     [labels] => stdClass Object         (             [name] => Portfolio             [singular_name] => Portfolio             [add_new] => Add Portfolio Item             [add_new_item] => Add New Portfolio Item             [edit_item] => Edit              [new_item] => New Portfolio Item             [view_item] => View Portfolio Item             [search_items] => Search Portfolio Items             [not_found] => No portfolio items found             [not_found_in_trash] => No portfolio items found in Trash             [parent_item_colon] =>              [all_items] => Portfolio             [menu_name] => Portfolio             [slug] => portfolio             [name_admin_bar] => Portfolio         )          [description] =>      [public] => 1     [hierarchical] => 1     [exclude_from_search] =>      [publicly_queryable] => 1     [show_ui] => 1     [show_in_menu] => 1     [show_in_nav_menus] => 1     [show_in_admin_bar] => 1     [menu_position] =>      [menu_icon] => http://languagefutures.localhost/wp-content/themes/language-futures/ocmx/images/icons/portfolio-icon.png     [capability_type] => post     [map_meta_cap] => 1     [register_meta_box_cb] =>      [taxonomies] => Array         (         )          [has_archive] =>      [rewrite] => Array         (             [slug] => portfolio             [with_front] =>              [pages] => 1             [feeds] =>              [ep_mask] => 1         )          [query_var] => portfolio     [can_export] => 1     [delete_with_user] =>      [_builtin] =>      [_edit_link] => post.php?post=%d     [name] => portfolio     [cap] => stdClass Object         (             [edit_post] => edit_post             [read_post] => read_post             [delete_post] => delete_post             [edit_posts] => edit_posts             [edit_others_posts] => edit_others_posts             [publish_posts] => publish_posts             [read_private_posts] => read_private_posts             [read] => read             [delete_posts] => delete_posts             [delete_private_posts] => delete_private_posts             [delete_published_posts] => delete_published_posts             [delete_others_posts] => delete_others_posts             [edit_private_posts] => edit_private_posts             [edit_published_posts] => edit_published_posts             [create_posts] => edit_posts         )          [label] => Portfolio     )      Flushed rules, and still: http://languagefutures.localhost/portfolio/project-and-themes/ (works OK) http://languagefutures.localhost/portfolio/project-and-themes/who-do-you- think-you-are/ (404) I've used the Rewrite Rules Inspector plugin on the latter URL, and it shows:               portfolio/(.+?)(/[0-9]+)?/?$    index.php?portfolio=$matches[1]&page=$matches[2]    portfolio     (.?.+?)(/[0-9]+)?/?$            index.php?pagename=$matches[1]&page=$matches[2] page      AFAIK all this is as it should be. Using the Query Monitor plugin, these are the queries being run that seem to be relevant:               SELECT ID, post_name, post_parent, post_type     FROM k3bex_posts     WHERE post_name IN ('project-and-themes','who-do-you-think-you-are')     AND (post_type = 'portfolio'     OR post_type = 'attachment')          Caller:     get_page_by_path()-     WP_Query->get_posts()     WP_Query->query()     WP->query_posts()     WP->main()     wp()          Returns: 2          SELECT k3bex_posts.*     FROM k3bex_posts      WHERE 1=1      AND (k3bex_posts.ID = '1493')     AND k3bex_posts.post_parent = 0      AND k3bex_posts.post_type = 'portfolio'      ORDER BY k3bex_posts.post_date DESC          Caller:     WP_Query->get_posts()-     WP_Query->query()     WP->query_posts()     WP->main()     wp()          Returns: 0          SELECT ID     FROM k3bex_posts     WHERE post_name LIKE 'who-do-you-think-you-are%'     AND post_type = 'portfolio'     AND post_status = 'publish'          Caller:     redirect_guess_404_permalink()-     redirect_canonical()     do_action('template_redirect')          Returns: 1      The obvious stand-out is the second one. 1493 is indeed the right ID for the child page. Why is the query specifying post_parent = 0? I'm continuing to look into it but if anyone has experienced anything like this and survived, tips would be great.


title: Using Wordpress functions in custom PHP file without any output to the page?

text: I need to use Wordpress functions `get_option` and `update_option` in a custom PHP file. However, I also need to be able to redirect using headers at the end of the PHP script. Requiring wp-load.php or wp-blog-header.php seems to output something to the page, and thus the redirect won't work if it's placed after the the `require`. How do I use `get_option` and `update_option` if I also need to redirect at the end of the script?


title: do_shortcode via ajax

text: I try to call contact-form-7 via ajax with do_shortcode. But it shows just "shortcode code".               function example_ajax_request() {     // The $_REQUEST contains all the data sent via ajax     if ( isset($_REQUEST) ) {               $shortcode = do_shortcode("[contact-form-7 id='900' title='Email Us']");     echo apply_filters('the_content', $shortcode);          die;          }          add_action( 'wp_ajax_example_ajax_request', 'example_ajax_request' );           add_action( 'wp_ajax_nopriv_example_ajax_request', 'example_ajax_request' );          add_action( 'init', create_function('',  'register_shortcode_ajax(   "example_ajax_request", "example_ajax_request" ); '));          function register_shortcode_ajax( $callable, $action ) {     if ( empty( $_GET['action'] ) || $_GET['action'] != $action )         return;     call_user_func( $callable );     }      I check it with suteurl/wp-admin/admin- ajax.php?action=example_ajax_request&ajax=true&width=600&height=300 and see [contact-form-7 id='900' title='Email Us'] content.


title: How to Process Form Request

text:
So... I have a form build into a WordPress page like this:               <form action="/help" method="GET">
Contact Us
                             Name:
                             <input type="text" name="name" />
                             Email:
                             <input type="text" name="email" />
                             Subject:
                             <input type="text" name="subject" />
                             Message:
                             <textarea name="msg" style="width:200px;height:380px"></textarea>

                             <input type="submit" style="width:206px;margin:0 auto;border:1px solid gray;border-radius:3px;background-color:orange;color:white" />
                             <?php if(isset($_GET['success'])) echo "Your message has successfully been sent!"; else echo "
"; ?>                           </form>      And /help redirects to the same page which contains this code, so I'm trying to redirect the page to itself.   Same page which contains the form above (page-help.php), also contains some php in the beginning for processing the data, like this:                 <?php      if(isset($_POST['message']))     {      // require 'PHPMailerAutoload.php';            $mail = new PHPMailer;            $mail->isSMTP();                                      // Set mailer to use SMTP       $mail->Host = 'mail.arkzel.com';  // Specify main and backup server       $mail->SMTPAuth = true;                               // Enable SMTP authentication       $mail->Username = 'arsham@arkzel.com';                            // SMTP username       $mail->Password = 'Xwbs*YR!';                           // SMTP password       $mail->SMTPSecure = 'tls';                            // Enable encryption, 'ssl' also accepted            $mail->From = $_POST['email'];;       $mail->FromName = $_POST['name'];;       $mail->addAddress('arsham@arkzel.com');               // Name is optional            $mail->WordWrap = 50;                                 // Set word wrap to 50 characters       $mail->isHTML(true);                                  // Set email format to HTML            $mail->Subject = $_POST['subject'];;       $mail->Body    = $_POST['message'];       $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';            if(!$mail->send()) {          echo 'Message could not be sent.';          echo 'Mailer Error: ' . $mail->ErrorInfo;          exit;       }       header("location: help?success=1");     }     ?>      But instead, what I get is a 404: Not Found message.   Much confused.


title: ”doing_wp_cron” in URL even if ALTERNATE CRON is not in wp-config

text: The insertion of `?doing_wp_cron` in Wordpress’s URL is very well documented here. My problem is a little different. I turned on the `ALTERNATE_WP_CRON` feature in my `wp-config` file a few days ago. Then, noticing this issue –i.e. the introduction of `?doing_wp_cron` in my URLs– I disabled it. And by “disabled” I mean I completely removed it from the `wp-config` file. I did this 36 hours ago. My problem is that `?doing_wp_cron` is still showing up in my access log. I wonder why? My two hypothesis are: 1) I should not remove `ALTERNATE_WP_CRON` but instead I should give it the value `FALSE` 2) Those URLs are in some browsers cache and being served as such. With time they should disappear. Feedback will be appreciated. P.


title: (WooCommerce) Remove Sidebar only on Single-Product page

text: I'm creating a theme and don't want to display the sidebar on single-product's page. Following the recommendations of WooCommerce, I made a copy of " **templates** " folder (under woocommerce plugin) and installed on **mytheme/templates** , changing the folder's name to " **woocommerce** ". On my theme's root, I created a file called **sidebar-shop.php**. By now I have the sidebar displayed on the shop page and on the single-product page. I tried to remove `do_action('woocommerce_sidebar');` from woocommerce/single-product.php and also tried to create a conditional on **woocomerce/shop/sidebar.php** , something like:               if (!is_page('single-product') {          get_sidebar('shop');      }      but the sidebar remains. Is there a working option to remove only the single product sidebar?


title: WP_Query posts by distance based on LAT & LNG in Database

text: I've got table in the WordPress database that has lat & lng stored and I'd like to add a sort feature on the results page 'Sort by Distance' that gets the locations that are closer to your provided lat & lng. I'm using WP_Query, it needs to work with it. Thanks :)                               $my_query = new WP_Query( array(                     'post_status' => 'publish',                     'post_type' => 'post',                      'category__in' => $category,                     'tax_query' => array(                             'relation' => 'AND',                             array(                                 'taxonomy' => 'age',                                 'field' => 'id',                                 'terms' => $age,                                 'operator' => 'IN'                             ),                             array(                                 'taxonomy' => 'price',                                 'field' => 'id',                                 'terms' => $price,                                 'operator' => 'IN'                             ),                             array(                                 'taxonomy' => 'group',                                 'field' => 'id',                                 'terms' => $group                             )                         ),                     'posts_per_page' => '-1',                     ) );


title: How to rewrite the post URL according to the category?

text: I have 1000 posts in my website, half of them are in difference categories and another half is in category called "blog". Current permalink structure is: http://xxxxx.com/articles/%postname% \- this is for all posts. Now if category is blog then permalink should be like this: http://xxxx.com/blog/%author%/%postname% is there a way to do like this?


title: wp_remote_post with ssl:// protocol

text: $response = wp_remote_post( 'ssl://securesite.com', array(             'method' => 'POST',             'body' => $string, // variable is set             'timeout' => apply_filters( 'http_request_timeout', 15),             'sslverify' => true         ));              error_log(print_r($response, TRUE));              if ( is_wp_error($response) ) {             return FALSE;         }              $result = wp_remote_retrieve_body($response);      The result is an error:               [30-Aug-2011 21:53:53] WP_Error Object     (     [errors] => Array         (             [http_request_failed] => Array                 (                     [0] => Unsupported protocol: ssl                 )              )          [error_data] => Array         (         )          )      If I use fsockopen and fgets everything works fine. Seems like I'm missing an undocumented trick since ssl should be handled by wp_remote_post.


title: Preventing tinyMCE from auto formatting selected blocks of content

text: Is there a way to prevent tinyMCE from auto formatting the content inside **selected** blocks? Something like               <!--dont-alter-->     variable range of content, text, < , ], images etc., that will not be touched by tinyMCE.     <!--end:dont:alter-->      so that when switching between editors, the content is unchanged? I have done tinyMCE plugins before, but would really appreciate some directions here. Above functionality would be very helpful, allowing control over formatting. Please share you wisdom. Thanks.


title: HTML markup output issue if a custom excerpt is pulled from an advanced custom field

text:
I've used a custom excerpt function to get an excerpt from an advanced custom field. The function inside functions.php looks like that:               function custom_field_excerpt($title) {         global $post;         $text = get_field($title);         if ( '' != $text ) {             $text = strip_shortcodes( $text );             $text = apply_filters('the_content', $text);             $text = str_replace(']]>', ']]>', $text);             $excerpt_length = 35; // 20 words             $excerpt_more = apply_filters('excerpt_more', ' ' . '[...]');             $text = wp_trim_words( $text, $excerpt_length, $excerpt_more );         }         return apply_filters('the_excerpt', $text);     }      the output is as expected. the text of the field is properly cut. the only problem is the resulting html markup. i've called the function inside the wordpress template with:
<?php echo custom_field_excerpt('news_post'); ?>
      But instead of placing the text inside like:
Worf, It's better than music. It's jazz. Mr. Crusher, ready a collision course with the Borg ship. This is not about revenge. This is about justice. The Federation's gone; the Borg is everywhere! In all trust, [...]
      The output looks like that:

Worf, It's better than music. It's jazz. Mr. Crusher, ready a collision course with the Borg ship. This is not about revenge. This is about justice. The Federation's gone; the Borg is everywhere! In all trust, [...]

      Is there a way to get the expected one liner beneath and get rid of the two extra p elements?
Worf, It's better than music. It's jazz. Mr. Crusher, ready a collision course with the Borg ship. This is not about revenge. This is about justice. The Federation's gone; the Borg is everywhere! In all trust, [...]
      Best regards and thanks in advance Ralf


title: Custom branding / theme specified by URL

text: Is there a way to have a site use a theme that is specified by the URL? for example the same site content, database and WordPress install where:   * `domain_x.com` uses `theme_a` with `company_branding`   * `domain_y.com` uses `theme_b` with `alt_company_branding`


title: Granting Author the capability to access a submenu item under Tools

text: I need the Author role to have the capability to access a submenu item (a third party plugin item) under the Tools menu in the admin. By default WordPress grants capability to the Tools menu for only Editor and Admin. Is there a way to add a capability for the Author to access this item? I've since tried using               $author->add_cap('import');      // add this to remove parent Tools menu item, but preserve the plugin submenu item     remove_submenu_page('tools.php', 'tools.php');      to get the Tools menu to show but the menu item still doesn't show.


title: Update value of a associative array with update_post_meta

text: I am trying to change the value of a specific key of an associative array which was saved in my post meta. This is how my array is saved in a custom field:               Array (          [0] => Array (             [321] => Zedity is an innovative content Editor to create posts or pages         )         [1] => Array (             [310] => A shortcode that includes other posts         )     )      This is how I am trying to update the value of key 321:               global $post;     $postid = $post->ID;     $add_to_ID = $_POST['wpd_plugin_note_id'];     $note = $_POST['wpd_plugin_note'];          $existing_list = get_post_meta($postid, 'my_list_items', TRUE );          foreach ($existing_list as $key => $value) {         $existing_list[$key][$add_to_ID] = $note;     }         update_post_meta($postid,'my_list_items',$existing_list);      It works, but after the update the array looks like this, instead of updating the value of key 321, the key=value pair is being added 2 times:               Array (          [0] => Array (             [321] => my new value for 321         )          [1] => Array (             [310] => A shortcode that includes other posts             [321] => my new value for 321         )     )      Can anyone tell me what I am doing wrong? Thanks


title: Why this function not working for install database on plugin activation

text: I followed codex instructions from wordpress site but for some reason it's not working for me and i can't understand why is there any debug settings or options to activate to explain me where i go wrong. Here is hook on plugin activation to install database but it's not working               global $evg_version;     $evg_version = '1.0';          //Install database when plugin activated     function evg_activate() {     global $wpdb;     global $evg_version;          $evg_table = $wpdb->prefix . 'evg_feeds';     $evg_table_charset = $wpdb->charset;     $evg_table_colate = $wpdb->colate;     //Create table     $sql = "CREATE TABLE $evg_table (         id bigint(20) NOT NULL AUTO_INCREMENT,         feedname varchar(200) NOT NULL,         provider varchar(20) NOT NULL,         searchterm varchar(200) NOT NULL,         numvideos int(10) NOT NULL,         poststatus varchar(20) NOT NULL,         commentstatus varchar(20) NOT NULL,         postauthor varchar(20) NOT NULL,         feedstatus int(5) NOT NULL DEFAULT '1',         UNIQUE KEY id (id)         ) DEFAULT CHARACTER SET $evg_table_charset  COLLATE $evg_table_colate ;";          require_once(ABSPATH . 'wp-admin/includes/upgrade.php');     dbDelta($sql);          add_option('evg_version', $evg_version);     }     register_activation_hook( __FILE__, 'evg_activate' );      add_option works and it updates version just it doesn't install database.