Adding action to save_post, post needs to be saved twice for function to work

I have written the following function which copies all post terms from the "tribe_events_cat" taxonomy to the "categoria" taxonomy when the post is saved. There is a bug where in order for the terms to be copied, I need to click "update" twice (i.e. save the post twice). I believe this happens because when I call `get_the_terms`, the post has not been saved yet. Is there any way around that, so that `get_the_terms` gets the terms from the newly updated post?                  function bam_save_event_cat( $post_id ) {             $taxonomy = 'categoria';                  $tribe_cats = get_the_terms( $post_id, 'tribe_events_cat');                  foreach($tribe_cats as $tribe_cat) {                 if( empty($tribe_cat->name) ) continue;                 $catname = $tribe_cat->name;                 $cats[] = $catname;             }             wp_set_object_terms( $post_id, $cats, $taxonomy );         }              function bam_save_event($post_id) {             if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )                 return;                  if ( !current_user_can( 'edit_post', $post_id ) )                 return;                  if(get_post_type( $post_id ) == 'tribe_events' ) {                 remove_action( 'save_post', 'bam_save_event' );                 wp_update_post( array( 'ID' => $post_id ) );                 add_action( 'save_post', 'bam_save_event' );                      bam_save_event_cat( $post_id );             }         }              add_action( 'save_post', 'bam_save_event' );


Change content off every sixth element

I would like to create custom post query where i will list all my posts in the list. Then the tricky bit is to add different content to sixth element off that list. So something like this
custom post 1

custom post 2

custom post 3

custom post 4

custom post 5

<the_content>

custom post 6

custom post 7
          ok here is what it did:
              <?php $my_query = new WP_Query( array(              'post_type' => 'people',              'posts_per_page' => 10,              'order' => 'DESC',              'paged'=> $paged         ) );?>                                  <?php while ( $my_query->have_posts() ) : $my_query->the_post(); ?>                                  <?php if (  $my_query->current_post == 5 ) { ?>
I'm odd one
                              <?php  } else {?>
<?php the_title(); ?>
                              <?php } ?>                                                 <?php endwhile; ?>                             <?php wp_reset_query();?>
      I hope that make sense, Thank you very much.


How To Use Custom Tax of a Post Type

I've defined a custom post type. I've defined a custom taxonomy for this custom post type. I've populated the custom taxonomy. How do I make the list of custom taxonomy values show up in the admin edit page of the custom post type? So I can assign one or more custom taxonomy values to the custom post type post? Thanks


Post order by custom fields

<?php query_posts( 'cat=16'); ?>             <?php if ( have_posts() )              while ( have_posts() ) : the_post(); ?>                                     <?php print_custom_field('time'); ?>                            <?php the_title(); ?>          <?php endwhile;?>      this is my query I want the post is order by custom field 'time' in ASC


Worried I have a funky .htaccess for WP site in light of strange search engine behavior

My friend started a new (non-commercial) blog 5+ months ago, but Google + Bing are acting like we're telling it to not be indexed. I don't mean it ranks poorly. I mean it doesn't rank **at all.** I checked Google Webmaster Tools. No malware/bad rep. **Google + Bing crawl it regularly, but index no pages.** I initially suspected robots.txt, but GWT is not complaining about it. And so now I turn to .htaccess. Does this look strange to you? Feedburner having two entries? Deny from all and Allow from all in the same entry? I'm pretty ignorant about .htaccess and Apache, but just the inconsistency seems funny.               # temp redirect wordpress content feeds to feedburner     <IfModule mod_rewrite.c>     RewriteEngine on     RewriteCond %{HTTP_USER_AGENT} !FeedBurner    [NC]     RewriteCond %{HTTP_USER_AGENT} !FeedValidator [NC]     RewriteRule ^feed/?([_0-9a-z-]+)?/?$ http://feeds.feedburner.com/anonymousblog  [R=302,NC,L]     </IfModule>          # temp redirect wordpress comment feeds to feedburner     <IfModule mod_rewrite.c>     RewriteEngine on     RewriteCond %{HTTP_USER_AGENT} !FeedBurner    [NC]     RewriteCond %{HTTP_USER_AGENT} !FeedValidator [NC]     RewriteRule ^comments/feed/?([_0-9a-z-]+)?/?$    http://feeds.feedburner.com/anonymous_comments [R=302,NC,L]     </IfModule>          <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*          <Limit GET POST>     order deny,allow     deny from all     allow from all     </Limit>     <Limit PUT DELETE>     order deny,allow     deny from all     </Limit>          php_value memory_limit 32M


How long does plugin review usually take?

WordPress says that plugins are manually reviewed within a "vaguely defined amount of time". What's the experience? How long does this take, on average?


How do you keep the default WYSIWYG active when using a custom template?

I've created a custom template for my "About Us" page because it need more options than what the static "page.php" file had to offer. However the content that i enter into my "About Us" page from the default WYSIWYG editor on the back end doesn't appear on the new template obviously because i'm not calling in that template part (if that's even the right term for it). Just to be clear when i create a custom template and need to call in a custom Field Group i'm using               <?php get_template_part( 'content', 'content_area' ); ?>      However i will state that on this template page i'm not using a loop in this particular php file, is that not ok. Do loops need to be part of all php pages? Maybe i should start there. Here's my code               /*     Template Name: About Us     */          include(TEMPLATEPATH."/header-internal.php");

            some content goes here

          <?php get_template_part( 'content', 'content_area' ); ?>
                               <?php      $args = array(       ' post_type' => 'content_area'      );      $the_query = new WP_Query( $args );      ?>           <?php if( $the_query->have_posts() ) : while( $the_query->have_posts() :      $the_query->have_posts(); ) ?>
<?php the_field( 'header' ); ?>

<?php the_field( 'content_area' ); ?>
           <?php endwhile; endif; ?>


I want the page mysite.com/product to be accessed with the URL > mysite.com/product/productname instead of > mysite.com/product?name=productname I am trying to achieve this with the code in the plugins main file:                add_rewrite_rule('^(product)/([^/]*)/?', 'product?name=$matches[1]','top');      but I am getting the error: > Fatal error: Call to a member function add_rule() on a non-object in > /location/wp-includes/rewrite.php on line 21 Any suggestions?


add_rewrite_rule regex issue

I am trying to add the following function into my functions.php through the WordPress editor but every time I try it says error 403 Forbidden - Access to this resource on the server is denied!               function my_custom_rewrites(){         add_rewrite_rule(         '^/?database/([0-9]+)/?([a-zA-Z0-9_-]*)/?([a-zA-Z0-9_-]*).html',         'index.php?image=$matches[1]&comms=$matches[2]&commz=$matches[3]',         'top' );     }      I know the following line is the issue as if I remove it completely, it successfully updates functions.php:                   '^/?database/([0-9]+)/?([a-zA-Z0-9_-]*)/?([a-zA-Z0-9_-]*).html',      I have tried removing certain characters without success. I have previously used this regex string in .htaccess files


How to increase image by URL upload limitation

System info - wordpress multisite installation - Version 3.9.1 with following system info - RAM 69,8/128M • SQL 142 • PHPv 5.3.28 Hi Support Team, I am using a multisite installation with a geotheme Theme and setup a central image storage by using this code within wp-config.php: define( 'UPLOADS', 'wp- content/'.'images' ); Now a limitation problem ocur after reaching round about 1.000 images by Url uploaded (/wp-content/_images/icons/...example.png) into my media library. I need these icons to be used as category icons for the geotheme setup. I am still able to add and save Urls but after checking this the icon is not saved. It seems there is a limitation on importing images by URL´s in Media Library. Now I Need help to find out why I am not able to add more images by Url-Upload into the media library. Is there a code available to increase this limitation? Alex P.S. I asked also the theme developer, but without any positive results. They say I have to import the images directly into the media library, but do not want this because I want to use the indirect Image urls (/wp- content/_images/icons/...example.png) for the other sub-sites too without beeing forced to add these images too into the sub-site media library. AND I want to make sure that later on after migration and changing of the main domain, all images will be available too.


Function to load correct CSS for Template not working

I have three templates I want to be able to use (Index Page, Main Template, and Default). I was able to add a "if/else" statement into a function to get the correct CSS file to load depending on which template was being used between two templates (Index and Default). However, when I try to use "elseif" so I can add in another option for Main Template, it doesn't work. Instead the page that uses Main Template loads the Index Page CSS. This is the code in question:                   if ( is_page() && ! is_page_template( 'page-templates/index_page.php' ) ) {             wp_enqueue_style( 'authorLuncheon-layout-style1', get_template_directory_uri().'/layouts/index_page.css' );         } elseif ( is_page() && ! is_page_template( 'page-templates/main_template.php' ) ) {             wp_enqueue_style( 'authorLuncheon-layout-style2', get_template_directory_uri().'/layouts/main_template.css' );         } else {             wp_enqueue_style( 'authorLuncheon-layout-style3', get_template_directory_uri().'/layouts/content-sidebar.css' );         }      Here's the whole function:               function authorluncheon_scripts() {         wp_enqueue_style( 'authorluncheon-style', get_stylesheet_uri() );              if ( is_page() && ! is_page_template('page-templates/index_page.php' ) ) {             wp_enqueue_style( 'authorLuncheon-layout-style1', get_template_directory_uri().'/layouts/index_page.css' );         } elseif ( is_page() && ! is_page_template( 'page-templates/main_template.php' ) ) {             wp_enqueue_style( 'authorLuncheon-layout-style2', get_template_directory_uri().'/layouts/main_template.css' );         } else {             wp_enqueue_style( 'authorLuncheon-layout-style3', get_template_directory_uri().'/layouts/content-sidebar.css' );         }              wp_enqueue_script( 'authorluncheon-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120206', true );              wp_enqueue_script( 'authorluncheon-skip-link-focus-fix', get_template_directory_uri().'/js/skip-link-focus-fix.js', array(), '20130115', true );              if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {             wp_enqueue_script( 'comment-reply' );         }     }     add_action( 'wp_enqueue_scripts', 'authorluncheon_scripts' );


