I am unable to save my data from a form

For some reason I am unable to save the data from my form:               add_action( 'admin_menu', 'example_menu_settings' );          /** Step 1. */     function example_menu_settings() {         add_options_page( 'example Plugin Options', 'example', 'manage_options', 'example-settings', 'example_plugin_options' );         add_action( 'admin_init', 'register_example_settings' );     }          /** Step 3. */     function example_plugin_options() {         if ( !current_user_can( 'manage_options' ) )  {             wp_die( __( 'You do not have sufficient permissions to access this page.' ) );         }              $client_id = get_option('example_client_id', '');         $secret = get_option('example_secret', '');              echo '

example Plugin Settings

             <form method="post" action="options.php">';             settings_fields( 'example-settings-group' );             do_settings_sections( 'example-settings-group' );             echo '<input type="hidden" name="option_page" value="general"><input type="hidden" name="action" value="update"><input type="hidden" id="_wpnonce" name="_wpnonce" value="103f63adef"><input type="hidden" name="_wp_http_referer" value="/example-Blog/wp-admin/options-general.php">

                 Client ID	                 <input name="example_client_id" type="text" id="example_client_id" value="' . $client_id . '" class="regular-text">

                 Secret	                 <input name="example_secret" type="text" id="example_secret" value="' . $secret . '" class="regular-text">

Your keys is found inside your example account settings.

                 <button id="example-test-connection" class="button">Test connection</button>';                 echo submit_button();             echo '</form>
';     }          function register_example_settings() { // whitelist options       register_setting( 'example-settings-group', 'example_client_id' );       register_setting( 'example-settings-group', 'example_secret' );     }      Here is the error I get:               Are you sure you want to do this?          Please try again.      This is the /wp-admin/options.php page. What am I doing wrong?


SQL to update custom post taxonomies

I have a custom post "review". It uses the same categories and tags from default posts, so they share "category" and "tag" taxonomies. But later I changed the "review" register to have their own taxonomies, "review-category", and "review-tag". Of course all tags and categories previously assigned on reviews was unbind from them. So the question: how can I (if possible) convert all tags and categories only in reviews to the new taxonomies? If I wasn't clear enough:               UPDATE wp_term_taxonomy SET taxonomy='post-tag', parent=0 WHERE taxonomy='tag';      This can convert all "category" to "post-tag", but I need to do it only for reviews. Something like (it doesn't work):               SELECT FROM wp_posts WHERE post_type='review'(     UPDATE wp_term_taxonomy SET taxonomy='post-tag', parent=0 WHERE taxonomy='tag';      ) Thank you!


Getting attachment images is cloning some of them

So, i got this code to retrieve the images inserted in a gallery within a post:               <?php     $args = array(         'post_type' => 'attachment',         'numberposts' => -1,         'post_status'=>'inherit',         'post_mime_type' => 'image',         'post_parent' => $post->ID,         'orderby' => 'menu_order',         'order' => 'ASC'     );     $attachments = get_posts($args);     if ($attachments) {         foreach ($attachments as $attachment) {             $image_attributes = wp_get_attachment_image_src( $attachment->ID, 'full' );             ?><img title="<?php echo $attachment->post_title; ?>" src="<?php echo $image_attributes[0] ?>" /><?php         }     }     ?>      and the output if fine, except that some pictures are duplicated and given a `class="cloned"` attribute. This code is running within a basic loop:               <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>      with no extra special things before and after. This is happening locally and online as i wanted to be sure about this weird thing; here's the demo. If you inspect the code you'll see this:                                         But if you check the source code you wont see the `class="cloned"` i'm speaking of (devil inside!). It's driving me a bit crazy cos it's messing up with the pictures order in some cases and this one has to be respected from the order decided in the gallery's options. I checked with Opera, Chrome and Firefox, and all show me the same thing. Any clue?


White screen and can't activate themes and plugins

