Only homepage working correctly, 404 error on everything else

I've been developing wordpress based websites for some time now, and i built one for my company's own brand, it worked with no problem at all for ages, but now for some reason, i can only get the homepage properly, for startesr, this is my setup:   1. Wordpress freshly updated to 3.7.1 (although problem existed before update and i hoped the update would fix whatever was causing before i had a clue of what's going on)   2. Gantry Framework and Theme updated to the most recent   3. Several plugins, not worth enumerating because it shouldnt be a plugin problem, i tried deactivating every single one and it returned nothing new.   4. NO ACCESS TO .htaccess !!! (this is where i think the problem lies...) I believe im getting a permalink error, and i've been seeing everywhere on the internet i whould go to the permalink page and just save without making changes to flush the rewrite engine rules (sorry if this is not said the right way, im new to it), the problem is my host is not accepting my request for permissions to change the .htaccess files, for security reasons, they say... is there any way i can achieve this flush without having permissions to write on .htaccess? i have sent them the rules wordpress tells me to write on .htaccess:               <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>      But after writing these, nothing changes, i still dont know what happened, i dont know if they changed something server-side (probably they changed permissions, because i had no problems before some weeks ago)... Is there anyway to solve this problem on my side or do i have to just keep nagging the guys at the hosting company until they give me permission to write on .htaccess? What valid arguments could i point to them so they dont find me a threat to their servers? Thank you for your time and answers :)


Users - remove 'send password' checkbox

Is there a recommended method for removing the 'Send password' checkbox when managing users in WordPress admin? Or alternatively a way of alterting users to changes that doesn't involve mailing the password in plain text? Thanks, Toby


Save number of Facebook likes to database

I have a custom post type called Neighborhoods, which stores information about various neighborhoods of a city. Each neighborhood also has a Facebook page. What I'd like to do is for each neighborhood, use the Facebook Graph to grab the number of likes of the page and save them in the WordPress database to display in various parts of my website. I don't know exactly what code to use, but here is the basic outline:               Run this once a day:         Query neighborhood post type in the database         For each neighborhood:             $data = json_decode(file_get_contents('https://graph.facebook.com/neighborhoodURL'));             $numberOfLikes = $data->likes;             Save $numberOfLikes in it's own field in the database      And once that's set, I should be able to call the number of likes field in the loop. Anyone know the best way to do this?


Integrating CSS Into a WP Function Call

Below is a code I use to display post views. It is integrated with an options panel which allows users to choose whether to display it. I would like to integrate the div class .postviews directly into the code. I would like to do this because it incorporates a blue background and if the views are not displayed, that blue background still gets displayed.               <div class="postviews">     <?php $options = get_option('to_post_views');     if( $options == 'Yes' ) { echo getPostViews( get_the_ID() );     } ?>     </div>      If you view this page, views are currently being displayed where it says "58 views."


Why is the post title and content automatically being displayed in the post thumbnail (Featured image)?

I use the following code to show the post thumbnail (only):                   <?php // Create and run custom loop             $custom_posts = new WP_Query();             $custom_posts->query('post_type=page_content&sections=ThemeCL');             while ($custom_posts->have_posts()) : $custom_posts->the_post();         ?>
                 <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_post_thumbnail(); ?>
         <?php endwhile; ?>      But for some reason the title and content of the post is being shown (inside tags!):

Mainbar

Hello this is the title Hello this is the post content

      I only want the post thumbnail (Featured Image) to be shown. Any suggestions?


Letting the user define the arguments in a custom loop? (the "$custom_posts->query(...)" part)

I use the following to retrieve a post from a custom post type and custom taxonomies:               <?php // Create and run custom loop         $custom_posts = new WP_Query();         $custom_posts->query('post_type=blocks&location=Front Page&section=Mainbar');         while ($custom_posts->have_posts()) : $custom_posts->the_post();     ?>

<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?>
     <?php endwhile; ?>      In the Page, I want to create fields that will let the user customize the loop arguments like this:               $custom_posts->query('post_type=blocks&location=<Enter Location>&section=<Enter Section>');      What's the easiest way of doing this? How would that code look like?


TinyMCE 4 & wp_editor multiple editor issue

Just updated WordPress to new 3.9, new features are great, love them. Only got some issues with tinyMCE 4. I use `wp_editor` to create multiple tinyMCE editors with custom field. Here is the code:               $tinymce_opt = array(      'height'    => "250",      'plugins'  => "nz_button, line, gap, slider_colorbox, icon_list, icons, font_size",      'toolbar1' => "formatselect,fontselect, styleselect,|,bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,link,unlink,|,forecolor,removeformat,charmap,undo,redo",      'toolbar2' => "nz_button, line, gap, slider_colorbox, icon_list, icons, font_size",      'toolbar3' => ""     );           $settings = array (         'tinymce'       => $tinymce_opt        );       wp_editor( ${"layer_$i"}, "layer_$i", $settings);      Everything is fine. The problem is that it does not understand plugins (my custom shortcodes, that i created). Custom shortcodes work fine in regular wp editor, but in multiple wp_editor, it just does not find them. In colsole i get error 404 can’t find for example “line” shortcode http://mywebsite.com/wp-includes/js/tinymce/plugins/line/plugin.min.js 404 (Not Found) All my custom shortcodes are ignored, not found. Does anyone know, how to tell tinyMCE + wp_editor to use custom shortcodes? My custom shortcodes are located in my theme P.S. It worked fine with old tinyMCE.


“Custom Field” to Excerpt field" for pages?

In the question "Copy SEO Meta Desc “Custom Field” to Excerpt field?" The plugin posted as a part of brasofilo's answer works great but, I would like to alter the excerpt for Pages of my WordPress site instead of or in addition to posts. How would I accomplish this?


Custom Post Type not working with Capabilities

I have the following custom post type that I am using on one of my sites:               function careers_post_type() {              $labels = array(             'name'                => _x( 'Careers', 'Post Type General Name', 'text_domain' ),             'singular_name'       => _x( 'Career', 'Post Type Singular Name', 'text_domain' ),             'menu_name'           => __( 'Careers', 'text_domain' ),             'parent_item_colon'   => __( 'Parent career:', 'text_domain' ),             'all_items'           => __( 'All careers', 'text_domain' ),             'view_item'           => __( 'View career', 'text_domain' ),             'add_new_item'        => __( 'Add New career', 'text_domain' ),             'add_new'             => __( 'New career', 'text_domain' ),             'edit_item'           => __( 'Edit career', 'text_domain' ),             'update_item'         => __( 'Update career', 'text_domain' ),             'search_items'        => __( 'Search careers', 'text_domain' ),             'not_found'           => __( 'No careers found', 'text_domain' ),             'not_found_in_trash'  => __( 'No careers found in Trash', 'text_domain' ),         );         $args = array(             'label'               => __( 'career', 'text_domain' ),             'description'         => __( 'career information pages', 'text_domain' ),             'labels'              => $labels,             'supports'            => array( ),             'taxonomies'          => array( ),             'hierarchical'        => false,             'public'              => true,             'show_ui'             => true,             'show_in_menu'        => true,             'show_in_nav_menus'   => true,             'show_in_admin_bar'   => true,             'menu_position'       => 5,             'can_export'          => true,             'has_archive'         => true,             'exclude_from_search' => false,             'publicly_queryable'  => true,             'capability_type' => 'post',         );         register_post_type( 'career', $args );          }      The sucker works beautifully. However I want to add a custom capability to it. I used this tutorial: http://justintadlock.com/archives/2010/07/10/meta- capabilities-for-custom-post-types Once I make the code this, it stops working:               // Register Custom Post Type     function careers_post_type() {              $labels = array(             'name'                => _x( 'Careers', 'Post Type General Name', 'text_domain' ),             'singular_name'       => _x( 'Career', 'Post Type Singular Name', 'text_domain' ),             'menu_name'           => __( 'Careers', 'text_domain' ),             'parent_item_colon'   => __( 'Parent career:', 'text_domain' ),             'all_items'           => __( 'All careers', 'text_domain' ),             'view_item'           => __( 'View career', 'text_domain' ),             'add_new_item'        => __( 'Add New career', 'text_domain' ),             'add_new'             => __( 'New career', 'text_domain' ),             'edit_item'           => __( 'Edit career', 'text_domain' ),             'update_item'         => __( 'Update career', 'text_domain' ),             'search_items'        => __( 'Search careers', 'text_domain' ),             'not_found'           => __( 'No careers found', 'text_domain' ),             'not_found_in_trash'  => __( 'No careers found in Trash', 'text_domain' ),         );         $args = array(             'label'               => __( 'career', 'text_domain' ),             'description'         => __( 'career information pages', 'text_domain' ),             'labels'              => $labels,             'supports'            => array( ),             'taxonomies'          => array( ),             'hierarchical'        => false,             'public'              => true,             'show_ui'             => true,             'show_in_menu'        => true,             'show_in_nav_menus'   => true,             'show_in_admin_bar'   => true,             'menu_position'       => 5,             'can_export'          => true,             'has_archive'         => true,             'exclude_from_search' => false,             'publicly_queryable'  => true,             'capability_type' => 'career_editor',             'capabilities' => array(                 'publish_posts' => 'publish_career',                 'edit_posts' => 'edit_career',                 'edit_others_posts' => 'edit_others_career',                 'delete_posts' => 'delete_career',                 'delete_others_posts' => 'delete_others_career',                 'read_private_posts' => 'read_private_career',                 'edit_post' => 'edit_career',                 'delete_post' => 'delete_career',                 'read_post' => 'read_career',             ),         );         register_post_type( 'career', $args );          }      I even tried taking the capabilities array out and the content type still vanishes. What am I doing wrong?


How to get attachments for a specific post type?