ACF checkbox array is returning numbers, not labels

I am using Advanced Custom Fields and the add-on Repeater to create a field in the admin through which a user can select multiple icons. Each icon has an associated label, and I'm trying to return the results of the checked icons in a `foreach` loop. Here's my code:               <?php     // icons     foreach (get_sub_field('nav_widget_platforms') as $label => $value) {         echo '
'.$label.'
';     }     ?>      So for example, if the checkbox `cloud : eCommerce` is selected, the `$value` should be `cloud`, and the `$label` should be `eCommerce`. The problem is that `$label` is returning numbers, not labels, so that the page is displaying `0`, `1`, etc. depending on which order it is in the array. I'm not sure what I'm doing wrong here, or how to troubleshoot it.


Trouble creating custom sanitization function when uploading video files

I'm trying to create a Theme Customizer control in Wordpress that will allow the user to upload an MP4 and WEBM video, and in doing so I need to create a sanitization option to verify the file type. I'm having some trouble and can still upload any type of file... Here's what I'm doing:               function customizer_header_image( $wp_customize ) {            // Header Background Video (MP4)       $wp_customize->add_setting( 'header_video_mp4', array(         'default'             => '',         'sanitize_callback'   => 'check_header_video'       ) );            $wp_customize->add_control(         new WP_Customize_Upload_Control( $wp_customize, 'header_video_mp4_control', array(           'label'             => __( 'Header Video (MP4)', 'rainier' ),           'section'           => 'header_image',           'settings'          => 'header_video_mp4',         ) )       );          }          // Register the customize functions     add_action( 'customize_register', 'customizer_header_image' );          // Custom sanitize function for header video uploads     function check_header_video($file){       return validate_file($file, array('webm', 'mp4'));     }      As you can see I pass the control's `'sanitize_callback'` parameter to my `check_header_video`, and in there you can see in that function that it runs the file against a native Wordpress function `validate_file`, with accepted file types. Not having much luck. Does anyone know what I'm doing wrong here?


How to set featured image to custom post from outside programmatically

I am trying to fetch and insert images outside the wordpress environment to a custom post via PHP. How to move/upload that image to wordpress upload directory year date folder format just like wordpress do and set that image to featured image against the custom post? Also to upload image to custom post gallery? Below is my code               $filename = $image['name'];     $target_path = "../wp-content/uploads/";     $target_path = $target_path . $filename;     $wp_filetype = wp_check_filetype(basename($filename), null );     $wp_upload_dir = wp_upload_dir();     $attachment = array(         'guid' => $wp_upload_dir['baseurl'] . '/' . basename( $filename ),         'post_mime_type' => $wp_filetype['type'],         'post_title' => preg_replace('/\.[^.]+$/', '', basename($filename)),         'post_content' => '',     'post_status' => 'inherit'     );     $attach_id = wp_insert_attachment( $attachment, $target_path, $post_id );     $attach_data = wp_generate_attachment_metadata( $attach_id, $filename );     wp_update_attachment_metadata( $attach_id, $attach_data );     set_post_thumbnail( $post_id, $attach_id );      i have managed to upload the image to my uploads directory but cannot unable to create the year and date folder . this there any wp function for it ??


Why is home page content not displaying with this rewrite rule?

I am trying to pass a variable from a URL to PHP using mod_rewrite while maintaining standard WordPress functionality. Here's my mod_rewrite rules:               RewriteEngine On     RewriteBase /     RewriteRule ^(\w+)/$ /index.php?state=$1 [L]     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]      When I go to this URL: http://epiclasers.com/arizona/ It is obviously being handled by index.php (because the theme is being loaded) and the state variable is being passed to PHP. but I am having trouble getting the home page content to be displayed - instead it is showing 404 "page not found" content. Can someone shed some light as to why this is happening? **UPDATE:** When I redirect using the R flag, it works as it should:               RewriteRule ^(\w+)/$ /index.php?state=$1 [R,L]      and the home page is served: http://epiclasers.com/?state=arizona It seems that WP is grabbing the URL using $_SERVER['REQUEST_URI'] to process requests/queries - and WP is getting confused by the /arizona/ in the URL? Let's just assume that mod_rewrite is functioning correctly. Does anyone know how to customize WordPress to ignore "/arizona/" in the URL?


display last post modified date in genesis child themes

Since I frequently update posts so it’s crucial for me to display last modified date instead of post published date like following image. Its because I want search engine to display my post last modified date not post published date. Can anyone help me regarding this issue any help would be appreciated. ![enter image description here](http://i.stack.imgur.com/ZHvyw.png)


Using a pre_get_posts filter to search for multiple strings on all meta values

Using a pre_get_posts filter to search a given string on all meta_values:               $query->set('meta_value', 'first string');      debug:               AND ( (CAST(wp_postmeta.meta_value AS CHAR) = 'first string') )      Works Ok :) but how can I search on all meta_values for an array of strings? For example. I need something like:               $query->set('meta_value', array('first string', 'second string'));          AND ( (CAST(wp_postmeta.meta_value AS CHAR) = 'first string') OR (CAST(wp_postmeta.meta_value AS CHAR) = 'second string') )      It is possible using $query->set('meta_value'... or something else? Thanks in advance!


How do I profit from a Plugin?

While I remain committed to the open source foundation of WordPress, I do prefer to make a living plying my trade as a developer of quality software that fulfils a need of people willing to pay for it. I have developed a plugin for use by mainly business users of WordPress, i.e. cases of people using blogs to market their business, or trying to use WordPress as a CMS as well. I would like to 'sell' a 'pro' version this plugin, while still having a base version freely available. I would also like to avoid asking someone to pay for something they don't feel they have to, like charging a bloated distribution fee or something. I am considering that users of the pro version must be registered members, with a registration fee, and an online registration check when starting the plugin. What other options are available here? **EDIT:** Inspired by Zweiblumen's mention of SAAS, I have envisaged a model where the freely available, no registration, code is more of a skeleton which access the business logic and data through a web service. What do readers think of that?


get only 1 wpdb and get taxonomy, post to next page

1st question.                $passport_num="M00093";       $querystr = "     SELECT $wpdb->posts.*      FROM $wpdb->posts, $wpdb->postmeta     WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id      AND $wpdb->postmeta.meta_key = '_Passport'      AND $wpdb->postmeta.meta_value = $passport_num     AND $wpdb->posts.post_status = 'publish'      AND $wpdb->posts.post_type = 'us_visa'     ORDER BY $wpdb->posts.post_date DESC       ";               AND $wpdb->postmeta.meta_value = $passport_num      This part is not working. how can I change it? 2nd question,               <div class="post" id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">       <?php the_title(); ?>
       <?php the_time('F jS, Y') ?>
          <?php the_content('Read the rest of this entry »'); ?>

Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>         <?php comments_popup_link('No Comments', '1 Comment ', '% Comments '); ?>

      NO RESULT I need to get a term from a taxonomy ("visa_processing") how can I get the term which is related with this post? 3rd question. I put like this and got result. but I need to send it to next page as "POST" (we don't want to show them on URL with the taxonomy (term). thanks for your time.


Allowing users to view private posts (pending approval)

OK so I mostly fixed this myself I went into post.php in wp-includes. Changed the `'protected' => true,` of pending to `'public' => true,` but every time wordpress updates this will reset (I think) so can anybody mention a permanent way to make this change? Previous part of the question is below Basically I want my registered users to be able to view private posts types on the front end just like an admin can when they click view post on a draft/pending approval post. I have this page HERE which loads the pending-approval posts. But when a user clicks one they can't read the post because they don't have the permissions. I've tried the User Role Editor plugin and gave subscribers the permission for `read_private_posts` and `read_private_pages` but that didn't work. (apparently to get it to work they would have also needed edit permissions and I'm not willing to give them permission to edit others posts.) Are there any solutions I could do in the function.php such as               $subRole = get_role( 'subscriber' );     $subRole->add_cap( 'read_private_pages' );     $subRole->add_cap( 'read_private_posts' );      (tried the above, it doesn't work, was just an example)


Meta value Array

I am hoping someone can help me out. I have created a custom meta box and trying to store an array, but when using `update_post_meta`, it doesn't seem to be storing it as an array. I am getting the info via an api and it seems to be breaking down when going from the textarea to the `update_post_meta`. I have tried `serialize`, `unserialize`, `maybe_serialize`, `maybe_unserialize` etc. Anyway here is my code.               $movieCast(array)            array (       0 =>        array (         'actor' => 'Anthony Hopkins',         'actor_char' => 'Alfred Hitchcock',         'actor_link' => 'anthony-hopkins',         'img_path' => '/oDMLEhFmXLkTlUnErs0RxRua7kN.jpg',       ),       1 =>        array (         'actor' => 'Helen Mirren',         'actor_char' => 'Alma Reville',         'actor_link' => 'helen-mirren',         'img_path' => '/dRYchPNm8WCXxWHcGtUwq9VLra1.jpg',       ),       2 =>        array (         'actor' => 'Scarlett Johansson',         'actor_char' => 'Janet Leigh',         'actor_link' => 'scarlett-johansson',         'img_path' => '/dZ4uNJtLQkGlJ76eePrXYqUDWgn.jpg',       ),...          echo "<textarea id='actors_array' name='actors_array' rows='5' cols='120'>" ?><?php var_export($movieCast); echo "</textarea>";      I have tested that the textarea is an array using `echo is_array($cast) ? 'Array' : 'not an Array';` and it's returning `Array`. So I figure the problem is further down at save function                   $actors_array = $_POST['actors_array'];     update_post_meta( $post_id, 'actors_array', $actors_array );      Once stored and I use `$cast = get_post_meta` it seems it has not been stored correctly. When testing `echo is_array($cast) ? 'Array' : 'not an Array';` it returns `not an array`.               echo"<pre>";print_r($cast);echo"</pre>";      returns                   array (       0 =>        array (         'actor' => 'Anthony Hopkins',         'actor_char' => 'Alfred Hitchcock',         'actor_link' => 'anthony-hopkins',         'img_path' => '/oDMLEhFmXLkTlUnErs0RxRua7kN.jpg',       ),       1 =>        array (         'actor' => 'Helen Mirren',         'actor_char' => 'Alma Reville',         'actor_link' => 'helen-mirren',         'img_path' => '/dRYchPNm8WCXxWHcGtUwq9VLra1.jpg',       ),       2 =>        array (         'actor' => 'Scarlett Johansson',         'actor_char' => 'Janet Leigh',         'actor_link' => 'scarlett-johansson',         'img_path' => '/dZ4uNJtLQkGlJ76eePrXYqUDWgn.jpg',       ),...      So I am really hoping someone can help me out please. Thanks :)


Adding an Archive button to posts page for administrators

I want to add an Archive button near the `Edit, Quick Edit, Trash and View` buttons in the posts page - http://i.imgur.com/HDZBPCy.png. I've found a nice function that can probably do just that, but I've got no idea how to use it - wp_set_post_categories. What I want is to have a static `Archive` category, that isn't present in any of the menus, but due to the nature of the site (lots of orders, results etc) we have to keep them and I just don't want them to be in the trash or unpublish them after their deadline expires. I've looked through the pages to see how `Delete` button works, but I've found 30+ references to it, and I can't fathom how exactly does that work. Any help would be greatly appreciated.


FB - Comment Moderation Tool bug?

I am an admin of this site. This blog uses the FB comments plugin since around 1 year. Since I enabled the July Breaking Changes, I: -am not receiving any more new comments notifications on FB; -New comments are not appearing in the Comments Moderation Tool -However everything in the blog seems to be working fine, people are commenting, admins can reply, etc. This is the code in place:               <div class="fb-comments" data-href="<?php the_permalink() ?>" data-num-posts="6" data-width="580">
      And these are the og tags for the post pages:               <meta property="fb:admins" content="617488311,100000919127291"/>     <meta property="fb:app_id" content="184823298231084"/>     <meta property="og:type" content="article"/>     <meta property="og:url" content="<?php the_permalink() ?>"/>     <meta property="og:image" content="<?php echo wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) ) ?>" />     <meta property="og:title" content="<?php single_post_title(''); ?>"/>     <meta property="og:description" content="<?php echo strip_tags(get_the_excerpt($post->ID)); ?>" />      I hope you can take a look and are able to figure out where the problem is. I'd really appreciate your hints. Do you see any error in the code I used? Thanks


Removing h3s in excerpt output?

I have a custom post type and the content looks something like this:
Description
          The Production Assistant works closely with the production team to ensure that our games ship on time and at our very high standards. You will be a part of an international team and gain valuable insight into game development from a management perspective. Aside from production, you will also expand your knowledge of different disciplines such as, engineering, design, art, human resources, administration, and information technology.      The problem now is that the excerpt outputs something like this now:
Description The Production Assistant
      How can I tell WordPress to trim the h3s and the text inside them?


Customizing tinyMCE 4 Styles and Format dropdowns

As has been pointed out in multiple posts here there are some big problems with tinyMCE 4 formatting for WP 3.9 - this code comes very close: TinyMCE: adding CSS to format dropdown But there are problems - here are the ones that I have discovered:   * 'color' does not work (as I pointed out at the bottom of the question)   * 'block' =>'p' - does not work on its own, but it will if you add a class with 'classes'   * 'lineHeight' - does not work   * There seems to be no way to control the font size and type in the dropdowns Has anyone been able to come up with a solution to any of these?


Adding shortcode field to edit gallery / Gallery Settings

I want to add a field to the Add Media / Edit Gallery / Gallery Settings column which is able to accept shortcodes. I want to do this so that I can add a Cart66 shortcode which will "render" an add to cart button and price to individual thumbnails in the relevant gallery page. Any help much appreciated.


Determine if ID is page or post and query the ID

I want to look up a page id and determine if it's a page or post. Then query that id and display stuff like title, featured image, etc. This works for Pages:                   query_posts('page=' . $featured_tab);       This works or Posts:                   query_posts('p=' . $featured_tab);       This will tell me if $featured_tag is a post or page:                   get_post_type( $featured_tab )       But this does not work                   foreach ( $featarr as $featured_tab ) {             if (get_post_type( $featured_tab ) == 'page') {                 $featured_tab_type = 'page=';             } elseif (get_post_type( $featured_tab ) == 'post') {                 $featured_tab_type = 'p=';             }             query_posts($featured_tab_type . $featured_tab);                   while (have_posts()) : the_post();                         Echo 'stuff here';      The problem I am having is this...the $featured_tag variable represents an assigned page/post id that is displayed on a page. So I feed in a string of id's, i.e., 34,543,2432,355... etc then take each id as $featured_tab and query for title, featured page and excerpt. Then I display all the page/post id's in a three column table. This work perfect but only if I query for one or the other but not both as I do in the if statement if post use p= or if page use page=. When I use the if condition is get crazy results here if there are 9 ids, I get 50+ results...duplicates and only post no page are displayed.


options.php problem - data not saved

I've created a custom menu page with some fields. I want to store these settings to use elsewhere. The form with the fields should save and POST data using `action="options.php"` but every time I hit save on the form it sends me back to the settings page, and does not save the data. I'm registering the settings in my functions.php               function register_settings() {               register_setting('settings-group','phonenumber');             register_setting('settings-group','primaryemail');             register_setting('settings-group','secondemail');         }      This is the form action               <form method="post" action="options.php">      Here is the full code which is in functions.php http://pastebin.com/zVhSLZ9d


How can I make my .htaccess file writeable by wp-admin?

My ISP changed the hosting for my Wordpress blog and everything stopped working. There was a DNS issue but they resolved that, but then every page apart from the home page returned a 404 error. When I checked the permalinks page (`/wp-admin/options-permalinks.php`) in wp- admin I saw the following: > If your .htaccess file were writable, we could do this automatically, but it > isn’t so these are the mod_rewrite rules you should have in your .htaccess > file. Click in the field and press CTRL + a to select all. Adding what it listed (via my ISP's file manager) fixed the problem but got me wondering. What I'd like is for the `.htaccess` file be writeable for wp-admin. I know that the file should **not** be writable for everyone and I would keep the permissions as restrictive as possible to keep things secure, I'm just interested in making my life easier. However, I note the that the permissions on the file are:               rw-r--r--      So what permissions do I need to set to make the file writeable by wp-admin, but not by anyone and everyone? Or is it some other permissions on the server that need to be set? _I can manually make edits through the ISP's file manager interface so it's not as if I can't update the file at all. It's just that it could get to be a pain if I have to keep doing this._


How to make thumbnails of uploaded animated gifs NOT animated

I am having an issue where I want the thumbnails of my animated gifs to NOT be animated. I tried to talk to hostgator about helping with this issue and they simply said that I must find a solution through wordpress to make this happen. I run an adult site http://www.azngirls.com (please do not click if adult content is an issue for you) and as you can see, on the front page all the thumbnails of the animated gifs are all animated even after being resized into thumbnails and its creating a lot of lag for people that visit the site. This site shows an example of how an uploaded gif should be shown - http://ipinpro.ericulous.com/pin/category/architecture/ \- on the top right you can see a thumbnail of a GIF that is not animated, but when you click the image to view the original image, you can see that the animation appears. This is basically what I want happening for my site.


Checking if $_FILE isset for an array of file upload metaboxes

I have been struggling with this for almost 2 days with no avail. I have a custom post type of `PRODUCTS` that has a group of metaboxes for uploading PDF files in the `wp-admin`. I've created the metaboxes in the admin. Here's the code for my metaboxes:               //PDF upload Meta Boxes     $meta_box_pdf_uploads = array(         'id' => 'products-pdf-meta-boxes',         'title' => "PDFs",         'page' => 'product', //attach to products custom post         'context' => 'normal',         'priority' => 'default',         'fields' => array(             array(                 'name' => $prefix . 'pdf1',                 'desc' => 'Product PDF',                 'id' => $prefix . 'pdf1',                 'type' => 'text'             ),             array(                 'name' => $prefix . 'pdf2',                 'desc' => 'Product PDF',                 'id' => $prefix . 'pdf2',                 'type' => 'text'             )         )     );      For now there are only two pdf's to upload. Here is the code to show my metaboxes in the admin menu:               function products_pdf_uploads_show_meta() {         global $meta_box_pdf_uploads, $post, $prefix;              echo '
';         echo '
Upload your PDFs here
';         foreach ($meta_box_pdf_uploads['fields'] as $field) {             // get current post meta data             $meta = get_post_meta($post->ID, $field['id'], true);                  echo '
',                     '',                              '<input type="file" style="width: 700px;" name="', $field['id'], '" id="', $field['id'], '" />',                     '	',                  '
';         }              echo '
';          }      All of this works until I try to check if the file upload field has a value or not. Here is what I'm working with now as far as the code to save the meta (there's tons of debugging code so you're aware):                //Upload PDF files         foreach ($meta_box_pdf_uploads['fields'] as $pdf_field) {                  //Make sure field isn't emtpy             if(isset($_FILES[$pdf_field['name']]) {                 //var_dump($_FILES);                 print_r ($_FILES[$pdf_field['name']]);  //debugging                 $pdf_type = $_FILES[$pdf_field['name']['tmp_name']];  //debugging, can't get this to return any value                 wp_die('Passed! '. $pdf_type); //debugging                 //Setup File type allowed                      //Get the file type                       } else {                 //var_dump($_FILES);                 print_r ($_FILES[$pdf_field['name']]);                 wp_die('Nothing was passed: ' . $pdf_field['name']);  //debugging             }         }      Now even if I don't add a file to the upload field, my first condition is still met here:               if(isset($_FILES[$pdf_field['name']]) {      I know it's because it's returning an array of the $pdf_field. I've also tried check if the error was 0 using `$_FILES[$pdf_field['name']['error']` but I can't return any of the $_FILE array values. When specify a field to upload and I do a `print_r ($_FILES[$pdf_field['name']])` it returns:               Array ( [name] => 1testpdf.pdf [type] => application/pdf [tmp_name] => /tmp/phpF7HQnJ [error] => 0 [size] => 8278 )       Which is correct, but it also does this when I dont' specify a field, only all the arrays values are empty except for the ERROR which equal 4 (no file specified). I have been pulling my hair out over this. What is the best way to do this? I think if it was a single metabox and i could call it like `$FILE['name_of_file']['error']` it would work. Why is using a `foreach` messing this up? Thank you!


I need a Simple image uploader with a simple screen. WP default has too many options.

Hi guys I'm looking for a metabox type plugin that can upload ONE image into the post, that works with custom post types. I don't want to use the default WP uploader because it has too many options, like file url, image url, etc. It is too confusing for customers who are not familiar with WP. So I need something simple. A simple metabox. All the plugins I was able to find use the default WP media uploader which as I said has too many options. Anyone know of a plugin I can use for that? Free or paid. The closest one I found was Magic Fields but it doesn't support custom post types AND it uses a custom folder to store files. Thanks.


Why does WordPress require a ftp server to be running on the webserver to transfer plugins?

I had asked a related question on Super User: > A use case of a system "receiving" files over FTP would be, for example, the > way WordPress plugins are installed via 1-click where WordPress initiates a > file transfer to the local Linux box from the remote WordPress plugin > repository using ftp(s) More specifically this screen: ![WP asking for ftp info during plugin install](http://i.stack.imgur.com/nsEup.png) My initial understanding that WordPress would transfer the files from the WordPress plugin repository, like how a FTP client would do. But further discussions on chat have left me confused as to why would WordPress require the FTP details of the web server? What am I missing here?


apply_filters('the_content') - make it ignore shortcodes?

I am using `apply_filters('the_content)` so I can see properly formatted content inside my wp editor in the backend. However, this also renders the shortcode that's in the content. I want it to ignore the shortcode and apply filtering to the rest of the content, basically the same thing as when making posts. If you view post content in the backend, you will see the shortcode, but if you view it inside a page on your website, you will see the rendered shortcode (its result). Is this possible?


CSV file generation failing

I'm using a plugin for a client (that i modified to some degree) that creates and maintains a database of organization members (using a new wp table to do so). There is a nice feature that does a csv import and insert, that works great. There is also a feature to download the contents of this table as a csv, that works fine on my local system, but fails when running from the server. I'm, frankly, at a loss as to why. The php file that contains the logic is simply linked to. The file:               <?php         //include some files         include('../../../wp-blog-header.php');              //DIAG: phpinfo();                 function fputcsv4($fh, $arr) {             $csv = "";             while (list($key, $val) = each($arr)) {                 $val = str_replace('"', '""', $val);                 $csv .= '"'.$val.'",';             }             $csv = substr($csv, 0, -1);             $csv .= "\n";             if (!@fwrite($fh, $csv))                  return FALSE;         }              //get member info and column data         $table_name = $wpdb->prefix . "member_db";         $year = date ('Y');         $members = $wpdb->get_results("SELECT * FROM ".$table_name, ARRAY_A);         $columns = $wpdb->get_results("SHOW COLUMNS FROM ".$table_name, ARRAY_A);         //DIAG: echo 'SQL: '.$sql.', RESULT: '.$result.'
';              //output headers         header("Content-type: application/octet-stream");         header("Content-Disposition: attachment; filename=\"members.csv\"");              //open output stream         $output = fopen("php://output",'w');               //output column headings         $data[0] = "ID";         $i = 1;         foreach ($columns as $column){             //DIAG: echo '
'; print_r($column); echo '
';             $field_name = '';             $words = explode("_", $column['Field']);             foreach ($words as $word) $field_name .= $word.' ';             if ( $column['Field'] != 'id' && $column['Field'] != 'date_updated' ) {                 $data[$i] = ucwords($field_name);                 $i++;             }         }         $data[$i] = "Date Updated";         fputcsv4($output, $data);              //output data         foreach ($members as $member){             //DIAG: echo '
'; print_r($member); echo '
';             $data[0] = $member['id'];             $i = 1;             foreach ($columns as $column){                 //DIAG: echo '
'; print_r($column); echo '
';                 if ( $column['Field'] != 'id' && $column['Field'] != 'date_updated' ) {                     $data[$i] = $member[$column['Field']];                     $i++;                 }             }             $data[$i] = $member['date_updated'];             //echo '
'; print_r($data); echo '
';             fputcsv4($output, $data);          }         fclose($output);     ?>      So, we have a routine wherein a query is run, `$output` is established with `fopen`, added to via foreach statements, and finally `fclose`d. The error that I'm getting (from the server) is               Error 6 (net::ERR_FILE_NOT_FOUND): The file or directory could not be found.      But it clearly is getting found, its just failing. If I enable `phpinfo()` (PHP Version 5.2.17) at the top of the file, I definitely get a response - notably `Cannot modify header information` (because `phpinfo()` has already generated a header). All the expected data does get printed to the page, however, so that much, at least is working correctly. I am guessing there is something preventing the fopen, fclose functions from working properly, but I don't have enough experience with this to identify exactly what the problem is. I'll note again that this works exactly as expected in my test environment (localhost/XAMPP, netbeans). Any thoughts would be most appreciated.


Print Post Parent Title

I'm trying to print the posts' parent title on the page as well as the post title for that page. This is how my content-page.php template currently renders the page title.               the_title( '
', '
' );      I realise I can retrieve the posts' parent title by doing this:               $parent_title = get_the_title($post->post_parent);     echo $parent_title;      Is there anyway I can slip that code in between the_title parameters, so my parent title and my post title are both wrapped by that `h1` element? Any help is appreciated. Thanks in advance!


How do I move a subdirectory blog site from one wordpress multisite to another wordpress multisite

I have one WordPress multisite instance setup with subdirectories. I have a production environment of a WordPress Multisite setup exactly the same. I need to export only one site from the test instance (Blog Posts, Users, and uploads) and then import into the production instance. I cannot overwrite the main site in the production environment. I just need to copy over the subdirectory site. How would I do this? Would I use the WordPress Importer plugin? How do I export only blog post data from the one test blog site's database and then import that data into the production database? Regards David


How can I show wordpress posts based on author?

I'm working on a site that will have 6 authors. Each author will have their own page that will only show their posts. what is the best way to handle this? I would like to do by creating a page or using the url such as /?a=username. However, if there is a more standard or a better way feel free to suggest that instead. Thanks!


how to add new .webm mime types

i tried google but no success yet. I am trying to upload .webm and .ogg video types in wordpress ( for html5 video ofcourse) I am getting error like               Baki fula.webm” has failed to upload due to an error     Sorry, this file type is not permitted for security reasons.      tried plugins like   1. PJW Mime Config   2. AP Extended Mime Types but doesnot seem to work either. I am working locally with easyphp in windows 7 in wordpress 3.4.1. Can anyone plase help me in solving this issue. Any help is appreciated


Is it possible to disable certain user roles from creating tags?

As a site admin, I'd like to have control over things. I'd like to prevent my contributors and authors ( who generate content for me ) from creating new tags. I don't want that tag taxonomy to turn into a zoo! Especially when you know that wordpress creates separate terms for apple and Apple! I give them a while list ( of 1000 tags that I want them to cover ) and that's it. They cannot come up with the 1001st. How do I achieve that so that my authors just pick from what I give them?


Pagination for query_posts();

I know there have been many question like this and I've read them, but I still cant get it working... I have this query:               query_posts(array('cat'=>3,'posts_per_page'=>5));      And I simply display the content below in `while (have_posts()) : the_post();` loop How can I add pagination to this? I'm trying with adding `posts_nav_link();` ( I don't know is it the right function to call what I want) and links displayed take me to http://mysite.com/page/2. Since its my index page its ok to not add category name in link (its news page) but after clicking on the link, when I'm on the page/2/ news simply doesn't change. I still see the first page of my news without change... I think I need to add attribute of 'paged' to my query, but how and where? I've tried `'paged'=>'paged'` in array but still nothing


Where is the query in wp-login.php

I am making a login form in WordPress and i want to have a validation on it, so i tried to look at the wp-login.php to see how they validate things. But i did not find what i am looking for. I would like to know how they validate things or what input do they need to validate things. I tried to search the WordPress forums all i can find is plugin, plugin and more plugin. I don't want a plugin. I want to hard code it. So please help me. I want to know where you can find the part that searches for the user's username and password. Or if not, know what is needed for a successful login. example username or password or others. by the way here is the wp-login.php. Thanks


Help me out with this Undefined index ?

I'm working on flickr Wp-widget. Here is code to fetch flickr pics.               class imperia_flickr extends WP_Widget {              function imperia_flickr() {             $widget_ops = array('description' => 'This Flickr widget populates photos from a Flickr ID.' );                  parent::WP_Widget(false, __('imperia - Flickr', 'imperiathemes'),$widget_ops);               }              function widget($args, $instance) {               extract( $args );             $id = $instance['id'];             $number = $instance['number'];                  echo $before_widget;             echo $before_title; ?>

             <?php _e('Photostream'); ?>                 <?php echo $after_title; ?>

            <?php                        echo $after_widget;        }             function update($new_instance, $old_instance) {                            return $new_instance;        }             function form($instance) {                 ******  $id = esc_attr($instance['id']);         ******  $number = esc_attr($instance['number']);             ?>
                 <label for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Flickr ID (idGettr):','imperiathemes'); ?>                 <input type="text" name="<?php echo $this->get_field_name('id'); ?>" value="<?php echo $id; ?>" class="widefat" id="<?php echo $this->get_field_id('id'); ?>" />

                 <label for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number:','imperiathemes'); ?>                 <select name="<?php echo $this->get_field_name('number'); ?>" class="widefat" id="<?php echo $this->get_field_id('number'); ?>">                     <?php for ( $i = 1; $i <= 12; $i += 1) { ?>                     <option value="<?php echo $i; ?>" <?php if($number == $i){ echo "selected='selected'";} ?>><?php echo $i; ?></option>                     <?php } ?>                 </select>
             <?php         }     }           register_widget('imperia_flickr');      This widget works fine but gives following error               -- Debug: Undefined index: id on line 54 of /wp-content/themes/imperia/includes/widgets/widget-imperia-flickr.php     -- Debug: Undefined index: number on line 55 of /wp-content/themes/imperia/includes/widgets/widget-imperia-flickr.php      I have marked these lines with ****** above. Where I'm going wrong ? What needs to be fixed ? Thanks


Can I query another data table on a multisite with the single.php template?

**Here's a quote froma thread on this forum showing exactly what I'm trying to do:** blog 1 gets = wp_post table blog 2 gets = wp_2_post table > Small multisite setup, two very different sites, both need to access an > event custom post type. I don't want to duplicate posts (there are some > plugins that "broadcast" a post to the network). > > switch_to_blog(1) will get me part way there, where blog 1 is the "master" > blog that contains the event data, as far as archive-style pages that list > all the events. But my concern is that the URL/permalink of the event, when > viewed from blog 2 will point to blog 1, and following that permalink will > then take the user to the other blog, confusing the user. > > Is there a solution (possibly using rewrite) that would allow an event post > at //blog1/events/event1 to appear as //blog2/events/event1 when viewed from > blog 2?" **Here's the answer I'm trying to work with:** > Register the CPT on blog 2 with 'show_ui' => FALSE. Hook on blog 1 into > save_post and copy the data to blog 2. > > Pro: You can search in those posts. Correct templates will be used > automatically. Con: Duplicated data are always a little bit … dirty. **So far: I created a custom query using the $wpdb class that queries posts from blog 1 onto blog 2.** The problem I'm having is when I click on the post I get a 404 for every post except the default post which is on both blog 1 and 2. I think because wordpress looks for the data of that post in the wp_2_post table instead of the wp_post in the query in the single.php in blog 2's template. Would it be possible to change the single.php query in the blog 2 theme to point to the wp_post table of blog 1 and trick wordpress into giving me the post from blog 1? ***note** I don't want to duplicate data for multiple reasons this is why I ask instead of using save_post. Thank you for any answer I receive, Corbs


Add email to wp_users but leave open for registration

Is there a way to enter an email into the wp_users datbase programatically but leave that user profile open for overwriting in case the user goes through a manually registration process?


Using custom page templates with plugin

I'm developing a plugin. This plugin creating a new post type and displaying these posts in a custom template. For example it's a event calendar plugin. This plugin creating a new post type 'event '. Users adding new events from wp - admin, like normal blog posts. And users creating a new page with 'Event Calendar ' page template. But for enabling Event Calendar page template, users have to copy eventcalendar.php from plugin's dir to their template's dir. Last step (copying file) is really hard for some users. Is it possible to call custom page template from plugin dir?


Using the same shortcode to show any table from the database

I have a little question for you. I want to create a shortcode that makes a table with data that I have stored in a database. But i want to send the shortcode an attribute, to specify which table (database) I'd like to show.               add_shortcode("list", "list");          function list($tbl) {         extract(shortcode_atts(array('item' => '')), $tbl);         if($item!="") {             $mydb= new wpdb('root','root','mydb','localhost');             $rows = $mydb->get_results("select * from ".$item);             echo "
";             foreach ($rows as $obj) {                 echo "
";                 //Here I want to put the content of the row                 echo "
";             }             echo "
";         } else {             echo "
Table does not exist
";         }     }      The shortcode would be something like this:               [list item="table1"]      How can I use the same shortcode to show any table of a database? How can I manage each row to show all the fields it has got? Because i have different tables with different number of columns and different column names, and i want to display each cell in a in the table. Thanks!


my basic php code producing unexpected results

I am writing a code snippet to display attachments to a post but for each user, he should only be able to see his own attachments and not those of other users                   $current_user=wp_get_current_user();              //display all post attachments. see http://codex.wordpress.org/Template_Tags/get_posts#Show_attachments_for_the_current_post         $args = array(         'post_type' => 'attachment',         'numberposts' => null,         'post_status' => null,         'post_parent' => $post->ID         );     echo "Uploads By me";      echo "
";         $attachments = get_posts($args);         if ($attachments) {                  foreach ($attachments as $attachment) {                 echo "
";                 the_attachment_link($attachment->ID, false);                 echo " by author ".$attachment->post_author ;//debug info                 echo " and Current user is ".$current_user->ID ;//debug info                 if($current_user->ID==$attachment->ID) echo " Matched!! ";//debug info                 echo "
";             }         }     echo "
";     //end attacmnets      I placed the code in my custom page template and as you can see in picture below, the statement `if($current_user->ID==$attachment->ID) echo " Matched!! ";` failed and this is what i wanted to depend on to selectively show attachments.Please help out![enter image description here](http://i.stack.imgur.com/ygDXa.jpg)


Cannot Modify Header Info Error on updating User Profile

I keep on getting this error on updating a user:               PHP Warning: Cannot modify header information - headers already sent by (output started at /wp-admin/includes/update.php:134) in /wp-includes/pluggable.php on line 866, referer: /wp-admin/user-edit.php?user_id=4&wp_http_referer=%2Fwp-admin%2Fusers.php      Any ideas why? My header.php does not seem to start with an empty space, but just with `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">` And, besides, this seems to be more backend related... **Solution** Somehow `pluggable.php` or `update.php` or one of the user edit files got corrupted. After the upgrade to 3.3.2 all good again. All users can be updated again within getting stuck in error reports.


Redirect all multisite uploads to single folder

I have a network of multisite blogs which much operate separately for reporting and small functional reasons, but which share a lot of the same data and imagery. I am looking for a way to redirect all requests for files to a single folder in my domain: instead of creating multiple uploads and thumbnails for each site, with a of redundant images and potential URL images when syncing content between sites. I was thinking of using something like this, but it is not working for me. `RedirectMatch 301 /wp-content/uploads/(sites/[0-9]+/)(.*)$ /wp- content/uploads/$2` My other option is this: Shared upload folder in wordpress multisite However I have concerns about making the change to a live environment. Has anyone else successfuly transitioned to a combined uploads folder in a live environment?


I've just received this error/warning after trying to upload an image, any ideas what it means and what I can do to fix it? Warning: Cannot modify header information - headers already sent by (output started at /home/achenn/public_html/wp- content/themes/whskytngfxtrt/functions.php:14) in /home/achenn/public_html/wp- includes/pluggable.php on line 866 Here's my site, live. functions.php:               <?php          // sidebar functions          if(function_exists('register_sidebar'))     {         register_sidebar();     }               ?>               <?php          // portfolio functions              add_action('init', 'create_portfolio');         function create_portfolio() {             $portfolio_args = array(                 'label' => __('Portfolio'),                 'singular_label' => __('Portfolio'),                 'public' => true,                 'show_ui' => true,                 'capability_type' => 'post',                 'hierarchical' => false,                 'rewrite' => true,                 'supports' => array('title', 'editor', 'thumbnail')             );             register_post_type('portfolio',$portfolio_args);         }     ?>          <?php          // custom input- portfolio backend              add_action("admin_init", "add_portfolio");         add_action('save_post', 'update_website_url');         function add_portfolio(){             add_meta_box("portfolio_details", "Portfolio Options", "portfolio_options", "portfolio", "normal", "low");         }         function portfolio_options(){             global $post;             $custom = get_post_custom($post->ID);             $website_url = $custom["website_url"][0];     ?>
             Website URL:<input name="website_url" value="<?php echo $website_url; ?>" />
        <?php         }         function update_website_url(){             global $post;             update_post_meta($post->ID, "website_url", $_POST["website_url"]);         }     ?>          <?php           // detail columns- portfolio backend          add_filter("manage_edit-portfolio_columns", "portfolio_edit_columns");     add_action("manage_posts_custom_column",  "portfolio_columns_display");          function portfolio_edit_columns($portfolio_columns){         $portfolio_columns = array(             "cb" => "<input type=\"checkbox\" />",             "title" => "Project Title",             "description" => "Description",         );         return $portfolio_columns;     }          function portfolio_columns_display($portfolio_columns){         switch ($portfolio_columns)         {             case "description":                 the_excerpt();                 break;                       }     }     ?>      portfolio.php-               <?php     /*     Template Name: Portfolio     */     ?>     <?php get_header(); ?>
         <?php              $loop = new WP_Query(array('post_type' => 'portfolio', 'posts_per_page' => 10));          ?>         <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>         <?php                $custom = get_post_custom($post->ID);             $screenshot_url = $custom["screenshot_url"][0];             $website_url = $custom["website_url"][0];         ?>

<?php the_title(); ?>
             <a href="<?=$website_url?>"><?php the_post_thumbnail(); ?>              <?php the_content(); ?>
             <?php endwhile; ?>
     <?php get_footer(); ?>


Display info from custom fields in all images' HTML

Okay, I've been working on this all day and can't find the solution anywhere. I've created a custom field within the image upload screen (info first found here). The field stores the name of a photographer to give him/her credit. Everything's fine there. What I can't figure out is how to get this information into every image's title data across the site. I want my field for Image Credit to append itself to all image titles across the site, so each image title would read something like "My Title (by Photographer Name)". What I have figured out is close, but not quite good enough. I can get the information from my custom field by using "get_children()" of type "image" on the existing post, and then calling "get_post_meta()" for my custom field name on each result. I can then use this information to add it to the post featured images by altering the title properties within "get_the_post_thumbnail()" when I call it. What I need is to be able to do something like this site-wide on all images, not just the featured ones. I feel like there should be somewhere in the Core that defines how images are displayed. Perhaps I could overwrite this with a same-name file in my own theme, or by declaring a function to override the default behavior. Maybe there's a filter or a hook I could use. However, I can't find any documentation to help me, and I'm about out of ideas. Any and all thoughts would be much appreciated, even if they're just partial ideas. _Note: I tried to link all my functions for easy reference, but spam- prevention wouldn't let me post that many links so I'll list them here instead:_   * codex.wordpress.org/Function_Reference/get_children   * codex.wordpress.org/Function_Reference/get_post_meta   * codex.wordpress.org/Function_Reference/get_the_post_thumbnail


Different permalink for CPT and regular Posts/Pages but why?

_Permalink structure in Back- end:`http://domain.com/%year%/%category%/%postname%`_ For "regular" Posts/Pages all is okay but as soon a CPT is shown `%year%` is gone?   Url shown for Posts/Pages looks some like: `http://domain.com/2014/category01/regular-post001`   Url shown for CPT looks some like: `http://domain.com/category01/cpt-post002` Most weird (to me) is, when I give in (for that CPT) `http://domain.com/2014/category01/cpt-post002` it shows the CPT BUT then leaves out/redirects to the url without 2014(year). What am I missing/doing wrong?


Adding CSS to admin TinyMCE editor for custom button

I have created a plugin that adds a new button to the TinyMCE editor in the admin edit pages/posts area. I am trying to apply a font icon to it as per the the other buttons in Wordpress 3.8. I have created a CSS file will the following:               .mce_mybutton::before {         content: '\f459';     }      All I need to do is load the CSS when the editor is loaded... Seemed easy. I tried `add_editor_style()` but apparently it is only for theme development not plugins I found the `mce_css` filter but it didn't work. I think it is for only applying CSS to the content in the editor... Not the buttons. I read the source code for the `edit-from-advanced.php` and `class-wp- editor.php` the files responsible for generating the editor on the admin edit pages/posts. There is a setting within the `_WP_Editors` object that looked promising:               'editor_css' => '', // intended for extra styles for both visual and Text editors buttons, needs to include the <style> tags, can use "scoped".      However I couldn't find a way to hook into it. Any help would be appreciated. Thanks!


Is there a plugin for uploading files such as PDF files?

I want to put my lecturers for my students as PDF files in my wordpress, is it possible?


Will a post object's "post_name" always be equal to the "path" on non-hierarchal custom post types? (using get_page_by_path() function)

**The Short:** When feeding the _path_ into get_page_by_path() something like this:               $post_object = get_page_by_path( 'path_of_post', OBJECT, 'my_custom_post_type' )      ... Assuming the custom post type is non-hierarchal, is there any scenario where the _path_ entered into the function would not match a post object's slug? (What I mean by slug is $post_object->post_name) ============================= **The Long:** I'm using custom post types in the background for a couple of plugins I'm creating. The end-user has no access to the actual edit post screens for these custom post types. All of the admin pages the end-user actually sees are custom built. For an example of two things I have going on: I have a plugin that creates slideshows, where each slideshow is a custom post type "slider". I have a layout builder plugin where each custom layout is a custom post type "layout". In this example, the two meet when within a layout, the user could assign a slideshow to the layout. Currently I have this setup where in the post meta for a _layout_ the user can save the post ID of a _slider_. **The problem with using post ID's:** What I would like to do in the end is provide users sample XML files from WordPress's Export tool. So, they could then just import these posts of different post types along with all post meta info, and everything will all running together without me having to build any kind of mod to WordPress's Import/Export tool to accomodate this. But since when you import posts from an Export file, WordPress's built-in tool obviously has to assign new ID's to all of the posts, so if (for example) a _layout_ had a _slider_ assigned to it by the post ID, when the two posts were imported, the ID of the _slider_ would no longer match to what the _layout_ has. **My new plan:** So, I'm trying to figure out a different way to assign everything to each other, so everything will be compatible with WordPress's import/export and I can efficiently grab assigned posts. The best idea I've had is to assign (for example) a _slider_ to a _layout_ by referencing the slider post's slug `$post_object->post_name`. This way, on the front-end of the site, I can use WordPress `get_page_by_path();` function to grab the post's object. So the reason for my question (see top) is just to make sure there isn't something I'm overlooking with using this function and referencing all of these things by their slugs? Also, maybe there's a better way to reference all of my custom post type posts other than this method I've come up with?


Unsual behaviour of navigation Menus

I deleted all the previous menus which where there in my site. Then I created a new menu called Home and added few pages to it So my menu looks like this![enter image description here](http://i.stack.imgur.com/q4TvW.png) **Problem :** When I click on About us and other links, then that links are not working. Why is this so?? Is it because I deleted all my previous menu? If so then how I can get my deleted menus? Update: Error in firebug![enter image description here](http://i.stack.imgur.com/GYaOX.png)


Modify excerpt link

I read the thread about adding a filter on the last line of the code, but am not sure that will work here. http://www.ahy4life.com/resources.php In the middle right column in the Promotions section, the 'Continue reading ->' link is linked to the wrong page. How can I correct this?
       <?php       $featuredPosts = new WP_Query();       $featuredPosts->query('showposts=5&cat=8');       while ($featuredPosts->have_posts()) : $featuredPosts->the_post(); ?>
<?php the_title(); ?>

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

       TIA


How to define the template priority between built-in categories and custom taxonomies?

Let's say I want to create a custom template for my taxonomy `customtax`. This is pretty simple, I just create a `taxonomy-customtax.php` in my theme directory. Now, I'ld like to query a built-in category with one term of my custom taxonomy, like so:               www.example.com/?customtax=x&category_name=y      The problem here is that Wordpress always uses the `archive.php` (or `category.php` I think) instead of my `taxonomy-customtax.php` template. Is there a way to invert this behaviour?


why php notice is not getting ignored?

I have been adding at the top of my wp-config.php the following to switch off php logger but won't take any effect on it. Is there something else what I should do?               error_reporting(0);     @ini_set(‘display_errors’, 0);


Clean/filter HTML inserted to post content by XML RPC

An external service that uses XML RPC to publish some posts on my site adds some unwanted CSS styles and HTML to the post content. I would like to clean it up using a HTML cleaner that I've built based on DOMDocument and DOMXPath. My only question is how can I access the post_content before it is actually saved to the databse so I can run my cleaner on it? Perhaps there is a filter/action that I can use?


How to read individual user's directory and display content to that specific user?

I am creating a photo plugin for users to view their photos. The plugin works in a way that when I add a new user, a directory is created in the uploads folder inside `wp-content` with the user's username as the name of the folder. This is where that user's images will be stored. Here is the code:               function create_photo_folder() {              $upload = wp_upload_dir();         $upload_dir = $upload['basedir'];         $upload_dir = $upload_dir . '/USER_PHOTOS';         if (! is_dir($upload_dir)) {            mkdir( $upload_dir, 0700 );         }          $blogusers = get_users('blog_id=1&orderby=nicename');         foreach ($blogusers as $user) {             wp_mkdir_p($upload_dir . '/USER_PHOTOS'.$user->user_login);              }     }          register_activation_hook( __FILE__, 'create_photo_folder' );     add_action('user_register','create_photo_folder');      The above code works fine in creating the folders. The problem I am facing is that I want to be able to fetch the contents in the folder of each user and display it to them when they log in. I have already created a menu page called YOUR PHOTOS for all users. Now I would like to be able to retrieve the content in each folder for each user and display it to them there.


wp_list_pages: only show subpages on the parent page?

I'm using `wp_list_pages('title_li=')` on my site. Some of my pages do have subpages, however I don't want to list them unitl I'm on an actual parent page that has subpages. So imagine my front-page:               — About Us     — Gallery     — Kitchen     — Disclaimer      When clicking on Gallery (and Gallery has two subpages) I want them to be listed as well.               — About Us     — Gallery       — Subpage 1       — Subpage 2     — Kitchen     — Disclaimer      How am I going to do this with the `wp_list_pages()` function?


Odd /wp-admin/admin-ajax.php entries showing in Wassup

I have an odd issue going on that I'm not sure how to troubleshoot. Ever since I installed a popular post plugin (Wordpress Popular Posts) I have been seeing a strange entry in Wassup real time analytics to a page called /wp-admin/admin-ajax.php over and over again. Before I installed the plugin it would show the page that was being hit but it looks like for whatever reason this page is getting hit instead and I am unable to see what page the user is actually hitting. Here is an example of what I'm talking about: ![enter image description here](http://i.stack.imgur.com/4b4dG.jpg) EDIT: **How do I get the correct page/post to be displayed instead of this?** I have looked throught the settings in Wassup and as far as I can tell there is no way to correct this through the plugin. Is there a better plugin to use for tracking top posts that will alleviate this issue? I have tried a few other plugins but have had no luck correcting the problem. I just want something that I know will work. Thanks,


quotes problem in very simple sql

I just simply want to execute a SQL sentence inside of a post (i am using EXEC-PHP widget for that). The problem are the quotes when i want to do something like $my_name='hello' "select * from Table where name='$my_name'"; getting wrong quotes.... select * from Table where name=‘hello‘ i have tried streepslashes_deep, addslashes, stripslashes... I think it shouldnt be so difficult... maybe its not my best day any help? thanks!


Using WP_Query with multiple loops on one page in search.php

I'm trying to set up a search page that first shows a Loop with all posts with a Custom Field meta_key of 'seek_premium' where it's meta_value is 'yes', and then a second Loop where the meta_value (same meta_key) is empty. I've got it working for the most part, but the way I'm doing it seems to break the default search functionality, in that if I do a search, no matter if a post contains the search query or not, I end up seeing all posts marked as "seek_premium" in the first loop, and all posts where "seek_premium" is empty in the second. Here's my code:               <?php if ( have_posts() ) : ?>
My Heading
         <?php             $premium_query = new WP_Query( array( 'meta_key' => 'seek_premium', 'meta_value' => 'yes' ) );             while ( $premium_query->have_posts() ) : $premium_query->the_post();                  $seekpremium = get_post_meta( $post->ID, 'seek_premium', true );         ?>                 SHOW PREMIUM POSTS                                                                                <?php endwhile; ?>          <?php             $free_query = new WP_Query( 'post_per_page=50' );             while ( $free_query->have_posts() ) : $free_query->the_post();                 $seekpremium = get_post_meta( $post->ID, 'seek_premium', true );                 if ( !empty( $seekpremium ) )                     continue;         ?>                 SHOW FREE POSTS                                                                  <?php endwhile; ?>      <?php else : ?>         <?php include ( TEMPLATEPATH . "/unknown.php" ); ?>     <?php endif; ?>      Anyone have any ideas? I'd seen something about using $is_search as a parameter, but either am not implementing it correctly or something else with my query is wrong...


Is it possible to put a function somewhere other than the functions.php file? I.e directly into a template? I have the following that needs to be called before some code and to make sure this happens I want to place it above everything else in the template:               function set_region_cookie()     {         if(isset($_POST['region']))         {             // Set Cookie             setcookie('region', $_POST['region'], time()+1209600);             // Reload the current page so that the cookie is sent with the request             header('Region: '.$_SERVER['REQUEST_URI']);         }     }     add_action('init', 'set_region_cookie');


Why is unfiltered html allowed in custom fields for author / contributor roles?

I'm creating a WordPress theme which has a custom textarea metabox for inserting embed codes (soundcloud, bandcamp etc). I feel like I should be adding in some security to stop non-admin/editor users to be able to save potenitally harmful data, but it seem WordPress as standard allows html in custom fields for these lower-capability users. Is there a reason why html is allowed in standard custom fields, yet not in the main edit area, for users without unfiltered_html capability?


Correct syntax for database inserts from plugin?

I'm testing a script to create a database insert. Is this the correct syntax for the insert or do I need to obtain a reference to global $wpdb and use that?               <?php     /*     Plugin Name: Test Database Insert     */          function test_db_insert()     {     INSERT wp_terms(term_id, 'name', slug) VALUES (1, 'test', 'test');     INSERT wp_term_taxonomy(term_taxonomy_id, term_id, taxonomy, parent) VALUES (1, 1, 'category', 0);     INSERT wp_term_relationships(object_id, term_taxonomy_id, term_order) VALUES (1, 1, 0);     }          register_activation_hook(__FILE__, 'test_db_insert');


walker_category doesn't walk?

I'm trying to use the walker_category class in order to modify the HTML output of the `wp_list_categories` for several custom taxonomies, but the walker doesn't seem to 'work the tree'. Here is my current code:               class Custom_Taxonomy_Walker extends Walker_Category {          function start_lvl( &$output, $depth = 0, $args = array() ) {         $class = '"level-' . $depth . '"';         $output .= sprintf( "\n
", $class );     }     function end_lvl( &$output, $depth = 0, $args = array() ) {         $output .= "
\n";     }     function start_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0 ) {         if ($depth <= 1) {             $class = "parent";         }         else {             $class = "enfant";         }         $output .= sprintf( '
', $class );     }     function end_el( &$output, $depth = 0, $args = array() ) {         $output .= "
\n";     }      } and the call to `wp_list_categories`:                           foreach ($post_types as $post_type=>$post_tax) {                     $args = array(                         'show_count'    => 1,                         'hierarchical'  => 1,                         'pad_counts'    => 1,                         'taxonomy'      => $post_tax,                         'walker'        => new Custom_Taxonomy_Walker);                     wp_list_categories ($args);                 }      Could someone provide a hint in the right direction? Thanks a lot for helping.


How to relate to 2 taxonomy with category

I really need your help my question is this, is it possible to relate to taxonomies? This is My Problem sample: My post type is "show" taxonomies and the categories location (Taxonomy)   Categories   * california    * alaska    * new york  genre (Taxonomy) Categories   * comedy   * broadway   * romance note: each location has 3 genres to choose for example: california (comedy, broadway, romance) alaska (comedy, broadway, romance) newyork (comedy, broadway, romance) my question is how will make a query like: displaying all "comedy" shows on "california" location or something like displaying all "romance" shows on "alaska" location if u can send me codes for this ill be gladly appreciate it, i will try to analyze the stuff again thanks alot


MailChimp integration that allows users to select from multiple lists

I'm integrating Mailchimp signup into a WP install and I have 2 questions.   1. What is the best way or best plugin to integrate mailchimp signup?   2. Is it possible to allow the user to select from multiple lists to be subscribed to. I realize the latter is more closely related to MailChimp but I'm hoping that someone has an answer for that as well.


How to apply action the_post to the post that is only being mainly displayed

I'm trying to write an action that will modify some WooCommerce product on its display. This is my simple code               function do_some_modifications($post)     {         if (is_singular('product')) {             // do some action         }         return $post;     }     add_action('the_post', 'do_some_modifications');      But the page contains two related products and "the_post" is called for them as well. How can I avoid running that code for additional products displayed on the main product page? Thank you!


Add a <!--more--> tag to a custom post type

I'm building a portfolio site for a friend and he's got three seperate photo packages and may want to add more in the future, so I've created a custom post type called Packages so that he can add as many as he likes and they'd all appear on one page. I've created a single-packages.php template so that each package would link to a sinple.php page to show the full content, but when I add the 'more' tag within the editor it doesn't split the content and the packages page spews out everything rather than just showing the content before the 'more' tag. Any help on this much appreciated. note - I'm not a PHP expert and so won't understand complex coding suggestions


Exclude function from homepage only?

There is a function in a theme that I am using that does some pagination stuff. I do NOT want that function to show up on my home page (only), so I'm trying to set up an if/else statement but can't for the life of me can't get it to work right. Using the following code, the function shows up not only on the homepage but also on the category pages. I am using this code in my index.php file and my site is setup to show posts from a custom post type.               <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
My Loop Stuff Here
     <?php endwhile; ?>          <?php if (!( is_home() || is_front_page() )) : function_to_NOT_show_on_homepage(); endif; ?>          <?php else: ?>         [else stuffs]     <?php endif; ?>          <?php wp_reset_query(); ?>


Wordpress upload file action hook

I have a custom post type called "Magazine" shown in the admin interface. Everytime a user **uploads** a **file** in the wp-admin to my custom post type "Magazine", I want to fire a hook because I have to process the file. Is there any **action hook** I can use in this case? Hope someone can help me.


Trigger Autosave or disable unsaved changes dialog

As the title says, I want to trigger the autosave function of wordpress manually or just disable the "unsaved changes" dialog. The reason for this: I'm developing a plugin which reloads the post edit page after doing some stuff and it's just annoying that the "unsaved changes" popup always pops up before reloading.


permalink overwriting after save post

I'm developing a plugin to sell tickets for live courses. Using a shortcode [ticketform] I show a form that takes customer data and if everything is ok --> go to paypal --> thank you page. Within this (shortcode) form there is a dynamic select that shows only courses I checked in a metabox for the page. This metabox shows a list of checkboxes, one for each live course. Live courses are posts of a custom post type registeres as -> _eventilive_ The problem: I have a page named _"Evento dal vivo"_ whose permalink is _domain.com/evento- dal-vivo_. When I check a course in this page and save, WordPress change the permalink of the page, and that's wrong. I thought the issue is related to rewrite params used when the CPT is registered. At the moment, all my attempts gone bad. Ideas?


How can I call plugin function from a custom template?

I've just developed a calendar plugin.   To display a calendar in a template, I call `do_shortcode(args...);`. This works fine. But how can I call a function from my plugin that will return data? I don't want to use `include_once` \- I really just want to call a function E.g.               $events = calendar->getEvents(args...)


How can I replace the search results displayed by Wordpress?

I'm working on a plug-in which will override the search results returned by Wordpress, with results from a custom XML feed. However, I'm not looking to do this on a separate page, but to replace the results Wordpress would normally display on the blogs search page with the results from my XML feed. I have been unable to find a filter or hook which would allow me to intercept or override the results wordpress returns, nor can I find one which allows me to override what is displayed on the page. My first thought was to look for something similar to the_content, but I'm unable to locate anything similar to that for use in this situation. The plug-in is going to be used by sales staff, so the plug-in needs to work in such a way that it requires as little work and technical knowledge as possible on the part of installer. My reasoning for wanting to override the results instead of inserting a new widget is that I want the plug-in to use the same search form the theme uses by default. Is this even possible? If so, how would I go about doing it?


How to split test a menu item

I have four links in my main navigation menu, which is displayed on every page of my site. `Link 1 | Link 2 | Link 3 | Link 4` I have a form that once completed is a goal/conversion and redirects to a success page. I'd like to split test a different menu where one of the links goes to a different page. Variant A: `Link 1 | Link 2 | Link 3A | Link 4` Variant B: `Link 1 | Link 2 | Link 3B | Link 4` How can I test which link (3A or 3B) leads to more form completions?


Create action running on trashed_post hook to modify post_meta value

I have a custom post type that always do math operation to its post_meta and other custom post type post_meta. For example:   * post-type 1 = **cpt_product_order**   * post-type 1 post_meta = **cpt_pm_product_order**   * post-type 2 = **cpt_product**   * post-type 2 post_meta = **cpt_pm_product_stock** There's a cpt_product with cpt_pm_product_stock = 100, frontend operation enable specific user made order by inserting new cpt_product with post_meta cpt_product_order of 10 will substract cpt_pm_product_stock to 90 100 **cpt_pm_product_stock** \- 10 **cpt_product_order** = 90 **cpt_pm_product_stock** cancelling order will delete/trash the cpt_product and cpt_product_order, and cpt_pm_product_stock should back to 100. Which action hook should used for this operation? Is it trashed_post? I didn't find any answer on codex, http://codex.wordpress.org/Plugin_API/Action_Reference/trashed_post is empty Thanks in advance for an answer. ;)


WP Custom Comment Callback Not Responding

I have a client site that has requested a custom comment format for posts of a specific category. In my loop template, I have this:

               <?php wp_list_comments( 'type=comment&callback=gallery_comment'); ?>

      And in my functions.php file, I have this:               <?php function gallery_comment($comment, $args, $depth) {        $GLOBALS['comment'] = $comment; ?>        <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">          <div id="comment-<?php comment_ID(); ?>">

<?php comment_text() ?>: <?php comment_text() ?>

<a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ) ?>"> –              <?php get_comment_date() ?> at <?php get_comment_time() ?><?php edit_comment_link(__('(Edit)'),'  ','') ?>

     <?php }?>      It's not returning any comments, but for the life of me, I can't figure out why. I followed the instructions in the WP codex to the letter. Is there something that I have overlooked? Thanks for any help! ty


Is it mandatory to have a link to the theme designer?

I just wanted to know if it's ok to modify/remove links pointing to the designer of the theme. In my case I have "theme by" and the site's logotype, would it be ok to remove the logotype and write the site's name? Or remove it altoghether? Does it have to do with the particular designer of the theme? Thanks


Crop featured image by default

I'm having trouble finding out how to accomplish this - I want to display a cropped version of an image in the post. So when it's uploaded, it would automatically be displayed cropped. Is there any way to do that? For example, this would be the original image uploaded and this is what it would look like in the post Is there a way to set that cropping be default? It would be great if the user would upload the image already cropped, but if they don't, I want to have a fallback.


How to Orderby User Role?

Im looking to order posts by the users role... I currently have 2 user roles (intending to create more), and they are "Premium User" and "User", and some poss created by "Admin" All of these posts are on one page, and i would like all the posts that are written by the "Premium User" at the top, then the rest underneath. I have currently accomplished this with 2 separate loops, however, as the site grows there will be need for pagination to be added, and with 2 separate loops, this isnt going to work. Any help appreciated! Thanks,


Visitors Contacting Authors

Is there any way that I can have a website user be able to contact a post author. The website user must not be required to be logged in to the website. I guess a form to email the post author might be the way to go, but it must be simple to use, and avoid spam. Is there such a plugin for wordpress that can handle this?


Disable WordPress 3.6 idle logout / login modal window / session expiration

I manage a WordPress site hosted at WPEngine that was recently force-upgraded to version 3.6. The upgrade introduced "In-line login following expired sessions", and therein lies the problem. The website is used to manage registrations, room assignments, and other similar functions for a resort. This means that WordPress is often left open, but not actively used, for hours at a time. Before 3.6 everything was fine, but now the client is complaining about the new login modal popping up "often" (every 2-3 minutes or every 20 minutes, depending on who is asked). My question in short: How do you disable or extend the session responsible for this new modal window? I have tried using the `auth_cookie_expiration` filter, but this only seems to effect being logged out between page loads and has no effect on the in-line login window. Full code of what I tried:               function myplugin_cookie_expiration( $expiration, $user_id, $remember ) {     // If the "Remember Me" box is checked, keep the session for 14 days. Otherwise     // only keep the session for 2 hours     return $remember ? 1209600 : 7200;     }     add_filter( 'auth_cookie_expiration', 'myplugin_cookie_expiration', 99, 3 );      There seems to be question similar to this already posted, but there was no response... Thanks in advance for any insight you can offer!


Search not displaying results

I can't seem to get any results to show up, even though I know for a fact that the content exists! Here's my code (search.php)                <?php     /* Template Name: Search */               get_template_part('./template/global/header');     ?>

<?php     if (function_exists('bcn_display')) {         bcn_display();     }     ?>
             <?php             $sidebar = get_post_meta($post->ID, 'wpcf-sidebar-template', true);             if ($sidebar == 'disable') {                 ?>                              <?php }             ?>

<?php the_title(); ?>
                 <?php                 get_search_form();                 if (have_posts()) : while (have_posts()) : the_post();                         the_content();                     endwhile;                 else:                     ?>
<?php _e('Sorry, no posts matched your criteria.'); ?>
                 <?php endif;                 ?>
                  <?php             if (function_exists('dynamic_sidebar')) {                 if (!($sidebar)) {                     if (is_admin()) {                         echo _e('No sidebar preferences are defined.');                     }                 } else {                          if ($sidebar != 'disable') {                         echo '';                         get_template_part('./template/misc/sidebar-banner');                         dynamic_sidebar('sidebar-' . $sidebar);                         echo '';                     }                 }             }             ?>

                   <?php         get_template_part('./template/global/footer');


2 wordpress blogs with 1 users table and 1 login

I have been trying to achieve that and I did without the 1 login part I fallowed this post/tutorial , but no matter what I do I can not get it to login ones for both websites. My set up is `sitename.com/wordpress1/` and `sitename.com/wordpress2/`(in this one I have `BuddyPress` installation) The shared user table work - I can register from wordpress1 site and login with the same username on wordpress2 without any problems, but I need to login for every site separately. I can see that after I login in the two websites they create 2 different cookies for each:               name: wordpress_38f490d1cc4aa19b4d792ab9d875aaeb     name: wordpress_logged_in_38f490d1cc4aa19b4d792ab9d875aaeb          name: wordpress_8c8848dc05bf5a0a44af5ccc0204cd82     name: wordpress_logged_in_8c8848dc05bf5a0a44af5ccc0204cd82          host: sitename.com //for all of the above.      My understanding is that the two should create only one and use it across. What do you thing the problem could be? Am I missing something in the settings? Could the problem be in my HOST provider? What about the `.htaccess`? Any ideas what I am doing wrong? EDIT: From here I read this: > If you plan on creating sites that are strongly interconnected, that share > data, or **share users** , then a multisite network might not be the best > solution. So I chose to use multiple installations instead...


How to dynamically insert <a href> in the image caption?

So, below is the Wordpress default generated code for a gallery item:

Caption Text

      What I need, is to surround the caption text with the image url, so when the user clicks on the caption it will open the big image, like this:
Caption Text
      I know I can do this via image gallery with a href in the caption text, but the site is for a client and I want to be done dynamically. I also found that this can be done in media.php (via functions.php), but I don't know how... I hope I've made myself clear :)


How to set a fall back template for a custom post type in a plugin?

My custom plugin creates a custom post type, and I want to theme my own `"single-my_custom_cpt.php"` file. However, I want to store it in my plugin folder, and allow that it be over-written in the websites' active theme folder. For example, single-my_custom_cpt.php exists in `/plugins/my-plugin/` folder, and someone creates `/themes/site-theme/single-my_custom_cpt.php`. I want the theme file to come up first, and if it's deleted, the plugin file to come up.


Make a Custom template for a specific category in wordpress

I am having issue with a custom category template. I want to create a new template for my specific category "VIDEOS" so that all posts under this category show in new style. Basically, i want to show posts with videos in a new way as 3 posts in one row with featured images and a featured slider on top of that page showing 4 new posts of that category ? But i am confused... Can i do this in wordpress ? Because my home page also has a featured slider. Can i create a new slider for that page template but one thing is sure. I need to work with only one category for that custom template i.e. videos......... Any help will be appreciated. Thanks in advance ....


How do I extract the Alt Text from an image attachment upload via the Wordpress Options Framework Plugin?

I'm currently creating a custom WordPress theme and using the WordPress Options Framework plugin to make a custom options page for my client. I'm able to easily create an image upload option and can get that uploaded image to show up where I intend it to within my theme's framework. Within my options file (required for the plugin to work), the array I've created for the image upload functionality is the following code:               $options[] = array(     'name' => __('Header Overlay', 'options_framework_theme'),     'desc' => __('This creates a full size uploader that previews the image.', 'options_framework_theme'),     'id' => 'header_overlay',     'type' => 'upload');      Then, within the theme I call that uploaded image with the following code:               <img src="<?php echo of_get_option('header_overlay', 'no entry'); ?>" />      Like I mentioned this all works perfectly. However, what I cannot figure out is how to extract the Alt Text from the image upload dialogue and including it as an echo within the img src tag in the theme. Is there anything I can add within the array above to create something to echo within the theme? **[update]**   If I do a search for the text `of_get_option` throughout the files, I find one file. This is the code:               if ( ! function_exists( 'of_get_option' ) ) :          function of_get_option( $name, $default = false ) {              $config = get_option( 'optionsframework' );              if ( ! isset( $config['id'] ) ) {                  return $default;              }              $options = get_option( $config['id'] );              if ( isset( $options[$name] ) ) {                  return $options[$name];              }              return $default;          }      endif;


show posts in different styling

I would like to show `categories` in the front page with different behavior:   * categories to show `posts` in two styles [Three `posts` having the same style and then another two with the same style] ![Three posts having the same style and then another two with the same style](http://i.stack.imgur.com/ekUm7.jpg)   * another `categories` will show `posts` like below image ![enter image description here](http://i.stack.imgur.com/E5nRx.jpg)   * for the `category` page itself, I would like to show the last three `posts` as featured with the same style, then the rest of posts having the same style. This is my first wp `theme`, so how to make this possible?


explain why is_single doesn't work

I am playing around with template hierarchy. I have uploaded stock 2012 theme and deleted page.php and single.php. I found that when I visit a blog post and click the the post reply link to leave a comment, the comment form doesn't show. So I copied comments_template() function out of single.php and pasted it into content.php inside the is_single conditional that looks like this                   <?php if ( is_single() ) : ?>
<?php the_title(); ?>
             <?php else : ?>
                 <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?>
      //added the comments template here      comments_template( '', true);             <?php endif; // is_single() ?>      from that, I would expect the comments template to show but it does not. It did however show up when I added the is_single conditional to the index.php loop Why would it not work in the                get_template_part( 'content', get_post_format());