I have a newly installed Wordpress website. The problem is the front end is just showing a white blank screen. I can access the admin dashboard, and when I went to Themes I got this error. > ERROR: The theme directory "twentyfourteen" does not exist. ![enter image description here](http://i.stack.imgur.com/vJBBA.png) I can install a theme, but I can't activate them and everytime I try I always get this message. > Cheatin uh Same thing for plugins, I can install a plugin but I can't activate them and I always get this message... > The plugin does not have a valid header. Any help would be appreciated.


WordPress plugins not showing after switching servers

So I recently moved my site to a new server, and now some of my plugins will show only if you are logged in as admin, but will not show to the regular user. However, some plugins still show and work fine. I have already reinstalled and that hasn't done anything. Any ideas? Thanks!


To whom do emails get sent via the Wordpress comments form?

I am working on a Wordpress 3.9.1 site, specifically the comments form. I have a copy of the site on my server and I want to test the form in the following three ways:   * Adding a new comment   * Replying to a comment   * Replying to a reply of a comment To do so, I want to be careful not to send many emails out to the site owner, and I want to be **very** careful not to send any out any email to site users. I see under site > admin that there are options to "E-mail me whenever":   * Anyone posts a comment   * A comment is held for moderation  These are both unchecked. My question is whether there is anywhere else I should worry about emails being sent (eg if someone replies to a user, does the user get sent an email?)


How to change title tags on paginated posts?

I've created many post with multiple pages with the nextpage-tag. The problem is that these show up as errors in "Google Webmaster Tools" because of duplicate title tags and meta descriptions. The urls are like this:               http://mypage.com/mypost/     http://mypage.com/mypost/2     http://mypage.com/mypost/3      all of which have the same title and meta tags. Is it somehow possible to include the page number to the meta tags? I'm using the "WP SEO" which surprisingly doesn't have this feature.


A carousel slideshow plugin in JavaScript

Am looking for carousel slideshow plugin that is similar to the one implemented here. Any JavaScript slideshow that closely resembles that one would do. It does not even have to be a WordPress plugin, any standalone JavaScript library would also be very useful.


Pull a post based on a meta value in a custom post type

I'm trying to display a post, from a custom post type based on a meta value in that post type, in this case a checkbox that says "if this is checked show it on the front page. Usually I write a query using meta_key = > front_event value => true. But this does not work for custom post types. So I have this:               <?php          $event =array(         'post_type' => 'Events',         'posts_per_page' => 1,         'order' =>'DESC',         'meta_query' => array( array(                 'key' => 'front_event',                 'value' => true ))         );?>      This also does not work. Can anyone tell me what I should be doing differently? Thank you! Nadine.


Wordpress adds extra width to post images container boxes

when I insert an image into a post, the `<div>` that contains that image (and thus any caption) is set to be wider that the image itself. For example, I have added an image that is 211px wide. The `<div>` that houses the image has an element style of 221px. Is there a way, other than using javascript, to remove that, and have the box of equal width to the containing image?


Thumbnails appear to be zoomed

Im using a theme which has my thumbnais set to 150x150px. But after installing plugin (just too check it out) I noticed it displays them correctly, but the default thumbnails are zoomed in. Can anybody give me a clue on where I should be looking? This is the css for the thumbs:               #content .featured_box { width: 150px; float: left; margin-right: 14px; color:#afafaf; }     #content .featured_box img { width: 150px; height: 150px; }     #content .featured_box p { font-size: 11px; color:#afafaf; }     #content .last { margin-right: 1px; }     #content .first { margin-left: 1px; }          .recent_box { width: 150px; float: left; margin-bottom: 15px; }     .recent_box img { width: 150px; height: 150px; }     .recent_box h3 a { font-size: 13px; color: #000; text-decoration: none; }     .recent_right { float: right !important; }      Edit: Im still no further forward with this, can anybody else think of anything else why/how this would be happening? Could it be down to the video thumbnail is 16:9 and the thumbail is 4:3? Here is the php stuff also:               <a href="<?php the_permalink(); ?>"class="img_hover_trans"><?php the_post_thumbnail('featured-small'); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
      edit 2: I found this in my functions.php               if ( function_exists( 'add_theme_support' ) ) { // Added in 2.9       add_theme_support( 'post-thumbnails' );       add_image_size('featured-big',335,338,true);       add_image_size('featured-medium',284,176,true);       add_image_size('featured-small',150,150,true);       add_image_size('featured-sidebar',58,58,true);       add_image_size('featured-blog',336,157,true);       add_image_size('recent-sidebar',150,150,true);     }      edit 3: Strange on this, but if I change one of the above lines to:                 add_image_size('featured-small',200,150,true);      It displays in the correct aspect ratio (even though its set to 150x150 everywhere else). I dont know why that works, but it does.


Phantom page can't get rid of/can't get at to change

Hi: I need to add a page to my very first WP site, which, at present, only has 4 pages on it (though one page has photo albums on it, which generate their own pages). I built the theme, the site is very simple, and up until now, has been fine. But now I seem to have a phantom page I can't find, can't delete, and can't change. The site is at http://www.twistintomradio.com If you type in another nonexistent page url in a browser, such as: http://www.twistintomradio.com/about.html, you get a 404 page, as is proper. But if you type in: http://www.twistintomradio.com/mountainrose.html, you get a page with the mountain rose logo that I placed on the homepage. I don't remember creating this page, but if I did, I deleted it as it does not come up when I go to "ALL Pages" in the Admin. But I want to build that page now. But when I "ADD NEW" page and name it mountainrose.html, the page with the logo appears in my browser, no matter what I do. I've cleared the caches in different browsers, on different computers, etc. I've cleared the WP cache (using Quick Cache plugin.) That page still comes up. I've trashed and permanently deleted this attempt to build the page now, it isn't in my list of pages, it isn't in the trash, but still the page comes up in browsers. I've looked on the server in the wp-content directory - no such page there. Where is this page coming from? How can I get rid of it? Thanks for any assistance!


How to show wp.me shortlink underneath each post?

What is the variable that holds the wp.me url? / What is the webservice / call that provides me the wp.me url? / What is the workaround to read that rel tag from the dynamic generator header (on a self hosted domain). ... to show it beneath each post.


Custom Post Type archive-{post-type}.php not working

My permalink is set to a custom structure: /blog/%year%/%monthnum%/%day%/%postname%/ I have a custom post type we'll call "post-type". I also have an archive page named archive-post-type.php Accessing domain.com/post-type/ though is defaulting to archive.php and skipping archive-post-type.php My register_post_type looks like this:                   register_post_type( 'ch_post_type',         array(             'labels' => array(                 .......             ),         'public' => true,         'has_archive' => 'post-type',         'show_in_nav_menus' => false,         'menu_position' => 100,         'menu_icon' => 'dashicons-category',         'supports' => array('title','editor','custom-fields'),         'rewrite' => array( 'slug' => 'post-type', 'with_front' => false ),         'hierarchical' => true         )     );      Under Settings > Reading, I have a Page set up for Home and Blog. I've flushed my permalinks as well. I know others have had this problem and I have not yet seen an answer that solves it. I'm on version 3.9 Thank you in advance!


Display Registered Taxonomies

Another question. I have a custom post type called "Articles" Within that I have registered some taxonomies using register_taxonomy called "Article Topics" So my client would pop over to Articles, put in a new article, fill out the publisher, and link to where its published, choose the topic its about...all good. Except: How do i get those "topics" to display in the sidebar. How do i make a sub-nav out of registered taxonomies? Something like this:               <?php wp_list_categories($args); ?>       Is this even a good idea? Or should I just say to hell with it, and go back to categories, and ditch the custom post type? Thanks. Nadine


I just move my server to Mac server before I use to be with GOdaddy was no problem updating framework of my theme now I'm getting this error `Failed: Filesystem preventing downloads. ( ftpext)` not sure why but I've put this code in wp-config.php already               putenv('TMPDIR=' . ini_get('upload_tmp_dir'));          define('FS_METHOD', 'ftpext');          define('FTP_BASE', 'wpdirectory');          define('FTP_USER', 'myuser');          define('FTP_PASS', 'mypassword');          define('FTP_HOST', 'myftphost');          define('FTP_SSL', false);


How can I migrate to worpress using my last blog's rss

I have all of the my blog's posts in a rss file and I want to copy them in my blog.How can I do this?!?


Append Second Link to Read More

I'm looking for a way to filter the "Read More" link so I can append a second link and text. I know how to filter the text but not the entire output, eg: * * * Standard post excerpt before the more quicktag.... Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ut auctor ligula. Vestibulum ac lectus quis nisl tempor fermentum. Maecenas urna erat, convallis eu. Read More | Add a Comment * * * Thank you for any links / advice!


How to selected value default in option list?

I researched but did not find right answer to my question I have custom post type for states, cities and countries and would like to set the default value in the country list for "Argentina", but do not know how to solve it. see my code:                       <select name="pais" class="pais-select">                              <option value="">País</option>                         <?php                             $pais = diretorio_request('pais');                             foreach(diretorio_countries() as $country) {                         ?>                         <option value="<?php echo $country; ?>"<?php echo ($pais == $country) ? ' selected="1"' : ''; ?>><?php echo $country; ?></option>                         <?php                             }                         ?>                     </select>       I tried something like "selected = selected" but does not mark Argentina scored Zimbábue (rsrs)


Listing future posts together with normal posts

In my blog I'm displaying lists of posts from every category I have in the homepage. I have a column for each category. The code is this:               <?php     $categories = array('3', '4', '5');          foreach ($categories as $category):     ?>

<?php echo  get_the_category_by_ID($category); ?>

     <?php      global $post;     $args = array('numberposts' => '3', 'category' => $category, 'post_status' => array('publish', 'future' ));     $myposts = get_posts($args);      Now I'd need to display also posts occurring in the future. They are called events, I guess. I know I cannot use the wordpress status flag of the posts, because it has another purpose. I also tried the Event Manager plugin, but I can't find any way to mix these custom posts with the normal ones. Any suggestion?


WP native tag suggest metabox. How does it process tag id?

As you know, there is a metabox that suggests tags as you type to input box. Is anyone knows how this function gets the tag's ID (term_id) which is selected? I have looked at some of the core files but it seems only the tag name is retrieved and the ajax response returns only the name, no sign of id. But it's just impossible as the tag is updated **by the tag's ID but not it's name** upon submitting or updating the post The core files i've looked at:               wp-admin/includes/meta-boxes.php     wp-admin/js/post.dev.js     wp-admin/admin-ajax.php     wp-includes/post.php     wp-includes/js/jquery/suggest.dev.js     wp-includes/taxonomy.php


referencing the current user in a page i created in wordpress

I created a page in wordpress and i tried to access the current logged in user via wp_get_current_user() and am getting error "function undefined". please how do I make this function available in my page.


SSL Breaks Wordpress CSS

We purchased an SSL certificat from network solutions (would never recommend them to my worst enemy, btw). Apparently it's activated... did a few checks that says it's activated for our domain. But when I put in https://www.texasshredderclassic.com the entire site breaks. To be more specific, by "breaks," I mean it completely disables the CSS, and my login User+Password no longer work (seems like this might be a clue?) You can see it by going here: https://www.texasshredderclassic.com I've tried downloading Wordpress HTTPS, but that kicks me out of the admin page and also mangles the CSS. I don't care if it works on the entire site, just need it working for our form page (texasshredderclassic.com/registration) – using gravity forms and connecting to authorize.net! I'm tearing my hair out here because I don't have a clue where to go next. Seems like we have the SSL cert... just can't get the damn thing to work! Any help is GREATLY appreciated!


Category page for custom-taxonomy shows 404 when using custom permalink structure

I'm having a small issue with category pages for a custom taxonomy when custom permalinks are used, and I was wondering if someone might be able to help out and point out where I'm going wrong. I've created a taxonomy "Brands" for use with a custom post type (in this case, Products), using the code below place in the functions.php file of the theme. I've created a page template for the Brands page, which lists all the brands using the wp_list_categories($args) template tag, and that's all fine. Now, if I use Wordpress' default permalink settings (where you get urls ending with ?page_id=7 and similar), clicking on any of those brands in the list, takes you to a category page which lists all the products for that brand - which is exactly the intent. If however, I set any other custom permalink structure (say /xyz/%postname%/ ), when you click on the brand name I get the 404 page instead of the category page (the same also happens when clicking view on a Brand when viewing the list within the Wordpress admin). With the custom permalink structure, when clicking on the brand it appears to be using the correct url structure (http://www.siteroot.com/brands/brandname/) when showing the 404 page. With the default permalink setting it goes to http://www.siteroot.com/?brand=brandname, which works correctly. I've checked various guides on making custom taxonomies, and have tried to be very careful with setting the rewrite for the taxonomy, and now I'm at a loss as to what the issue is. Any help will be much appreciated.               add_action( 'init', 'build_taxonomies', 0 );          function build_taxonomies() {            register_taxonomy(         'brand',         'products',         array(         'labels' => array(             'name' => 'Brands',             'singular_name' => 'Brand',             'search_items' => 'Search Brands',             'popular_items' => 'Popular Brands',             'all_items' => 'All Brands',             'parent_item' => 'Parent Brand',             'parent_item_colon' => 'Parent Brand:',             'edit_item' => 'Edit Brand',             'update_item' => 'Update Brand',             'add_new_item' => 'Add New Brand',             'new_item_name' => 'New Brand Name'             ),             'hierarchical' => true,              'public' => true,             'show_ui' => true,             'sort' => true,             'query_var' => true,               'args' => array('orderby' => 'term_order'),             'rewrite' => array('slug' => 'brands', 'with_front' => false)         )     );      }


Sidebar "Wrapper" Plugin/Widget?

I'm coming from a Joomla background and I'm setting up a Wordpress installation for a friend's Shoutcast station. I would have done the setup in Joomla, as I'm more familiar with it, but I wanted to be able to hand administration of the WP install over to my friend once it's going, and I feel Joomla is a bit over her head. We're using the shout-stream plugin for providing a sidebar stream player. We don't care for the stats display of shout-stream, so I was attempting to use a custom PHP **what's playing now** script I wrote for another station page I did in Joomla. Joomla has a component/plugin that can encapsulate a PHP script and display it in the sidebar. ## My question is: Is there a similar plugin for Wordpress? I searched the plugin repository and found one which, at first glance, looked like it might work **(wp-wrapper)** , but further checking indicates it has to be used only on a post or a page. We want the PHP script to run/display in the sidebar. Is there such a plugin for WP or am I stuck going back to Joomla? Thanks   Dave


The best way to protect uploaded media in WordPress?

I'm new to WordPress as I normally code my stuff by hand, I've been uploading some media to display links to within protected pages, which is great, however, anyone can access the direct url of the media. Does anybody have a suggestion how to stop this? I'm reluctant to just go hacking into .htaccess.


Post X of Y in single.php / sidebar.php

Is there a way of putting "Post X of Y" into my sidebar? I think I can only show it when it is a single blog post (something like checking if the content is_single) but I want to be able to see which post I am viewing. Googling "wordpress post x of y" for the last 20 minutes has given me a lot about category x in page y or something similar, so I thought to ask here.


the category city made as a subdomain

i'm looking for a solution wherein the category city will be made as a subdomain. For example, when a user search for a certain thing in the main domain and under a certain city, the user will be directed to the subdomain "city.domain.com". same to a user who uploaded a product, for example, under a city - the product will be automatically be under the city category, which could then be viewed in the subdomain. thanks a lot.


how to allow all users who register to a main domain be automatically be registered to all subdomains

i'm looking for how to let those users who registered on a subdomain be automatically be registered in all my subdomains. in this case, the users don't need to register again to the subdomains, when already registered to one. this means that they have a single account on all subdomains. thank you.


Get fields from metabox array

In my functions I'm registering multiple metaboxes with custom fields. A single metabox array for instance, looks like this: In functions.php               $meta_boxes[] = array(         'id' => 'general_info',         'title' => 'General Information',         'pages' => array('post', 'page', 'link'), // multiple post types, accept custom post types         'context' => 'normal', // normal, advanced, side (optional)         'priority' => 'high', // high, low (optional)         'fields' => array(             array(                 'name' => 'Asking Price',                 'id' => $prefix . 'asking_price',                 'type' => 'text',                 'std' => ''             ),             array(                 'name' => 'Currency',                 'id' => $prefix . 'currency',                 'type' => 'text',                 'std' => 'USD'             ),             array(                 'name' => 'Salesman',                 'id' => $prefix . 'salesman',                 'type' => 'text',                 'std' => 'Your Name'             )         )     );      In my theme, how can get all the field names (and even values if possible) from metabox `general_info` ? I'm trying to retrieve data from each metabox separately.


How to inject content after <body>

I would like to inject some elements directly after the `<body>` tag. Is that possible using only WordPress hooks?


Adding vkontakte social "like" button to posts results in multiple buttons on first post only

I'm trying to add a VKontakte (pretty much the russian version of Facebook) "like" button to wordpress posts by placing it within the loop along with Twitter/Facebook "like/share" buttons. While this works fine on single posts, on the news overview with excerpt poss the button displays repeatedly on the first post and not on ANY other post. I'm following these instructions: http://vk.com/developers.php?o=-17680044&p=Like&s=0 I know the issue has to be with something in the javascript messing with the loop and repeating it in one post instead of beneath EVERY post but no idea how to fix it. Oddly enough their "share" button works absolutely fine. Any help appreciated as all I so far was able to find about it was in russian...which I don't speak :/


Meta Boxes causing Header errors

I'm attempting to move some meta boxes and custom post types to a plugin file (to survive future theme updates). One issue is that now, all my wp_nonce values are returning an "undefined index" notice (I realize that this isn't a huge issue, but I'd like my code to be working in the cleanest possible manner). The main issue, however, is that the $_POST in the save function causes a warning error of "headers already sent" with conflict from the pluggables.php file (line 876). Here's the code that I'm attempting to use:               // Add and Save Meta Boxes for Congregation Post Type     add_action( 'add_meta_boxes', 'add_congregation_metaboxes', 1 );     add_action('save_post', 'save_address_meta', 1, 2); // save the Address field          function add_congregation_metaboxes() {         add_meta_box('congregation_address', 'Congregation Address', 'congregation_address', 'congregation', 'side', 'default');     }          // The Congregation Address Metabox      function congregation_address() {         global $post;         // Noncename field          wp_nonce_field( plugin_basename( __FILE__ ), 'address_noncename' );         // Get the first line of the address         $address_line1 = get_post_meta($post->ID, '_address_line1', true);         // Get second line of the address         $address_line2 = get_post_meta($post->ID, '_address_line2', true);         echo '
Address
';         echo '<input type="text" name="_address_line1" value="' . $address_line1  . '" class="widefat" />';         echo '<input type="text" name="_address_line2" value="' . $address_line2  . '" class="widefat" />';         }          // Save the Metabox Data !! The error is in the wp_verify_nonce     function save_address_meta($post_id, $post) {         // Verify Nonce           if ( !wp_verify_nonce( $_POST['address_noncename'], plugin_basename(__FILE__) )) {           return $post->ID;           }         // Check permissions         if ( !current_user_can( 'edit_post', $post->ID ))             return $post->ID;         // Cycle through array         $address_meta['_address_line1'] = $_POST['_address_line1']; //This is the line that explodes         $address_meta['_address_line2'] = $_POST['_address_line2'];         // Add values of custom fields         foreach ($address_meta as $key => $value) { // Cycle array!             if( $post->post_type == 'revision' ) return;              $value = implode(',', (array)$value);              if(get_post_meta($post->ID, $key, FALSE)) {                  update_post_meta($post->ID, $key, $value);             } else {                  add_post_meta($post->ID, $key, $value);             }             if(!$value) delete_post_meta($post->ID, $key);          }     }      Any help is appreciated!


Tricky URL rewrite with custom values in url

We have custom post type as `user_images` and each of these post has a image attached with image name is 3 digit number followed by extension. When the url               http://mysite.com/wp_username/3digitnumber      is accessed, we want to use a custom template inside theme to show the image Tricky part is the url should remain same for visitor but internally should call the custom template with the `wp_username` and `3digitnumber` as query variable. `wp_username` is valid WordPress user nicename. Couldn't get a clue so made a minor compromise to url format               http://mysite.com/image/wp_username/3digitnumber      Tried creating a page using the custom template and used the following htaccess rule               RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{QUERY_STRING} !^iuser=.*     RewriteCond %{REQUEST_URI} !^/wp-content/(.*)$ [NC]     RewriteRule ^image/(.*)/([0-9]+)$ /index.php?post_type=page&p=564&iuser=$1&iname=$2 [L]      where 564 is the page id with custom template. However the url changes to               http://mysite.com/custompage/?iuser=myuser&iname=001      Also tried               function add_rewrite_rules($rules) {         $newrules['image/([^/]+)/?([0-9]{1,})/?$'] = 'index.php?post_type=page&p=564&iuser=$matches[1]&iname=$matches[2]';              $rules = $newrules + $rules;         return $rules;     }     add_filter('rewrite_rules_array', 'add_rewrite_rules');      (called `$wp_rewrite->flush_rules();` once after adding this.) But again the url changes to               http://mysite.com/custompage/?iuser=myuser&iname=001      **Answer:** Solution provided by @Milo works perfectly. The url changed to one with query string because of Browser Cache


Missing argument 2

Hi just looking for help with this cant solve this Thanks Missing argument 2 for t2t_homepage_slide()XXXXXXX/index.php on line 41 and defined in/xxxxxxx/ten.php on line 94               <?php                         $slide1 = get_option($shortname.'_slide_1');                          $slide2 = get_option($shortname.'_slide_2');                          $slide3 = get_option($shortname.'_slide_3');                          $slide4 = get_option($shortname.'_slide_4');                          $slide5 = get_option($shortname.'_slide_5');                      ?>                     <?php if($slide1 != '') : ?>                         <?php t2t_homepage_slide($shortname.'_slide_1'); ?>   <--line 41                     <?php endif; ?>                     <?php if($slide2 != '') : ?>                         <?php t2t_homepage_slide($shortname.'_slide_2'); ?>                     <?php endif; ?>                     <?php if($slide3 != '') : ?>                         <?php t2t_homepage_slide($shortname.'_slide_3'); ?>                     <?php endif; ?>                     <?php if($slide4 != '') : ?>                         <?php t2t_homepage_slide($shortname.'_slide_4'); ?>                     <?php endif; ?>                     <?php if($slide5 != '') : ?>                         <?php t2t_homepage_slide($shortname.'_slide_5'); ?>      ##               function t2t_homepage_slide($slide,$size) {     <--- line 94         global $wpdb;              $image = get_option($slide);         $caption = get_option($slide.'_caption');         $price = get_option($slide.'_price');         $url = get_option($slide.'_url');


Simplify the admin end

I'm thinking about using WordPress as a content management system for a school. The frontend of WordPress itself would never be seen by the students, but the admin interface would be used by teachers to post bulletins and other messages and news items. Wordpress would then provide an RSS feed to integrate with the schools existing systems. My question is how can the WordPress backend be simplified for use by people with very little technical knowledge. All the is really needed for most users is the ability to view previous posts, and write posts. Can this be easily achieved using some themes or plugins? Or am I better off using another system for this, if so what? Thanks.


How can I improve the performance of this query_posts loop?

I created a WordPress page template to build a customised XML feed for certain WordPress posts on my site. Specifically, the page template renders XML and only includes certain custom post types and only if these posts contain specific meta data. I'm using the data to feed WordPress content to an iOS application. It seems to work great; however, the response times from the server vary and often fail. My hosting company ( MediaTemple ) has suggested I could improve performance by making the database query more efficient. Are there any standard optimisation tips for this kind of query?               <?php     $numposts = -1;     $posts = query_posts( '&showposts=' . $numposts . '&post_type=listings' );     header("Content-Type: application/rss+xml; charset=UTF-8");     echo '<?xml version="1.0"?>';     ?>     <rss version="2.0">     <channel>         <title>My custom feed</title>         <?php foreach ($posts as $post) { if ( get_post_meta($post->ID, 'mymeta', true) ) { ?>             <item>                 <various item elements...>             </item>         <?php } ?>         </channel>     </rss>


Get logged in username in wordpress url

I want to get the username of the logged in users in the URL of my wordpress site. Like if user: **arvind** is logged in, I want to get the url as **'www.wp.com/arvind'** or **'www.wp.com?user=arvind'**. Is there any solution for that?


Migrating database / content of non-CMS site to Wordpress

I have a non-CMS website which is fully build with PHP with a lot of content in it. I don't want to add my posts manually in Wordpress, because that's a pain in the ass (I am talking about 5000 posts)... So my question would be: how do I do this? Is it even possible to clone something like this?


Dynamically add more fields/remove last field in a form

What I want to achieve is to build a form, which contains buttons "add one more field" and "remove last field" that would do exactly this - add a field dynamically to my form or remove the last one. I have done this in Drupal, but am not sure how exactly to achieve this in WordPress. My basic logic is to use ajax to insert new fields dynamically or remove the last one. Is there something like Form API in Wordpress (I tried to search but without success) that will me my task easier to achieve?


Unexpected results with conditionals inside template part

**Scenario:** I have a template part `loop-product.php` which i am calling from `home.php`, `taxonomy.php` and a page template `template-products.php`. Inside that template part `loop-product.php` file i am setting the number of columns by checking `is_home()` conditionals. **Problem:** The conditional works fine for homepage, taxonomy page but its still set on the page template. On the product item i have added a class `columns-$cols` so you can check it on the site. Its showing `columns-4` on the product template page where it suppose to show `columns-3`.               <?php         $j = 1;         if(is_home()){             $cols = 4;         }else{             $cols = 3;         }         if(have_posts()):while(have_posts()):the_post();                  // getting thumbnail image here          ?>                      <div class="product-item <?php echo 'columns-'.$cols ?>" <?php if($j%$cols == 0){ echo 'style="margin-right:0;"'; } ?>>                   <a href="<?php the_permalink(); ?>">                                              <img src="<?php echo $img[0]; ?>" width="100" height="75" alt="<?php the_title(); ?>">
<?php the_title(); ?>
                     <?php                         if($price): ?>                         Price: <?php echo $price; ?> BDT                     <?php endif; ?>
                  <?php if($j%$cols == 0){ echo '

'; } ?>                       <?php $j++; endwhile; endif; ?>

      Check the site here http://computercarebd.com/ Appreciate your time. Thanks! Page template code: http://pastebin.com/CzRgzzVF


How to access function from outside of a class within this class in WP plugin?

I am developing a WP plugin called e.g. **DD_Awesome_Plugin** and this is my code so far (simplified version without additional code logic within class functions):               class DD_Awesome_PLugin {              public function __construct()         {              }              public function add_menu_page()         {             add_options_page('DD Awesome PLugin', 'DD Awesome PLugin', 'administrator', __FILE__, array('DD_Awesome_PLugin', 'display_options_page'));         }              public function display_options_page()         {             $plugin_options = get_option('dd_my_awesome_plugin');             echo "Here we go admin!";                  /* and after echo I need to triger a function "trigger_me_from_class()" that is located outside of the class. */         }          }               add_action('admin_menu', function() {         DD_Awesome_PLugin::add_menu_page();     });          add_action('admin_init', function() {         new DD_Awesome_PLugin();         include_once dirname(__FILE__) . ('/simple_html_dom.php');     });                /* just trigger this function "trigger_me_from_class" from "display_options_page" function (situated in DD_Awesome_plugin class above) */     public function trigger_me_from_class()     {         $str = date('Y-m-d H:i:s', time());         wp_mail('info@example.com', 'DD success message', "Success at $str." );     }


Users Can Only Post Reviews When Logged In?

I use the plugin WP Customer Reviews on my site but to leave a review you must fill out a form even if you are logged in. I would like to make it so that if a non logged in user goes to submit a review red writing appears explaining that you must be logged in to post a review. I would also like to remove some fields on the login form. Does anyone know how I can modify the plugin to do this? I don't know where to start and I don't want to damage any core files. I've also contacted the plugin developers and asked this same question on their forums but got no response.


WP_Query Limit Data_Query last 90 days

I want to perform a `WP_Query` that finds all posts limited to the last 90 days. From my understanding, WP_Query accepts numerical values for months, years, days, etc, but I'm not sure I understand how to pass an argument that says "get all posts from 90 days ago until today." I'm guessing I have to get the current time and then subtract 90 days from that, but it looks like the "day" argument is relative to the month (i.e. 1-31). There is no way to compare timestamps? This is sort of what I have so far -               $today = getdate();      'date_query' => array(                         array(                             'day' => array( $today["day"], $today["day"] - 90 ),                             'compare'   => 'BETWEEN',                         )                     )


Why $ for jquery doesn't work?

I used the following to enqueue jquery plugins:               <?php         function my_scripts_method() {             wp_enqueue_script(                 'custom functions',                 get_template_directory_uri() . '/js/main.js',                 array('jquery'),                 '1',                 true             );             wp_enqueue_script(                 'dotdotdot & lightbox',                 get_template_directory_uri() . '/js/plugins.js',                 array('jquery'),                 '1',                 true             );         }         add_action('wp_enqueue_scripts', 'my_scripts_method');      And I don't know it it's related but jquery only responds to calling `jquery(...` and not `$(...`. Why is that?


How do I reclaim either deleted pages or their permalinks?

A client deleted the the main administrator account. All the site’s core pages linked to the account, so they disappeared as well. The last known backup was in February, so can’t roll the database back to the backup without loosing new users and posts. The client has started rebuilding the core pages by copying and pasting content from Google cached pages into new pages on a new administrator account. **The permalinks cannot be set to the deleted pages permalink and an increment (-2) is always placed at the end of the link.** **Is there a way to:**   1. Attach the old pages to a new user account. Do they still exist in the database? How would I find them?   2. Or, how do I scrape the record of the original pages out of the database so that the permalinks can be used for the new reconstructed pages?


How to prevent tinymce macro from inserting nbsp;?

I've got the following macro button defined to wrap a selection in a shortcode in the wp_editor visual editor:               (function() {     tinymce.create('tinymce.plugins.ingredient_name', {              init : function(ed, url){             ed.addButton('ingredient_name', {             title : 'Tag ingredient',             onclick : function() {                 var text=ed.selection.getContent({'format':'text'});                 ed.execCommand('mceInsertContent',false,'[ingredient_name]' + text + '[/ingredient_name]');             },                 image: url + "/name.png"             });         }     });          tinymce.PluginManager.add('ingredient_name', tinymce.plugins.ingredient_name);          })();      The macro works as intended, except that tinymce is also inserting &nbsp in front of the resulting shortcode. So, instead of this result:               1 [ingredient_name]pound[/ingredient_name] salami      I get this:               1 [ingredient_name]pound[/ingredient_name] salami      this then somehow gets mangled when inserting to the DB, and rendered to the template, I get '1Â pound salami'. I can go back and remove the offending &nbsp's, but I'd prefer tinyMCE not insert that entity in the first place. Any ideas?


How to display comments by logged in user and responses

I want to create a profile page and display the logged in persons comments, AND also responses to his/her comment. Like this: > **Post title** > > Comment (by logged in user) > > --->Responses(replies) to his/her comment Any ideas how to do this? EDIT: This is what I got right now, I get the logged in persons comments with use of a shortcode on a page that I have. **What I want to get is also the responses for each comment made by this logged in user.**               <?php     /*     Plugin Name: Show Recent Comments by a particular user     Plugin URI: http://blog.ashfame.com/?p=876     Description: Provides a shortcode which you can use to show recent comments by a particular user     Author: Ashfame     Author URI: http://blog.ashfame.com/     License: GPL     Usage:      */          add_shortcode ( 'show_recent_comments', 'show_recent_comments_handler' );          function show_recent_comments_handler( $atts, $content = null )     {         extract( shortcode_atts( array(              "count" => 10,             "pretty_permalink" => 0             ), $atts ));              $output = ''; // this holds the output              if ( is_user_logged_in() )         {             global $current_user;             get_currentuserinfo();                  $args = array(                 'user_id' => $current_user->ID,                 'number' => $count, // how many comments to retrieve                 'status' => 'approve'                 );                  $comments = get_comments( $args );             if ( $comments )             {                 $output.= "
\n";                 foreach ( $comments as $c )                 {                 $output.= '
';                 if ( $pretty_permalink ) // uses a lot more queries (not recommended)                     $output.= 'comment_ID ).'">';                 else                     $output.= 'comment_post_ID.'#comment-'.$c->comment_ID.'">';                            $output.= $c->comment_content;                 $output.= '';                 $output.= "
\n";                 }                 $output.= '
';             }         }         else         {             $output.= "
You should be logged in to see your comments. Make sense?
";             $output.= '
Login Now →
';         }         return $output;     }     ?>


Can't access WP site over WiFi network

I'm making a mobile site and I'm using the main computers IP adress to connect to it from the iphone `10.0.0.1/wp` With normal sites it works fine, but the WP site I get is stripped from CSS, JS, and images, only plain text. on the mac and the iphone-simulator it works fine. Is it something known and configurable?


How to export all content with feature images?

I want to export all content with featured images from my localhost WordPress site to the production blog,but when I tried using the default WordPress export-import plugins ,all content get exported (including post images) except for featured images. As you can see here ,this problem is been faced by many others also .So how to export and import all content including featured images.I am using WordPress 3.4.1.


How to Add Custom Fields to Custom Taxonomies in Wordpress CLEANLY

Saving extra fields that were added to a taxonomy. I want the most proper & efficient way of doing so. **Where should I save the new fields?** 2 possible solutions are to 1) Use the Wordpress options table as described here... Add Custom Fields to Custom Taxonomies. This is admittedly "not clean" and assumed not to be the correct answer.               // A callback function to save our extra taxonomy field(s)     function save_taxonomy_custom_fields( $term_id ) {     if ( isset( $_POST['term_meta'] ) ) {         $t_id = $term_id;         $term_meta = get_option( "taxonomy_term_$t_id" );         $cat_keys = array_keys( $_POST['term_meta'] );             foreach ( $cat_keys as $key ){             if ( isset( $_POST['term_meta'][$key] ) ){                 $term_meta[$key] = $_POST['term_meta'][$key];             }         }         //save the option array         update_option( "taxonomy_term_$t_id", $term_meta );     }     }      2) Add a new table as described here Custom Taxonomies in Wordpress which follows the naming convention of 'wp_' + customtaxonomykey + 'meta'. 3) Some other option


Visual editor in comments with custom buttons

I have loaded WP visual editor in comments using `wp_editor` function and I want to customize the height and buttons of the editor, also it would be much better to show Text mode/tab only and disable the Visual mode/tab. Here my code:               <?PHP         $settings = array(                           false,        // wpautop                           false,        // media_buttons                           'comment',    // textarea_name                           5,            // textarea_rows                           'None',       // tabindex                           'None',       // editor_css                           'test',       // editor_class                           true,         // teeny                           false,                           true,         // tinymce                           true          // quicktags                          )          ?>     <?php wp_editor( 'Enter your comments here', get_the_ID(), $settings); ?>       Thanks


qTranslate - show articles in two languages

I would like to show all articles on my page in two languages while the menu and everything is translated in the language choosen.               <?php      $id=5; $post = get_page($id);      $content = qtrans_use('fr', $post->post_content,false);      echo $content;       ?>      This is as far as I got. But I want it to be dynamic with every article. Thanks for your help!


Custom Taxonomy in Permalink of Post

It is possible to use this as a permalink for a post:               /%category%/%postname%/      But lets say I've created a taxonomy called "artist". I'd like to use this for my posts:               /%artist%/%postname%/      I know that taxonomies allow you to list their terms with this:               /%artist%/%someartist%/      but that is not what I'm looking for. I want to modify POST urls, not taxonomy ones. I'm trying this on my blog and it is not working. Is this something that can be done in Wordpress?


Author Profile URL

I have 2 user roles. "photographer" and "subscriber" I have set my author.php like this               <?php get_header();          $thisauthor = get_userdata(intval($author));         $author_user = $wp_query->get_queried_object();             ?>          <div id="main">          <?php        if (user_can($author_user, 'photographer')) {            get_template_part( 'author', 'photographer' ); }        else if (user_can($author_user, 'subscriber')) {            get_template_part( 'author', 'subscriber' ); }          ?>        </div><!--/main-->          <?php get_footer(); ?>      This is working great to show different profiles based on the user roles. However id like to change the url based on the roles. Something like http://xxx.xxx/subscriber/username/ http://xxx.xxx/photographer/username/ Any ideas on getting this done?


Redirect logged in users if they are on a specific page

I'm trying to prevent a user access besides the admin to the registeration page and reset password page if they are already logged in. I have the following:               function redirect_loggedin_users() {     // Maybe use is_user_logged_in() instead?     if (!current_user_can('manage_options') && is_page(array(2090, 2092))) {         wp_redirect(home_url());                 exit();         }     }     add_action('init', 'redirect_loggedin_users');      I tested it and it's not working. Can someone please assist me? Thanks.


How properly delete only one site (blog) from the Network in WordPress Multisite (WPMU)

I have a Network with ~30 sites. And I need to delete only one of them. Could you please tell me how should I delete properly only one site from the Network WordPress Multisite (WPMU)? Because when I have done it in the admin area side the site was deleted from the admin but the plugins and some other tables for this site are still in database and all files in website directory (`blog.dir/id_of_the_site`) are left too. How properly could I do that? Should I delete manually all tables with site ID (in table name) from database and then delete the website directory with files from `blog.dir` directory? Or should I do something else? Perhaps do you know another way, more safety and properly? P.S. Also I'd like to know if it is possible to restore this site after these manipulations (from the backup) and what is algorithm, because I know that after deletion some data from `wp_blogs` table were deleted too? Thanks.


ACF loop and php formatting

The following php will loop through each page and then output **ALL** of the ACF custom fields sequentially. What I need help formatting is a conditional statement that places all `$fields`, except `$field_name` containing 'title', in their own container.               $pages = get_pages( array('sort_column' => 'menu_order'));      foreach ($pages as $page_data) {         $fields = get_fields($page_data);         if( $fields )         {                foreach( $fields as $field_name => $value )           {                 $field = get_field_object($field_name, false, array('load_value' => false));                 // if(strpos($field_name,"title") !== false ){            // /*this field has name containing title*/            // }                 echo '
';            echo $value;            echo '
';                }         }          }      So final HTML should look like:
TITLE

1

2

3

      Thanks for your advice.


Change link to permalink inside post content

Probably this has been answered before several times.But couldn't find so sorry if it sounds duplicate. I have a post content and in that content I have couple of internal links Now inserting those links via editor I put the id instead of slug name. Is there any way so that when it displays in the site it automatically detects the id and change to permalink. Or I need to copy the permalink and put it in the post? Please suggest.


Diffrent search templates for different post types

I have a site with diffrent post types. Two of them are the 'post' post type and the other one is 'charity', for both pages I have an index, the normal index.php and a diffrent page template for charity. I used a plugin called taxonomy filters to filter the category and a custom taxonomy on 'charity'. for 'post' I created an other widget that only searches for category's. This works amazing, the only thing is that I get redirected to the search.php template. No problem, I thought, and I made some conditional statements on search, where at diffrent post types diffrent widgets will be shows. so in short it is something like:               <?php if ( 'charity' == get_post_type() ){          //widget1         //html for charity     } else ( 'post' == get_post_type() ){         if ( 'post' == get_post_type() ){              //widget2     }     //html for posts and search     }     ?>      Now the filtering is working amazingly good, when I'm on charity and i select a cat and a term it will direct to search, but keep the same template with te checkboxes still as they where. BUT.. and here comes the real problem.. When I want to search something normally via the searchform, and it belongs to one of the two post types, it will (ofcourse..) take that template, including the filters of that post type. can I prefend that? I want the filters only to show up when redirected from that post type index.. Isn't there something as `if redirected from index.php`? that would be amazing !


how to create my own edit.php admin page code or template for my custom post type

Most plugins try to hide the components of the edit.php screen on wp admin and replace it with meta boxes to create the needed layout and fields for the custom post type. But this means that there is still unnecessary code on that edit.php page not used and increases the page load. Also, Not everything can be done using meta boxes. Is there is a way where i can create my own edit.php page from scratch for my custom post type? maybe hide the custom post type UI and make a new admin page and use it to insert the custom posts or update it? is this possible on admin pages?


Error when setting cookie

I get this error when trying to set a cookie on a WP page.               Warning: Cannot modify header information - headers already sent by(...)      Any help here? It worked fine when I did the php outside of wordpress, but when I move it in, it broke. Nothing special about the cookie(very basic). So how do I get the cookie to set?


prevent custom widget file names from showing in Appearance > Editor

I've setup a few custom widgets for my theme, and when I go into Appearance > Editor, the widget file names are showing up in the list of files that can be edited. How can I prevent these widget file names from showing up in the Editor's list of files? I put them in a subdirectory ("widgets"), but they are still showing up on the list with the main pages.


Get categories related to particular category

I have assigned two different main categories to blog and portfolio. the blog will show only categories related to main blog category and portfolio will also do the same. with this code for portfolio               $cat_ids = get_all_category_ids();     foreach($cat_ids as $cat_id) {     $cat_name = get_cat_name($cat_id);         $cat_slug = strtolower($cat_name);         $cat_slug = str_replace(' ', '-', $cat_slug);         if(get_category($cat_id) ) {                  echo '
'.$cat_name.'
';         }     } // foreach       i am getting all categories also blog. i just want to show the categories related to 'portfolio' category on portfolio page.


Extending wp.media.model, query media from different blog on network and refresh view

I'm trying to extend the new wp.media.model to allow users to be able to choose any blog across the network and pull down the associated media library into the library content view. In the old thickbox we just called `switch_to_blog()` and refreshed the thickbox. I would like to stay within the new backbone.js media-views and media-models (open to other suggestions) but I'm having trouble getting wp.media.query() to return the results from the correct blog. I'm calling switch_to_blog() using the wp.media.ajax method and the correct global variables are being set. The result of the query variable below is an object of attachments for the original blog not the switched to blog. javascript:               /*global blogs */ //Object of network blogs passed via wp_localize_script     (function ($) {         "use strict"; // jshint ;_;              var current = blogs['current_blog'];         var Blogs = blogs['UserBlogs'];              $(function() {             var media = wp.media.editor.add('content');             media.on('open', function() {                 var html = $("<select>", {name:'blog_id', id: 'blog_id'});                 $.each(Blogs, function (index, blog) {                     if( 1 == index ) { return; }                     html.append($("<option>", {value:blog.userblog_id, html:blog.domain}).prop({ selected: blog.userblog_id == current}));                 });             $(".attachment-filters").after(html);                  $("select#blog_id").change(function () {                 var str = "";                 $("select#blog_id option:selected").each(function () {                     str += $(this).val();                     var options = {                         type: 'POST',                         url: ajaxurl,                         data: {                             blog: str                         }                     };                     wp.media.ajax('switch_blog', options );                     var query = wp.media.query();                     console.log(query);                 });             })         });     });     }(jQuery));      PHP:               public static function _switch_blog() {         global $blog_id;         $current = $blog_id;         $blog = isset( $_POST['blog'] ) ? intval( $_POST['blog'] ) : false;         $result = false;         if ( (bool)$blog )             $result = switch_to_blog( (int)$blog );            if ( $result )                echo json_encode( array( 'success' => $result, 'response' => 'Switched from: '.$current. ' to '.$blog_id ) );              exit;     }


Retrieve name or slug from get_objects_in_term

I have taxonomies set up for users, and on `taxonomy-{term}.php` I have the following code to "loop" them all out, sorted by ID:               $term_id = get_queried_object_id(); // Get taxonomy term ID     $term = get_queried_object(); // Get the term     $argu = array('orderby' => 'name', 'order' => 'ASC', 'fields' => 'all'); // Order     $users = get_objects_in_term( $term_id, $term->taxonomy, $argu );          if ( !empty( $users ) ) { // Don't show if empty ?>          <?php foreach ( $users as $user_id ) if (!user_can( $user_id, 'invisible' )) { // Exclude users with the role invisible ?>          <!-- Thumbnail, title, name etc. here -->      How would I go about sorting them by their last name (which is a custom field)? Ideally I would like to change `'orderby' => 'name'` to something like `'orderby' => 'CUSTOM-FIELD-NAME'`, or if I could utilize `get_objects_in_term()->name;` somehow. Here's a `var_dump($users)` from a term page where I have four users:               array(4) { [0]=> string(2) "12" [1]=> string(2) "19" [2]=> string(2) "20" [3]=> string(2) "21" }      The number inside the quotes is the users' ID. **Edit, completely revised using WP_User_Query**               $args = array(     'fields' => 'all_with_meta',     'role' => 'talare',     'order' => 'DESC',     'meta_query' => array(         array(         'key' => 'last_name', // the meta field (or key) we want to target for sorting         )     ));     //get_users calls WP_User_Query and returns an array of matching users     $users = get_users($args);          //custom function for comparing the data we want to sort by     function cmp($a, $b){         if ($a->last_name == $b->last_name) {             return 0;         }         return ($a->last_name > $b->last_name) ? 1 : -1;     }     //usort sorts our $users array with our function cmp()         usort($users, 'cmp');          //leaving an array of $users sorted by the value of meta 'last_name'     foreach ($users as $user) {         //Thumbnail, title, name etc.     }      I got the sorting-function from here.


Programmatically Selecting Theme Based on URL

I've inherited a site which has a mobile version. Let's call it qqq.com. It has a Varnish server in front of it to cache the pages. But it seems the Varnish server is also detecting mobile requests, and changing the URL to m.qqq.com. The WP install is then switching to the qqq-mobile theme, instead of the qqq theme. How would you do that? I'm trying to locate the code that does this, so I can do the same thing on my local dev instance. Thanks for your help.


Add custom field to all posts in specific category

I want to bulk add a custom field (category) with value (photography) to all posts in a specific category (photography, with Category ID 5). I have used the code below to bulk add a custom field to all posts, but how can I narrow this down to a specific category? Anyone? This is the code I used for all posts:               INSERT INTO wp_postmeta (post_id, meta_key, meta_value)     SELECT wp_posts.ID, 'category', 'photography'     FROM wp_posts     WHERE wp_posts.post_status = 'publish'


What is the template file for topic layouts in bbPress?

The theme I'm using edits the Topic layout in such a way that the role is not being displayed anymore. I'd like to revert those changes in the theme editor, but I can't seem to find the template file for the bbPress topic layout. Could anyone tell me where to find it?


Get posts in a subcategory of a chosen parent

Taking on legacy data I have the following structure -Top level category (category) -- Sub category (report) --- Post I want to get all posts in a particular top level category. **The problem is all the posts are only assigned to Sub Categories, not their top level categories.** I've tried the following:               function getPostsInCategory($category) {              return get_pages(array(             'post_status'   => 'publish',             'post_type'     => 'post',             'child_of'      => $category, // e.g '3'             'numberposts'   => -1         ));     }      I use `get_pages` instead of `get_posts` because it seems to support heirachy better. How can I get all posts that are in a "report" that is a child of my chosen category?


Default Attributes in Shortcode Not Working

I'm learning about shortcodes. My shortcode is working fine. But, I'm not getting the default values for the attributes.               function csf_cap_databaseinfo($atts,$content=null) {         global $wpdb;              shortcode_atts( array('title'=>'My Default', 'year'=>'1900'), $atts);               $greeting = $wpdb->get_results($wpdb->prepare("SELECT * FROM wp_test;"));                $out = '
'.$atts['title'].'

'.$atts['year'].'

                             ID	                             Greeting
';               foreach ($greeting as $greet)             {              $out .= '
'. $greet->id .'	';              $out .= ''. $greet->greeting .'
';             }                $out .= '
';                             return $out;           }      So, if someone types in [db-info] in a post, without any attributes, they aren't getting "My Default" and "1900". If they type in: [db-info title="Hello" year="1973"], it works as expected. What am I doing wrong? Thanks. -Laxmidi


Custom Post Type And "fopen"

Never posted here but since I can't find a solution on my own, let's abuse your kindness! I'm adding some custom post types through my theme. The first custom type works like a charm, but as soon as I add the second (and third) one, the apache's error log reports a PHP Warning when trying to do a search action (like the one to search a post to attach a media).               fopen(http://localhost/site/wp-cron.php?doing_wp_cron) [function.fopen]: failed to open stream [...] in E:\\www\\site\\wp-includes\\class-http.php on line 876, referer: http://localhost/raw/wp-admin/edit.php      It only happens when I set the 'thumbnail' string into the $args['supports'] array passed to the register_post_type function. Any help would be much appreciated! Regards


WordPress Job Interview Preparation

I'm interviewing for a job as a WordPress Developer. I've only been working with WP for a year now and feel I have a good overview, as in how to set it up, what functions.php does, where to modify themes, etc.. But the interview I have next week is going to be asking me all about WordPress and Linux with some MySql thrown in. All I know is that they will be giving me a laptop and a test. How do I prepare for such a thing? Should I practice writing a plugin today? I know how to set up a Linux server, but I'm not great with advanced file manipulation or shell scripting. I'm good at setting up, troubleshooting and configuration. And I read the WP Codex a LOT. What would be a good homework assignment to give myself to prepare properly? I've noticed there aren't many resources for studying for a WP-centric interview out there.


ACF: post query, hide duplicate values

I'm querying an ACF field, and displaying all the results on the front-end like so—   PHP:
                     <?php                           // args                     $args = array(                         'numberposts' => -1,                         'post_type' => 'wpsc-product'                     );                          // get results                     $the_query = new WP_Query( $args );                          // The Loop                     ?>                     <?php if( $the_query->have_posts() ): ?>
                         <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
                                 <a href="/shop/?view_type=default&product_search=<?php $remove = array(" ", ",", "/", ".", ":", "-", "–", "—", "!", "?", ";");     echo strtolower(str_replace($remove, "+", get_field('products_page_designer_name'))); ?>">                                     <?php the_field('products_page_designer_name'); ?>
                         <?php endwhile; ?>
                     <?php endif; ?>                          <?php wp_reset_query(); ?>
      This works great, the only problem is the values of some of the fields are duplicates of others, e.g. It will output a list like so:                 Value 01     Value 02     Value 02     Value 03     Value 03      etc etc. but I only want to display one instance of each, thus if there's a duplicate value it will be hidden. Is this at all possible? Any suggestions would be greatly appreciated!


How to get past purchase details, like cart items?

Is it possible to get past purchase items? I have created a custom database table but i forgot to add the number of a spefic purchased items in a field. Is this still possible? i tried               print_r($purchase_log);     print_r($purch_data);      But these just gives cart total and customer data? Any tips, suggestions regards


Embed Captivate HTML5 into WP

I would like to embed HTML5 interactions I create in Captivate into my WordPress. I don't need the data to report to an LRS; I just need the learner to be able to interact with it. An iframe is not ideal, as we would like to be screen agnostic. I saw a similar question here that did not seem to be resolved. Does anyone have another suggestion?


Is it possible to temporarily override the language setting?

I have a bilingual site working no problem that tests for cookies before setting WPLANG in wp-config.php, with all the text internationalised etc. My one problem is that notification emails are being sent in the language of the current user, not the language of the recipient. So if user1 comments in English, and user2, who uses the site in Spanish but replies in broken English, the comment notification email that user1 receives will be in Spanish. I have a language preference stored for each user, so I intend to customise how the emails are sent so that it checks for the language of the recipient first. So, to the question. Here is a sample line plucked from wp_notify_postauthor() in pluggable.php which uses gettext calls to construct the email message:               $notify_message  = sprintf( __( 'New comment on your post "%s"' ), $post->post_title ) . "\r\n";      I'm hoping to continue with this gettext-based method. But that would mean temporarily switching the locale setting immediately prior to constructing the email message, and then switching it back again immediately afterwards. [edit] _Reading through the core files I think I might better describe this as unloading the text domain prior to sending the emails and reloading afterwards, where required. To optimise I could create a text-domain subset specifically for notification messages to load and unload, rather than the text-domain for the entire site, and, of course, when sending multiple notifications, group the messages to send by language_ [/edit] Is that a) meaningful, b) possible, and c) sensible? Because the alternative is to drop gettext here and have both (and eventually, all) language versions there in the php and build the email string accordingly based on my language test.


Need a conditional div in custom Walker function for wp_nav_menu()

I have used wp_nav_menu() for my custom WP sites with Custom Walker Function which is working fine and providing me below output:

HOME

MY Review Post 1

My Test Post

      But Right now i want to add one conditional div `if($thisItem->object == 'category')` class through loop after the ul class="col-sm-12 list-unstyled" inside the div class "yamm-content". So output will be:

HOME

MY Review Post 1

My Test Post

title text come here
                                 learn more

      Please provide some idea how can i get it from my custom Walker function. I just tried to get it through static way but don't know how to place it after ending the `</UL>`. Anybody please help me..                 class custom_menu_walker extends Walker_Nav_Menu {     private $curItem;          function start_lvl(&$output, $depth) {         $thisItem = $this->curItem;               $output .= '

';             $output .= ( $depth == 0 && $thisItem->object == 'category' ) ? '
' : '
';                }           function end_lvl(&$output, $depth) {         $output .= '

';          }          // add main/sub classes to li's and links      function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {          $this->curItem = $item;              $indent = ( $depth > 0 ? str_repeat( "\t", $depth ) : '' ); // code indent                   // depth dependent classes         $depth_classes = array(             ( $depth == 0 ? 'dropdown' : '' ),             (( $depth == 0 && $item->object == 'category' ) ? 'yamm-first' : ''),             ( $depth % 2 ? 'menu-item-odd' : 'menu-item-even' ),             'menu-item-depth-' . $depth         );         $depth_class_names = esc_attr( implode( ' ', $depth_classes ) );              // passed classes         $classes = empty( $item->classes ) ? array() : (array) $item->classes;         $class_names = esc_attr( implode( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) ) );              // build html              $output .= $indent . '
ID . '" class="' . $depth_class_names . ' ' . $class_names . '">';              // link attributes         $attributes = ' class="menu-link ' . ( $depth == 0 ? 'dropdown-toggle' : '' ) . '"';                   $item_output = sprintf( '%1$s%3$s%4$s%5$s%6$s',             $args->before,             $attributes,             $args->link_before,             apply_filters( 'the_title', $item->title, $item->ID ),             $args->link_after,             $args->after         );                   // build html         $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );     }                    function end_el( &$output, $item, $depth = 0, $args = array(), $current_object_id = 0 ) {         if ( $depth == 0 && $item->object == 'category' ) {                   ?>

title text come here
                                 learn more

                 <?php              }       }     }


Admin Panel - Custom Menu Sub-Item LINK

I'm trying to add a custom link under my Post Type in my admin menu, which will link to Pending Posts. This code functions, but it instead makes a page (like I suppose the function should), but I just need a single link and there doens't seem to be a `add_submenu_link` function unfortunately. Is there a way to create a static link but place it in my post type submenu?               /** Add Pending Posts to WP Admin Menu **/     function add_custom_link() {         add_submenu_page('edit.php?post_type=cpt_custom', '', 'Pending Posts', 5, __FILE__, 'sub_page_pending');     }     function sub_page_pending() {       echo '
Pending Posts
';     }     add_action('admin_menu', 'add_custom_link');      I've tried to use a `wp_redirect()` but I get some errors telling me that the headers have already been set.


Excluding cateory not working on my site. how to solve this?

I am using my own wordpress theme. I am trying to exclude some categories on my `author.php` I am using the following code for that purpose.               $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $author_id=$post->post_author;     $args = array('author'=> $author_id, 'posts_per_page' => 10, 'paged' => $paged, 'category__not_in' => 16, 19, 1, 20);     query_posts( $args); ?>      I tried `$args = array('author'=> $author_id, 'posts_per_page' => 10, 'paged' => $paged, 'cat' => -16, -19, -1, -20);` also not working. How can I exclude those four categories.


Access from template info of another blog (in the same network)

In my root blog (1), i have a custom post type that can be linked to an existing blog of my network. It does so by recording in post metas the ID of the blog it is linked to. I use `_blog_id` as a name for this data. In a page of this root blog, i list these custom posts, and i easily retreive the meta i saved:               <?php while ( have_posts() ) : the_post();     $blog_id = get_post_meta(get_the_id(), '_blog_id', true);      Now, i have the ID of the blog i want information from, so i try the following:               switch_to_blog($blog_id);     $blog_url = get_bloginfo('url');     restore_current_blog();      Unfortunately, that doesn't work because `$blog_url` has the URL of the root blog. Worse: `switch_to_blog()` works but not `restore_current_blog()`, because subsequent calls to the LOOP functions now work in the sub-blog. For example, when calling `the_post_thumbnails()`, the image source is referred by "/uploads/sites/2/2014..." while i'm in the root site. **As you could guess, i have two questions:**   1. **How to retreive blog info of another blog in the network, from the template of a blog?**   2. **Why does`switch_to_blog()`, followed by `restore_current_blog()` makes the LOOP functions to behave incorrectly?** Thank you everyone! Have a great weekend!


New installation can't be found due to htaccess of the original non-Wordpress site

I have a non-Wordpress site , **www.example.com** For canonicalization purposes I have this in .htaccess :               Options +FollowSymLinks     RewriteEngine On     RewriteCond %{HTTP_HOST} !^www\.example\.com$     RewriteRule (.*) http://www.example.com/$1 [R=301,L]         This way all non-www links will be redirected to www version of site. Recently I decided to attach a wordpress blog at **www.example.com/blog** . After the installation is complete, whenever I go to **www.example.com/blog** I get 404 - Page not found error. I tried both auto install with Fantastico and a manual install, with the same result. I found out that when I remove the piece of code above from my .htaccess it fixes the problem, and wordpress installation is accessable and usable. However, I would like to keep the the original htaccess settings, for SEO purposes. I tried to change url version in wordpress General Settings and then restore main site htaccess file - it would still break the wordpress and 404 is back again. I tried to add next code in wp-config.php :               define('WP_HOME','http://www.example.com/blog');     define('WP_SITEURL','http://www.example.com/blog');      It didn't fixed the problem either... I understand it has something to do with htaccess. I also notices that there is no htaccess file in wordpress folder, probably due to the fact that I haven't changed permalinks settings yet. I would appreciate any help on this matter! P.S: I just noticed that **www.example.com/blog/wp-login.php** is visible regardless of htaccess config, however after I log in it brings me to 404 page again :(


WP Ecommerce, Gold Cart and pagination

This one is driving me mad! Pagination does not work in that it was displaying the same set of products on every page - now after resaving permalinks (twice as recommended) clicking on page 2 results in the message "There are no products in this group." I have done everything advised - resaving permalinks, activating and deactivating WPEC, disabling WP Total Cache etc - nothing works (can't find a lot of help out there including on the WPEC forum) My next shop will be built using a different plugin!) Any help much appreciated.


WP_nav_menu fallback not working

I just realized the fallback doesn't work for my project when a custom menu doesn't exist. I can't figure out what I am missing. Here is the code that displays the nav menu:               $menu = wp_nav_menu(        array(           'menu_class' => 'reset sf-menu',           'container_id'=>'nav',           'echo'=>0        )     );          $menu = str_replace("\n", "", $menu);     $menu = str_replace("\r", "", $menu);     $menu = str_replace("\t", "", $menu);     echo $menu;      here is the test site: http://brainbuzzmedia.com/themes/amplify/styles/charcoal/


Theme Location empty

I have a problem. I have a WordPress theme which supports two navigation menus. The primary menu shows all the pages, and the secondary menu displays the categories by default. When I go to Appearance->Menu to change the settings it says "The current theme does not natively support menus, but you can use the “Custom Menu” widget to add any menus you create here to the theme’s sidebar". Could anyone please tell me how to solve this?


Multiple while loops not functioning

I have this `while` loop in my product page with Wordpress e-commerce plugin. It is looping through custom post meta.               <?php if (wpsc_have_custom_meta()) : ?>         <?php $count = 2; ?>         <?php while ( wpsc_have_custom_meta() ) : wpsc_the_custom_meta(); ?>         <?php if (stripos(wpsc_custom_meta_name(),'g:') !== FALSE) continue; ?>
             <a href="#tab<?php echo $count; ?>"><?php echo wpsc_custom_meta_name(); ?>
         <?php $count ++; ?>     <?php endwhile; ?>     <?php endif; ?>          I repeat this twice. Once to iterate through tab titles and once through the tab body. But for some reason the second instance of the `while loop` won't work. If I delete the first instance then the second one works as expected but as soon as I have to examples of it then it no longer works. Thanks for the help.


Share buttons on article footer

for a website I need to place facebook and twitter share buttons on the footer section of each article on the blog page (where are listed all the articles). I tested many social plugin and was able to have this result only using ShareThis. (I've tested without luck also Sharebar, Sociable and Social likes). Unfortunately Sharethis has a layout bug on my website that cuts off few pixels from the buttons, you can see it on this screenshot: http://postimg.org/image/gdog4h8nz/ I have no clue on how to fix this since I have no control on the nested span tags that build those buttons. Does anyone know a way to fix that border issue, or knows another social plugin that does the same and works better? EDIT: This is the code I see on notepad++:
         <?php          $share = "";         //the_content( __( $articlefooter, 'twentythirteen' ) );         the_content( __( ''.$share.'Continua a leggere »', 'twentythirteen' ) );         ?>
      The code inside the $share variable gets replaced in runtime by ShareThis script, and becomes much bigger with a lot of nested span tags:                                                   0                                                   0          Continua a leggere »           I have found the nested span tag that can be edited to fix the issue, but I have no control over it. I treied to add height to the class stMainservices, like this:               .stMainServices {         height:24px;     }      but from Chrome I see that the style gets overwritten somehow.


How to display a static HTML page while setting up a WordPress site?

I just installed Wordpress. I have a non Wordpress splash page at [root folder]/index.html. I'd like to keep the splash page up while I work on skinning Wordpress. When I try to access index.php (also in the root folder), it rewrites the url to index.html. I don't see index.html in the url but the splash page is there and I never see Wordpress. I am able to access the Wordpress admin without issue. Anyone know how I can access Wordpress without making it go live?


Delete all one-word comments

I'm trying to delete all wordpress comments with only one word. I found this mysql query to delete all comments at once, but that's not what I want to achieve:               DELETE FROM wp_comments WHERE comment_approved = '0'


Get the children of the parent category

I'm trying to get all the children categories to display in this loop but I'm struggling with the code. This is what I have so far.               <?php $args=array('orderby' => 'name', 'order' => 'ASC');         $categories=get_categories($args);          foreach ($categories as $cat) { ?>
<a href="#" class="customer-acquisitiontop" id="<?php echo $cat->slug; ?>" data-filter=".<?php echo $cat->slug; ?>">
<?= $cat->cat_name; ?>

         <?= $categories=get_categories('parent'); ?> /*This should be the children of the parent category */

     <?php } ?>      Any help would be great


Redirect a password protected page?

I'm looking for the simplest way to redirect a password protected page, to another page after entering the password. E.g.               <?php if ( is_page('name-of-page') && ! post_password_required() ) {         wp_redirect( home_url() ); exit;      } ?>      Using wp_redirect is triggering a 'headers already sent error'. I've seen some solutions using output buffering to avoid this but, I'm not sure if it is the best solution. Thanks!


Widget update function not saving values

Hello WordPress Answers! I'm having trouble with the widget `update` function saving values correctly, but first let me explain the situation. I'm writing a simple news ticker widget plugin, which filters the posts displayed by post type with check boxes in the widget settings form. To generate the check boxes I'm using a `foreach` loop over the available post types. However, the widget update function isn't saving the post type values. I confirmed this by doing a `print_r` in the form function (values exist) and again in the widget function (values do not exist). Here is my code:               class ami_newsticker_widget extends WP_Widget {          // process the widget     function ami_newsticker_widget () {              $widget_ops = array(             'classname' => 'ticketcontainer',             'description' => 'Display a scrolling newsticker'         );         $this->WP_Widget( 'ami_newsticker_widget', 'AMI News Ticker Widget', $widget_ops );     }          // build the widget settings form     function form( $instance ) {         $defaults   = array( 'num_posts' => 5 );         $instance   = wp_parse_args( (array) $instance, $defaults );         $num_posts  = $instance['num_posts'];          foreach ( get_post_types() as $post_type ) {       $instance['post_types'] .= $post_type . ',';     }     $post_types = $instance['post_types'];         //echo '
';     //print_r($instance);         //echo '
';              ?>
Number of posts to show: <input class="widefat" name="<?php echo $this->get_field_name( 'num_posts' ); ?>" type="number" value="<?php echo esc_attr( $num_posts ); ?>" />

Filter by Post Type:
             <?php foreach ( get_post_types() as $post_type ) { ?>
<input name="<?php echo $this->get_field_name( $post_type ); ?>" type="checkbox" <?php checked( $this->get_field_name( $post_type ) ); ?> /><label for="<?php echo $this->get_field_name( $post_type ); ?>" /><?php echo $post_type; ?>
             <?php            } ?>

              <?php     echo '
';     print_r($instance);     echo '
';     }          // save the widget settings     function update( $new_instance, $old_instance ) {         $instance = $old_instance;         $instance['num_posts'] = strip_tags( $new_instance['num_posts'] );     $instance['post_types'] = strip_tags( $new_instance['post_types'] );              return $instance;     }          // display the widget     function widget( $args, $instance ) {             global $wpdb;             extract( $args );            echo '
';       print_r($instance);       echo '
';                  // load the widget settings       //foreach ( $instance['post_types'] as $post_type ) {         //if ( $post_type == 'on' ) {           //$checked .= $instance['post_types'][$post_type] . ' ,';         //}       //}       //echo $checked;                  // get and clean the db data             $num_posts = intval( absint( $instance['num_posts'] ) );             $sql = "SELECT post_title, guid                             FROM {$wpdb->posts}                             WHERE post_status = 'publish'                             ORDER BY post_date DESC                             LIMIT {$num_posts}";                  $results = $wpdb->get_results( $sql );                  // print the widget             echo $before_widget;             echo '
';                  foreach ($results as $result) {                 echo '
guid . '">' . $result->post_title . '
';             }                  echo '
';             echo $after_widget;     }      } It seems like there is something obvious that I'm missing, but I've been banging my head against a wall on this! Any help would be greatly appreciated. Thanks in advance!


How to add hook to the_title() and get_the_title()

I've having trouble with accented characters now if i do utf8_decode() before echoing the title the problem is solved but instead of changing this all over my theme, can't I do this in one place that upgrade proof? I'm not really familiar with hooks but I think thats they way to do it, havent found out how to do it tho.


Limit the word count in the post title

Is there a way to limit the word count of the post title? I searched over the internet but found nothing. All I know is, only the content of the post can be limited or excerpted.


WordPress creating 404s under blog tags

Webmaster Tools is pulling up 404s under by blog tags. I go to a blog tag, scroll all the way down and find an "older posts" button. I click the button and the new page is a 404 because there is not enough content under that specific tag to run into a second page. How do I prevent wordpress from automatically creating these /page/2/ ?


fetch_feed: retrieve entries in the appearing order, not chronologically

I'm using WP function fetch_feed to retrieve a feed and display its items.                   <?php         /* include the required file */     include_once(ABSPATH . WPINC . '/feed.php');         /* specify the source feed   */     $rss = fetch_feed('FEED_URL');         /* checks obj. is created    */     if (!is_wp_error( $rss ) ) :         /* specify number of items   */     $maxitems = $rss->get_item_quantity(4);         /* create an array of items  */     $rss_items = $rss->get_items(0, $maxitems);     endif;         ?>
             <?php if ($maxitems == 0) echo '
Content not available.
';         else             // Loop through each feed item and display each item as a hyperlink.             foreach ( $rss_items as $item ) : ?>
                     <a href="<?php echo $item->get_permalink(); ?>" title="<?php echo esc_html( $item->get_title() ); ?>" rel="external"><?php echo esc_html( $item->get_title() ); ?>
                 <?php endforeach; ?>
      If I visit the feed in question with (e.g.) Firefox, I see the entries in the XML appearing order. fetch_feed retrieves the most recent instead (according to their "published" tag). How can I make sure it retrieves items according to their order on the XML feed (not chronologically). Maybe is possible to set the order with this..? **EDIT:** I tried adding $feed->enable_order_by_date(false); but it seems to break the function..


Comparing arrays with meta_query in pre_get_posts

I'm working on a form for filtering a list of posts using custom fields created with the Advanced Custom Fields plugin. Because of the form, I'm using the `pre_get_posts` action to change the query via GET requests. (following code references are either PHP or dumped from `print_r()`) I set the meta_query like this:               $query->set('meta_query',$filter);      and `$filter` looks like this:               Array     (         [0] => Array             (                 [key] => delivery_method                 [value] => Array                     (                         [0] => Online                         [1] => Scheduled                          )                      [compare] => IN             )     )      The custom field that I am querying is structured like this:               Array (         [delivery_method] => Array (             [0] => Online             [1] => Scheduled         )     )      When I look for posts with `[compare] => IN` (as above), no posts are returned. When I look for posts with `[compare] => NOT IN`, all of the posts are returned. I am trying to return only those posts which have a specific "delivery method". Is there a way to compare the two arrays that I missed? or do I have to somehow explode one of the arrays and compare individual values against an array?


Display custom posts in checkbox list

I am working in a WordPress backend design and I would like to know if is there any function like wp_categories_checklist but for posts. I have an issue here: http://wordpress.org/support/topic/order-posts-by- custom-post-type-in-dropdown-field?replies=10 in order to find a multiple selection of my dropdown. So if is there any way to put my posts array in a meta box like the custom categories from WordPress that would be great. Thanks


418 header status, I'm a teapot

I'm just backing up a clients via ftp site prior to working on it, when suddenly all urls are returning an error page with the header status being `418`. A quick Google finds that this was created for an April Fools joke. Does any body have any idea why I would be getting this error?


Using Custom Function With Advanced Custom Fields

I've written a custom function which works with the native WordPress custom fields function but I need it to work with the Advanced Custom Fields plugin. I have created the custom field and meta box using the plugin and added the function to my child theme's `functions.php` file. I am using the field name (demo_field) for the meta box in the custom function but the meta box does not hook in to the function.               add_action( 'genesis_after_post_content', 'custom_field_before_content' );     function custom_field_before_content() {       if(is_single() ) {         genesis_custom_field('demo_field');       }     }      What am I doing wrong? Ok i fixed that but it doesn't return the image even though i configured the settings to return value for the image object. It displays the HTML for the image.               add_action( 'genesis_after_post_title', 'custom_field_before_content' );     function custom_field_before_content() {     if(is_single() ) {     the_field('second_image');       }     }      Here's what it displays: 32538, , second feature image, , , /wp-content/uploads/2013/06/second-feature- image.png, 600, 300, Array Here's the final solution i worked out myself which i tested and works with Genesis only. You can change the hook if using another theme with hooks.               add_action( 'genesis_after_post_title', 'custom_field_before_content' );     function custom_field_before_content() {     if(is_single() )      if( get_field('second_image') ):     ?><img src="<?php the_field('second_image'); ?>" alt="" /><?php     endif;      } The code comes from the ACF website.http://www.advancedcustomfields.com/resources/field-types/image/


Is it possible to have pagination with an offset loop?

I am developing a blog page that requires 3 different post styles (Ie; one full page width with featured image and content, one full page width without featured image and the rest are half page width) so I have been using an offset query. The problem I'm having is that I can't figure out how to force page 2,3, etc. to only use the half page width styles. On top of that I can't get pagination to work anyway Is this even possible?


Here is my wordpress theme to check out(its not completely finished): http://benlevywebdesign.com/wordpress/ This is my first time working with php/wordpress and making themes so keep that in mind. I have an index.php, css, and a 960.css file and don't know about the other files that you can include. In my theme I would like to have different styles for my posts based on the content of each post like for images and video links or audio links. I want to first focus on a photo style where the photo will be big and large and not the size of a thumbnail or regular post image. Once I learn how to have different styles I can add more on my own because that is just the css! * * * Here is my current loop code:

<?php the_time('d'); ?>

<?php the_time('M'); ?>

<?php the_time('Y'); ?>

                 <?php comments_number('No comment', '1 comment', '% comments'); ?>

                     <a href="<?php the_permalink(); ?>"><?php the_title(); ?>

                      <?php the_author_posts_link(); ?>

                     <?php the_post_thumbnail( $size, $attr ); ?>

                 <?php the_content(); ?>

                 <?php the_category(', '); ?>

 <?php wp_list_comments(); ?>

                      <?php endwhile; else: ?>
Hmmm? Can't. Find. Post.
         <?php endif; ?>      * * * Here is an example blog theme that is doing what I want(3rd post from the bottom) http://demo.kreativethemes.com/evolution/ * * * I read about using the `post_class()` function and that I would need to create another php file for the post type, or that I could just code the mark up right into the loop if that's more what I prefer on this question CSS for Custom Post Types (and understood what they are doing but don't know how to actually do it) I think I want to go with putting it right into the loop if that's not too complicated as I said earlier I don't know much about other files you can include.