I have this page where I am showing all post's attachments. This is the code:               <?php     $args = array(         'post_type' => 'attachment',         'post_status' => 'published',         'posts_per_page' =>25,         'post_parent' => null, // Post-> ID;         'numberposts' => null,     );          $attachments = get_posts($args);          $post_count = count ($attachments);          if ($attachments) {         foreach ($attachments as $attachment) {         echo "
";             $url = get_attachment_link($attachment->ID);// extraigo la _posturl del attachmnet                   $img = wp_get_attachment_url($attachment->ID);             $title = get_the_title($attachment->post_parent);//extraigo titulo             echo '';             echo "
";         }        }     ?>      Now, I have the 'post', 'page' and 'videos' post_types. I am getting all of them but I want to display 'post' post_type only. How do I exclude 'video' post_type? Thanks!


How to display milliseconds instead of seconds using timer_stop function?

I'm trying to display milliseconds instead of seconds using timer_stop wordpress function. Currently I have               $sbp_speed = timer_stop(0,2);      That display the time like `1.56` s and I need to display the time like `455.1 ms` Thank you!


How can i remove the posts category class names from body_class

I have 2 categories, just to make an easy example, Cars and Bikes. I have a post that fits both of the category. If i visit the Cars category, the body_class looks like this: "archive category category-cars category-1 category-cars category-bikes" The problem is that somehow the post category is visible in the body_class after the category-1 classname. How can i avoid this? I need to use different colors for different categories, but right now the category-bikes class overwrites the category-cars class.


mysql custom wp query

this code is designed to select posts with selected meta value in wordpress query               <?php $values = $wpdb->get_results("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key  = 'wpcf-scr'",ARRAY_A);?>     <select name="wpcf-scr">     <option value="">default</option>     <?php foreach ($values as $value):?>     <?php if($value['meta_value']):?>         <option value="<?php echo $value['meta_value']?>"><?php echo $value['meta_value']?></option>     <?php endif;?>     <?php endforeach;?>     </select>      I need to re use the code but with selecting posts with tags(manual assigned) not meta values... something like this below just for explanation (it's wrong)               <?php $values = $wpdb->get_results("SELECT DISTINCT post_tags FROM $wpdb->tags ",ARRAY_A);?>     <select name="tags">     <option value="">default</option>     <option value="tag1">tag1</option>     <option value="tag1">tag2</option>     <option value="tag1">tag3</option>     <option value="tag1">tag4</option>     </select>      How to make the second example correctly ? thanks


Is There a Plugin Life Cycle Documentation?

Is there some documentation somewhere that explains what is the life cycle of the plugins? I'm starting a new plugin with OOP style, and I just found out that my main class is being instanciated **a lot** (thanks to Xdebug and Netbeans).   I wonder why, and it annoys me because I'm instanciating a Dropbox-API object, and I really didn't think WordPress would just instanciate my main class that much. I haven't found anything related to the plugins life cycle in the Codex nor on Google.


Designing a member area on my site

I am new to wordpress and I have a website I inherited and I have never even heard of wordpress. My first mini project is to create a page with my members that can then be linked to a personal page that has information about them. Is there anything I should look into?


Adding a Span Class in a Function

Link: http://themeforward.com/demo2/2011/01/02/centered-and-captioned-image- longer-title/ I've tried this about 8 times and need some help. For the bread crumbs (navigation trail on the top of the page) I would like to add a span class only to the »'s that appear. If somebody could add this in the function below I would really appreciate it! My function:               //////////////////////////////////////// Breadcrumbs     function dimox_breadcrumbs() {       $delimiter = '»';       $home = 'Home'; // text for the 'Home' link       $before = ''; // tag before the current crumb       $after = ''; // tag after the current crumb       if ( !is_home() && !is_front_page() || is_paged() ) {          echo '
';          global $post;         $homeLink = get_bloginfo('url');         echo '' . $home . ' ' . $delimiter . ' ';         if ( is_category() ) {           global $wp_query;           $cat_obj = $wp_query->get_queried_object();           $thisCat = $cat_obj->term_id;           $thisCat = get_category($thisCat);           $parentCat = get_category($thisCat->parent);           if ($thisCat->parent != 0) echo(get_category_parents($parentCat, TRUE, ' ' . $delimiter . ' '));           echo $before . 'Archive by category "' . single_cat_title('', false) . '"' . $after;         } elseif ( is_day() ) {           echo '' . get_the_time('Y') . ' ' . $delimiter . ' ';           echo '' . get_the_time('F') . ' ' . $delimiter . ' ';           echo $before . get_the_time('d') . $after;         } elseif ( is_month() ) {           echo '' . get_the_time('Y') . ' ' . $delimiter . ' ';           echo $before . get_the_time('F') . $after;         } elseif ( is_year() ) {           echo $before . get_the_time('Y') . $after;         } elseif ( is_single() && !is_attachment() ) {           if ( get_post_type() != 'post' ) {             $post_type = get_post_type_object(get_post_type());             $slug = $post_type->rewrite;             echo '' . $post_type->labels->singular_name . ' ' . $delimiter . ' ';             echo $before . get_the_title() . $after;           } else {             $cat = get_the_category(); $cat = $cat[0];             echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');             echo $before . get_the_title() . $after;           }              } elseif ( !is_single() && !is_page() && get_post_type() != 'post' && !is_404() ) {           $post_type = get_post_type_object(get_post_type());           echo $before . $post_type->labels->singular_name . $after;              } elseif ( is_attachment() ) {           $parent = get_post($post->post_parent);           $cat = get_the_category($parent->ID); $cat = $cat[0];           echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');           echo '' . $parent->post_title . ' ' . $delimiter . ' ';           echo $before . get_the_title() . $after;              } elseif ( is_page() && !$post->post_parent ) {           echo $before . get_the_title() . $after;              } elseif ( is_page() && $post->post_parent ) {           $parent_id  = $post->post_parent;           $breadcrumbs = array();           while ($parent_id) {             $page = get_page($parent_id);             $breadcrumbs[] = 'ID) . '">' . get_the_title($page->ID) . '';             $parent_id  = $page->post_parent;           }           $breadcrumbs = array_reverse($breadcrumbs);           foreach ($breadcrumbs as $crumb) echo $crumb . ' ' . $delimiter . ' ';           echo $before . get_the_title() . $after;              } elseif ( is_search() ) {           echo $before . 'Search results for "' . get_search_query() . '"' . $after;              } elseif ( is_tag() ) {           echo $before . 'Posts tagged "' . single_tag_title('', false) . '"' . $after;              } elseif ( is_author() ) {            global $author;           $userdata = get_userdata($author);           echo $before . 'Articles posted by ' . $userdata->display_name . $after;              } elseif ( is_404() ) {           echo $before . 'Error 404' . $after;         }              if ( get_query_var('paged') ) {           if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ' (';           echo __('Page') . ' ' . get_query_var('paged');           if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ')';         }              echo '
';            }     } // end dimox_breadcrumbs()


Homepage slider not using correct images

I am currently in the process of starting my first blog. Currently, I am stumped. I have a homepage slider that refuses to work with me. The documentation for the theme I am currently using is located here. The problem I'm having is I can't figure out how or what the slider decides to use as an image and then the caption in the slider and how to add more to the slider. I would like it to be a the larger picture 970x360 or something like that with the caption beneath it with 3 or more pages to slide through, not have the description overlayed on it. I've gone into the theme option and messed around to no avail. I'm am lost as to where to go from here. For the visuals on the issues please see my blog.


Return single taxonomy term outside the loop

I'm trying to list just the first taxonomy term outside the loop. This is working fine but it lists all terms, and I just need the first - any suggestions?                   $taxonomy = 'taxonomy-name-here';         $queried_term = get_query_var($taxonomy);              $terms = get_terms($taxonomy, 'slug='.$queried_term);         if ($terms) {           foreach($terms as $term) {         echo ' ' . $term->name . ' ';           }         }      Edit: clarification: the above seems to be returning all categories within the taxonomy, I'm only looking to get the taxonomy category of the current page. Update: I found a simple answer!:               $categories= wp_get_object_terms($post->ID, 'taxonomy-name');     echo $categories[0]->name;


Custom Post Type + Custom Taxonomy = Archive Listing Page Problems

