Taxonomy or Custom Field

I'm creating a network that has profile pages for authors (custom post type) on the main site, where I've created a few non-hierarchical taxonomies to help users sort through the authors. These taxonomies are: title, genre, publisher and date published. I understand the first three. What I don't understand is how to appropriately keep track of date published. Should I use a taxonomy? But that presents certain problems (I think) when it comes to searching a range of dates, lets say between 1900-1917. Or if I wanted to create a tag cloud. I've always felt that taxonomies were to establish relationships between terms. Does a range qualify as a relationship, and more practically can it work? If I created a custom field for date, how would I have users search through results? Hope that makes sense. Just looking for some opinions, from more experienced people, on how that would be best represented.


Help With MySQL to WPDB Query Conversion

I have a problem. I've got a PHP script that tracks individual file downloads, and I'm looking for a way to display that number in individual posts. I've got a half-baked solution- a plain ol' MySQL manual connection script, but I'm trying to convert it to use as a Wordpress plugin (I want it to use WPDB). **I've tried to convert it, but I don't know what the Wordpress alternative to 'mysql_fetch_array.'** Anyways, I've included the original script below, as well as my progress on a Wordpress-friendly version. Plain Version:               function mb_download_count() {         global $post;         if (get_post_meta($post->ID, 'zipname', TRUE)) {             $namemeta = get_post_meta($post->ID, 'zipname', TRUE);                  require $_SERVER['DOCUMENT_ROOT'].'/downloader-connect.php';             $result = mysql_query("SELECT * FROM mb_download_manager                                         WHERE filename='".$namemeta.".zip'");                        // get the first (and hopefully only) entry from the result             $row = mysql_fetch_array( $result );                 // Print out the contents of each row into a table              if ($row['downloads'] == '') { echo ('0'); } else {             echo $row['downloads']; }             } else { }     }      Wordpress-friendly Version so far:               function mb_download_count() {         global $wpdb;         global $post;         if (get_post_meta($post->ID, 'zipname', TRUE)) {             $namemeta = get_post_meta($post->ID, 'zipname', TRUE);                  $result = $wpdb->query("SELECT * FROM mb_download_manager                                         WHERE filename='".$namemeta.".zip'");                    $row = mysql_fetch_array( $result );             if ($row['downloads'] == '') { echo ('0'); } else {             echo $row['downloads']; }             } else { }     }


Show different number of posts per page in tag archives

I am using the following code out of loop to show one post per page in tag archive.               <?php query_posts($query_string."&showposts=1") ?>      However, I want to show recent posts as 10 posts per page and older posts than a date (say 1 August) as 1 post per page. Is there any way I can do that.   Thanks.


Adding a new user from the front end

I have a front end form that creates a new post from users that are not required to login. However, I need to create a new user based on the information passed in the form. As it is right now I can successfully create a new user, but in the user admin in the backend there are no posts associated with this new user (thought the posts are successful themselves). Side note, if I delete the user and click to delete all associated posts, it will delete the post they created. I just can't figure out why it won't show their posts in the user admin... Code as follows in my custom template file:               $new_post = array(     'post_title'    =>   $title,     'post_content'  =>   $description,     'post_category' =>   array($_POST['cat']),  // Usable for custom taxonomies too     'tags_input'    =>   array($tags),     'post_author'    => $user_id,     'post_status'   =>   'publish',           // Choose: publish, preview, future, draft, etc.     'post_type' =>   'post'  //'post',page' or use a custom post type if you want to          );          // Insert a user          if ( ! is_user_logged_in() ) {             // create an account           $user_data = array(                 'ID' => '',                 'user_pass' => wp_generate_password(),                 'user_login' => $lastname,                 'display_name' => $lastname,                 'first_name' => $firstname,                 'last_name' => $lastname,                 'role' => get_option('default_role'), // Use default role or another role, e.g. 'editor'                 'user_email' => $email             );             $user_id = wp_insert_user( $user_data );         }     else {         $user_id = get_current_user_id();     }


One WordPress install serving multiple virtual hosts

I have a number of WordPress-enabled sites setup as virtual hosts under XAMPP on a Windows 7 development server.      An example virtual host is as follows:      <VirtualHost *:80>   ServerName siteA.localhost   DocumentRoot "C:/htdocs/siteA"   </VirtualHost> My goal is to have all the sites use the same WordPress install, which is located in it's own folder off the Document Root, ie: "C:/htdocs/wordpress".      The only WordPress files unique to each virtual host will then be the wp- config.php file and the /wp-content/ folder, which will be located off the root of each site.      Does anyone have any suggestions for how to achieve this? I've tried adding the WordPress folder as an Alias for each Virtual Host, and adding it as "php_value include_path" value for each Virtual Host as well, but neither of these have worked.      Ultimately I want to make it easy to upgrade all my WordPress-powered sites by having them share the same WordPress core.      Thanks.


How can I add in post's the text "No content"

How can I add in a post the words "No content available" if nothing is ritten Example:   If there is no text added, i want to get "No content available" automated in my template. I want to get for a specific Post Type, `Seriale`. How can I make that? In the template i have this               <?php          if (is_search())              the_excerpt();          else              the_content(__('Read the rest of this entry »')); ?>     <?php          if (is_page() or is_single())              wp_link_pages(array(                 'before' => '
Pages: ',                  'after' => '
', 'next_or_number' => 'number'             ));      ?>


get_terms problem : related articles

I'm trying to use get_the_term_list to catch the name of the current taxonomy of the page, and then use it with get_terms and a foreach method, to show the result of all the "elements" from the same taxonomy, but i only got an empty result. (for example, this is to have the related articles of the page). Do you know why it doesn't work? The echo on get_the_term_list works ok, but then in the parameter of get_terms, the result of the "li"s is blank.               $my_tax = get_the_term_list( $post->ID, 'type');     //echo $my_tax;?> output works fine          $terms = get_terms($my_tax);     foreach ($terms as $term) {     echo "<li>".$term->name."</li>"; // empty     }      Could you help me?


Adding a user's ID behind the <a> tag ref link address

Good day, everyone: I want to make wordpress to add the user's id number behind the ref's link string, so that, for example
      go this page
      above code will be turning in to a link if the user id is 113 who clicked it, the address will become:               go this page      Or, if you know an alternative to do so, please also let me know. Generally, the purpose will be that a user will be directed to a page that with unified address but there will be a number equal to his id attached behind. every time, someone click the same link, in same page, will have the same effect on each user. **When a user click it, will be the CURRENT USER, who is a registered user.** If anyone could tell me if I could create the page at the same time (if not exist), will be terrific! Thank You


Media Content disapeared after upgrade WP core to 3.5.1

my Media -->Library content disappeared from the dashboard, but I still can see it inside my actual site folder. Could anyone instruct me how to fix it? Thank You


Get multiple posts with some custom fields efficient

Is there an efficient way to get some posts with (some of) their custom fields in one go? I have a custom post with some custom fields and would like to create an overview page where I display all posts in their respective category. I need the custom fields because there is info about how to display the posts in this overview (icon location, alt text etc.) I don't want to just get a list of posts and then get the custom fields for every single one of them using a loop producing a ton of queries. I know I can cache the result until a post changes but it would be nice if it wasn't necessary at all. So is there a way to get posts with their custom fields or at least a way to get the custom fields of several posts at once or do I have to write my own query to achieve that?


Add 'last' class to second post in featured post loop

Hi there I'm using the following query to pull in two featured posts onto the home page of a site I'm building. How do I add a last class to the second post it drops onto the page?
Case Studies
                 <?php $my_query = new WP_Query('post_type=casestudy&posts_per_page=2');                     while ($my_query->have_posts()) : $my_query->the_post();                     $do_not_duplicate = $post->ID; ?>
                         <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
                         <?php the_excerpt(); ?>
                     <?php endwhile; ?>      Thanks John


Best Way to Grab Post ID from Plugin

I'm currently using loop_end to hook my plugin and get the post id from a page. This works great, except that it's also displaying my plugin in the recent posts widget which I don't want. Is there a better way to do this so that it ONLY displays on page content and not widgets?


Call do_action class's function

There is the following do_action               else     do_action( 'example', $this->nothing());      Where nothing() does exactly what it sounds like. This logic is in a public function testFunction in a class called Test. What I would like to do is hook into this function (I'm in a different plugin), and call a different function (looppages()) that is already in the same class as the above logic like this:               add_action( 'example', Test::looppages);      Can I do this?


How to check if commenter is the_author?

What's the best way of checking if my commenter is also the author of the post that he post comment on? I know there's a css way (`.byauthor`), but how about PHP? How to compare post author with comment author? I was trying with is_author(), the_author() and comment_author() but it just doesn't look right (what if somebody uses the same nickname as author?). Here's my code for now:               <?php if(get_the_author() == get_comment_author()) _e( 'Author', 'theme' ) ?>


How to execute WordPress as though it is in the root folder while it is installed in a subdirectory?

I have a folder and file structure already in place for a site to which I am inserting WordPress. My goal is to execute WP at the root level (/) when a visitor just visits the domain without a path, however I want WP to be installed within the `wordpress` subfolder folder. So far I've reviewed several hits on this, but every single one of them appear to have the negative side effect of pushing the user on over to http://mydomain.tld/wordpress rather than keeping the user on /. How can this be accomplished? I am guessing it is going to take some massaging of .htaccess in both the root folder and the other subfolders to which I want to grant access aside from WordPress, but I'd like to see this delineated properly. One thing I have tried is to follow the Codex suggestion "Pointing your home site's URL to a subdirectory". In this I have updated my `.htaccess` as per what is there, however the site is consistently redirected to `http://mydomain.tld/wordpress`. I obviously want it to just be `mydomain.tld` without the additional wordpress path. I have further attempted to do the following, with the `mydomain.tld` loading up the wordpress blog, but then seemingly when I go to any page, such as the default sample page that is installed with a fresh installation, it then adds the subfolder path again `mydomain.tld/wordpress/blah`: in `/index.php`:               <?php     /**      * Front to the WordPress application. This file doesn't do anything, but loads      * wp-blog-header.php which does and tells WordPress to load the theme.      *      * @package WordPress      */          /**      * Tells WordPress to load the WordPress theme and output it.      *      * @var bool      */     define('WP_USE_THEMES', true);          /** Loads the WordPress Environment and Template */     require('./wordpress/wp-blog-header.php');      and `/.htaccess`:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /wordpress     RewriteRule ^index\.php$ - [L]          # uploaded files     RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]          # add a trailing slash to /wp-admin     RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]     RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]     RewriteRule . index.php [L]          </IfModule>          # END WordPress      Also, the `wp_options` table siteurl has `http://mydomain.tld/wordpress` in it as well.


bbPress: How to set conditional for specific user -or- user role, to be displayed in user profile

I've been trying to set a conditional for specific users (e.g. http://www.mywebsite.org/forum/users/john/) to display a custom "Contributor" graphic within their user profiles. The graphic would be displayed directly underneath the specified profile pics using the template file (bbpress/templates/default/bbpress/user-details.php). I was also thinking that it might be easier to set the conditional based on their WordPress user role (e.g. Contributor), so that I wouldn't have to write each user in the condition manually. Here's what I've tried so far:               <?php if(current_user_can('contributor')) { ?>          <?php } ?>      I've also tried:               <?php if(bb_user_id('15')) { ?>          <?php } ?>      I'm very new to PHP, and I've been trying very hard to find the answer. If you can help me, I would appreciate it very much! Thanks.


Replacing link URL ending strings via MySQL

We are about to purchase a site that uses Amazon affiliate links. Naturally, they have their own affiliate ID, Amazon affiliate links look like this:               http://www.amazon.com/gp/product/productcode/?tag=affiliateID-20      What would be the best way to alter the ending string for these links' URL's in a Wordpress blog?


Display category description instead of "nothing found" page

I'm using Wordpress 3.8.1 with the theme twenty fourteen. Unfortunately , when you click on a category with no post assigned to it for now , it displays a _not found_ page. I've tried to create a plugins with a hook that replace that by a text (like the description of the category). If there are no posts is in the category, only the description is displayed, if the category have posts, description is displayed and posts founds after. For now I don't find any ways to affect the _nothing found_ page. Is it possible to do this without modifying the category.php file (with plugin by hooks) like this thread


Re-using single CPT code with get_template_part?

Wordpress newbie, here. I've created a custom post type, using CPT UI, named "menus". Later created single instances of that "menus" CPT, directed by a "single-menu" template. So here's my hierarchy for that "menu" CPT: one template "menus" : listing all "menu" posts one template "single-menu" : generating individual posts of the "menu" post type various pages based on the "single-menu" template : for example, a "monday" page Now, i want to retrieve this "monday" single instance of that CPT and re-use its code using get_template_part(). So far, i've been able to call the CPT listing page content ("menus") but unable to call the single instance ruled by the "single-menu" template. Here's my code:               <?php      get_template_part( 'menus');      ?>      The path for the page targeted reads as follow on my browser:               http://localhost/website/menu/monday/      I've tried several combinations but have been unable to call it. New to wordpress as mentioned, used to use a standard php include function in my static prototype. It worked fine, now how i can call this "monday" with the get_template_part()? Any idea as to how this could be done? Pointers welcome too!


paginate_links adds strong element

I just faced a strange issue with `paginate_links` in WordPress 3.8.1. The navigation itself works great and as expected. But when going to the last page, it adds `<strong>` tags to the whole markup:               global $wp_query;          $unlikely_number = 99999999;          $args = array('total' => $wp_query->max_num_pages,                   'base' => str_replace($unlikely_number, '%#%', esc_url(get_pagenum_link($unlikely_number))),                   'current' => max(1, get_query_var('paged')),                   'format' => '/page/%#%',                   'prev_text' => 'PREV',                   'next_text' => 'NEXT',                   'type' => 'list',                   'end_size' => 2,                   'mid_size' => 2);          echo paginate_links($args);      Here is the generated HTML with screenshots. ![page name as needed](http://i.stack.imgur.com/xfWtc.png)

1

2

3

NEXT

      ![page navi with strong tag in last page](http://i.stack.imgur.com/CZyjL.png)

PREV

1

2

3

      Does anybody know this issue or could imagine a fix for that?


Can I / Should I use WordPress as a CMS for my Flash application

I sometimes build applications in Flash for the web that need a fair bit of dynamic data. Would WordPress be a good fit for my CMS solution? can it "talk" to flash? Does it allow output as different formats such as XML, JSON, or AMF?


disable wordpress canonical tag meta

wordpress core automatically generates canonical tag in **HEAD** section:               <link rel="canonical" href="http://blabla.com" />      how to disable/remove that?


Minimize database queries to user tables?

I'm trying to come up with a strategic way to collect large amounts of usermeta data _(and output to the screen)_ while keeping database queries low. Some pages, like the home page, single pages, and category pages, load up in less than half a second with 40-60 queries. Other pages that contain large amounts of usermeta load up in 5-6 seconds with 200-220 queries. Is there a "best practice" way to do somehow pull all userdata before the website loads (or the first time a website loads) and then tap into that information (IE, a multidimensional array based on user ID) for all other user-based queries on the site? Would the information save on visit (cached on browser), or would it be necessary to use the transient api? Any thoughts?


Hack nav menu to add gettext() to menu items?

I'm translating my whole site with gettext and I'm using shortcodes for the content in my pages that in turn call gettext. However shortcodes don't seem to work for menu items I need to figure out a way to translate them. I'm wondering whether there is some way to modify my menu from my functions.php to add it a _("") function somewhere between retrieving the menu items labels from the database and echoing them. Is that possible? if not, how can I translate menu items?


I want a widget to appear on only one page

I have a rotating images widget I want to display on my homepage. My selected homepage is a static front page I created with several other pages to make my blog look more like a website than a blog, and then I have a separate blog page. The widget does not come with shortcode. Rather it comes with something like code that I have to insert in editor in a place that will make the widget appear where I want the rotating images to appear. What I've figured out with trial and error is that when I insert the code into the page.php I can get it to show up exactly where I want it on my selected home page. The problem is that it also shows up on all the other pages except the blog page. So, what I need to do is to write some additional code telling wordpress to only show the widget on the one page. Any ideas on how to write this code? Here is the code that comes with the widget:               <?php include (ABSPATH . '/wp-content/plugins/featured-content-gallery/gallery.php'); ?>      Thanks, Jason


wp-admin/admin-ajax.php - Slowing My Site down

Whenever I do a speed test on my site from Pingdom - the page wp-admin/admin- ajax.php takes the longest to load and therefore it is causing my site to load slowly. As speed is an important factor I would like some advice. This is the site.


If custom field doesn't exist, or exists and it's true show title?

Im trying to add new feature to the theme and that's show/hide page title,but since i already have about 50 posts i can't go to all of them and save again just to save custom field values. So i tried to make check if custom field doesn't exist, or if exist but not set to false show the title. But im failing at some point. Custom field is metabox with checkbox, when checked it records "1" in database, when unchecked records "0" in database. And of course since im adding it now, 50 posts doesn't have that field in database. Here is my last tryout.               if ( empty(vf_get_meta($post->ID, 'page_options', 'show_title')) || (vf_get_meta($post->ID, 'page_options', 'show_title') == true ))      This should check if meta is empty or if it's true and show page title. But something im not understanding. Isn't return false if it's empty? How do i do it than?


Shortcode help: If no image entered take default

I have a shortcode that creates an "opinion box". The user should insert 4 parts   1. the title   2. the images   3. the opinion   4. side of the image in relationship with text i want to check if no image was entered and in such   a case take a default image from /images/ folder...   but to do so without changing the 'paste Img Url'   statement which i need in order to explain to the   user where to put the image if exists. **This is the shortcode:**               function opinionBox( $atts, $content = null ) {         extract( shortcode_atts( array(             'title' => 'yourtitle',             'imgURL' => 'paste Img Url',             'side' => 'left'         ), $atts ) );              return '

                 '. $title .'

                 '. $content .'

         ';     }     add_shortcode( 'opinionbox', 'opinionBox' );


How to add homepage Widget?

How do I add a 'Homepage' widget to my widget bar in Wordpress 3.3 ??!! **EG:** Dashboard > Widgets > Homepage with same fields as others


Moving Some Articles to new site

I have a question about moving wordpress sites around. I've read most of the Support Docs about moving a wordpress site. My question is this, what would you guys recommend in regards to moving only certain posts from one site into a totally different domain. My current domain is a tech/blog installation. The past year or so, I've been posting my technical stuff to a different domain, and my current domain is collecting quite a bit of dust. What I'm wanting to do is turn my current domain into a personal blog and move only my technical articles over to the new blog. Obviously, there's probably an easy way to move posts and comments over (i haven't looked into it but i'm pretty sure I can do this pretty easily). The true question is how I would present these posts on the current site once they are moved over to the new domain? Do I keep them on the current domain? Should I redirect users to the new domain automatically on only these posts? Should I remove them from the current site? These type of questions I'm wondering and if you guys have an pointers please let me know.


New clone of Wordpress site 301 redirects back to orginal site

My new cloned site when accessed by IP in a browser forwards back to the original site via a '301 Moved Permanently'. How do I keep this new site from forwarding back to the old? History: Our dedicated webserver is dying, and I am attempting to get working clones of our wordpress websites working elsewhere before it is dead. I am new at this and wanted to have the security of seeing them running in a new linode VM before I switched the DNS over.   * I set up the VM with Ubuntu Server 12.04, wordpress & LAMP    * I copied over all the webfiles from the dedicated server(DS) to the Virtual Machine(VM)    * I ran mysqldump on the DS and reinstalled the wordpress database on the VM    * I made sure that the DB_user and DB_password in wpconfig.php had permissions to the DB    * I made sure that the Apache virtual host files ( that I copied from the DS) has the IP of new vm.  Then the forwarding began, I have researched and tried the following   * I added both of the following to my wpconfig.php file. I tried it by IP and by an alternate name > define( 'WP_SITEURL', 'http://example.com' );   >  define( 'WP_HOME', 'http://example.com' ); >   * I and others have gone through the code looking for any typical > forwarding code >   * I tried turning off rewriteengine in .htaccess > Apache is working as I can access static files via http://<ip>/image.png, but when I enter the IP in a browser, it pauses for a second and forwards back to the original site on the old DS. I am not convinced that wordpress is working correctly on the new site as it always forwards. We get this **301 Moved Permanently** when accessing it with curl               curl -v http://<ip>/     * About to connect() to <ip> port 80 (#0)     *   Trying <ip>...     * Adding handle: conn: 0x7fb182003a00     * Adding handle: send: 0     * Adding handle: recv: 0     * Curl_addHandleToPipeline: length: 1     * - Conn 0 (0x7fb182003a00) send_pipe: 1, recv_pipe: 0     * Connected to <ip> (<ip>) port 80 (#0)               GET / HTTP/1.1     User-Agent: curl/7.30.0     Host: <ip>     Accept: */*          < HTTP/1.1 301 Moved Permanently     < Date: Thu, 27 Feb 2014 13:34:33 GMT     * Server Apache/2.2.22 (Ubuntu) is not blacklisted     < Server: Apache/2.2.22 (Ubuntu)     < X-Powered-By: PHP/5.3.10-1ubuntu3.9     < X-Pingback: http://<orginal_domain_name>.org/xmlrpc.php     < Location: http://<orginal_domain_name>.org/     < Vary: Accept-Encoding     < Content-Length: 0     < Content-Type: text/html; charset=UTF-8     <      * Connection #0 to host <ip> left intact      How do I keep this new site from forwarding back to the old?


Facebook Like Button in Jetpack

I'd like to have a Facebook Like Button (not a Facebook share, which is available) through Jetpack. There is a "Add a new service" and I've tried various parts of code from all over but always gets an "An error occurred creating your new sharing service - please check you gave valid details." Anyone knows howe to do this?


How does Wordpress handle MySQL row lock errors?

If there is a WordPress plugin which updates rows in a custom table, but that update encounters a row lock, what happens? E.g. two users simultaneously fire an update on TABLE1, one setting AGE=1 and the other setting AGE=2:   * Will there be a row lock at all?   * Will MySQL handle this "gracefully" and one of the 2 updates simply be "lost"?   * Does Wordpress handle it gracefully?   * Do I need to take care of it in the plugin? The data is not very important, as in I dont need to track every change. But I do need to handle any errors that might arise.


Dynamic href link to Contact Page

I need a `<a href="Something Like <?get_contact_page>">Contact Page</a>` Code that always links to the Contact page, no matter what is it's ID There's a page template for contact page. Is it possible to do this? I'll gladly provide any further information you need :) Thanks!!


What archive plugin works with W3 total cache?

All plugins I've tried makes the page go blank. I tried so far:   * Smart Archives Reloaded    * Clean Archives Reloaded    * Better Extended Live Archives Thanks. Tal


Custom post type for 'staff' versus using wordpress user profiles?

A scenario I keep coming across is where an organisation might have several staff for whom I want to have some sort of listing and a single profile page with biographical information. Typically I would create a custom post type for staff and maybe a custom taxonomy if needed. But now I'm wondering if it might not be optimal to use the built-in "user" post type in Wordpress. I realise I can customise the user profile fields, display user listings, single profiles etc Custom taxonomies are possible too I believe. Is there a best practice here? I have a case now where all staff are also writing blog posts under their own name and so have a user account anyway and it crossed my mind that maybe I'm better off just fleshing out their user profiles and working with author.php instead of using the custom post type of 'staff'. For now I've been going with the CPT and using Posts 2 Posts plugin to associate their "staff" post with their "user" account and thereby create listings of their blog posts on their single staff page. Any thoughts on how best to implement this in wordpress is appreciated.


Customizing lost password email

I need to change the default email text that will be sent to recover the password. I have already changed the mail of activation in multisite:               // Start changing email body     function myprefix_change_activation_email_body ($old_body, $domain, $path, $title, $user, $user_email, $key, $meta) {         $my_message .= "\n\nhello {$user} ,welcome to {$domain} !\n\n";              // ... other stuff         return $my_message;     }     add_filter('wpmu_signup_blog_notification_email', 'myprefix_change_activation_email_body', 10, 8);     // End changing email body          // Start changing email subject     function myprefix_change_activation_email_subject ($old_subject, $domain, $path, $title, $user, $user_email, $key, $meta) {         $my_subject = "my subject";         return $my_subject;     }     add_filter('wpmu_signup_blog_notification_subject', 'myprefix_change_activation_email_subject', 10, 8);


redirect loop to page, can't find origin, can't remove

I have a new client who did "something, I can't remember what" to her blog. Now when you visit the home page, it redirects to a page she created and deleted, "/road-maps/". I have no idea why it started doing this, or how she got it to do this. She has no FTP access and did something solely in the Wordpress back office. I located the deleted page in the trash and deleted it permanently but it still redirects. I disabled every plugin and it still redirects to there. I exported the database and looked for instances of "road- maps" anywhere inside it and found only two places - the temporary redirect that I put in place to a static page while I try and fix the problem, and the references to the page in the site tracking logs. Nothing else. I looked in .htaccess and it looks fine, no mention of "road-maps". I SSHed into the site and did a global search for "road-maps" and found nothing. I'm at my wit's end. Where could this redirect possibly be coming from? And how do I remove it? Thanks so much.


Changing themes on locally hosted webpages

I recently turned my Raspberry Pi into a web server, and now I installed Wordpress on it. Everything is going excellently, but when I went to change the theme from default, I found I need my hostname, FTP username, and FTP password. I didn't see this as a major problem, so since I host my webpage on my 'Pi I put in "localhost" and my MySQL username/password for the server I set up. It popped up an error saying it failed to connect to the FTP server. Since I am still fairly new to Wordpress and webhosting, could someone please tell me what I _should_ have used?


Post Content, Special Characters and Filters

I added a hook to `the_content`.               add_filter('the_content', 'edit_the_content');     function edit_the_content($content){         return $content;     }      Pretty simple right? However, when it output `$content` from within my `edit_the_content()` callback it seems like WordPress converts some, but not all characters into special characters. **Example:** it's = `it’s` but then an anchor tag, remains untouched and not converted. Is there some sort of filter which runs on `the_content` which only converts some characters to special characters, but not all?


Loop get_theme_mod

I've got a bunch of customizer settings set up Rather than calling individual get_theme_mod statements for each setting individually, is there a way to simplify it to loop thru them without having to explicitly write each one individually? The complete file is also setup on Gist for review               <?php               /** Adds the Customize page to the WordPress admin area */     function litho_customizer_menu() {         add_theme_page( 'Customize', 'Customize', 'edit_theme_options', 'customize.php' );     }     add_action( 'admin_menu', 'litho_customizer_menu' );          /** Adds the individual sections, settings, and controls to the theme customizer */     function litho_customizer( $wp_customize ) {         class Example_Customize_Textarea_Control extends WP_Customize_Control {             public $type = 'textarea';                  public function render_content() { ?>                                      <?php echo esc_html( $this->label ); ?>                     <textarea rows="5" style="width:100%;" <?php $this->link(); ?>><?php echo esc_textarea( $this->value() ); ?></textarea>                              <?php }         }              $wp_customize->add_section( 'site_settings', array(                 'title' => 'Framework Settings',                 'description' => 'Adjust settings',                 'priority' => 35,         ));               /* <?php echo $sidebar_position; ?> */                        $wp_customize->add_setting( 'site-subtitle', array( 'default' => 'Default subtitle text','sanitize_callback' => 'litho_sanitize_text', ) );         $wp_customize->add_control('site-subtitle', array(                 'label' => 'Copyright text',                 'section' => 'site_settings',                 'type' => 'text'         ));              $wp_customize->add_setting( 'litho_copyright_textbox',array( 'default' => 'Default copyright text','sanitize_callback' => 'litho_sanitize_text', ) );         $wp_customize->add_control( 'litho_copyright_textbox',array(                 'label' => 'Copyright text',                 'section' => 'site_settings',                 'type' => 'text'         ));                  $wp_customize->add_setting( 'litho_hide_copyright',array('sanitize_callback' => 'litho_sanitize_checkbox',) );             $wp_customize->add_control( 'litho_hide_copyright',array(                     'type' => 'checkbox',                     'label' => 'Hide copyright text',                     'section' => 'site_settings'             ));                  $wp_customize->add_setting( 'litho_logo_placement', array( 'default' => 'left','sanitize_callback' => 'litho_sanitize_logo_placement', ) );             $wp_customize->add_control( 'litho_logo_placement',array(                     'type' => 'radio',                     'label' => 'Logo placement',                     'section' => 'site_settings',                     'choices' => array( 'left' => 'Left','right' => 'Right','center' => 'Center')             ));              $wp_customize->add_setting( 'litho_powered_by', array( 'default' => 'wordpress','sanitize_callback' => 'litho_sanitize_powered_by', ) );         $wp_customize->add_control( 'litho_powered_by',array(                 'type' => 'select',                 'label' => 'This site is powered by:',                 'section' => 'site_settings',                 'choices' => array( 'wordpress' => 'WordPress','nuclear-energy' => 'Nuclear Energy')         ));              $wp_customize->add_setting( 'page-setting', array( 'sanitize_callback' => 'litho_sanitize_integer', ) );         $wp_customize->add_control( 'page-setting',array(                 'type' => 'dropdown-pages',                 'label' => 'Choose a page:',                 'section' => 'site_settings'         ));              $wp_customize->add_setting( 'color-setting', array( 'default' => '#000000','sanitize_callback' => 'sanitize_hex_color', ) );         $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'color-setting',array(                 'label' => 'Color Setting',                 'section' => 'site_settings',                 'settings' => 'color-setting'         )));              $wp_customize->add_setting( 'file-upload' );         $wp_customize->add_control( new WP_Customize_Upload_Control( $wp_customize, 'file-upload',array(                 'label' => 'File Upload',                 'section' => 'site_settings',                 'settings' => 'file-upload'         )));              $wp_customize->add_setting( 'img-upload' );         $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'img-upload',array(                 'label' => 'Image Upload',                 'section' => 'site_settings',                 'settings' => 'img-upload'         )));              $wp_customize->add_setting( 'textarea' );         $wp_customize->add_control( new Example_Customize_Textarea_Control( $wp_customize, 'textarea',array(                 'label' => 'Textarea',                 'section' => 'site_settings',                 'settings' => 'textarea'         )));              $wp_customize->add_setting( 'font-color', array( 'default' => '#444444', 'sanitize_callback' => 'sanitize_hex_color', ));         $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'font-color',array(                 'label' => 'Font Color',                 'section' => 'colors',                 'settings' => 'font-color'         )));              $wp_customize->add_setting( 'featured-background',array( 'default' => '#ffffff','sanitize_callback' => 'sanitize_hex_color','transport' => 'postMessage', ));         $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize,'featured-background',array(                 'label' => 'Featured Background',                 'section' => 'colors',                 'settings' => 'featured-background'         )));              /* AJAX function for live preview */         if ( $wp_customize->is_preview() && ! is_admin() ) {             add_action( 'wp_footer', 'litho_customize_preview', 21);         }              function litho_customize_preview() {             wp_enqueue_script( 'litho-customize-js', get_template_directory_uri().'/core/js/customize.js',array());         }         add_action( 'wp_enqueue_scripts', 'litho_customize_preview' );              $wp_customize->get_setting('blogname')->transport='postMessage';     }     add_action( 'customize_register', 'litho_customizer' );          function litho_header_alignment() {         $litho_position = get_theme_mod( 'litho_logo_placement' );         if( $litho_position != '' ) {             switch ( $litho_position ) {                 case 'left':                     break;                 case 'right':                     echo '';                     break;                 case 'center':                     echo '';                     break;             }         }     }     add_action ( 'wp_head','litho_header_alignment' );          /* The force_balance_tags() function ensures that no tags are left unclosed, while the wp_kses_post() ensures that only safe tags make it into the database (the same tags that are allowed in a standard WordPress post */     function litho_sanitize_text( $input ) {         return wp_kses_post( force_balance_tags( $input ) );     }     function litho_sanitize_checkbox( $input ) {         if ( $input == 1 ) {             return 1;         } else {             return '';         }     }     function litho_sanitize_logo_placement( $input ) {         $valid = array(             'left' => 'Left',             'right' => 'Right',             'center' => 'Center',         );              if ( array_key_exists( $input, $valid ) ) {             return $input;         } else {             return '';         }     }          function litho_sanitize_powered_by( $input ) {         $valid = array(             'wordpress' => 'WordPress',             'nuclear-energy' => 'Nuclear Energy',         );              if ( array_key_exists( $input, $valid ) ) {             return $input;         } else {             return '';         }     }     function litho_sanitize_integer( $input ) {         if( is_numeric( $input ) ) {             return intval( $input );         }     }


How do I wrap 3rd party jquery scripts so that they work in wordpress?

I'm trying to include a jQuery autocomplete script in the header.php file of my theme. The script, outside of wordpress, works great using this structure (which is the same as the jQuery autocomplete demo):               <script>       $(function() {          .....       });       </script>      I've tried wrapping it like this:                <script>     jQuery().ready(function($) {                 $(function() {                      });             });                </script>      The original script works fine. Outside of wordpress I have no problem. It's when I try to add it to the header.php file that nothing works. Even other autocomplete scripts on the site stop working. Also, I've added the following to my functions.php file:               function add_qa_scripts(){       wp_enqueue_script( 'jquery-ui-autocomplete' );     }     add_action('wp_enqueue_scripts', 'add_qa_scripts');      I can see the scripts included in the footer of my theme. But, no matter what, I can't get the autocomplete to function. What am I doing wrong? EDIT: As I'm not sure of the structural questions in the comments, here is the page for reference - the category tags should be auto completing: http://bluepresley.com/qa/tag-search/


Bizarre issue with custom RSS template

I'm trying to create a custom RSS feed template for a site my company manages, and I've encountered a very confusing bug I'd like some input on. First off, as background context, after a lot of Googling, this is the method I've chosen to create the RSS template. (If there's a better approach, I'm all ears):   1. Copy /wp-includes/feed-rss2.php into my theme folder    2. Specify that file as a page template, and modify as desired   3. From the Wordpress backend, create a new page that uses the above template  From there, you get an XML feed that's formatted for RSS. That process seems to work fine, even if it's a bit kludgy. Now, here's the issue I'm having. The XML outputted looks something like this:               <?xml version="1.0" encoding="UTF-8"?>      <rss version="2.0"         xmlns:content="http://purl.org/rss/1.0/modules/content/"         xmlns:wfw="http://wellformedweb.org/CommentAPI/"         xmlns:dc="http://purl.org/dc/elements/1.1/"         xmlns:atom="http://www.w3.org/2005/Atom"         xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"         xmlns:slash="http://purl.org/rss/1.0/modules/slash/"         >           <channel>          <title>New Grocery Coupons & Online Coupons Added Daily</title>          <atom:link href="http://couponkim.dev/weekly-deals-rss/" rel="self" type="application/rss+xml" />          <link>http://couponkim.dev</link>          <description>Coupon Kim has online coupons, printable coupons, and coupon code section for Moms like me trying to save money!</description>          <lastBuildDate>Mon, 18 Apr 2011 14:51:44 +0000</lastBuildDate>          <language>en</language>          <sy:updatePeriod>hourly</sy:updatePeriod>          <sy:updateFrequency>1</sy:updateFrequency>          <generator>http://wordpress.org/?v=3.1</generator>              <item>              <title>coupon-code</title>              <link>http://couponkim.dev/soap-com-coupons/coupon-code-159/</link>              <comments>http://couponkim.dev/soap-com-coupons/coupon-code-159/#comments</comments>              <pubDate>Mon, 18 Apr 2011 13:46:18 +0000</pubDate>                ...      (I've truncated the output for the sake of relevancy.) When I try to view the above in a Google Chrome, I get the following error message:               error on line 12 at column 30: xmlParseEntityRef: no name      My assumption here is that the ampersand is causing problems, though honestly, that's still a guess at this point. OK. So this is where it starts to get weird. I went into the PHP template, and embeded that title inside of a CDATA tag. Strangely, I didn't see that change reflected in the output when I refreshed the page. Trying something simpler, I just killed all of the PHP in the template inside of the title tags, and replaced it with static text like "This is a Test." When I refreshed the page, I _still_ didn't see any change in the output. At that point, I suspected that some cache somewhere must be working against me. I disabled the W3 Total Cache plugin, cleared my browser's cache (I'm using Chrome), and restarted Apache for the hell of it. I reloaded the page again, but saw no change. Now, as an experiment, I changed the `<title></title>` tags to read `<test></test>` and reloaded. This time, I _did_ see the change. So at this point, I thought, OK, cool, I'm finally breaking through the cache. I changed the line back to: `<title>This is a Test</title>`, but saw outputted `<title>New Grocery Coupons & Online Coupons Added Daily</title>`. So that's where I am. I've got literally no clue what the problem could be at this point. Here's one more weird thing to know, though. When I changed the `<title>` tags to `<test>`, and _did_ see the change made on line 12, the _next_ title tags (at channel->item->title at line 22) changed to read `<title>New Grocery Coupons & Online Coupons Added Daily</title>` \- ie, the troublesome output from line 12! My best guess is that there is some Wordpress filter that I don't know about that's operating on this output, but I'm really stumped at this point. Any light you guys could shed on this problem would be very much appreciated! Thanks in advance.


Use Regular Expression to get tag from permalink url during wp_rewrite in generate_rewrite_rules

I'm messing with wp_rewrite and have spent the past few hours trying to figure regular expressions out again (i seem to have forgotten.) This is probably extremely easy for someone. Basically I'd like to match an alpha expression and stop at teh first occurance of a forward slash. Here's what i'm doing: I have a url http://www.mydomain.com/basename/uniquename/page/2/ I want to get uniquename out with the following               'basename/(.*)/page/([0-9]{4})/?$' => 'index.php?post_type=basename&uniquenametaxonomy='.$wp_rewrite->preg_index(1).'&paged='.$wp_rewrite->preg_index(2),      obviously (.*) matches /page/ as well as uniquename and provides me with a query string looking like ?post_type=basname&uniquenametaxonomy=uniquename%2Fpage%2F2 I'd like it to be ?post_type=basname&uniquenametaxonomy=uniquename&paged=2 I know it has to be extremely easy, I'd like to match uniquename and stop at the first occurance of a forward slash.


query_posts() on key's value, or key's existence

I recently started using simple fields on a project to differentiate between types of posts. All posts from now on will have one of four possible meta values associated with this (Story, Article, Video or Cartoon). None of these types of posts have unique attributes or values, so I've decided not to go the custom post type route this time. I'm aware how to query for posts with a certain meta value, but this only works on posts that already have that meta key associated with them - not for posts that were created before the simple fields plugin was installled, and put into use. I'm curious how I would query for all posts that either lack the meta key "fizzbuzz" or have the key but it's associated with a value of "foobar". Is there a way to query for all posts that lack a key altogether?


What's the best way to echo out a filter variable?

I have a plugin filter that isn't working for me:               add_filter( 'gform_notification_email_3', 'route_notification', 10, 2 );     function route_notification($email_to, $entry) {         global $post;         $email_to = get_the_author_email();         return $email_to;     }      I think the $email_to variable isn't being set properly, but how do I echo this variable out to check it?


Plugin won't activate, fatal error (widget class not found)

I've been putting together a simple WordPress plugin that employs a sidebar widget and shortcode. One user has reported the following error when trying to activate the plugin on their local WP installation: > Plugin could not be activated because it triggered a fatal error. > > Fatal error: Class 'Example_Widget' not found in > /Applications/MAMP/htdocs/wordpress/wp- > content/plugins/exampleplugin/exampleplugin.php on line 30 Here's the code in `exampleplugin.php`, beginning with line 29:               $example_plugin = new Example_Plugin;     $example_widget = new Example_Widget;          class Example_Plugin {         ...     }      I'm fairly new to OOP in PHP, and can't figure out what's causing a fatal error for this user. The plugin works fine for me, making this all the more mysterious.


How to create a fixed header and scrolling content area

I've bee experimenting with a site I'm working on. My client wants the header with its nav and logo intact, so visitors always have the ability to access the navbar while scrolling to read the page content. I have added `fixed` to my wrapper `div` and that keeps the background static, but in this design the background is also part of the header. My page is http://axiomwest.com/client-services/ How can I achieve a fixed header area and allow scrolling only in the main content area?


Check for success of $wpdb->update() correctly

My code is               if( $wpdb->update($tableName,array('opt_value'=>$cInfo),array('opt_name'=>'showWeatherWidget')))         //show success message     else         // show failure message      This is not correct, `$wpdb->update()` returns false if it doesn't change any data, but there were no errors. Can someone tell me the proper way to display a success message that a field was updated?


Something strange with ajax

function __construct(){             $ajax = add_action('wp_ajax_my_action', array($this, 'ajax_respone'));             var_dump($ajax);             var_dump($ajax == '1234');             die();         }              public function ajax_respone(){             $whatever = intval( $_POST['whatever'] );             return $whatever;         }      It prints: > bool(true)   > bool(true) How it is possible that `'1234'` or just `1234` is equal to true? Helps only `===` Also just noticed that the `die()` in next code doesn't work               function __construct(){         add_action('wp_ajax_my_action', array($this, 'ajax_respone'));     }          public function ajax_respone(){         $whatever = intval( $_POST['whatever'] );         var_dump($whatever);         die();     }      This means that the function will not start or it starts only when requested?


Creating a custom feed for categories that includes the first post's featured image

I'm needing a little help getting this figured out. I have a query that's not quite working right now, but I need it to create a custom feed that includes category information and then includes the featured image from the first post in that category. Anyone have thoughts on how to get that running?               /**      * Custom Feed for Category Listing      */         function outputXMLFeed()         {             echo '<?xml version="1.0"?>';             echo '<items>';             $args=array(               'orderby' => 'name',               'order' => 'ASC'             );             $categories=get_categories($args);             $posts = get_posts(array('category' => $category->term_id));             foreach($categories as $category) {                  echo '<item>';                 echo '<catID>' . $category->term_id . '</catID>';                 echo '<catname>' . $category->name . '</catname>';                 echo '<postcount>' . $category->category_count . '</postcount>';                 echo '<slug>' . $category->slug . '</slug>';                 echo '<featured>' . [VARIABLE HERE] . '</featured>';                 echo '</item>';             }             echo '</items>';         }         add_action('init', 'add_my_feed');              function add_my_feed(  ) {           add_feed("myFeed", "outputXMLFeed");         }


Getting $user_id for the_author_meta outside the loop in multisite

So I am currently running a multisite install where the super admin creates all new sites. One of the templates we're using has a blog page for a loan officer. I am extending the user profile so the new user can input critical data that needs to be displayed on their page. There is only one user per site, in addition to the Super Admin that is automatically added when a site is created. What I have come to find, is that you need to specify the user ID if you want to use the function               the_author_meta();      outside of the loop. Here's my problem. I can't put an ID in the template, because each new loan officer will use this same theme template. So how can I make these fields dynamic? Below is an image of the profile section for the LO to help visually. Another example is that Andy Johnson will be the user of the blog with a role of author. The next site we create will be for Jack Smith. And his blog will need to reflect the relevant information that is put in his profile page. EDIT: I tried using get_current_user() as well but with no luck of fetching a specific user. It just pulls the Super Admin. I keep finding snippets that say they should work, but everything seems to output the Super Admin. EDIT: It seems as though getting the $user_id from the global post results in the Super Admin as well. Does anyway know if I should be using the WP_Users_Query? http://codex.wordpress.org/Class_Reference/WP_User_Query http://www.diigo.com/item/image/27x2l/02oy


How can I create a page as a draft from my plugin?

I am developing a plugin for a WordPress install so lower users can submit a new page or page revision so an Editor can approve it. I would like to do this by creating this post as a draft, then notifying an Editor via email... Is this possible? Thanks in advanced.


PAGE Specific Email Notifications

Is there a plugin, or a way that I can set a PAGE that has comments enabled to send an email notification to my subscribers? I don't want to enable email notification for all my pages that allow comments, but just certain pages. By activating email notification for a specific page, whenever I post a comment on that page I would like all my subscribers to receive a notification that includes the actual text of the comment. Can this be done? Thanks.


Expiring Unique URLs

So this other day I was trying to get a new functionality to work for a client's website. Unique download URLs for each time a new visitor clicks on a specific button in Wordpress How would the whole thing work: Let's say I have a button on the left widget area of my website that says "Download Ebook Now". -I need each visitor to be redirected to a unique URL ( that will expire after x amount of time) -On the separate page , the download link will be provided as normal Do you happen to know if there is a plugin or script out there that could handle such a task or another solution to go about implementing this? Thanks!


How can I customize the upload error message in Wordpress?

After following the guide for How can I prevent uploading bmp image? to remove bmp (and in my case tiff images) from being uploaded, I tested and it is working, but noticed users are now getting the error message:               Sorry, this file type is not permitted for security reasons.      ![screenshot-with- shadow.png](http://img813.imageshack.us/img813/4526/screenshotwithshadow.png) That looks to be in the `wp-admin/includes/file.php` folder:               if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) )             return $upload_error_handler( $file, __( 'Sorry, this file type is not permitted for security reasons.' ));      and also further down:               if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) )             return call_user_func($upload_error_handler, $file, __( 'Sorry, this file type is not permitted for security reasons.' ));      How can I hook into this so that I can change the message to something a little more friendly?


Wordpress on localhost still points to the live site

I have tried copying my wordpress site to my PC for editing offline using WAMP. I followed the following tutorial word for word. How to create a local copy of a wordpress site I have placed my files in C:\wamp\www\wordpress I saw somewhere about adding the following to the wp-config.php but it still points to my website.               define('WP_HOME','http://localhost/wordpress');     define('WP_SITEURL','http://localhost/wordpress');      I am 100% sure that wp_options table in my database only references `http://localhost/wordpress` so where is it getting my live site address from? UPDATE 1: I just noticed the following in the bottom of my wp-config.php               /**      * For developers: WordPress debugging mode.      *      * Change this to true to enable the display of notices during development.      * It is strongly recommended that plugin and theme developers use WP_DEBUG      * in their development environments.      */      define('WP_DEBUG', false);           define('WP_ALLOW_MULTISITE', true);      define( 'MULTISITE', true );      define( 'SUBDOMAIN_INSTALL', false );      $base = '/';      define( 'DOMAIN_CURRENT_SITE', 'www.mywebsite.co.uk' );      define( 'PATH_CURRENT_SITE', '/' );      define( 'SITE_ID_CURRENT_SITE', 1 );      define( 'BLOG_ID_CURRENT_SITE', 1 );           /* That's all, stop editing! Happy blogging. */           /** Absolute path to the WordPress directory. */      if ( !defined('ABSPATH') )     define('ABSPATH', dirname(__FILE__) . '/');           /** Sets up WordPress vars and included files. */         require_once(ABSPATH . 'wp-settings.php');      where it says               define( 'DOMAIN_CURRENT_SITE', 'www.mywebsite.co.uk' );      (obviously changed my address for posting) if I change it too               define( 'DOMAIN_CURRENT_SITE', 'localhost/wordpress' );      I get a redirect loop. Is this related or am I changing something I don't need to and the issue is else where? UPDATE 2: does it having anything to do with the fact that on my website the wordpress files are in the `www` folder and on the local they are in the `www/wordpress` folder?


A single category with a specific permalink structure differing from the standard set for the rest of the site

I'm interested to know if there's a method to specify a specific link structure for only a single category. Currently I have my install set to **/2012/12/post-title**. However there is a single category I would like to set to **/category-name/post-id/**. Part of this is that I don't plan to title any of these posts, but I also would like to make it simple to block this section from being crawled using the _robots.txt_ file. _Possible caveat, I'm using Nginx rather than Apache, so rewrite rules if needed will differ._ Thanks


Custom $_GET vars in wordpress entry with permalink

Hello I have something like this in the url: http://myblog.com/category/subcategory/postname/?var=true Using it on functions.php:               function add_query_vars($vars) {        $vars[] = "var";        return $vars;     }     add_filter('query_vars', 'add_query_vars');      But I need it: http://myblog.com/category/subcategory/postname/true How can get it?


add_theme_page is not working

Newbie in wordpress coding. please tell how to create theme option pages.               function my_plugin_menu() {              add_theme_page('Theme Options', 'Theme Options', 'edit_theme_options', 'theme-option-slug' , 'settings_page');      }          function settings_page()     {         echo "aa";       }


Passing variable as permalink URL

I've been trying to adapt the rewrite functions described here with little success:   * Passing variables through permalink structure   * WordPress permalinks and custom $_GET Variables The structure of the URL I'd like to achieve is /academics/faculty/profile/faculty-member Where /academics is the blog, faculty is the page, and profile is the child page of profile. If you use this: /academics/faculty/profile?fid=faculty-member It displays the faculty profile, no problem. What I want is to assign fid as a rewrite that cleans up the variable from the URL and leaves only the faculty member. I've rewritten the function so that the add_rewrite_rule looks like this:               // Register the variables that will be used as parameters on the url     function add_my_var($public_query_vars) {         $public_query_vars[] = 'fid';         return $public_query_vars;     }     add_filter('query_vars', 'add_my_var');          // Build the rewrite rules, for the extra parameter     function do_rewrite() {         add_rewrite_rule('(faculty/profile)/[/]?([^/]*)$', 'index.php?pagename=profile&fid=$matches[1]','top');     }     add_action('init', 'do_rewrite');          // The parameter is now accessible     get_query_var('fid') ;      I thought I was following the directions accurately, and I've flushed the permalink structure, but when I try to use the new URL it just reverts to /academics/faculty/profile and spits nothing out, even when I add:               $profile2 =     get_query_var('fid') ;      to the page template. Is my rewrite accurate? Any idea why it would work in the prior examples but not here?


Why this filter hook is not working when passing parameters?

Supposing I have this function which I hooked into my_get_users function:               function define_users($group) {          //Query database for users belonging to a group     global $wpdb;          $users= $wpdb->get_results("SELECT user_id from $wpdb->usermeta WHERE meta_key='groupname' AND meta_value=$group",ARRAY_N);          return $users;          }          add_filter('my_get_users','define_users',10,1);      This is my_get_users function where the apply_filters are found:               function my_get_users($group) {          //Define users as array     $users=array();                    $users = apply_filters('my_get_users', $users, $group);                   return $users;          }      I am sure there is data in the database but the $users variable is returning as an empty array. Any ideas what's wrong? Thanks for your help.


Page Title repeating in Wordpress

I am a newbie in WordPress and our website page titles are repeating. That is the first problem. The second problem appears to be that there is a space missing between the repetition. I have attached a diagram to demonstrate this issue. In the attached diagram note that at the top left of Chrome our blog's name is "Snowball Blog". Instead of a space after that, there is no space, and then We have the subtitle of the blog (in this case Hosting). After the word hosting this then appears ">> Snowball Blog". This happens on all pages, for example, "Snowball BlogMeet the Team >> Snowball Blog". I am not that familiar with coding so I would probably need simple instructions! :-) Here is a link to the hosting page of our Blog: Hosting page on our blog [I wanted to post a link to the image I captured but my reputation is still too low! Please visit the URL above to see an example of the problem!]


Changing H1 to Normal Links

After following this tutorial -- Showing all the posts in one page? \-- I was able to show all post links in one tag page. Example: http://blogote.com/tag/facebook/ Now I have several H1/H2 headers in those tag pages -- more than 100s. How can I convert these H1 titles into normal titles? Here's the code:               $title = the_title( '
post_type ) . '-title entry-title">', '
', false );      I have changed H1 to Strong tag, but is it possible to remove/refine the code further? I tried removing rel=bookmark and other elements but my efforts were unsuccessful (errors were shown after uploading the file). I also want the fonts to be normal, small in size. Appreciate your help! Thanks...


Dynamic-Image-Resize Plugin does not output anything

I'm having trouble using the "Dynamic-Image-Resize" plugin by "Kaiser Franz Josef". In my template I'm adding following code:               $imgsrc = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), "Full");     $image_path = $imgsrc[0];          dynamic_image_resize( array(         'src'     => $image_path             ,'width'   => 60         ,'height'  => 100         ,'classes' => 'thumb'     ) );      It just outputs nothing, neither it give any error. I have made sure that the image path is correct. How can I find out where is the problem? If I var_dump the output of the above function, I get following:               object(oxoDynamicImageResize)#507 (1) { ["atts"]=> array(4) { ["src"]=> string(55) "http://localhost:81/wp/wp-content/uploads/2013/02/1.jpg" ["width"]=> int(60) ["height"]=> int(100) ["classes"]=> string(5) "thumb" } }       I will highly appreciate any help.


how to call the category of the post

I jus want to create a gallery which shows either all or certain number of posts in that category under each post and i found a working code               <?php     $displayposts = new WP_Query();       //get posts from your news category       $displayposts->query('cat=5');     while ($displayposts->have_posts()) : $displayposts->the_post();     ?>     <?php the_content('read more...'); ?>     <?php edit_post_link('edit', '', ''); ?>     <?php endwhile; ?>      in the above code i want to enter the specific category instead of **cat=5**


Load Next WordPress Posts With AJAX?

I found an amazing plugin that loads the next posts with Ajax. http://www.problogdesign.com/wordpress/load-next-wordpress-posts-with-ajax However it doesn't work with custom post types. The code looks fairly simple. Any idea how to edit the code to use custom post types? Thanks


HTML tags in Wordpress image caption

I'm developing a client website with Wordpress (3.3) but have found that the image caption feature strips out any HTML tags. The resulting caption is plain text which makes proper image crediting difficult. Also being a client website, WYSIWYG editing is required. For example if my shortcode is:               [caption caption="This is my example caption"]                    [/caption]      The tags are stripped from the caption attribute like so:               [caption caption="This is my example caption"]                    [/caption]      The tags I'd most like to preserve are `<em>`, `<sup>`, `<sub>`, `<span>` and `<a>`. I haven't found any existing plugins to fix this except for links. Any ideas on how to go about this and which functions to override?


how to add previous and next link for the posts?

i would like to know how to link the next and previous post of the current post with in that category..i tried lotta plugins put nothing worked out and I am a noob in WP so kindly help me


How do I convert a page's title to lower case?

On my test case, the page' title is "Privacy". The straightforward approach               strtolower(the_title())      also returns "Privacy" -- still with a capital P. I also tried               mb_strtolower(the_title())      and               mb_strtolower(the_title(), 'utf8')      with similar results. Not sure if it matters, but my wp-config.php has               define('WPLANG', '');     define('DB_CHARSET', 'utf8');


Tabs and Category Widget

I need some help with tabs in Wordpress. I tried several tab plugins for Wordpress, but none did what I wont. I tried Quick tabs, Hybrid tabs and SidebarTabs. I want sidebar to be like this: http://www4.slikomat.com/11/0116/q7a-tabs.png In fact these are basic tabs, with possibility to put content in it. Another question is about displaying news from some category in widget on sidebar. I want to display it with thumbnail and title with link to that news. I want it to be like on this picture : http://www4.slikomat.com/11/0116/lpr-kat.png So can you recommend some plugin for that.


how to show the most viewed, random and recent posts in the home?

I would like to make my home page in such a way it shows the most viewed, random and recent posts by thre differents part by limitin the number of posts......give me at least some hints or idea to try it. Thank you in advance


How to sort posts by the average of comment meta values

Here's the situation- I've customized the comment submission whereby users can provide a rating, and this gets stored as a meta value in the commentmeta table. I can query to return the average value and display in the post. No problem so far. What I want to do now is sort posts by this average rating. My code to get the average rating is:               function average_rating() {     global $wpdb;     $post_id = get_the_ID();     $ratings = $wpdb->get_results("              SELECT $wpdb->commentmeta.meta_value         FROM $wpdb->commentmeta         INNER JOIN $wpdb->comments on $wpdb->comments.comment_id=$wpdb->commentmeta.comment_id         WHERE $wpdb->commentmeta.meta_key='rating'          AND $wpdb->comments.comment_post_id=$post_id          AND $wpdb->comments.comment_approved =1              ");     $counter = 0;     $average_rating = 0;         if ($ratings) {         foreach ($ratings as $rating) {             $average_rating = $average_rating + $rating->meta_value;             $counter++;         }          //round the average to the nearast 1/2 point         return (round(($average_rating/$counter)*2,0)/2);       } else {         //no ratings         return 'no rating';     }     }      I'm thinking I need to start storing the average value as a post meta field otherwise I'd have to loop through queries within queries with multiple joins, which seems to be a really bad idea. I'm hoping someone with a fresh set of eyes can help me think through architecting this.


Change Output for Images in Content

I want to wrap some html (divs and classes) around the tag (to create the appearance of photo corners by way of an image sprite). Basically, I want to re-write all tags added by WP in the content by way of some code in my functions file from this:                     to this:

      I want this done _after_ the page has been added/edited by me or anyone else adding content. I tried using wp_get_attachment_image with the function below, and it added the html ONLY when adding the image the first time into the edit content screen. Plus, when the image itself is dragged around inside the edit box, or possibly removed, remnants of the html are messed up.                   function image_corners( $html, $id, $alt, $title ){         $html = '

';         return $html;         }     add_filter('wp_get_attachment_image','image_corners',10,4);      It seems like every option I look at with a filter or a hook only adds it during the add-image step in the edit screen. Am I mistaken on this? I'd be fine with a jquery option to change the html on/after page load, but I'm not quite sure how to write that, and not sure if that is necessary? Any help is appreciated!


All font sizes change when manually typing 2011 into url and going to archive page

I am developing a site on MAMP and everything is going fine except that I thought I would check how all the default archive pages look. I typed 2011 at the end of the base url and it retrieved a yearly archive as expected. The problem is that the font sizes of every element change to a smaller size. I understand that there are different headings in the archives, but this problem affects the main nave menu, normal li items ... everything. Has anyone had this happen to them? Thank you.


How to use the Tag description as the title attribute?

I'm trying to use tags to create a list of cross references for each post and want the tag description to show next to the tag and/or as the title attribute for the hyperlink so the description shows when a visitor holds the cursor over the link. Using the TwentyTen theme I have located the code in functions.php and amended it as below:               function twentyten_posted_in() {         // Retrieves tag list of current post, separated by commas.         $tag_list = get_the_tag_list( $before = '

' , $sep = ' here'.'

' , $after = '
' );         if ( $tag_list ) {             $posted_in = __( 'Cross Reference %2$s. ', 'twentyten' );         }                    // Prints the string, replacing the placeholders.         printf(             $posted_in,             get_the_category_list( ',  ' ),             $tag_list,                     get_permalink(),             the_title_attribute( 'echo=0' )         );     }     endif;      As you can see I've changed the heading to say Cross Reference and by adding breaks I have a list of tags rather than a paragraph. I've identified where I want the Tag Description to go with the word "here". I thought it would be as simple as adding tag_description() but that didn't work. If I put a number in the brackets, e.g. tag_description(5) it displays the tag description in the correct place, but of course all the tags have the wrong description. Help! Thanks Ian.


Dashboard RSS Widget Overhaul

I want to give add an order digit on to the dashboard feed like in the image below: http://i.stack.imgur.com/kK0GJ.png I edited default-widgets.php - function wp_widget_rss_output () but it's still not showing any changes. PS: I'm using WPMUDEV Dashboard Feeds plugin. This plugin changes the widget_options so that I can show my own RSS feed and not the default Wordpress ones!


Approve comment hook?

I'm looking to send out emails to subscribers when a comment has been approved. The two actions in the Codex are: **1.**               add_action('comment_post', 'callback', $priority, $accepted_args);      Where the arguments are `comment_ID` and `approval status` (0 or 1). **2.**               add_action('edit_comment', 'callback', $priority, $accepted_args);      With argument `comment_ID` By default comments are not approved when they are posted so I think I would be editing them when I approve them but it's unclear in the Codex. Which option should I use when I approve a comment?


Custom Post Type Query W/Category Dropdown

I'm having a bit of trouble getting a custom post type query working coming from two drop downs. Let me show you what I'm using: **The Form:**               <?php require($_SERVER['DOCUMENT_ROOT'] . '/wp-load.php'); ?>     <form method="post" id="searchform" action="http://www.findabuilder247.com/directory">          <?php $args = array(        'show_option_none'   => 'Select a Tradesman',          'name'                => 'catagory',        'post_type' => 'profiles',        'hide_empty' => '1'     ); ?>           <?php wp_dropdown_categories( $args ); ?>          <?php $args = array(        'show_option_none'   => 'Select Area',          'name'                => 'area',        'show_count' => '1',        'taxonomy' => 'areas',        'orderby' => 'name',        'post_type' => 'profiles',        'hide_empty' => '1'     ); ?>           <?php wp_dropdown_categories( $args ); ?>          <input type="submit" value="" class="searchbutton4"  />     </form>      I'm then generating the query (or at least attempting to) with:               <?php            if($_POST){               $query = $_POST;               $cats = array();                foreach($query as $key => $param) {                    if($param != -1) {                      array_push($cats, $param);                    }                }                // print_r($cats);  // This prints the array, so I know it's working               query_posts(array( 'category__and' => $cats ));           } ?>      I'm using a custom loop to call the query in initially and I'm hoping to use this as a search function.                <?php $loop = new WP_Query( array( 'post_type' => 'profiles', 'posts_per_page' => 10, 'order'=> 'ASC', 'orderby' => 'title' ) ); ?>         <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>             ...         <?php endwhile; ?>      Any help would be much much appreciated. I'm pulling my hair out at this! **UPDATE** James Kemp is an absolute master! The following code is working perfectly for me:               <?php $loop = new WP_Query( array( 'post_type' => 'profiles', 'posts_per_page' => 10, 'order'=> 'ASC', 'orderby' => 'title' ) ); ?>         <?php                if($_POST){                   $query = $_POST;                   $cats = array();                   foreach($query as $key => $param) {                       if($param != -1) {                         array_push($cats, $param);                       }                   }                   $args=array(                'category__in' => $cats,                'post_type' => 'profiles',                'posts_per_page' => 10,                'order'=> 'ASC',                'orderby' => 'title'                );              $loop= null;              $loop = new WP_Query($args);               } ?>               <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>                  …                  <?php endwhile; ?>


[Plugin leenk.me]modify get_the_title

I use a plugin called leenk.me to post messages to Facebook based on my posts. One of the custom fields is %TITLE%, which posts the title of my post and the link to my post.               if ( false === $post_title )         $post_title = get_the_title( $post_id );      The way I currently have my WP set up, my excerpt is a link. I want to modify the get_the_title function so that instead of getting the title and link (ID) to my post, it gets the title and the link to the excerpt.               function get_the_title( $post = 0 ) {       $post = get_post( $post );            $title = isset( $post->post_title ) ? $post->post_title : '';       $id = isset( $post->ID) ? $post->ID : 0;            if ( ! is_admin() ) {         if ( ! empty( $post->post_password ) ) {             $protected_title_format = apply_filters( 'protected_title_format', __( 'Protected: %s' ) );             $title = sprintf( $protected_title_format, $title );         } else if ( isset( $post->post_status ) && 'private' == $post->post_status ) {             $private_title_format = apply_filters( 'private_title_format', __( 'Private: %s' ) );             $title = sprintf( $private_title_format, $title );         }       }            return apply_filters( 'the_title', $title, $id );     }


Cannot Access Console

http://bigpicturepartnering.com I can log into the site. When I try to access the WP console I get the following error: PHP Fatal error: Call to undefined function is_site_admin() in D:\websites\bigpicturepartnering\wp- content\plugins\wordpress-related-posts\related-posts.php on line 81 How can I get into the console to disable the plugin?


add_menu_page does not render the expected result

I'm trying to accomplish the simple task of adding a new page to the admin area but it seems that I just cannot wrap my mind around this simple function. Via codex, this is how I'm trying to add the page:               public function __construct(){         add_action('admin_menu', array( &$this, 'register_menu_page'));     }          public function register_menu_page () {         $hookname = add_menu_page (                 'My Slider',                 'My Slider',                 'manage_options',                 'my_slider',                 My_Slider::render_admin_menu()             );     }      When pressing the newly added button named `My Slider` I would expect the `My_Slider::render_admin_menu()` to be called and populate the right side of the page with some HTML (while keeping the left menu intact). However this is what I'm getting: ![text that always appears](http://i.stack.imgur.com/psI1n.jpg) First of all, you can see that the rendering function is always called (I'm currently on the Dashboard page) and it is weirdly inserted on the top of the page. Second of all, when the button is pressed, wordpress is trying to access `http://localhost/wordpress/wp-admin/my_slider`. What am I missing? Thank you!


wp_localize_script is not adding a global variable for javascript

So I've read a few tutorials on ajax and the codex documentation on it and I think I understand now how it is supposed to work, however it appears that wp_localize_script is not doing anything at all. According to what I've read in the codex and on various forums, the wp_localize_script should allow me to create a global object that an external javascript file can reference. But when I inspect the DOM in chrome it isn't there. My code is below               class Admin_Page extends Admin_Console {     static $add_script;                         public static function init() {         add_shortcode('CLADMIN', array(__CLASS__, 'handle_shortcode'));              add_action('init', array(__CLASS__, 'register_script'));         add_action('wp_footer', array(__CLASS__, 'print_script'));         // add_action( 'wp_ajax_getData', 'data_response' );     }                              static function data_response() {     //do stuff          }               public function register_script() {              wp_enqueue_script('masterJS','/wp-content/plugins/AdminQuizConsole/js/master.js',     array('jquery','jquery-ui-core','jquery-effects-core'), true);         wp_register_style( 'master', '/wp-content/plugins/AdminQuizConsole/css/master.css'     );     }          static function print_script() {         if ( ! self::$add_script )             return;                   wp_enqueue_style('master');         wp_localize_script('masterJS', 'AjaxRequest', array( 'ajaxurl' => admin_url('admin-ajax.php') ) );          }     }               Admin_Page::init();      Now unless I'm mistaken according to what I see here the localize should be being called after the enqueue and therefore should add something like this to the DOM               /* <![CDATA[ */     var MyAjax = {     ajaxRequest: "http://example.com/wordpress/wp-admin/admin-ajax.php"     };     /* ]]> */       But that does not appear to be happening. Can someone please explain to me is there something I'm missing? # EDIT Got the above question working but admin-page now returns with a zero               public static function init() {         add_shortcode('CLADMIN', array(__CLASS__, 'handle_shortcode'));              add_action('wp_enqueue_scripts', array(__CLASS__, 'register_script'));         // add_action('wp_footer', array(__CLASS__, 'print_script'));          add_action( 'wp_ajax_nopriv_get_data', 'data_response' );     }          public function data_response() {              global $wpdb;         $user_id=null;              $user_id = $user_id = $user_id ? $user_id : get_current_user_id();         $practiceKey = 'user_practice';              //Get Practice         $sql = $wpdb->prepare( "SELECT meta_value FROM {$wpdb->usermeta} WHERE user_id = %d AND meta_key = %s", $user_id, $practiceKey );         $sql3 = $wpdb->prepare( "SELECT meta_value FROM {$wpdb->usermeta} WHERE user_id = %d AND meta_key = %s", $user_id, 'user_practice_level' );         $practice = $wpdb->get_var( $sql );         $usr_level = $wpdb->get_var( $sql3 );         $db_name = $wpdb->prefix . 'plugin_slickquiz_scores';         if($usr_level == 0){             $get_data = $wpdb->prepare( "SELECT quiz_id,score,createdDate FROM $db_name WHERE usr = $user_id" );             $results = $wpdb->get_results($get_data,ARRAY_A);             $result_array = array();                  foreach ( $results as $value )             {                 $result_array[] = $value;             }         } elseif ($usr_level == 1) {             $get_data = $wpdb->prepare( "SELECT * FROM $db_name WHERE usr_practice = %s",$practice );             $results = $wpdb->get_results($get_data,ARRAY_A);                  foreach ( $results as $value )             {                 $result_array[] = $value;             }         } else {             $result_array[] = (1);              }                        $data_encode = json_encode($result_array);              header( "Content-Type: application/json" );         echo $data_encode;         die();          }              function get_level() {                  $.post(AjaxRequest.ajaxurl, {action : "get_data"})                 .done(function( json ){                     console.log(json);                 })                      .fail(function( jqxhr, textStatus, error){                     var err = textStatus + ', ' + error;                     console.log( 'Request Failed: ' + err);                 });                   }      The action name and the call back function seem to match up and it's being sent over post in case I wanted/needed to change the no_priv option. I'm sure it's just something I'm missing but I've tested my output by taking the query out of the callback function and echoing it straight onto the page and it does return valid JSON so I'm not sure what I'm missing now.


What are WordPress installation percentages by version?

I'm in the process of developing a plugin, and I'd like to figure out which versions of WordPress to support. But to get a good idea I'd need to know what percentages of old Wordpress versions make up the install base. Does such information exist? Alternatively if such information doesn't exist, does anyone have a suggested version I should support my plugin back to?


Creating an option for writing a post without an author attribution for a group blog on Wordpress

I'm developing a group blog on wordpress (first time working with it) and the client has requested that a 'None' option be added where an item can be posted without a "by" attribution. So basically there would be one article / excerpt template for attributed author's posts and another for the none option where the byline would just be the date posted without the "by [author name]." Is this possible with wordpress? Thanks!


Post Type only showing for "Admin" under "Appearance" > "Menus"

I have created a custom taxonomy as described on the Codex. I have "public" set to true, which show_in_nav_menus is supposed to inherit from, and have also explicitly added the show_in_nav_menus variable and set it to true. However, it only shows up for the user with the username "Admin". None of the other users can see it under Appearance > Menus, even ones marked as being an "Administrator". Here's my exact code:               function create_con_casino_reviews() {         register_post_type( 'con_casino_reviews',             array(                 'labels' => array(                     'name' => __( 'Casino Reviews' , 'continuum'),                     'singular_name' => __( 'Casino Review' , 'continuum'),                     'add_new' => __('Add new review', 'continuum'),                     'edit_item' => __('Edit review', 'continuum'),                     'new_item' => __('New review', 'continuum'),                     'view_item' => __('View review', 'continuum'),                     'search_items' => __('Search reviews', 'continuum'),                     'not_found' => __('No reviews found', 'continuum'),                     'not_found_in_trash' => __('No reviews found in Trash', 'continuum')                 ),                 'public' => true,                 'menu_position' => 25,                 'menu_icon' => get_stylesheet_directory_uri() . '/images/review-casino.png',                 'rewrite' => array('slug' => 'casino-review'),                 'supports' => array('title','editor','author','thumbnail','excerpt','trackbacks','custom-fields','comments','revisions'),                 'taxonomies' => array('category', 'post_tag'),                 'show_in_nav_menus' => true             )         );     }     add_action( 'init', 'create_con_casino_reviews' );      If I change:               register_post_type( 'con_casino_reviews',      to be:               register_post_type( 'con_casino_reviewss',      It works just fine.


How to output content based on same custom taxonomy?

I have been trying to output content of all post-types (Posts, Pages and CPTs) based on a term of a custom taxonomy that they **must** share (meaning if they don't share that particular term, the output should not include that post- type). Here is what I have so far:               $term_list = wp_get_post_terms($post->ID, 'persons', array('fields' => 'names')); // persons is the custom taxonomy         $args = array(             'post_type' => array( 'post', 'page', 'profile', 'letter' ), // profile and letter are CPTs                 'tax_query' => array(                     array(                     'taxonomy' => 'persons',                     'field' => 'slug',                     'terms' => $term_list                     )                 ),             'post__not_in'=>array($post->ID)         );          $related_content = new WP_Query( $args );          if ( $related_content->have_posts() ) {         echo __('Related Content (profiles, pages, articles, letters):', 'teselle');         echo '
';         while ($related_content->have_posts()) {              $related_content->the_post();                  echo '
' . get_the_title() . '
';              } // endwhile         echo '
';     } // endif          wp_reset_query(); wp_reset_postdata();      The problem with the above code is that it outputs too much. If I fill in the exact slug of the term I need, for example `'terms' => 'the- exact-slug'`, it works perfect, but I really need it to be a variable. Can someone point out what my mistake is in the above code? Thanks!


This webpage has a redirect loop issue with SSL page

I'm having an issue with the code below. As of right now, my domain is http://www.mydomain.com. When I try to click on the register link, I get an error saying:               --This webpage has a redirect loop--          $link2 = '' . esc_attr(__('Register')) . '';      The register page is an SSL page so it uses the HTTPS protocol. Can someone please help me?


Help with listing current users submitted custom post type in template file

I have the following code to list the member's post that they created. However it is listing all posts. Anyone know how to fix it? Thank you!                   <?php          if ( is_user_logged_in() ) {       global $current_user;       get_currentuserinfo();       echo 'User ID: ' . $current_user->ID . "\n";       $args=array(         'member' => $current_user->ID,         'post_type' => 'listing',         'post_status' => 'publish, private',         'posts_per_page' => '10'       );       $my_query = null;       $my_query = new WP_Query($args);       if( $my_query->have_posts() ) {         echo 'Your Posts';         while ($my_query->have_posts()) : $my_query->the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
           <?php         endwhile;       }       wp_reset_query();  // Restore global post data stomped by the_post().     }     ?>


Add row to custom database Table and delete all rows older than 1 day

I'm editing a view counter plugin so that it logs the IP of every user that viewed a post. This is to prevent them from refreshing the page and thus creating artificial views. The part I'm having trouble with is adding rows to the database table, and afterwards removing any rows that are older than an hour. I'm sure I'm doing something wrong but I can't figure out what. The Wordpress documentation on this is very confusing to me. **This is my database creation function**               ### Create Database for IP Logging     function postviews_create_table () {         global $wpdb;              $table_name = $wpdb->prefix . "postviews_ips";          $sql = "CREATE TABLE $table_name (         postid MEDIUMINT NOT NULL,         ip VARCHAR(15) NOT NULL,         time DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL     );";          require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );     dbDelta( $sql );     }      **And this is the function that's supposed to add new rows and delete old ones.**               ### Add user IP to Database & Delete Entries Older Than 1 Day     function postviews_add_ip () {         global $post;             $id = $post->ID;             $ip = $_SERVER['REMOTE_ADDR'];             $time = date("Y-m-d H:i:s");              $wpdb->insert(              'wp_postviews_ips',              array(                  'postid' => $id,                 'ip' => $ip,                 'time' => $time             )             array(                 '%d',                 '%s',                  '%d'             )          );              $sql = "DELETE FROM wp_postviews_ips WHERE time_created < (NOW() - INTERVAL 1 DAY)";              $wpdb->query($sql);     }


Simple fields plugin WordPress show repeatable file field

I have install the plugin Simple fields for WordPress, create an repeatable field for file. Upload an amount of images to an portfolio item. Now I will show these images on the page. I use currently the following code:                       $file_id = simple_fields_value('image_repeater');             $image_info = wp_get_attachment_image_src($file_id, "full");             $image_url = $image_info[0];                  echo "<img src='$image_url' class='imagebox' />";      This will show only the first image that I have uploaded. Now I want to show also the other images, but I don't know how. Hope somebody can help me out! Thank you!


Custom post type archive with taxonomy

Hmm OK, I'll try to be as clear as possible. I have a CPT named "custom_type" with the args (one of many) rewrite('slug' => 'space') and has_archive => 'spaces'. My first question. When calling mydomain.com/spaces it changes the title of the page in the browser window, however, it gets me only my index- page. Question number two. Is there any simple way to add the "archive-page" to my nav-menu or will i have to use absolute links? in my archive-spaces.php:               <?php     $paged = get_query_var('paged') ? get_query_var('page') : 1;             $loop = new WP_Query( array(                                           'post_type' => 'custom_type',     'slug' => 'space',                                                     'posts_per_page' => 3,                                                 'paged'=>$paged                                                        )                                                                      );?>                                                                        and in my custom-post-type.php               'rewrite'   => array( 'slug' => 'space', 'with_front' => false ),     'has_archive' => 'spaces',


Not able to override pluggable function with a mu_plugin

I'm trying to modify the email that's sent to users when they are invited to join my multisite network. Understanding I can only use the pluggable function, how do I override the default email with a must use plugin? Right now it's not allowing me to override and shows the default text. Here's my current code:               if ( !function_exists('wp_new_user_notification') ) {         function wp_new_user_notification( $user_id, $plaintext_pass = '' ) {             $user = new WP_User($user_id);                  $user_login = stripslashes($user->user_login);             $user_email = stripslashes($user->user_email);             $siteUrl = get_site_url().'/login';             $email_subject = "Welcome to Dewsly ".$user_login;                  $message  = sprintf(__('New user registration on your blog %s:'), get_option('blogname')) . "\r\n\r\n";             $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";             $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";                  @wp_mail(get_option('admin_email'), $email_subject, $message);                  if ( empty($plaintext_pass) )                 return;                  ob_start();                  ?>             <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">             <html xmlns="http://www.w3.org/1999/xhtml">                 <head>                     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />                 </head>                 <body style="background:#e5f6fb">                      </body>             </html>                  <?php                  $message = ob_get_contents();             ob_end_clean();                  wp_mail($user_email, $email_subject, $message);              }     }


Wordpress live, custom text box validation, how to?

I am teaching British Sign Language on my website, on the alphabet section I have an image of 'signs' that spell out a word. Below I would like a text box that requires the user to input the correct word and for the text box to validate live and appear with a tick next to it. Much like the functionality of the 'Homepage Example' seen here where you have to enter the word 'hello': http://livevalidation.com/examples#exampleStyles[1] Does anyone know how I would implement this on a Wordpress Site, or is there a plugin that allows custom or 'this type' of validation? I have been searching and reading for hours and only being a novice at programming I am unable to find a solution. I am trying to keep my site clean and easy to use. I know a quiz or something similar would work, but it's too many clicks, too bloated etc. I just want a quick text box that turns green or a tick appears when the correct answer is entered. I am also aware that plugins such as Gravity Forms & Contact Form 7 do validate but only dates & email addresses etc. Any help is greatly appreciated!


How to display a widget on a page with no theme?

I would like only a widget to appear on a page, is this possible? As in if I created a page, I am wondering if I can make a page just display the widgets contents with no headers, sidebars, just blank. Essentially if there was no widget added it would be a blank page. Is this possible?