I have a custom post type that uses a custom taxonomy. It's working, from what I can tell, in the sense that I can create a post, and assign the custom taxonomy terms to it. Debugging shows the terms are being saved. I guess my confusion lies in how the template hierarchy works. I copied the archive.php file and called it "taxonomy-zouk_video_level.php" and it's being called. But that file has the usual Loop in it, and no posts are found when I navigate to the URL for the term. Am I supposed to be using a different Loop? Or am I not to use the Loop at all? Here's my custom post type code:               <?php          function zouk_custom_types() {               $videolabels = array(             'name'               => 'Videos',             'singular_name'      => 'Video',             'add_new'            => 'Add New',             'add_new_item'       => 'Add New Video',             'edit_item'          => 'Edit Video',             'new_item'           => 'New Video',             'all_items'          => 'All Videos',             'view_item'          => 'View Video',             'search_items'       => 'Search Videos',             'not_found'          => 'No Videos found',             'not_found_in_trash' => 'No Videos found in Trash',             'parent_item_colon'  => '',             'menu_name'          => 'Videos'         );              register_post_type( 'zouk_video',             array(                  'labels' => $videolabels,                 'description' => __( 'A video.', 'bonestheme' ),                 'public' => true,                 'publicly_queryable' => true,                 'exclude_from_search' => true,                 'show_ui' => true,                 'query_var' => true,                 'menu_position' => 1,                 'menu_icon' => 'dashicons-editor-video',                  'rewrite'   => array( 'slug' => 'zouk_video', 'with_front' => false ),                  'has_archive' => 'zouk_video',                 'capability_type' => 'post',                 'hierarchical' => false,                 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions')             )         );               $instructorlabels = array(             'name'               => 'Instructors',             'singular_name'      => 'Instructor',             'add_new'            => 'Add New',             'add_new_item'       => 'Add New Instructor',             'edit_item'          => 'Edit Instructor',             'new_item'           => 'New Instructor',             'all_items'          => 'All Instructors',             'view_item'          => 'View Instructor',             'search_items'       => 'Search Instructors',             'not_found'          => 'No Instructors found',             'not_found_in_trash' => 'No Instructors found in Trash',             'parent_item_colon'  => '',             'menu_name'          => 'Instructors'         );              register_post_type( 'zouk_instructor',              array(                  'labels' => $instructorlabels,                  'description' => __( 'An instructor.', 'bonestheme' ),                 'public' => true,                 'publicly_queryable' => true,                 'exclude_from_search' => true,                 'show_ui' => true,                 'query_var' => true,                 'menu_position' => 2,                   'menu_icon' => 'dashicons-groups',                  'rewrite'   => array( 'slug' => 'zouk_instructor', 'with_front' => false ),                  'has_archive' => 'zouk_instructor',                 'capability_type' => 'post',                 'hierarchical' => false,                 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions')             )          );               /* use categories with the videos */         register_taxonomy_for_object_type( 'category', 'zouk_video' );          }              // adding the above to the Wordpress init         add_action( 'init', 'zouk_custom_types');          function zouk_video_types() {                 // now custom term for video levels         register_taxonomy( 'zouk_video_level', 'zouk_video',             array(                 'hierarchical' => true,                 'label' => 'Video Levels',                 'show_admin_column' => true,                  'show_ui' => true,                 'query_var' => true,                 'rewrite' => array( 'slug' => 'video-level' ),                 'public' => true,             )         );          }          // adding the above to the Wordpress init         add_action( 'init', 'zouk_video_types');          ?>


Code formatting: Gists vs Embedded

It seems that there are at least a couple different methods of working with code in WordPress entries and posts:   1. GitHub Gists (via the Gist Shortcode plugin, etc.)   2. Inline formatting in a `<pre>` block or directly inline with text with a `<code>` block. Gists are great because the formatting and storage is handled elsewhere, but then I lack potential search-engine index-ability into my code blocks, if I'm not mistaken. Inline is great because I'm guaranteed search-engine index-ability, but maintaining a plugin and custom styles for syntax highlighting is really terrible. Is there a way for me to get the best of both worlds in some way?


WordPress twenty thirteen theme - search bar inverse in safari

I've a problem with the search bar in WordPress theme twenty thirteen . . . The magnifying glass appear on the right of the text field, but I want it on the left . . . In Chrome, IE, and Firefox it appears well on the left of it as I need... I can not find the div / class to edit correctly, I tried like this:               site-header .search-field:focus     {     background-color: #ffffff;     border-top-width: 2px;     border-right-width-value: 2px;     border-bottom-width: 2px;     border-left-width-value: 2px;     border-top-style: solid;     border-right-style-value: solid;     border-bottom-style: solid;     border-left-style-value: solid;     border-top-color: #c3c0ab;     border-right-color-value: #c3c0ab;     border-bottom-color: #c3c0ab;     border-left-color-value: #c3c0ab;     border-image-source: none;     border-image-slice: 100% 100% 100% 100%;     border-image-width: 1 1 1 1;     border-image-outset: 0 0 0 0;     border-image-repeat: stretch stretch;     cursor: text;     outline-width: 0px;     outline-style: none;     width: 230px;     }     .site-header .search-field     {   border:none!important;     left:0px;        top:-50px !important;      }      but it doesn't change anything . . . You can check it online here


How to create a front end user profile with a friendly permalink

I want to create a public front-end profile page with a friendly url like this format.               mysite.com/user/someusername      Any idea on how can i achieve this? I know it has something to do with rewrite rule but i have no idea on how can i do that. If you got any link or tutorial for me that will be great. Thanks!


Problems accessing stylesheets/scripts loaded in WP header

When I view my pages source code I get the following:               <link rel='stylesheet' id='css_bootstrap-css'  href='http://*******.com/wp-content/themes/synapse/js/bootstrap/css/bootstrap.css?ver=3.5' type='text/css' media='all' />      And when I click on the link:               http://*******.com/wp-content/themes/synapse/js/bootstrap/css/bootstrap.css?ver=3.5      It won't work and this is shown:                  <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">                  <title>403 Forbidden</title>
Forbidden

You don't have permission to access /domains/*******.com/wp-content/themes/synapse/js/bootstrap/css/bootstrap.css         on this server.
               It's the same for the all the others scripts/stylesheets. Why is that?


Scheduled event occurring each page load, but supposed to happen daily

I have a scheduled event that is supposed to occur only once a day at 12am. However, for some reason my scheduled event is happening on each page load and I can't figure out why. The default WordPress cron is disabled. For right now I have a cron job running once a minute using a wget command in place of default WordPress cron. I built a simple plugin based on the code at this website My core logic works I just can't figure out how to schedule it daily at 12am everyday.               <?php         register_activation_hook( __FILE__, 'activate_daily_event' );         /**          * On activation, set a time, frequency and name of an action hook to be scheduled.          */         function activate_daily_event() {                 wp_schedule_event(1402460460 , 'daily', 'prefix_daily_event');              }              add_action( 'prefix_daily_event', 'prefix_do_this_daily' );         /**          * On the scheduled action hook, run the function.          */         function prefix_do_this_daily() {                 $terms=get_terms('sp_venue', array( "hide_empty" => 0 ));                 if  ($terms) {                         foreach ($terms  as $term ) {                                 $taxonomy_id = 'taxonomy_' . $term->term_id;                                 $term_ids[] = $taxonomy_id;                                 $option = get_option($taxonomy_id, false);                                 if(option){                                         $option['sp_venue_status'] = 'Open';                                         update_option($taxonomy_id, $option);                                 }                         }                 }         }              register_deactivation_hook( __FILE__, 'deactivate_daily_event' );         /**          * On deactivation, remove all functions from the scheduled action hook.          */         function deactivate_daily_event() {                 wp_clear_scheduled_hook( 'prefix_daily_event' );         }     ?>


How do I directly access a PHP file located in my themes folder?

I have a file in my theme's folder called "test.php". If I go to www.mysite.com/wp-content/themes/my-theme/folder/test.php the theme loads which I assume is a 404 error handled by WP. If I change the file name to be test.html I can access it no problem. I tried adding the following code to my functions.php file (to add a rewrite rule):               add_rewrite_rule( 'test.php$', $relative_directory . '/folder/test.php [L]', 'top' );      but even having the htaccess rule didn't seem to do anything. Any idea what could be causing this?


How to get styles from iframe in Customizer

I'm trying to get current styles from a live preview when Customizer is loaded to set them in my controls. How can I do that? I was trying in this way:               $('#customize-preview iframe').contents().find('body').css('font-size');      but it returns 'undefined', so as I think contents() loads only DOM without any styles. Is there any suitable function in WP Customizer which I can use to get style values and set them in my controls? Example: I've created control to change font-size and I used Slider UI to achieve it. Here is my problem. When I open Customizer, the slider is setted to 0. It doesn't make any sense, because font-size (i.e. for body) on my website is 13px, so the slider should also be setted to 13, not 0. To solve my problem I would like to get the current body font-size from my website and set it to the slider. I don't know, maybe there is a better solution. I hope it's clear now. Thanks for your help!


Custom Post Types Not Showing Up In query_posts Result

This query works in some places, but not in others... right now it's not working on the home page. This query is in a file that is included into index.php of my theme. The regular posts show, but no cutom post types. What's wrong with this query?               $args = array(       'post_type' => array('post', 'video', 'slideshow', 'poll', 'quote'),       'orderby' => 'date',        'order' => 'DESC'     ); query_posts( $args );


How to obtain the current website URL in my theme?

I am working on a custom theme and I have the following doubt about how to correctly insert the link to some section of my website into the theme. If you open this link you can understand what I need to do: `http://localhost/wordpressAsper/` As you can see under the header slideshow I have 3 boxes that are links. I need to link the second box (the one named **Archivio** ) to this page: `http://localhost/wordpressAsper/archivio-2/` I know that I can simply put this URL into the href attribute of my a tag but this is not a smart idea because then I have to moove the website on my remote webserver. So I am thinking that should exist something like a wordpress function to retrive the current URL of the website. What is the best way to implement this thing? Tnx


Adding to an array & passing it through do_action/apply_filters

For exercise I am working through a PHP class to add meta boxes I found on GitHub. I just copied the code and now I am playing around with it to understand it. It works like this: The file containing the class is included on init. Inside that file, but outside the class, an empty array `$meta_boxes` is initialized.   After that, a custom action is executed, using `apply_filters`. My guess is `apply_filters` is used instead of `do_action` because the latter does not return anything – `$meta_boxes = apply_filters( 'cmb_meta_boxes', $meta_boxes )`. Into that action, a function is hooked which adds to the existing array, which is returned at the end. That function gets `$meta_boxes` passed as an argument. TLDR;   An empty array is created, a function which adds to that array and returns it is fired. The function fires because it is hooked to a custom hook which is executed using `apply_filters`, because that way the function's return value can be assigned to a variable. To me, that seems really to be a really complicated task for a pretty simple thing. Is this 'the WordPress way' of doing things or can the same result achieved with less code? Why does the function that is hooked into the custom filter/action needs the array as an argument. Isn't it passed automatically to that function because it is added to the hook? Maybe I haven't yet fully understood the way variables are handled inside WordPress. If you think this is the case, any links to explanations would be also gladly accepted.


How do I allow my post to update it's date every week

I'm using the Eventure theme for WordPress and I'm trying to make my posts recur. I want it so that I can add a post with it's date, where I can set the iterations where the post is updated. I don't wan't the content of the post to change, I just want the post's date to be updates every iteration. I've looked for plugins but just can't find any that work with the latest version of WordPress. Any help would be appreciated.


How to add the wp-media-library button in tinymce?

![enter image description here](http://i.stack.imgur.com/7yQYH.png) That is a screenshot from the admin backend for the the tinymce editor in fullscreen view. I am implementing the editor in the frontend and I want to add the wp media library button in the default tinymce toolbar. I tried with the following code but it is not showing it. It only shows the bold, italic, and underline buttons:               function add_buttons_mce($buttons) {                 $buttons = array('bold,italic,underline,add_media,wp-media-library');         return $buttons;     }     add_filter('mce_buttons','add_buttons_mce');      ![enter image description here](http://i.stack.imgur.com/kFWvF.png) So, how can I put that button in there? EDIT: I am using WP 3.9+ and tinymce 4+ EDIT: is the button name for the wp media gallery `add_media` or `wp-media-library`?


How to Fetch Rss Feeds From Other Websites

I've 3-4 Blogs 2 on same topics I want if i post on 1st blog then 2nd blog can fetch feeds automatically and save that in database as a post or Can anyone tell me how smashing network work when someone post in his blog smashing fetch feeds and excerpt and show it in smashing network and when user click on that post he/she redirect to original blog post.


strtolower <title>

Currently the WordPress Twenty something themes all have this as the title:               <title><?php         global $page, $paged;         wp_title('~', true, 'right');         bloginfo('name');         $site_description = get_bloginfo('description', 'display');         if ($site_description && (is_home() || is_front_page()))             echo " ~ $site_description";         if ($paged >= 2 || $page >= 2)             echo ' ~ ' . sprintf(__('Page %s', 'schema'), max($paged, $page));     ?></title>      Would it be possible to have the whole bit returning as lowercase perhaps?


Single.php loses it's formatting

I needed to use the category name as a class for the H1, and also needed to exclude category 2. So I botched together the PHP code below. It works fine except the post looses it's formatting. I know that `get_post_format()` is what applies the format, but when I add it, it doesn't seem to do anything. Any help would be appreciated, thanks. Ok here is the entire Single.php, sorry if i'm not clear on what I was asking I'm a bit of a Wordpress newbie. What I'm trying to achieve is to have the title of the single post to have 2 classes:   1: .category-heading   2: .heading-"the slug of the category" eg .heading-featured                 <?php     /**      * The Template for displaying all single posts.      *      * @package WordPress      * @subpackage WDM      * @since WDM 1.0      */          get_header(); ?>

                                <?php while ( have_posts() ) : the_post();                 $excludedcats = array(2);                 $count = 0;                 $categories = get_the_category();                 foreach($categories as $category) {                     $count++;                     if ( !in_array($category->cat_ID, $excludedcats) ) {                         echo '
slug ) . '" >';                              if( $count != count($categories) ){                             echo " ";                         }                          }                     }                      single_post_title();                     echo '
';                     the_content();                      ?>
                          <?php wp_related_posts()?>

<?php _e( 'Post navigation', 'wdm' ); ?>
                         <?php previous_post_link( '%link', '' . _x( '←', 'Previous post link', 'wdm' ) . ' %title' ); ?>                         <?php next_post_link( '%link', '%title ' . _x( '→', 'Next post link', 'wdm' ) . '' ); ?>                                                         <?php comments_template( '', true ); ?>                      <?php endwhile; // end of the loop. ?>

          <?php get_sidebar(); ?>     <?php get_footer(); ?>


Custom URl parameter

i have Wp blog that need to receive a custom paramter on category page for filter the posts like my rule. For example: > http://mysite.com/category/teste?myvar=ABC How can I get the myvar from URL? I tried a lot of examples on the web, but no one works for the category page. Thanks!


Anchor tag generates blank href attribute using echo esc_url( )

Following is my categories page. It's listing the all categories in the page. But when `<a href>` gets blank value here. see the attached screen shot. Why `href` is blank here                li><a href="<?php echo esc_url(   $category_link ); ?>"><?php echo $cat- >name; ?>
      Here the the complete code               <? php         /*         Template Name: Categories         */             get_header();              $cats =  get_categories();             $num_cats  = wp_count_terms('category');              $count = $num_cats;  // Total Categories             $linetotal=round($count/3); // Part of Category             $cat1 = get_query_var('cat');             $category_link = get_category_link( $cat1 );                 ?>

                 <?php               $totalcount = 1;               $totalpart = 1;               foreach($cats as $cat): ?>
<a href="<?php echo esc_url( $category_link ); ?>"><?php echo $cat->name; ?>
                 <?php                 if($totalcount % $linetotal == 0 && $totalpart < 3) {                    echo '

';                       $totalpart++;                 }                 $totalcount++;               endforeach;?>

         <?PHP get_footer(); ?>      ![enter image description here](http://i.stack.imgur.com/boB1d.png) Any suggestions will be appreciated.


Finding the paragraphs in content

I am trying to create two functions, one that catches the first paragraph of some content, and one that catches the rest, but I have hit a bit of a conundrum. I have this in my single.php:
       <?php the_content(); ?>
      which produces:

The content .....

The content .....

The content .....

      each paragraph all nicely wrapped in a `<p>` tag. I _assumed_ that I could simple break the `explode()` the content based on the string `</p>`, theoretically splitting the content into paragraphs, but **all** the content is in the first resulting array element. I investigated, and there are no `<p>` tags in either the HTML edit, or indeed the database entry. Both look like:               The Content .....     The Content .....     The Content .....      Note: _Line breaks present, but not`<p>` tags._ Where does Wordpress add the `<p>` back in? How does it find the line breaks and how can I hook a function into that? * * * **FYI** Here is the function that fails, based closely on the `the_content()` function:               function get_first_paragraph(){         $content = $firstcontent = get_the_content();         $content = str_replace(']]>', ']]>', $content);         $content = explode('
',$content);              return $content[0];     }


Getting a blog language (site "lang_id" field vs the WPLANG setting)

There's a `wp_blogs` table which is very usefull when you want to get a list of blogs (and this is what I need to do). The problem is that I can't seem to be able to get the blog language from the `lang_id` field within that table. It just doesn't match the `WPLANG` option which set in each blog's option table. Yes, I could switch to each blog and do a `get_bloginfo('language')`, but that's quite expensive when you have a large number of blogs. So what's up with that `lang_id` field? What is it for?


Display multiple custom post types and sort them chronological by one of their fields

I have four custom post types created with the custom post types ui plugin; each stands for an event type with a different set of custom fields created with the advanced custom fields plugin. My goal is to show all events out of the pool of the four chronological. To query the four with WP_Query is no problem but so far to distinguish the output and to sort it gives me worries. The sample code queries the custom post types and outputs the date of the event as well as an echo to figure out the type of the event for debugging purpose.
         <?php $args = array(             'post_type' => array( 'eventtype1', 'eventtype2', 'eventtype3', 'eventtype4' ),             'posts_per_page' => -1         );         $the_query = new WP_Query( $args );         if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post();             if ( 'post_type' == 'eventtype1' ) {               ?>
<?php the_field( 'eventtype1_date' ); ?>
<?php               echo "event type 1";             }             elseif ( 'post_type' == 'eventtype2') {                ?>
<?php the_field( 'eventtype2_date' ); ?>
<?php                echo "event type 2";             }             elseif ( 'post_type' == 'eventtype3' ) {               ?>
<?php the_field( 'eventtype3_date' ); ?>
<?php               echo "event type 3";             }             elseif ( 'post_type' == 'eventtype4' ) {               ?>
<?php the_field( 'eventtype4_date' ); ?>
<?php               echo "event type 4";                           } ?>
      One problem is i am unsure if it is possible to distinguish outside the scope of the WP_Query array by post_type. Maybe the reason why there is no output yet with the sample code. Second i am uncertain how to sort the results. If i use the `'orderby' => 'date'`in the WP_query array i sort by the publish date and not the actual event date. About the sort i am unsure if it is possible at all in this setup? Any hints are more than welcome. Best regards Ralf **Update:** Ok i've solved the issue. With the following code it is possible to sort acf date picker fields and acf date picker fields in repeater fields (the date picker queried has to be placed at first in the repeater field) in more than one custom post type by date:
               <?php $args = array(                     'post_type' => array( 'event_type1', 'event_type2', 'event_type3', 'event_type4' ),                     'posts_per_page' => -1,                     'meta_query' => array(                           'relation' => 'OR',                           array('key' => 'event1_date_0_event1_date_day'),                           array('key' => 'event2_date'),                           array('key' => 'event3_date_0_event3_date_day'),                           array('key' => 'event4_date' )                     ),                     'meta_key' => 'meta_value',                     'orderby' => 'meta_value',                     'order' => 'ASC'              );              $the_query = new WP_Query( $args );              if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post();                 if ( get_post_type() == 'event_typ1' ) {                     $e1 = get_field( 'event1_date' );                     echo "Event Type 1"; ?>
<?php echo $e1[0]['event1_date_day']; ?>
<?php                 }                 elseif ( get_post_type() == 'event_typ2') {                     echo "Event Type 2:"; ?>
<?php the_field( 'event2_date' ); ?>
<?php                 }                 elseif ( get_post_type() == 'event_type3' ) {                     $e3 = get_field( 'event3_date' );                     echo "Event Type 3:"; ?>
<?php echo $e3[0]['event3_date_day']; ?>
<?php                 }                 elseif ( get_post_type() == 'event_type4' ) {                     echo "Event Type 4:";                     ?>
<?php the_field( 'event4_date' ); ?>
<?php                 }              endwhile;                  wp_reset_postdata();              else: ?>
Error
              <?php endif; ?>


How to edit a published post?

I'm writing a plugin. Can anyone please show me how to edit the content of a published post? I've tried using this:               function edit( $post_ID ) {     $content = "Hello. This is a test.";     $post_info = get_post($post_ID);         $post_info->post_content = "$content";     }          add_action('publish_post', 'edit');      Although I'm having no luck. Can anyone suggest how to get it working? Thanks for the help.


How do you find out which template page is serving the current page?

When you activate a wordpress theme, it's always a hassle to find out which file to go to change things. Any idea how to simplify things? But on the other hand, considering the get_template_part functionality, this may be impossible. What do you say?


Images get uploaded itself from the computer

I have a lot of images in my computer and I want to upload them to my website. For that I am looking for some automated plugin in which I can copy those images and it would upload them itself. Is there any Wordpress plugin that does it? ## EDIT To clearify what I want to achieve is, **When I drag and drop images to the FTP in a folder, all of those images get posted itself.** Thanks in advance.


WordPress Membership Plugin Advice

I need a plugin to allow every users to register and login to my site. I'm looking for a free alternative. I've google and found the following two alternative:   1. http://wordpress.org/extend/plugins/membership/   2. http://wordpress.org/extend/plugins/members/ Which of theme you think is better or do you have any other plugin in your knowledge than can better acheive this???


How do you allow plugins to be updated using the GUI without breaking your subversion repository?

Development on a WordPress installation is under Subversion version control. We're not using externals to link in the plugins - the plugins are getting installed / updated by non-developers in charge of content. This causes issues within the repository, especially for plugins that are already under version control and are just being updated to the latest version, since updating a plugin deletes the directory (including all the .svn folders) and then re-creates it. Here's a typical scenario, that's causing me no end of grief:   1. Put an existing WordPress site under version control in a fresh repo. This existing site ALREADY has some plugins. Some of those plugins are out of date   2. Now, go into the admin and update those plugins   3. run `svn st` and you see the following: ~ addthis ~ google-analytics-for-wordpress etc... The tilde ~ is especially nasty because it means "duh, I dunno wha happuh", and SVN just cacks. Even copying, deleting, removing, restoring, moving back, attempting to commit - nope. Many people recommend using svn:externals or manually FTPing the updates, which is all fine and dandy, but I'd just like to be able to use the UI as God intended. From what I can see in core, there's no hook that can be used to convince WP not to delete the folder, or the .svn folder. Is there something that can be done?


Multiple portfolios with one custom post type?

I wonder what's the right way of creating portfolio website (with as many portfolio pages I want). Usually I create page template that displays posts with category = `Portfolio` or with posts from Portfolio Custom Post Type. But what if I want multiple portfolios on my site? I know I can do it for example thru Theme Options page by assigning category to every portfolio page, but maybe there is a better way? Can I build mechanism like that:   1. I add page and choose "Portfolio" template.   2. After choosing template custom meta box appears. Inside custom box I have list of categories from my Portfolio Custom Post Type and I can choose which of the categories are displayed in this portfolio.


Disallow user registration/checkout via Hotmail/Yahoo

Hope someone can help or point me in the right direction... I'm looking to disable user registration on my website for users trying to register with Hotmail and Yahoo email addresses. It would also be a good idea to also provide a suitable error message to the user too, any ideas on how I'd go about doing this? I've seen the `user_register` hook, but not sure where to start...? All help appreciated, thanks in advance!


WP_Query older new links navigation?

I'm doing a custom query using WP_query to get posts from a specific category, but for some reason navigation links for the list don't appear. Is there a way to get the newer/older links to show up and work using a custom WP_query? This is what I'm doing:               <?php $mainList_query = new WP_Query('cat=4,352,731,754,49,44,54,17&showposts=200&order=DESC'); ?>     <?php if($mainList_query->have_posts()) : while($mainList_query->have_posts()) : $mainList_query->the_post(); ?>

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

<?php the_time('F jS, Y') ?> by <?php the_author() ?> at <?php the_time() ?>
         <?php if ( in_category( array(754,49,44,54,17) ) ) { ?>         <img src="<?php bloginfo('template_url'); ?>/images/360btn.jpg" width="67" height="16" alt="" />         <?php } ?>         <?php if ( in_category(4) ) { ?>         <img src="<?php bloginfo('template_url'); ?>/images/ps3btn.jpg" />         <?php } ?>
<?php the_tags('Tags: ', ', ', '
'); ?> Posted in <?php the_category(', ') ?>

                 <?php endwhile; ?>

<?php next_posts_link('« Older Entries') ?>

<?php previous_posts_link('Newer Entries »') ?>

                <?php else : ?>
Not Found

Sorry, but you are looking for something that isn't here.
            <?php get_search_form(); ?>                <?php endif; ?>


How can I make the page editor trust me?

I want two images to appear side-by-side. However, WordPress inserts a line- break between the elements, even if I use the HTML editor rather than the Visual editor. How can I make the editor trust that if I don't insert a line-break, I don't want it?


Unable to nest categories in menu

I have an issue with the new custom menu in WP3. Suddenly the nesting of categories stopped working and even though it's possible to nest them in the UI, when I press Save, then they all go back flat. Any chance someone has experienced this and know a way to fix it? Thanks.


The Difference Between Hierarchical and Non-Hierarchical Taxonomies?

The question is **_"What is the Difference Between Hierarchical and Non- Hierarchical Taxonomies?"_** This question really stumped me at first so I figured it would be a good idea to show the difference to others surfing the site looking for the distinction. Specifically the question is referring to the `hierarchical` argument passed to the `register_taxonomy()` function. More specifically, what's the difference between this: ## 'hierarchical' => false               register_taxonomy('movie-genre', 'movie', array(       'hierarchical'    => false,       'label'           => 'Genre',       'query_var'       => 'movie-genre',       'rewrite'         => array('slug' => 'genres' ),     ));      And this? ## 'hierarchical' => true               register_taxonomy('movie-genre', 'movie', array(       'hierarchical'    => true,       'label'           => 'Genre',       'query_var'       => 'movie-genre',       'rewrite'         => array('slug' => 'genres' ),     ));      Note I'm going to go ahead and answer my own question but won't mark it as best unless nobody else steps up with a really good answer too. Also my gut feeling tells me I might not have capture every distinction between the two dichotomies so if not please let us know what I missed.


Showing post thumbnail (attachment) on the archive.php category listing

I'm seeking to customize my categories listing (archive.php) so that it shows a thumbnail image of the first image attached to each post However, apparently the archive.php file is one of those that does not natively support the attachment object. For example, the code below will do most of what I want (though if no attachment is found, I get a blank image, I need to fix that). However, I'm afraid having a SELECT in a loop like this is perhaps way too expensive for what I'm trying to do. Any ideas?                   <?php while (have_posts()) : the_post(); ?>         <?php global $wpdb; $attachment_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_parent = '$post->ID' AND post_status = 'inherit' AND post_type='attachment' ORDER BY post_date DESC LIMIT 1"); ?>
                 <h3 id="post-<?php the_ID(); ?>"><img src="<?php echo wp_get_attachment_url($attachment_id); ?>" class="post-attachment" /><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
                 <?php the_time('l, F jS, Y') ?>
<?php echo $post->post_excerpt; ?>

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

         <?php endwhile; ?>


In a specific blog, the K2 theme does not have a Text Widget

I have a WPMu installation on a closed network, and one blog is using the K2 theme, but the Text Widget is not offered as an option. When I switch the theme to Default, the Text Widget is offered. If I use K2 on another blog in the installation, I can see the Text widget. Any ideas on why the Text Widget won't work on K2 on this specific blog?


Restricting a Plugin to Only Load its CSS and JS on Selected Pages?

I'd like to cause a plugin to restrict its loading of CSS stylesheets and JavaScript JS files to only those pages for which they are needed. An example for my question is the plugin Contact Form 7 which I've used to create a form in one page on my site (the "contact me" page). However it adds the following lines to EVERY page/post on the website:               <link rel='stylesheet' id='contact-form-7-css'  href='http://www.r-statistics.com/wp-content/plugins/contact-form-7/styles.css?ver=2.3.1' type='text/css' media='all' />           <script type='text/javascript' src='http://www.r-statistics.com/wp-content/plugins/contact-form-7/scripts.js?ver=2.3.1'></script>       This makes me suspect that this plugin is impairing my site's loading time, for an extension that interests me on only one page on the site. **Thus, my question is how can I remove these extra lines from all the pages except for the "Contact Me" page but without deactivating the plugin?**


Sorting within nested queries / multiple meta keys

I have the following ALMOST working perfectly, but have run into a couple of issues. Right now this displays a Books archive page, ordered like this: Genre Name -- Series Name --- Books within series, sorted by book-in-series (aka reading order) Which is fantastic - I can't tell you how long it's taken me to get to this point! :) But, I would also like to be able to determine sort order for the Series within each Genre. Is this possible? Right now it does not seem they are ordering by anything I can control; it's not by published-on date or alphabetically for instance. [SIDEBAR: I also have a question on how to display books which have not been assigned a "book in series" meta-key (they will be within a series called "Stand Alone Titles" but it doesn't make sense for the admins to have to give them book-in-series numbers). I first asked that question here but it might make more sense within the context of my full code, so I wanted to cross- reference it.] Here's my code:               // QUERY THAT PULLS ALL SERIES SORTED BY GENRE     $args = array(          'post_type' => 'series',          'posts_per_page' => -1,         'nopaging' => true,         'surpress_filters' => true,         'orderby' => 'meta_value',         'order' => 'DESC',         'meta_key' => 'genres',     );           $series = new WP_Query( $args);              if( $series->have_posts() ) : ?>              <?php             // ESTABLISH PREVIOUS GENRE AS SOMETHING IMPOSSIBLE (NOT BLANK)             $previous_genre = 'dfasd33';                  while( $series->have_posts() ) : $series->the_post();                 // Get custom post data to set current genre                 $current_genre =  get_post_meta( get_the_ID(), 'genres', true );                 if( $current_genre != $previous_genre ) {                     echo '
' . stripslashes($current_genre) . '
';                 }                 $previous_genre = $current_genre;              ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
                 <?php the_content(); ?>                      <?php                          $current_series_id = $series->post->ID;                          // QUERY THAT PULLS ALL BOOKS WITH PARENT ID OF CURRENT SERIES SORTED BY BOOK-IN-SERIES                     $args = array(                          'post_type' => 'books',                          'posts_per_page' => -1,                         'nopaging' => true,                         'surpress_filters' => true,                         'orderby' => 'meta_value',                         'meta_key' => 'book_in_series',                         'order' => 'ASC',                         'post_parent' => $current_series_id,                     );                          $books = new WP_Query( $args);                              if( $books->have_posts() ) :                               while( $books->have_posts() ) : $books->the_post(); ?>
<?php the_title(); ?>
                              <?php endwhile; //end book query while statement ?>                         <?php endif; // end book query if statement ?>                      <?php endwhile; // end series query while statement ?>          <?php endif; // end series query if statement ?>      Thanks for your help!


meta_query, number comparison, not quite working as it should

I have a wp_query that gets all custom post types in ascending order from today, to list some events on a site of mine. While this works fine:                $args = array( 'post_type'         =>  'events',                                     'posts_per_page'    =>  5,                                     'orderby'           =>  'meta_value',                                      'order'             =>  'ASC',                                     'meta_key'          =>  'my_special_date',                                     'meta_value'        =>  date('Ymd',strtotime("today")),                                     'meta_compare'      =>  '>=' );       I am not getting the same results when I convert this to using meta_query, like so:               array(  'post_type'         =>  'events',                     'posts_per_page'    =>  5,                     'orderby'           =>  'meta_value',                      'order'             =>  'ASC',                     'meta_query'        =>  array(                                                     array(                                                             'key'           => 'my_special_date',                                                             'value'         => date('Ymd',strtotime("today")),                                                             'compare'       => '>=',                                                             'type'          => 'NUMERIC'                                                             )                                                      )                           );       Note that I'm not comparing dates, I'm comparing numbers, as the date is in the Ymd format. the meta key is in this format. I am having some rather odd results from this - I can't quite work out what's wrong. Anything look obviously wrong to any of you?


Disabling HTML Filtering When Importing Into WordPress Multisite

A number of the sites I'm migrating to a WordPress Multisite instance have embedded videos and iframes within posts. Rather than convert each post to the kosher way of doing video embeds, I'd rather disable the WordPress functionality which strips out the embeds on import. Disabling the stripping when editing a post was as simple as disabling the kses filter. Unfortunately, I can't figure out what I need to disable for importing posts. At the moment I suspect the wp_insert_post() method but haven't narrowed down the filter. Any ideas? **Update:** This is specific to WordPress Multisite. Importing into a single WordPress site works just fine.


Show category and description

I am creating a theme, and I would like to show each category and its description in front page. I used the following code, but it is only showing one of the categories without a link to its page but a link for home page and also not showing the description.
         <a href="<?php echo esc_url( $category_link ); ?>">             <?php foreach( (get_the_category()) as $chaine ) {                  if($chaine->parent == 0){                      echo $chaine->cat_name . ' ';                  }             } ?>

         <?php echo category_description( $category_id ); ?>
      How shall I fix this?


Resizing Picture

I'm new to WP and am not sure how to re-size a picture. I want to scale down the pic of the guy on this page: http://www.millermusiclessons.com/ If you view the page source and find the source of the picture, it already has height and width attributes assigned to it. When I edit these attributes in Notepad++ and re-upload them to my server the page still looks the same (yes I am clearing my cache) How can I change these attributes? Any edits I make to to "index.php" never show up, but edits to "style.php" seem to always work. Thanks


Exclude categories from Loop, queries, widgets, post navigation

I recently ha a use case where I needed to prevent a certain category from being displayed in the front-end. In detail I needed to exclude posts assigned to that category from   * the main query (“the Loop”)   * search queries   * category queries   * archive queries   * post navigation (`next/prev_post_link()`) and the category name itself from being displayed as item of   * `the_category()` in theme templates   * the Categories Widget (list and drop-down) As a consequence I pretty soon found myself on a quest the results of which I’d like to share here and expose to further feedback.


How to setup different permlalinks for posts and pages?

I'd like to setup:               www.mydomain.com/a-page/     www.mydomain.com/blog/category_name/     www.mydomain.com/blog/category_name/post_name/     www.mydomain.com/custom_post/post_name/      How would I do it? Thanks in advance


Extra profile field as select box?

I want to add some more profile fields to Wordpress. It works fine with normal text box:               <input type="text" name="gender" id="gender" value="<?php echo esc_attr( get_the_author_meta( 'gender', $user->ID ) ); ?>" class="regular-text" /><br />      But of cause I don't want my users to enter "male" or "female". So I need a select box! :) May you please help me how I have to change the code above to get a select box?! Thanks a lot!


Page load timer?

Ok, so I'm confused as to what's going on here... I've been trying for hours now to get a relatively accurate page load timer setup on my WordPress site, but nothing is working like it's supposed to. I've added this code to my theme's header.php file as the very first block of code:               <?php       $exectime = microtime();       $exectime = explode(" ",$exectime);       $exectime = $exectime[1] + $exectime[0];       $starttime = $exectime;      ?>      and then I added this block of code as the very last thing in my theme's footer.php file:               <?php       $exectime = microtime();       $exectime = explode(" ",$exectime);       $exectime = $exectime[1] + $exectime[0];       $endtime = $exectime;       $totaltime = ($endtime - $starttime);       echo '<!-- page rendered in '.$totaltime.' seconds -->';     ?>      but rather than getting a somewhat accurate representation of how long it took the page to load, I'm getting these gargantuan numbers that I know aren't even close to accurate... Here's one example result:                 </body>      </html>     <!-- page rendered in 1321818086.6252 seconds -->


Get a path to a different plug-in

To get a the path to a plugin you can use `plugin_dir_path(__FILE__)` - but this obviously has to be called from within the plug-in. How can you _reliably_ get the path to plugin B (`pluginb/pluginb.php`) from within plug-in A? **Edit:** Its assumed you know the slug of the plug-in you're after (actually you can get them from `get_plugins()`). But I would like it to work generally.


Unable to upload specific .zip file type via frontend in WordPress 4.0

I allow uploading a selected few types of files from the frontend, e.g. .zip, .mp4, .jpeg and .pdf. Till now all these file types had no issues getting attached to the post it is uploaded to. However after upgrading to WordPress 4.0, I have not been able to upload specific .zip file type from the frontend, although it uploads well from the backend using media-upload interface. Please note that the other file types **.mp4 and .pdf files still attach with no issues.** Given below is the entire code that performs the attachment function.               if ( isset( $_POST['upload_attachments'] ) && $_SERVER['REQUEST_METHOD'] === 'POST' && wp_verify_nonce($_POST['secure_upload'], 'upload_attachments_nonce')) {              //checking if upload is empty         //checking if filesize is valid              if ($_FILES) { //http://wordpress.stackexchange.com/questions/39753/                        //loop through multiple files.                      $files = $_FILES['upload'];             foreach ($files['name'] as $key => $value) {                 if ($files['name'][$key]) {                     $file = array(                         'name'     => $files['name'][$key],                         'type'     => $files['type'][$key],                         'tmp_name' => $files['tmp_name'][$key],                         'error'    => $files['error'][$key],                         'size'     => $files['size'][$key]                     );                          $uploaded_file_type = $files['type'][$key];                     $image_file_types = array('image/jpg', 'image/jpeg', 'image/png');                     $appnvid_file_types = array('application/pdf', 'application/zip', 'video/mp4');                     $uploaded_file_size = $files['size'][$key];                     $size_in_kb = $uploaded_file_size / 1024;                     $image_size_limit = 1000; // Your Filesize in KB                     $appnvid_size_limit = 25000;                          if (in_array($uploaded_file_type, $image_file_types)) {                          if( $size_in_kb > $image_size_limit ) {                             $upload_error .= 'Image files must be smaller than '.$image_size_limit.'KB';                             return;                         } else {                             $_FILES = array("upload" => $file);                             foreach ($_FILES as $file => $array) {                                 $newupload = insert_attachment($file,$post_id);                                 //return; this loop neds to run multiple times so no return here                             }                               }                          } elseif (in_array($uploaded_file_type, $appnvid_file_types)) {                         if( $size_in_kb > $appnvid_size_limit ) {                             $upload_error .= 'File must be smaller than '.$appnvid_size_limit.'KB';                             return;                         } else {                             $_FILES = array("upload" => $file);                             foreach ($_FILES as $file => $array) {                                 $newupload = insert_attachment($file,$post_id);                                 header ('Location: ' . $_SERVER['REQUEST_URI']); //Post, redirect and get                                 exit();                                 //return; //run this loop only once for application and video file type.                             }                         }                          } else {                          $upload_error .= 'Invalid File type';                     }                 }             }         }                                header ('Location: ' . $_SERVER['REQUEST_URI']); //Post, redirect and get         exit();     } //end of nonce check      Here is the code for upload helper `insert_attachment` function by goldenapples               function insert_attachment($file_handler,$post_id,$setthumb='false') {              // check to make sure its a successful upload         if ($_FILES[$file_handler]['error'] !== UPLOAD_ERR_OK) __return_false();              require_once(ABSPATH . "wp-admin" . '/includes/image.php');         require_once(ABSPATH . "wp-admin" . '/includes/file.php');         require_once(ABSPATH . "wp-admin" . '/includes/media.php');              $attach_id = media_handle_upload( $file_handler, $post_id );              //if ($setthumb) update_post_meta($post_id,'_thumbnail_id',$attach_id);         return $attach_id;     }      The .zip file is not getting uploaded at all, otherwise I would find them in media-library ,even if unattached. When I try to upload a .zip file in the frontend, it simply returns the error invalid file type. As you can see this line clearly defines all three file types: `$appnvid_file_types = array('application/pdf', 'application/zip', 'video/mp4');` and this other line checks the inserted files: `elseif(in_array($uploaded_file_type, $appnvid_file_types)){` So how come the .mp4 and .pdf gets attached fine and .zip does not? If there was a mistake in the loop, no file-types would be uploaded at all. Also the fact is .zip files had been uploading fine till yesterday. I am clueless to what is happening. A little help will be appreciated please. * * * Just in case I checked for allowed file types and it lists .zip file type as allowed.               <?php $allowed_mimes = get_allowed_mime_types();             echo '<pre>';             print_r($allowed_mimes);             echo '</pre>';             ?>      Is it possible that wordpress might have made some changes in `image.php` or `file.php` or `media.php` that would block specific file types to be uploaded in the frontend ?


Retrieve a specific post's featured image and show on a different page

What I'm simply trying to do is grab the featured image thumbnail image from a specified post/page and display that image on any other page somewhere. So for instance, if it's a single post, use the thumbnail from post 9. If it's this page, use the thumbnail from 82, and so on. It doesn't seem as simple as this:               $thumbnail_id = get_the_post_thumbnail(82);      Because I've tried that and it doesn't work in all scenarios. Is there a universal way to do this?


Customizing Titles on the Fly with Code

I hope this question is easy. I want to customize my theme so that the post titles are created on the fly with code. For example, I might have a post where a price changes on the page 4 times a week, and I want to be able to change my to say: Get Product X for $19.99 without having to manually edit a meta variable... Is it possible to do? Is there a wordpress function I can call to override the title using a plugin?


Looping through 3 recent posts but separating them into separate divs

I am trying to loop through 3 posts, but separating each one into it's own div as some jQuery will show and hide one at a time. I've created the code to show one, but separating them I am unsure of.
         <?php         // Create a variable to hold our custom Loop results         $excludes  = array('4135');         $frontpageposts = get_posts( array(               'numberposts' => 1, // only the 3 latest posts              'post__not_in' => $excludes         ) );              // Create output only if we have results         // Customize to suit your HTML markup         if ( $frontpageposts ) {                    foreach ( $frontpageposts as $fppost ) {                    // setup postdata, so we can use template tags                   setup_postdata($fppost);                   ?>                        <div <?php post_class(); ?>>
<a href="<?php the_permalink(); ?>"><?php //the_title(); ?>Latest News #1

                             <?php                                                                                $content = $post->post_content;                                     $searchimages = '~]* />~';                                          /*Run preg_match_all to grab all the images and save the results in $pics*/                                          preg_match_all( $searchimages, $content, $pics );                                          // Check to see if we have at least 1 image                                     $iNumberOfPics = count($pics[0]);                                          if ( $iNumberOfPics > 0 ) { ?>                                                                                <img src="<?php echo catch_that_image() ?>" alt="<?php the_title(); ?>" />                                     <?php }                             ?>                             <?php //the_excerpt(); ?>

              <?php }         }          ?>
      I've changed the 'numberposts' to one in this instance as showing 3 here will display all 3 within the first news-container-1 div. The other two divs are:


How should I get the original comment while processing the reply

I'm working on a comments section for my template. And I need to do something like this:    **Comment:**   _-This was my original comment_   And this is my reply to the original comment.         So I wanna cite the original comment inside the comment that was a reply to the original comment. I `var_dump`ed through everything that `get_the_comment();` returns and failed to find any reference to the initial comment whatsoever. Can you please assist me with that? Cheers!


Delete user account - If user has attachments uploaded then redirect (with a message)

this is what im doing... In BuddyPress, before delete user account, if a user has attachments previously uploaded, he or she will be redirected to their own attachments list:               function custom_get_count_before_delete() {              global $bp, $wpdb;              $user_id = $bp->loggedin_user->id;              return $wpdb->get_var( $wpdb->prepare( "           SELECT COUNT(DISTINCT p.ID)              FROM $wpdb->posts p              WHERE p.post_author = %d                AND p.post_status = 'inherit'                AND p.post_type = 'attachment'", $user_id         ) );          }               function custom_check_delete_account () {              global $bp;              if ( $bp->current_component == 'settings' && $bp->current_action == 'delete-account' ) {                  if ( $count = custom_get_count_before_delete() ) {                      wp_redirect('http://www.mysite.lh/wp-admin/upload.php', 301 ); exit;                  }              }               }          add_action('init', 'custom_check_delete_account', 11);      My question is: How do I set or inject a message or warning message before to redirect and print it after redirect on the "/wp-admin/upload.php" list of attachments? Thanks in advance.


Change the $parent_file of a plugin page

I have a plugin that has 3 pages. One of those pages, I don't want displayed in the admin menu (working), but when a user is on that page, I want the plugin menu to be active. I'm using the `parent_file` filter, but it isn't working. I've had a look in the core, and alghouth the filter seems to be accepting the correct value (`$parent_file = 'charts'`), by the time the menu is being output, something else has changed it back (`$parent_file = 'edit-chart'`).               /**      * Highlight the 'Charts' top level menue when viewing the 'Edit Chart' page      */     function on_menu_parent($parent_file) {              global $current_screen;              $base = $current_screen->base;         if($base == 'admin_page_edit-chart') :             $parent_file = 'charts';         endif;              return $parent_file;          }      The filter, called from the Plugin Class constructor is this -               add_filter('parent_file', array(&$this, 'on_menu_parent'));      Does anybody know how to get this working correctly? Thanks.


Creating a metabox to upload multiple images, Ignoring The Featured Image

My question is basically identical to this other question here, however my question is still slightly different. I basically have a custom post type called "Packages" each package can have a slideshow with its own images. I understand the images are uploaded through the media uploader (as per the associated questions chosen answer), however is it possible to only get a list of images attached to the post that AREN'T the featured image? My understanding is that the answer given to the other question would get all images including the featured image, does Wordpress treat featured images differently in the background so I can exclude them?


other shortcodes in Contact form 7 MAILS

How to use other shortcodes inside Contact form 7- forms? indeed explains how to use other shortcodes inside Contact Form 7 forms. But that doesn't make them usable in the mails that Contact Form 7 sends on submission of the form. How do I make them work there too?


How can I display wp_link_pages before a shortcode, if it is used, or display after content?

I have the following shortcode in my content               [src]Some Link, Some Other Link[/src]      My post structure looks like this:               <?php echo $content; ?>     <?php wp_link_pages();?>      If that shortcode is being used in the content, I'd like for wp_link_pages to appear before it, if not, I would like it to display after the content. What's the best way to achieve this?


Set attached to state

In the media library every attachment post has an "Attached to" column. I've developed a plugin that adds author profile and a facebook like banner image. I now discovered that the attachment posts, that are used as profile pictures, are not marked as "attached to". I used a wordpress console plugin to get `WP_Post` objects of a linked and of an unlinked attachment. But I couldn't find any difference between them that I could use to set it manually. Is there any way to set the attached ststus of attachment posts?


Recent posts on a static home page

I want a static home page on my wordpress website, I have already set this up and have a bit of content on it, the next step is I want to have 5 recent posts underneath the content. As a normal page this is no problem, as soon as I set the page to a static home page, the posts disappear. From hours of searching I am aware that I need 'multiple loops' in my template, I have found a few examples and tried to implement them in my template with no success. I think I pretty much have the code to bring the recent posts through, bust I think I'm having trouble markup and template tags to actually show the posts. I hope this isn't too complicated to understand, and i really appreciate any help, I've been at this for 2 days with no progress at all. I can supply any code needed from templates or anything else. My website - www.completemuscleandfitness.com Ok, this is what i have so far               <?php     $args = array( 'numberposts' => '5' );     $recent_posts = wp_get_recent_posts( $args );          foreach( $recent_posts as $recent ){     echo '
' .   $recent["post_title"].'
 ';     }             which shows this - www.completemuscleandfitness.com How can i get it to look nice like the other post pages?


Get Image Description

I'm trying to make a post split in 2 columns. The first and left one is going to be any image inside the post, and the second and right one will be `the_content()` (excluding the images). So as of now I have no problem pulling all the images. However - I can't seem to get the image caption or title or description. Heres my code:               <?php if ( $images = get_posts(array(             'post_parent' => $post->ID,             'post_type' => 'attachment',             'numberposts' => -1,             'orderby'        => 'title',             'order'           => 'ASC',             'post_mime_type' => 'image',         )))         {             foreach( $images as $image ) {                 $attachmenturl = wp_get_attachment_url($image->ID);                 $attachmentimage = wp_get_attachment_image_src( $image->ID, full );                 $imageDescription = apply_filters( 'the_description' , $image->post_content );                 $imageTitle = apply_filters( 'the_title' , $image->post_title );                 $i++;                 if (!empty($imageTitle)) {                     echo '

» '.$imageDescription.'

';     } else { echo '' ; }             }         } else {             echo 'No Image Found';         }?>


Bootstrap 3 and Wordpress menu navigation menu highlighting

I am using Wordpress 3+ and Bootstrap 3. To generate the menus I am using the Bootstrap navwalker and the following code...               <?php $args = array('theme_location' => 'primary',     'container_class' => 'navbar-collapse collapse',      'menu_class' => 'nav navbar-nav',     'fallback_cb' => '',     'menu_id' => 'main-menu',     'walker' => new wp_bootstrap_navwalker());      wp_nav_menu($args); ?>      This works great and highlights the menu item when in that section correctly on a parent page, but on a child page, I can't work out how to highlight the menu item. Any ideas? Basically I have a menu item called 'NEWS'. When i click into a single post in the NEWS section, i want the menu item 'NEWS' to be highlighted like it is on the news post page.


Determine if more posts are available than was asked for in `query_posts()`?

I'm getting products (from a specific category) using a custom `query_posts()` function. I limited the `showposts` parameter to 25, so how do I know to activate pagination if there are still products (posts) to load? My `query_posts()` code looks as follows:               $args = array(         'post_type' => 'product',         'taxonomy' => 'product_cat',         'term' => $idObj->slug, // category slug         'showposts' => 25,         'orderby' => 'title',         'order' => 'asc',         'paged' => $paged  // global $paged variable     );          $all_products = query_posts( $args );      And then I output my products using a `foreach` statement:               foreach ($all_products as $product) {...}      I put this function in my **functions.php** , but `$paged` nor `$max_pages` don't seem to be set. So I get `false` from this function. Now, can anyone maybe point me in some direction, as I've got no clue.


Using jQuery to delete data stored in wp_options

I wonder if anyone could advise me further on my problem. Part of my plugin stores log files for debugging purposes. I have successfully displayed them in a (div#log) in my admin page using jquery and wp_localise_script. I have a button to delete these logs but I am unsure how to process this. I have a feeling that ajax might come in handy here but not sure where to start. Here is the relevant parts of my code: **admin_enqueue_scripts (action)**                $args = array(get_option('wow_tweets_log'));//log files fetched from wp_options table             wp_enqueue_script('wow_tweet');//registered earlier on with jQuery dependency         wp_localize_script('wow_tweet', 'wow_vars', $args);      **Admin Page**
Debugging
Debug

Hide

Empty Log

      **Javascript**               jQuery(document).ready(function() {               var debug_show = jQuery('#log').hide();//hides log by default              jQuery('#debug').click(function(){//on click shows logs files in div#log             for (var i = 0, l = wow_vars.length; i < l; i++) {                 var data = wow_vars[i];             }             jQuery('#log').show().html(data);              });         jQuery('#hide_debug').click(function()         {             debug_show.hide();         });      });      **Action to clear log**                function clear_log(){         delete_option('wow_tweets_log');//am stuck on how to invoke this              /*die();  would go at the end if ajax used*/      }      add_action('clear_log','clear_log');      So far this script is working to show all the log files, now all I need is to delete them when clicking #clear_log. I know plugging a do_action on init will delete them as soon as the page loads, making my javascript useless so I guess the only option is ajax! Do I need to add another reference to wp_localize_script()? Any help would be appreciated.


Hiding WordPress behind IIS redirects

We have a main .NET application that I do not have much ability to change, but we would like to move some of the links that are on it to WordPress so that marketing can update them on a regular basis without involving a developer. For security reasons, I can't install WordPress on the servers with the main application. Has anyone ever used URL rewriting rules in IIS to mask a WordPress site on a different server?               example: http://www.dominan.com/Info -> http://www2.domain.com:8080/About-Company      or               example 2: http://www.dominan.com/Info -> http://192.168.x.x:8080/About-Company


Is possible to create a custom link that creates a post that's already categorized?

I know this is not really a coding question but here goes. So is it possible to add a link to the WordPress Admin Sidebar that links to a New Post page that is automatically categorized as a category "team"? I can add the sidebar link easily with this code               add_action( 'admin_menu', 'register_team_page' );     function register_team_page(){         add_menu_page( 'Team Menu Title', 'Team menu', 'publish_posts', '#link-goes-here', '', "", 6 );     }      I am trying to figure out how to properly link to a New Posts page with the category "team" preselected.


How can I add custom meta on signup page and pass along to be used after blog activation?

I am trying to customize a signup process for our MultiSite Network I need to be able to assign levels based on a choice at signup. My thought is to add a field (hidden or otherwise) that holds the chosen level during signup, and assign that to the registering user somehow, (via meta?) and have that passed along when creating site. I assume there should be a way as their username and email is passed to the database right? Then when they activate their new site via activation link email, I could run a custom function, (there must be a hook for after site creation) that would grab that meta value I passed along use it in a custom function post activation. Does this make sense? Thank you for any input!


Login with email (WP Modal Login)

I'm trying to fork this plugin to use the user email to login, as opposed to Username. The plugin is http://wordpress.org/plugins/wp-modal-login/ Is there a nice way to do this, perhaps by a filter to get this plugin to work with email credentials? I've tried using this filter:               function custom_login() {       $data = array();               $data['user_login']     = sanitize_user( $_REQUEST['username'] );       $data['user_email']     = sanitize_user( $_REQUEST['user_email'] );       $data['user_password']  = sanitize_text_field( $_REQUEST['password'] );       $data['rememberme']     = sanitize_text_field( $_REQUEST['rememberme'] );       $data['user_login']     = sanitize_user( $_REQUEST['user_email'] );       $user = wp_signon( $creds, false );       if ( is_wp_error($user) )         echo $user->get_error_message();     }     // run it before the headers and cookies are sent     add_action( 'after_setup_theme', 'custom_login' );


Settings API - generating field value based on a different field?

I store my themes settings using Settings API. If I create a new setting using add_settings_field() is it possible to create another setting that will be based on the first one? Why? Imagine I have three settings:               main_color     lighter_color     darker_color      User opens Theme Options page and sets **main_color** to #444. Now I want **lighter_color** and **darker_color** to automagically change values based on main_color value (#444) so after all it looks like this:               main_color = #444     lighter_color = #777     darker_color = #111      Of course I could make 3 different settings and let user pick all the colors, but it won't be that user-friendly and the whole theme will look messy if he sets lighter_color to something darker than main_color. etc. Any ideas? :) Maybe using a callback? **UPDATE** Starting bounty. In short words - I have some settings stored in Settings API and I want to store their slightly modified versions somewhere else, I need full and easy access to these modified values, and they should update every time their Settings API "parents" do.


How to notify specific users when i'm posting/modifying a new post

Here's what I'm trying to do... I'm trying to send new submissions only to contractors requested. Using Role Scoper, I can select only users who can access the new submission. However, I am looking for a way to notify users via email when a new submissions is placed online. I can not make "groups" because it is not specific groups but strategically chosen when a new submissions is placed online. After a long search, I ask you, how can I sent an email to registered users. Ideally I would like to have the option to select users directly in the article as Role Scoper does.


Target "admins" with different styles on the front end

I'll first explain what i'm trying to do. I am building an intranet for a client. They do not want employees to be able to edit their profiles or upload avatars, just "admins" should be able to do that. To disable this, i'm going to `display: none` the edit profile and upload avatar buttons by default. I want these to then show for logged in admins -- so they can edit profiles. I didn't see any body class added to logged in admin users, so I was thinking I could add a CSS file for logged in admin users that displayed the hidden div. I am also using WP Engine, I don't know if this is affected by their caching or not. How can I accomplish this?


Get the excerpt for a post created by the related author

This has been bugging me for ages and can't quite get it working. I'm using the following code in my functions file to enable me to display posts created by the same author as the current single post.               function get_related_author_posts() {     global $authordata, $post;          $authors_posts = get_posts( array( 'author' => $authordata->ID, 'post__not_in' => array( $post->ID ), 'posts_per_page' => 1, 'post_type' => 'artistblog' ) );               foreach ( $authors_posts as $authors_post ) {         $output .= '
ID ) . '">'. get_the_post_thumbnail( $authors_post->ID,'medium' ) .'

ID ) . '">' . apply_filters( 'the_title', $authors_post->post_title, $authors_post->ID ) . '
';          }               return $output;     }      This works nicely. However I also want to display the automatically trimmed excerpt for each post. I've tried various methods and none of them have quite worked. Can anyone help with this please?


Get only used meta_values

this is how I'm getting the meta values:               $apart_locations = $wpdb->get_col( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key = 'postal_location' ORDER BY meta_value ASC" );      This is how I'm getting the published posts of a custom post type:               $apartments = $wpdb->get_col( "                     SELECT DISTINCT( post_id )                      FROM $wpdb->postmeta                      WHERE meta_key IN( $fields_string ) AND                            post_id IN ( SELECT ID FROM $wpdb->posts                            WHERE post_type = 'tvr_apartment' AND                                  post_status = 'publish' ) ORDER BY rand() " );      So my concern here is how can i get the meta_values only from the ones that are used by at least 1 published post? any idea how? -EDIT- I'm trying to Do this because the first query returns metas that are unnused: ![enter image description here](http://i.stack.imgur.com/FnrXS.png)


Wp favorite posts get user favorites in profile using buddypress

Im currently encountering a problem i display user wp favorites posts fine, but the issue is i wont display them, once users are logged out it says " no posts have been made" while each user has their own posts also once im logged in i can display my favorite posts in my profile but once i visit another profile it displays my favorite posts once again it should display the user's favorite posts instead of mine i have tried `bp_displayed_user_id();` but it doesn't seem to do the job, not working at all so i hope someone can solve my problem please... here's the code itself im using to display the favorite posts on the profiles

<?php _e('Items You Follow', 'bd_lang'); ?>

                  <?php $favorite_post_ids = wpfp_get_users_favorites();             if($favorite_post_ids) { ?>                          <?php foreach ($favorite_post_ids as $o) : $p = get_post($o); if ($p->post_status == 'publish') { ?>
                                                               <?php if(has_post_thumbnail($o)) { ?>
                                     <a href="<?php get_permalink($o); ?>" title="<?php echo $p->post_title; ?>">                                         <?php $image = vt_resize(get_post_thumbnail_id($o), '', 50, 0, true); ?>                                         <img src="<?php echo $image[url]; ?>" width="<?php echo $image[width]; ?>" height="<?php echo $image[height]; ?>" alt="<?php if(get_post_meta(get_post_thumbnail_id($o), '_wp_attachment_image_alt', true)) { echo get_post_meta(get_post_thumbnail_id($o), '_wp_attachment_image_alt', true); } else { echo $p->post_title; } ?>" />
                                               <?php } ?>                                                               <a href="<?php echo get_permalink($o); ?>" title="<?php echo $p->post_title; ?>"><?php echo $p->post_title; ?>
                          <?php } endforeach; ?>                  <?php } else { ?>
                     <?php _e('Your are not currently following any items.', 'bd_lang'); ?>
                  <?php } ?>