question
stringlengths
0
34.8k
answer
stringlengths
0
28.3k
title
stringlengths
7
150
forum_tag
stringclasses
12 values
I just upgraded from 3.0 to 3.1.2 and in the comments column under Posts in the WP Admin, this error keeps appearing for every row: Warning: number_format() expects parameter 1 to be double, string given in /path/mysite/wp-includes/functions.php on line 155 Can someone tell me how to fix this?
The "Comments" column is not a default/core column in the "Posts" page. Perhaps it is being generated by your Disqus Plugin? Try temporarily disabling the Disqus Plugin, and see if the PHP notices go away. EDIT: actually, it is a default column. But I still suspect Disqus is causing the PHP warning.
How to fix this PHP warning in WP-Admin after upgrading to 3.1.2?
wordpress
Is there a way to display (css and html) in a different way the "reply" form and the main "comment" form?
Well, it is the same form, but it is moved to another place in the DOM tree. So you could create one style for just <code> .comments #respond </code> , and one for <code> .comments .comment #respond </code> for the moved reply form.
Style reply form different than comment form
wordpress
If I want to "safely" delete a post. I want to make sure that no link exists (within my blog) to "to-be-deleted" post. How do I do that?
After reading this thread I saw that I might need this also sometimes. So here is the result: The internal link checker plugin It adds a meta box at your post edit screens that shows links to all posts who link internally to the currently displayed post. If you want to alter the output (add something for eg.), please u...
How do I check if I linked to a post before I delete it?
wordpress
I'm working on a project in which I'm creating a custom post type and custom data entered via meta boxes associated with my custom post type. For whatever reason I decided to code the meta boxes in such a way that the inputs in each metabox are part of an array. For instance, I'm storing longitude and latitude: <code> ...
No, it is not possible. I strongly recommend you unserialise your data and modify your save routine. Something similar to this should convert your data to the new format: <code> $args = array( 'post_type' =&gt; 'my-post-type', 'meta_key' =&gt; '_coordinates', 'posts_per_page' =&gt; -1 ); $query = new WP_Query( $args );...
meta_query with meta values as serialize arrays
wordpress
I created an option panel following a tutorial. But each time I try to save the settings I get the following: You do not have sufficient permissions to access this page. Any suggestions to fix this? (Not sure if this helps but I'm using Wordpress 3.1.2) EDIT: I don't have the permission issue if I place the code direct...
You're adding the menu page using the "administrator" role. Is the account you're using an administrator? Note: 1) You should be using an appropriate capability , rather than a user role . Generally, the appropriate capability for editing Theme options is <code> edit_theme_options </code> . 2) There is a known bug with...
I don't have permission to save the theme options I created myself?
wordpress
How do I make a menu entry that's just plain text, not a link? My kludge workaround is linking to "/", but I'd prefer no link at all.
If this is for a dynamic menu you can use a 'Custom Links' and use a # for the URL then click add to menu. Once it's in the menu, remove the # from the URL in the menu and save the menu. It'll then be a text only no link item. (you can then add sub menu's that are linked) which is what I use this method for.
Do not hyperlink menu heading
wordpress
I have a .htaccess file <code> &lt;IfModule mod_rewrite.c&gt; RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] &lt;/IfModule&gt; </code> the config for the vhost looks like <code> &lt;VirtualHost *:80&gt; S...
The problem was not having mod_rewrite enabled ... Resolved it through <code> sudo a2enmod rewrite </code>
Already have htaccess but permalink settings not working. Getting 404
wordpress
How do I make menu items open in a new tab/page instead of replacing the current page?
Go to Appearance > Menu click screen options (near top of page) tick "Link target" Now, when you click a menu item drop down, you can choose what the link target is (you want to choose New window or tab)
Make menu items open in new tab/page
wordpress
When I visit Appearance → Menu , I can add custom links, but not any links I've already created under Links . How can I do this?
You can't add link/blogroll type items to the main navigation - add them as custom links instead. [Update] To be more precise, you could do it, but you would need to write some code that hooked into the menu creation/editing section, present a list of blogroll links in a metabox, allowed you to choose from them, and th...
Adding existing links to custom navigation menus?
wordpress
The posts on our music blog usually include multiple tracks of music. I want to have each individual track be its own entity--a custom post type called "track" --which I want to be able to insert freely into a post where I wish using a shortcode. The image below explains pretty well what I am looking to do. (Link to th...
I would suggest creating a new custom taxonomy for relations between a post and its "tracks" or grouping of track posts if you'd like that way you can easily create a shortcode that will query all the needed tracks at once using a shortcode instead of calling your shortcode over and over and to order them you can creat...
Post the content of a specific "Custom Post Type" post within a post using a shortcode
wordpress
I have created one theme. The theme was denied today for the following reasons: Theme Review: Themes should be reviewed using <code> define('WP_DEBUG', true); </code> in <code> wp-config.php </code> Themes should be reviewed using the test data from the Theme Checklists (TC) <code> wp-config.php </code> is the WordPres...
To answer your questions: the wp-config.php is wordpress setting file. how to alter my custom theme? you don't need to alter your theme, its simply telling you to turn debug to true within wp-config.php and review your theme, to see if it creating any warnings or errors. put this line <code> define('WP_DEBUG', true); <...
Questions about WordPress.org theme review
wordpress
I have a unique plugin whose purpose is to set up a new WordPress site with a theme, default widgets, default plugins, custom menus, pages, posts, etc. The plugin does everything it needs to do when activated and never runs again. I'm looking for suggestions on how I might, as the last step in the activation routine, d...
You can deactivate it with: <code> deactivate_plugins( basename( __FILE__ ) ); </code> I don't think you can delete it. It would be a big security risk, IMO. But if the folder has the correct (but insecure) permissions, you could use the PHP function rmdir
Can a plugin deactivate and delete itself once installed and activated?
wordpress
Sadly my "reply" link for threaded comments is not working. The current situation: First i load the comments reply script (check if scripts content load: works) into the <code> &lt;head&gt; </code> using two functions (the first <code> wp_register_script() </code> at the init hook, the second <code> wp_print_scripts() ...
Don't link the script file directly. Enqueue it instead, e.g. in <code> functions.php </code> : <code> function mytheme_enqueue_comment_reply() { // on single blog post pages with comments open and threaded comments if ( is_singular() &amp;&amp; comments_open() &amp;&amp; get_option( 'thread_comments' ) ) { // enqueue ...
comments reply script not working
wordpress
My site has a few custom post types, news, events, you-tube, etc. I'd like to create an rss feed for each post type as well as a main with all. I've experimented an bit and found how to combine them into one but I haven't determined how to segment each. Do I need to create separate feed-rss.php for the templates as wel...
Look at this: http://www.seodenver.com/custom-rss-feed-in-wordpress/
Creating separate feeds for custom post types
wordpress
I used the following code in order to add a Theme Options panel in my Wordpress admin: <code> &lt;?php $themename = "Nettuts"; $shortname = "nt"; $categories = get_categories('hide_empty=0&amp;orderby=name'); $wp_cats = array(); foreach ($categories as $category_list ) { $wp_cats[$category_list-&gt;cat_ID] = $category_...
Referring to this post stackexchange-url ("How to use media upload on theme option page?") Check if you find anything helpful. Thanks!
How to add an upload image button (just like the one in the Custom Header) in the Theme Options I just created?
wordpress
I have a Custom Post Type called 'Property'. I display a list of CPT properties on a page: 10 per page with pagination. I would like to add an "Email friend" link to every property on the list, so a user can email that property url to multiple email addresses easily. Is there a plugin that can do this? Otherwise, what'...
I ended up using a simple "mailto" link. Not sure this is the best approach for this question, but it seems to work. If someone knows a better solution (ideally plugin or code) please feel free to add it. Thanks, Dasha
Email friend for each Custom Post Type posts on a page
wordpress
I'd like my archive.php page's daily view (is_day) to display scheduled posts (post_status=future). For example, if I go to mysite.com/2011/05/20 I would see all posts scheduled to appear on May 20. The archive page's loop starts with: <code> if ( have_posts() ) the_post(); </code> and ends with: <code> rewind_posts();...
Keep things simple - leave your archive templates alone and place this in your <code> functions.php </code> ; <code> if ( !is_admin() ) : function __include_future( $query ) { if ( $query-&gt;is_date() || $query-&gt;is_single() ) $GLOBALS[ 'wp_post_statuses' ][ 'future' ]-&gt;public = true; } add_filter( 'pre_get_posts...
Show scheduled posts in archive page
wordpress
I having trouble with the results, the url and the pagination shows correctly, but when I'm on page 2 or 3 etc... there only show the results from the first page. this is my code. <code> &lt;?php $portfolioloop = new WP_Query( array( 'post_type' =&gt; 'portfolio', 'posts_per_page' =&gt; 12 ) ); ?&gt; &lt;?php while ( $...
you are quering the same posts over and over, and that is way you are getting the same posts, to fix it just add <code> 'paged' =&gt; get_query_var('paged') </code> to your query arguments, so change: <code> &lt;?php $portfolioloop = new WP_Query( array( 'post_type' =&gt; 'portfolio', 'posts_per_page' =&gt; 12 ) ); ?&g...
Pagenavi Plugin and Custom Post Type - Multipage results
wordpress
I've been using WPML to have multilanguage capabilities in my WordPress implementations. Now WPML has gone commercial, and I'm looking for a open source non-commercial replacement. My main concerns are: It should be easy to use for the content administrator. It should be fairly flexible. It should let me decide the URL...
I'd look into qTranslate . I haven't ever used it, but it's the only free alternative to WPML that I've ever seen. That being said, I'd suggest you just pony up the $30-80 for WPML. It's by far the best-maintained and cleanest multilingual plugin you can get and it's absolutely dirt cheap, considering what you get. And...
Multilingual WordPress plugins
wordpress
I have been trying to find a way to return page information in order to create a landing page. I have done this with posts before, to create a blog reel, and would like to achieve the same overall result with pages. The Scenario: I use a drop menu with pages created in the WordPress. Nesting the pages builds the menu. ...
Two suggestions: To output your "Loop" only for Child Pages, and not for Grandchild etc. Pages, add a conditional. e.g. <code> foreach ( $mypages as $page ) { if ( $page-&gt;post_parent == $post-&gt;ID ) { // Loop goes here } } </code> To output only an excerpt of each Child Page, enable excerpt support for Pages, and ...
Displaying part of every child page?
wordpress
OK so i have a main menu and a sub-menu How can i make a menu item active when viewing a single post. The sub-menu uses taxonomies so i know i need to make the taxonomy active when one of the posts has the taxonomy in use
So i ended up doing some jquery and lots of it. The downside is that i have to add the code each time i create a new menu. I am looking into re-creating this but do not want to bother with it right now. This is the link to the solution. It is very very temporary so if you wish to use it go ahead but there are better wa...
Show nav link highlighted
wordpress
I've gotten my custom post types to display as it should in date based archives; the structure example.com/year/month/day (and above) works properly as long as it's extended with '?post_type=post_type_name'. With stackexchange-url ("Bainternets") solution I've also gotten wp_get_archives to properly list archives based...
From comment: Use the plugin Custom Post Type Archives . It is slightly more flexible than the argument <code> 'has_archive' =&gt; TRUE </code> for <code> register_post_type() </code> .
Extend the wp_get_archives output with '?post_type=foo'?
wordpress
I am using WP 3.0.3 and I would like to exclude sticky posts from my query: This doesn't seem to work: <code> &lt;?php query_posts( 'posts_per_page=9&amp;cat=-1,-2&amp;ignore_sticky_posts=1' );?&gt; </code> To get JUST the sticky post I use the following: <code> $sticky = get_option('sticky_posts'); $args = array( 'pos...
<code> ignore_sticky_posts </code> was introduced in WordPress 3.1. Before this version, you can use <code> caller_get_posts </code> , which will have the same effect (this option was used when you queried the posts via <code> get_posts() </code> , which uses the same <code> WP_Query </code> class in the background, bu...
ignore_sticky_posts in WordPress 3.0.3?
wordpress
My Wordpress site uses a custom front page ( <code> home.php </code> ). The blog page uses a template ( <code> blog.php </code> ). However when I visit the blog page the navigation bar does not highligt the current page. This is because the class <code> .current-menu-item </code> (and the class <code> .current_page_ite...
The custom navigation menu uses the global <code> $wp_query </code> object to figure out what page is the current page and should get that class. <code> query_posts() </code> replaces this <code> $wp_query </code> object, so the navigation menu can't apply the correct classes. Why do you use a separate template for thi...
Navigation list not correctly styled on pages with custom template (missing .current-menu-item)
wordpress
I'm using Alex Rabe's NextGEN Gallery in a lot of client sites as a centralized image repository, and am finding I often need to load an entire gallery into a lightbox (invoked via a single thumbnail), without displaying more than a single thumbnail on page. Thus, I could have a series of four thumbnails on a page, eac...
Output all images of each gallery in your HTML. Use an anchor tag that links to the fullsize image around each thumbnail. Depending on the lightbox plugin you prefer to use, group all images from the same gallery (often done using the <code> rel </code> attribute in HTML). At that point, just hide all but one thumbnail...
Load entire NextGEN gallery from single thumbnail?
wordpress
I have an installation of wordpress with the core wordpress files in a sub-directory as described here: http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory . I've also changed wp-content to just content and moved it outside the wordpress core directory. Everything works fine except the media upload dialog doe...
Update: I fixed the issue myself. The problem was resulting from where I had removed jQuery output from the front end of my site (using my own version) improperly. It was not an issue with Wordpress itself. The function I was using to unset it removed it from the admin as well. I hadn't realized that some of the hooks ...
How to fix broken admin Thickbox?
wordpress
I followed this tutorial in order too add a custom upload button in the Wordpress admin. It displays the picture you just uploaded right after saving: The problem is that I can't manage to display the picture in the front end, in a template file. This is the section that displays the picture: <code> function ud_section...
simple answer to this, if you wan to display the image use: <code> $options = get_option('ud_options'); if (isset($options['file'])) { echo "&lt;img src='{$options['file']['url']}' /&gt;"; } </code>
Can't manage to display an uploaded picture (uploaded from a custom button) in the front end
wordpress
I thought about adding it as inline CSS with code from the <code> functions.php </code> (not really sure how to do it). Something like this: <code> function addcss() { background: $this_is_the_css_value; } </code> I would like to know that. But if there's is a better option (without adding inline CSS). I would like to ...
One way of doing this would be to create a "CSS" file from PHP. In other words, create a file, call it something like <code> style.css.php </code> , and at the beginning of the file put: <code> &lt;?php header("Content-type: text/css"); </code> Then, link that file in the head of your theme file. Because the <code> sty...
Best way of adding CSS which can be manipulated by the user via theme option panels?
wordpress
I read somewhere that I can set a constant in the wp-config.php to update WordPress from the latest trunk version and not the stable version. Stupid as I am, I can't find the site anymore where it was written. I know I could also update with SVN, but I thought the autoupdater was a smarter version.
http://wordpress.org/extend/plugins/wordpress-beta-tester/ Sets you up for the nightlies, if that is what you are looking for. I've got it running on my dev install @ cdn.rvoodoo.com. Works great there
How to update WordPress from the latest trunk
wordpress
I have already read this question and answer to it ( stackexchange-url ("Where do I start from") ). So I have slightly different question. If I basicaly have no knowledge of how the WordPress code is structured and I have some ideas for plugin I would like to write should I start at the same place where author of the a...
The book Digging into WordPress is a good start. I bought this myself. I found it to be full of useful resources. If you want plugin development then stackexchange-url ("Professional WordPress Plugin Development") is a great book. Another book I bought and I used it to develop my first plugin. Other places to keep visi...
Where is it better to start learning how to develop for Wordpress?
wordpress
So I have written my first WordPress plugin for production and in the next few days I will be starting up on another project where I might have to write two plugins for the same WP site because they do two distinct set of tasks. Now I was reviewing some of the code I had written for the first plugin I thought it would ...
Yes, you can easily set up plugins that share a code base. If you make use of global variables and constants, you will be able to read data stored in one plugin by the other. Also, remember that any function registered in one plugin, will be available to all other plugins (unless they're private class functions), as lo...
Is it possible for two WordPress plugins to share the same code base?
wordpress
I want to specify which css file gets loaded when the user clicks on "Appearance > Editor". However, its always loading style.css for some reason. Any way to enforce that a specific file gets loaded there?
This seems to be controlled by global <code> $file </code> variable, which is filled from request (GET or POST) by WordPress. So you will need to pass file you want in request or hook somewhere and override value of the variable. If latter be careful that you don't lock editing to single file altogether. See source for...
Can I specify that custom.css gets loaded at Appearance > Editor instead of style.css?
wordpress
I'm getting the following PHP warnings when using the WordPress plug-in " Feed JSON ". Can someone tell me how to fix them? Warning: Invalid argument supplied for foreach() in /mypath/wp-content/plugins/feed-json/feed-json-template.php on line 39 Warning: Cannot modify header information - headers already sent by (outp...
Probably get_the_tags() is returning an empty array. Try changing the function to: <code> $my_tags = get_the_tags(); if ($my_tags){ foreach($my_tags as $tag) { $tags[] = $tag-&gt;name; } } </code>
How to fix these PHP Warnings with the "Feed JSON" plug-in?
wordpress
I tried to find anything about adding a widget within a widget area. That widget should be a widget group / sub widget area. I've found a plugin that does this: http://wordpress.org/extend/plugins/extensible-widgets/ http://jidd.jimisaacs.com/files/2010/02/wpew-screen-9.png What I really want is to dynamically create s...
if you take a look at Tabber Tabs Widget plugin does it you will see that it creates a widget and a new "sidebar", now if you place widgets in that sidebar they will show only where you place the plugins widget. and if you look at what Tabbed Widgets plugin does, it creates a widgets that pulls a list of all registered...
Widgets with groups / sub widgets? Widget in a widget?
wordpress
Okay... I turned every stone on the internet and I couldn't find plugin that I need. I want to have a dedicated page for each tag. When I click on a tag I want to get a page with "posts cloud" - all posts tagged with that tag. Post font should be proportional to "popularity" of a post... Is there such thing on earth?
Take a look at CloudClutter theme and see how its done http://wordpress.org/extend/themes/cloudclutter
Posts cloud - Anyone?
wordpress
I have came across the WordPress logout error several times but I really never figured out the cause of it. In earlier days, it was generally that I was missing a nonce but now even with logout link generated by <code> wp_logout_url(); </code> , I am greeted with the WP die screen: <code> You are attempting to log out ...
This message is raised by <code> wp_nonce_ays() </code> which is called by <code> check_admin_referer() </code> . Your browser has probably not sent a referer header, so WordPress could not validate the nonce. This may be a problem in your browser settings or your network connection.
WordPress failure when logging out
wordpress
What's the <code> .php </code> file which generates the <code> Appereance-&gt;Custom Background </code> page in Wordpress' admin panel?
<code> wp-admin/custom-background.php </code>
What's the .php file which generates the Custom Background page in the admin panel?
wordpress
I am trying to find a solution to toggle (hide/show) threaded comments. I need to see only comments 1,2,3 etc... and hide 1.1,1.2,1.3 etc... Clicking "show comments" will toggle and display the thread of comments. example: 1 --- -----clicking "show more comments" shows ----- 1.1 ----- 1.2 ----- 1.3 ----- ... 2 --- ----...
http://jsfiddle.net/K3gr7/4/ I used an ordered list to markup the comments. You probably need to tweak it to your own setup, and cache some variables for optimization, but the functionality is in there. <code> $(document).ready(function() { // Toggle all $('#toggle-all').click(function() { var $subcomments = $('#commen...
Toggle nested comments
wordpress
I want to show post #4/100 at the top for each post for which I'm using following code <code> function updateNumbers() { /* numbering the published posts: preparation: create an array with the ID in sequence of publication date, / / save the number in custom field 'incr_number' of post with ID / / to show in post (with...
You should use one of query functions - <code> get_posts() </code> , it allows to very flexibly configure set of posts to retrieve.
Wordpress Post # of # filtered by category slug
wordpress
Im looking a way to change the following HTML: <code> &lt;div class="votes"&gt;Rating: &lt;strong&gt;+5&lt;/strong&gt; (from 5 votes)&lt;/div&gt; </code> and produce: <code> &lt;div class="votes"&gt;&lt;div class="calculated-rating"&gt;+5&lt;/div&gt;&lt;/div&gt; </code> Thanks in advance.
<code> &lt;script type="text/javascript"&gt; jQuery(document).ready(function(){ jQuery('.votes').each(function(){ votes = jQuery('strong',this).html(); jQuery(this).html('&lt;div class="calculated-rating"&gt;'+votes+'&lt;/div&gt;'); }); }); &lt;/script&gt; </code>
Delete some text and change html tag with Jquery
wordpress
I have my front page setup to display a custom post type via: <code> add_filter( 'pre_get_posts', 'my_get_posts' ); function my_get_posts( $query ) { if ( is_home() &amp;&amp; false == $query-&gt;query_vars['suppress_filters'] ) $query-&gt;set( 'post_type', array( 'jwf_portfolio', 'attachment' ) ); $query-&gt;set( 'ord...
This did it: <code> add_filter( 'pre_get_posts', 'my_get_posts' ); function my_get_posts( $query ) { if ( is_home() &amp;&amp; false == $query-&gt;query_vars['suppress_filters'] ) $query-&gt;set( 'post_type', array( 'jwf_portfolio', 'attachment' ) ); $query-&gt;set('orderby', 'menu_order'); $query-&gt;set('order', 'ASC...
Best way to arrange custom post types by Attributes -> Order metabox value?
wordpress
Using JQuery: While the user types, Im trying to find a way to restrict a field to only accept a-z and 0-9, restricting a-z be lowercase without accents like ñ or ó. <code> &lt;input type="text" value="" id="signup_username" name="signup_username"&gt; </code> Thanks in advance.
Jquery is my favorite js library anything you can think of already has a plugin, in your case check out jQuery AlphaNumeric http://www.itgroup.com.ph/alphanumeric/
Accept a-z and 0-9 (restrict a-z to be lowercase without accents like ñ or ó)
wordpress
I'm trying to display the 'Tag Description' on my tagged pages. I've added an if statement to loop-page.php already to only show custom text when a tagged page is being displayed... <code> &lt;?php } elseif ( is_tax ( 'product_tag' ) ){ ?&gt;&lt;h1 class="entry-title"&gt;&lt;?php the_title(); ?&gt; print out this text ...
get the term by its slug and echo out the descriptions <code> elseif {is_tax ( 'product_tag' ) ){ $term_slug = get_query_var( 'term' ); $taxonomyName = get_query_var( 'taxonomy' ); $current_term = get_term_by( 'slug', $term_slug, $taxonomyName ); ?&gt;&lt;h1 class="entry-title"&gt;&lt;?php echo $current_term-&gt;descri...
How to echo tag description on loop-page.php using WPeC 3.8
wordpress
In Wordpress> Settings> Permalinks there is an option at the bottom of the page to change the 'Tag Base'. I've entered 'testtag' in this option and saved, but my tag pages are still displaying as 'tagged' (eg www.example.com/tagged/tagcategory). wpsc-functions.php in the wp-ecommerce> wpsc-core folder... on line 319 't...
Tags are a custom taxonomy called <code> product_tag </code> in WPEC 3.8+, they're not the same taxonomy as default WordPress tags so that's why tagbase has no effect. Line 315 in wpsc-core/wpsc-functions.php: <code> register_taxonomy( 'product_tag', 'wpsc-product', array( 'hierarchical' =&gt; false, 'labels' =&gt; $la...
How to rename 'Tag Base' with WPeC 3.8?
wordpress
Hey guys, My WordPress permalink structure is set to `/%postname%/. When I create a page with a name "FAQs" the permalink generated is "mydomain.com/faqs". When I link to this page in my code (hardcoded) like this... <code> &lt;a href="&lt;?php bloginfo('home'); ?&gt;/faqs#b" title="FAQ's"&gt;FAQs&lt;/a&gt; </code> (pa...
If your permalink structure is <code> /%postname%/ </code> with a trailing slash, you need to pass the hash like this: <code> /faqs/#b </code> with the trailing slash.
mod-rewrite exception? keep #hash in matching urls?
wordpress
I'm using the plugin comments rating (thumbs up - thumbs down) on my comments template. It stores "karma" in the db column "comment_karma" in comments table. I am looking for a way to sort wp_list_comments by higher karma to lowest. Have tried something like <code> &lt;?php wp_list_comments('callback=mu_custom_callback...
Just incase if you have not checked out the plugin developers page but heres something that you could try <code> if (function_exists(ckrating_get_comments)) { $post_id = $post-&gt;ID; $mycomments = ckrating_get_comments( "post_id=$post_id&amp;status=approve&amp; orderby=comment_karma&amp;order=DESC"); } else $mycomment...
Sort comments by karma
wordpress
I'm making a custom activity calendar for a client here: http://arbeidshesten.com/aktivitetskalender/ The backend is a custom post type "aktiviteter", with custom fields for the date ("dato") and some more details. The code looks like this: <code> &lt;table&gt; &lt;tr&gt; &lt;th&gt;Aktivitet&lt;/th&gt; &lt;th&gt;Sted&l...
I wonder if adding <code> 'posts_per_page' =&gt; XXX </code> to your query would give the desired results? Just a thought. Good luck!
custom post-type query just returns two posts
wordpress
I'm trying to hook into the "save_post" action from an AJAX callback in my plugin, but it doesn't seem to work. In fact, hooking into "save_posts" only seems to work from a few key action execution points (e.g. "init" or "admin_init") but not from others (e.g. an "add_meta_boxes" callback). In my particular case, I'd l...
Adding function to hooks is runtime operation, it is not persistent. Whatever hook operation you run in Ajax actions - they are performed in separate WP instance and expire as soon as Ajax response is returned. They have no influence on currently loaded page. You probably need to hook your functionality to <code> save_...
Why can't I hook into save_posts after admin_init?
wordpress
I am trying to set up a category archive (editing category.php) that displays a list of posts from one single category. If I left the twentyten default code <code> (get_template_part( 'loop', 'category' );) </code> and i go to www.mysite.com/categoryname it correctly filters the posts only for the categoryname. If I tr...
That happens because you are overwriting the query with you $args, If you want to modify it and not overwrite it then use this format: <code> //get the $query_string in to your $args array global $query_string; parse_str( $query_string, $args ); //modify whatever you want $args['post_type'] = 'post'; $args['posts_per_p...
Category page showing posts from all categories
wordpress
<code> get_option() </code> provides couple of filters <code> 'pre_option_'.$option </code> and <code> 'option_'.$option </code> . However most times I tried to make use of these it usually explodes and not worth the trouble - either I need to check another option inside my filter, which triggers my filter, which trigg...
Usually I remove the filter, then add it back on afterwards; <code> function _my_custom_option( $option ) { remove_filter( 'pre_option_name', '_my_custom_option' ); // do what you like with $option add_filter( 'pre_option_name', '_my_custom_option' ); return $option; } add_filter( 'pre_option_name', '_my_custom_option'...
get_option() filtering and getting out of recursion
wordpress
I'd like to be able to have categories of a custom post type, how do you set this up? update I want to keep the default categories for regular blog posts, but a separate set of categories just CPT.
You need to add 'taxonomies' => array('category') in your register_post_type() function.
How do you add categories to custom post types in WordPress?
wordpress
I am writing a media plugin that uses custom tables to store its contents. (eg not the post tables where wordpress stores it attachment data). Now i'm looking for a way to use the default wordpress comment system to add comments to it. (These comments will not be in the regular comment table but also a custom table. I ...
<code> wp_list_comments() </code> has no filters or hooks so its going to be a bit hard, what you can do is use <code> comments_array </code> filter hook <code> add_filter('comments_array','my_custom_comments_list'); function my_custom_comments_list($comments, $post_id){ //if criteria are met //pull your comments from ...
Intercept comment form submit/list by hook/filter
wordpress
I'm developing Wordpress plugins. When i activate my plugin, i'm getting a message The plugin generated 293 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin. Plugin working very wel...
My guess is you get a PHP error, which generates output before the headers are sent. If you have <code> E_NOTICE </code> enabled, calling <code> $_POST['foo'] </code> may generate a "Notice: undefined variable" error if that variable is not set. Best practice: never assume anything about GET, POST, COOKIE and REQUEST v...
Wordpress Plugin Development - Headers Already Sent Message
wordpress
I have the plugin CustomPress from wpmudev. I know longer have my membership there as it was just to pricey. I am also using there theme wpmu_dixi with some of my own customizations and tweaks. None of those tweaks where to its cor files i just added some new widget locations and messed with the css. Anyways when i go ...
I found out that it is the plugin i am using and have instead decided to use the register function
Error when adding custom taxonomy to wp nav menu
wordpress
I am running a Buddypress site, but I am not getting emails when a new subscriber registers. I have used a code in my functions.php that removes the activation email the user would receive (I want them auto activated and I am using a mailchimp auto responder to contact them upon registering instead). I don't see where ...
Just go to your Network Admin dashboard. Click on Network Settings under Settings tab. and Mark the Check box Registration notification Send the network admin an email notification every time someone registers a site or user account. Now when ever a new user will register you will receive an email.
Buddypress send admin notification email when new subscriber registers
wordpress
My apologies if this question has already been asked somewhere else, I searched but couldn't find anything. I am working on a tours website, there will be individual package pages that show some text, images and some other stuff. On the right hand side of my single package pages I have a comparison table which is merel...
Loop over the <code> $cpackages </code> results twice, and <code> rewind_posts() </code> in between. first time only output when the id matches the current post id, then skip that id the second time through.
How Can I Always Display A Particular Post First Using WP_Query?
wordpress
I'm using a feed to receive special YouTube feeds organized via playlists. Unfortunately, the URL is not included in the description field, but I can get the videos to display by including the source URL on post. This works fine except since the URL is not in the post area in the editor, the YouTube thumbnail grabbers ...
Each YouTube video has 4 generated images. They are predictably formatted as follows <code> http://img.youtube.com/vi/&lt;insert-youtube-video-id-here&gt;/0.jpg http://img.youtube.com/vi/&lt;insert-youtube-video-id-here&gt;/1.jpg http://img.youtube.com/vi/&lt;insert-youtube-video-id-here&gt;/2.jpg http://img.youtube.co...
Grab YouTube Thumbnail AFTER Post?
wordpress
How to install WP-cumulus add-on into WordPress ? Thanks,
there you go: Installing wp-cumulus
WordPress Cumulus
wordpress
I have the following query, what it does is get a list of "Books" (custom post type). This list is displayed on a page which also has a small form with a dropdown populated with the terms of "Editors" (custom taxonomy). When a user chooses an "Editor", it reloads the page and the query returns the corresponding "Books"...
Your form will post back to the URL specified in the <code> action </code> parameter, or to the same URL if you don't specify it. You start at <code> /books/page/8/ </code> , so if your <code> action </code> parameter is empty, the resulting URL will also be <code> /books/page/8/ </code> . Just fill in the <code> actio...
Pagination : How to remove /page/x/ after a 'POST' action on a form returning to page 1
wordpress
I am getting this error when I try to return the post_title value from my WP_Query: <code> **Fatal error:** Cannot use object of type WP_Query as array </code> Here is the code: <code> $query = new WP_Query( array( 'meta_key' =&gt; 'Old ID', 'meta_value' =&gt; $atts['oldid'] ) ); return $query['post_title']; </code> Ho...
I'm not sure you understand the logic of <code> WP_Query </code> . Rather than explain in words, here's a code example; <code> $query = new WP_Query( array( 'meta_key' =&gt; 'Old ID', 'meta_value' =&gt; $atts['oldid'] ) ); if ( $query-&gt;have_posts() ) return $query-&gt;posts[0]-&gt;post_title; return ''; </code> Chec...
What kind of object type is WP_Query?
wordpress
In custom theme development, how does one enable default built-in widgets? Note I mean default built-in widgets, not custom ones. I tried the following example for a WP 3.12 blog by placing it in my theme's functions.php file, trying to activate Pages by default. It didn't work, but I don't know why. <code> function my...
that's not the way, <code> wp_register_sidebar_widget </code> is used to create widgets. if you want your sidebar to display widgets by default use <code> [dynamic_sidebar()][1] </code> in your theme eg from the 2010 theme: <code> &lt;div id="primary" class="widget-area" role="complementary"&gt; &lt;ul class="xoxo"&gt;...
Enabling Default Widgets in a Custom Theme
wordpress
I am working with someone that has a host (internetplanners.com) that uses fantastico to install WordPress. Basically, my question is has anyone had bad experiences with fantastico or webhost internetplanners.com? Note, I have installed Wordpress on my local machine (Windows) and didn't have any trouble. I don't have e...
I always thought that Fantastico essentially just; Placed a copy of WordPress on your server (not always the latest version, as you say, this is a local copy limited by the update frequency of Fantastico) Set-up a database (and user) automatically Configured <code> wp-config.php </code> accordingly Then you'd just cont...
Fantastico pros and cons
wordpress
I have a custom taxonomy registered for my custom post type. I need to make it possible for a user to specify the order in which the taxonomy terms should appear (something like menu order for pages). Then when displaying the taxonomy terms on the site I will use the specified custom order to order them. What is the be...
Thank you everyone for advice and apologies, I haven't realised that I hadn't have selected the answer for this question. Since I've asked it, I came across Category Order and Taxonomy Terms Order plugin. I mainly use this plugin for ordering.
Custom order of terms for custom taxonomy in admin and website
wordpress
A custom background plugin has started to cause certain browsers (FF, IE8,9, Safari) to reveal an appended url string when viewing the index page: http://dearearth.net - this mostly shows when not visiting the site directly, but rather when going through, for example, google. This persists in IE 9 even after refresh or...
This doesn't have to be a plugin issue. If someone puts a link on their website to your blog say for example: www.example.com but not only that they place some random string: www.example.com/?foo=bar in that link to your site then when search engines crawl this page with the link to your site on google or any other sea...
Plugin Appends ugly url string to index
wordpress
I came across a strange problem while working on my dev environment for a site we're making. We have custom post types, so I'm not sure if that's the reason why it's not working correctly. However, I managed to get the posts to display 5 at a time instead of normal 10. However, in one of the categories, it only display...
The problem is that your query is selecting 10 posts per page, but you're only limiting the view to 5, so you're losing 5 posts per page. The proper way to change the number of posts per page is to modify the query before the loop: <code> &lt;?php $myquery = wp_parse_args($query_string); $myquery['posts_per_page'] = 5;...
Displaying Custom Posts
wordpress
Here is what I have: A custom post type that has a custom meta value added to a post that stores the posts expiry date. When the post passes this expiry date it no longer shows on the site. This works but I'm using something like this to list the terms for the custom post type: <code> $termcats = get_terms('dcategory',...
As far as I remember counts for terms are stored in database, so there is nothing to modify when you fetch them - you simply get ready-made numbers. So you will either need to implement and maintain your special logic for counts completely separately or try to recalculate and modify native counts, see <code> wp_update_...
How to hook get_terms() to only show count of posts that have custom meta
wordpress
I am not sure how to add multiple capabilities to 'assign_terms' capability. My code is below, notice the capabilities array within the register_taxonomy function <code> /* Registers taxonomies. */ function cflnk_wod_score_register_taxonomies() { /* Set up the artist taxonomy arguments. */ $wod_name_args = array( 'hier...
When assigning capabilities to 'capabilities' argument of <code> register_taxonomy() </code> you need to assign the capability and not the role! so use capabilities that only a specific role has eg: <code> 'capabilities' =&gt; array ( 'manage_terms' =&gt; 'manage_options', //by default only admin 'edit_terms' =&gt; 'ma...
How to assign multiple roles for capabilities array withini register_taxonomy function?
wordpress
I'd like to display 9 posts and be able to insert a sticky post with its custom html template in between 4th &amp; 5th post. Currently the sticky post gets displayed in both the "sticky container" and regular posts. have_posts()) : $my_query-> the_post(); ?> <code> &lt;?php if ($count &lt;= 9 ){ ;?&gt; &lt;article&gt; ...
Your code looks odd to me, typically to insert something between posts you add a counter and count each loop, then add custom code on a particular count, this is for the main loop, for a non main loop or secondary loop us wp_query. <code> &lt;?php if (have_posts()) : ?&gt; &lt;?php $count = 0; ?&gt; &lt;?php query_post...
How to display sticky post with custom html
wordpress
How to create a blog in a sibling directory of an already installed WordPress directory? The domain is <code> example.com </code> and there is an existing installation in <code> blog </code> directory and the root directory at <code> example.com/ </code> is free. Is it possible to create a blog at <code> example.com/an...
I'm pretty sure that this can't be done. I think WP multisite can only control blogs that are underneath it - which is why you'd have to install WP at the root. I was once looking to do the same thing, and unfortunately all my research pointed to "no" being the answer.
Multisite installation on an existing single installation
wordpress
Can someone recommend me a nice countdown widget plugin for Wordpress? I've been using the Countdown widget under Blogger and it's exactly what I need. A simple number from now until date or from date. I can't seem to find a very simple, easy countdown that does the same thing in Wordpress.
Yes, there's a great widget called the jQuery T-Minus Countdown Widget Enjoy!
Countdown Widget
wordpress
I'm building a site for a magazine using WP and am needing to display a month of posts at a time. How would I make the next_posts_link(); and previous_posts_link(); functions return results, shorted as one month per page? If I can't do it via those functions, how would I make the front page display in an archive-like m...
You have to modify the query that selects the posts to select by month. This bit of code placed in the template will get the page number and subtract that from the current month. <code> &lt;?php $page = get_query_var('paged') ? get_query_var('paged') : 1; $subtractor = $page-1; $date = date("Y-m-d H:i:s"); $current_mon...
Making next_posts_link(); return posts by month
wordpress
In stackexchange-url ("this post on wordpress.stackexchange.com") I asked whether using get_template_part(), as demonstrated in the TwentyTen theme, is a recommended best practice. The general consensus I got was that it was not necessarily the best practice in all situations. This related question then is: can you pro...
A recommended approach for using <code> get_template_part </code> would be for including bits of code that would otherwise be repeated frequently in all your templates. Like if you had conditionals defined within your loop that you wanted to include in archive.php, search.php, single.php etc. It also allows child theme...
When is get_template_part() preferable to simply using the template.php files?
wordpress
I am running a theme on my Wordpress install that was built for Wordpress 2.8, prior to the time that Wordpress started using featured images for posts. I am switching to a theme that was built for Wordpress 3.1 and it uses the featured image instead of looking for a custom field. I have a lot of old posts with the cus...
http://justintadlock.com/archives/2009/11/16/everything-you-need-to-know-about-wordpress-2-9s-post-image-feature LIsts a plugin: http://wordpress.org/extend/plugins/get-the-image I'm not sure by the article and description if what you are looking for is exactly what it does? It seems to imply that, but I'm not 100%
How can I migrate all of my custom field thumbnails to the built-in post featured image?
wordpress
We're trying to use WordPress as a light CMS system and we need to be able to section off parts of WordPress so that editors for one product aren't able to edit other products. Seems like out of the box WP has 5 user levels but there isnt any thought around fine grain access (without using WP Network)
Google is your friend ;) Restrict categories Role Scoper
How can I limit WordPress editor roles to a specific category?
wordpress
I have the following code: <code> &lt;?php if ((is_home()) OR (!is_single()) OR (!is_page('171'))) : ?&gt; &lt;body&gt; &lt;?php else: ?&gt; &lt;body class="last-page"&gt; &lt;?php endif; ?&gt; </code> However it doesn't seem to work as expected. I want the class "last-page" to be applied to the body of the page with t...
from your verbal desription, i would think this should work: <code> &lt;?php if ( is_single() OR is_page('171') ) : ?&gt; &lt;body class="last-page"&gt; &lt;?php else: ?&gt; &lt;body&gt; &lt;?php endif; ?&gt; </code>
How to apply style to the body tag of a particular page?
wordpress
I have a plugin I want to use, but it depends on the $ identifier, as apposed to using jQuery. Is it possible to enable the $, to save me recoding the plugin? EDIT The plugin automatically adds the javascript, therefore I can't wrap it.
Try this: <code> jQuery(function ($) { /* You can safely use $ in this code block to reference jQuery Call your plugin here */ }) </code> I think you already know this. But still for reference http://api.jquery.com/jQuery.noConflict/
how can I make $ work in wordpress for jQuery?
wordpress
I'm trying to do some WordPress URL rewriting ... Specifically I have custom post type that currently works like this: <code> http://mydomain.com/videos/post-title/ </code> But I would like to have it located at: <code> http://mydomain.com/videos/author-name/post-title/ </code> Is there any way to achieve this?
using Jhon's Custom Post Permalinks plugin it should be easy using: <code> /%post_type%/%author%/%postname%/ </code>
Adding %author% in custom post type URL structure?
wordpress
I'm using the WP-TweetButton but when I set the settings to add the button manually. Nothing is displayed. Settings: The Code: <code> &lt;div id="social-buttons"&gt; &lt;div id="tweet-button"&gt; &lt;?php tweetbutton(); ?&gt; &lt;/div&gt; &lt;div id="fb-share"&gt;&lt;?php if (function_exists('fbshare_manual')) echo fbs...
I finally, got it; <code> &lt;?php echo tweetbutton(); ?&gt; </code>
WP-TweetButton is not displaying the tweet button if this is set to "Manual."
wordpress
What is the best way to add php to the edit link? For example: insert <code> &lt;?php echo of_get_option('dappo_actionbtncolor', 'dappblue' ); ?&gt; </code> into the span tag of <code> &lt;?php edit_post_link( __( 'Edit this', 'mytheme' ), '&lt;span class="edit-link"&gt;', '&lt;/span&gt;' ); ?&gt; </code>
The easiest way might be to use <code> get_edit_post_link() </code> ( Codex ref ), which returns just the link, allowing you to use it however you need, according to your purposes.
PHP in Edit Post link
wordpress
I am using <code> $wpdb-&gt;update </code> to update a custom table I have in my database. When I <code> var_dump </code> the result it returns: <code> int(0) </code> So I tried <code> $wpdb-&gt;print_error() </code> to see what's wrong. However, it shows nothing. I also tried <code> $wpdb-&gt;show_errors() </code> , b...
I would recommend running the following code right after your query to see what's happening: <code> exit( var_dump( $wpdb-&gt;last_query ) ); </code> This should print the last query that hit your database. In cases like these, I usually will manually run such a query through phpMyAdmin to see if it runs without errors...
Showing errors with $wpdb update
wordpress
Situation: I'm working on a plugin and I'm developing it as a class, everything worked fine until I run into this situation. I wanted to make things a bit cleaner and tried this.. <code> class MyPlugin { function __construct() { add_action('admin_menu', array(&amp;$this, 'myplugin_create_menus'); } //I don't want to wr...
You can't pass an argument to the callback function. <code> add_menu_page() </code> adds it as an action handler , and <code> admin.php </code> fires the action , without any arguments. I see two simple solutions to this problem. One is to store all filename in an array in your class, indexed by hook name. Then you can...
Passing arguments to a admin menu page callback?
wordpress
I have downloaded a plugin called Stream Video Player , which has a shortcode. If I put the shortcode into the content editor, it works well and it displays the video. However, if, inside a template I am creating, I call it through the <code> do_shortcode() </code> function, it doesn't work, it just shows the text <cod...
It's not really a shortcode, its a content filter but you can try calling the plugins function directly: <code> if (function_exists('StreamVideo_Parse_content')){ echo StreamVideo_Parse_content("[stream flv=xxx.es/wp-content/uploads/2011/04/VIDEO-UE.mp4 mp4=xxx.es/wp-content/uploads/2011/04/VIDEO-UE.mp4 provider=video ...
Stream Video Player does not work with do_shortcode()?
wordpress
I'll just like to add that I have a current working solution in place and works well but I'm looking for ideas of being able to do it better or cleaner if possible. We have hundreds of properties in a custom post type with metakey/metavalue holding the properties longitude and latitude co-ordinates. We allow a visitor ...
I would duplicate the coordinates of the posts in a separate table <code> (post_id, lat, lon) </code> , with an index on <code> (lat, lon) </code> . With all the joins and the casts I doubt the database can use an efficient index with your query. I once wrote stackexchange-url ("an answer to a similar question") using ...
Is it possible to wrap Geo Location search around WP_Query?
wordpress
I need a plugin for custom post type. I need something like this: Can anyone suggest a plugin which has this feature, especially image upload and "Add another" button option.
This metabox class does exactly what you are after and so much more. wpalchemy-metaboxes
Multiple image uploader under editor?
wordpress
I'd like to make all the links in posts on one of my sites to be with rel="nofollow" on links inside posts. I wasn't able to find a plugin that did the job except for WP-NoExternalLinks. It also didn't work, unless I used it's dooms day option: "Mask ALL links in document (can slow down your blog and conflict with some...
you can add a filter in your functions.php add <code> // Nofollow in content add_filter('the_content', 'my_nofollow'); function my_nofollow($content) { //return stripslashes(wp_rel_nofollow($content)); return preg_replace_callback('/&lt;a[^&gt;]+/', 'my_nofollow_callback', $content); } function my_nofollow_callback($ma...
A plugin for having rel="nofollow" in posts?
wordpress
If you were configuring a new VPS for a WP website that hasn't launched yet, What technologies would you choose? (website specs below) Website Targeting 50-60k hits /mo. and more The website is designed to categorize embedded YouTube videos using a chained select menu (1 query for multiple boxes). Using less than 5 "st...
There's a post here that's very good about load optimization and performance: stackexchange-url ("Steps to Optimize WordPress in Regard to Server Load?") It might be a good idea to also utilize a CDN for a majority of your page requests. If you want performance you'll have to minimize requests to your database and setu...
Fastest Server Config, Whats your suggestion?
wordpress
I'm trying to synchronise my files with the Amazon S3 server for distribution using CloudFront, as the CDN. I am currently having troubles syncing the files though. I've verified that the details are correct, though, when I click on sync it says it is syncing 1 item of many, but looking at the S3 bucket, it doesn't see...
I switched to W3 Total Cache, and it now works.
Cannot upload to S3 using CDN Sync Tool
wordpress
Recently our site began no longer returning correct search results. When searching it returns one result that's unrelated to the inquiry. I've turned off all plugins and reverted back to a day when I thought it was working properly to no avail. What could possibly cause this to occur? You can see in the image below tha...
AFAIK, out-of-the-box WordPress does not include taxonomies, such as tags and categories, in it's search, only post titles &amp; content. I'm sure this has always been the case, so I'm a little confused as to why it 'used to work'. Perhaps the pages have been modified, and used to contain the search terms themselves, b...
What would causes search to return incorrect results?
wordpress
On this page: http://codex.wordpress.org/Function_Reference/wp_add_dashboard_widget The function wp_add_dashboard_widget is described. It states: <code> wp_add_dashboard_widget($widget_id, $widget_name, $callback, $control_callback = null) </code> How do you use the $control_callback, properly? I am completeley stuck, ...
Solution : hover on the title bar of your widget, then click configure Don't ask me why this works like this but it does.
How do I use the control callback when creating a simple dashboard plugin
wordpress
I want two menus using the new WordPress 3.0 feature. In <code> functions.php </code> I have: <code> function register_my_menus() { register_nav_menus( array( 'header-menu' =&gt; __( 'Header Menu' ), 'top-menu' =&gt; __('Top Menu') ) ); } add_action( 'init', 'register_my_menus' ); </code> And in <code> header.php </cod...
<code> wp_nav_menu() </code> does not have a <code> name </code> argument . Instead, you should use <code> theme_location </code> . With <code> register_nav_menus() </code> , you indicate that you have two locations in your theme where you can display a menu. The user can then create multiple menus, and assign them to ...
Can't display custom menu using name?
wordpress
say i've got a url http://bfami.modernactivity.co.uk/category/museum/orderby/date/order/desc/ that works with; <code> add_rewrite_rule( 'category/(.+?)/orderby/([^/]+)/order/([^/]+)(/page/?([0-9]{1,}))?/?$', 'index.php?category_name=$matches[1]&amp;paged=$matches[5]&amp;orderby=$matches[2]&amp;order=$matches[3]', 'top'...
ended up with; <code> class="&lt;?=( strpos( $oby ,'date' ) ? 'active' : null )?&gt;" </code> though can imagine i'll need to get this working on one job or the other... thanks all!
get variable from url?
wordpress
At the begining, I thought there was an issue with my HTML or CSS files. But then I realized that other people using Wordpress 3.1 had the same problem (check out stackexchange-url ("this link")). The admin bar disappears when I click another 'Pages' or 'Posts,' but it leaves its 28px padding at the top of the page. I'...
Verify that <code> wp_footer() </code> is being called in all template files, and that the Admin Bar javascript and CSS are being properly hooked into the document head.
Wordpress 3.1's admin bar disappears only leaving its 28 px padding (in ubuntu)!
wordpress
I am trying to find a function, plugin, query - something that will separate the parent comment count from the reply count. Does anyone know how to achieve this? 10 comments total are broken into 3 parent comments and 7 replies. How can I display this at the top of the comment form? Please &amp; thank you!
here's a quick and dirty method... in functions php, we create a callback function for wp_list_comments() which will count our comments: <code> $GLOBALS['parent_comments_count'] = 0; $GLOBALS['child_comments_count'] = 0; function count_comments( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; if($comment-&g...
Count parent comments & replies separately?
wordpress
I have a custom post type "mycustom_products" (hierarchical) that has custom taxonomies called 'categories' and 'tags' (as many other custom post types do). My custom category is called "myprod_category" (also hierarchical) and my tag taxonomy is called "product_tag" ( not hierarchical). I want to show a list of Produc...
If you have a lot of products, probably a custom sql query is a better option. I'd probably recommend following that route either way. Custom queries may be 'icky', but it'll lighten resources and be a darn slight quicker in most cases* I've written a function that does most of the labour, and may well come in handy in...
Show certain terms from custom taxonomy but exclude 'parent' terms?
wordpress
If I know a taxonomy term slug, how can I get that term's name?
The function you are looking for is <code> get_term_by </code> . You would use it as such: <code> &lt;?php $term = get_term_by('slug', 'my-term-slug', 'category'); $name = $term-&gt;name; ?&gt; </code> This results in <code> $term </code> being an object containing the following: <code> term_id name slug term_group ter...
How to get a taxonomy term name by the slug?
wordpress
I hope this question is easy. I want to customize my theme so that the post titles are created on the fly with code. For example, I might have a post where a price changes on the page 4 times a week, and I want to be able to change my to say: Get Product X for $19.99 without having to manually edit a meta variable... I...
I can't answer how you'll get your dynamic data with which to update your Post Title, but you can easily hook into the Post Title, using the <code> the_title </code> filter: <code> &lt;?php function mytheme_dynamic_title( $title ) { // do something to the Post Title, which is passed // into this function as the variabl...
Customizing Titles on the Fly with Code
wordpress
My question is basically identical to this other question stackexchange-url ("here"), however my question is still slightly different. I basically have a custom post type called "Packages" each package can have a slideshow with its own images. I understand the images are uploaded through the media uploader (as per the ...
Generally speaking, I would take the approach of querying for post attachments, but withhold the attachment that is the post thumbnail. WP provides a simple way of finding the post thumbnail ID with <code> get_post_thumbnail_id </code> (Codex Ref). To modify the code from the other post, I would add the following param...
Creating a metabox to upload multiple images, Ignoring The Featured Image
wordpress
Are there any plugins that allow one to make use of the _trackPageLoadTime(); functionality available in the new version of Google Analytics yet?
Google Analytics by Yoast has Custom Code setting to add stuff to tracking code. But says that it is added before <code> trackPageview </code> , while site speed instructions show it added after. Might or might not matter, I don't know. Update Plugin has been updated to support (and default to) site speed tracking .
Analytics plugins that allow for inclusion of _trackPageLoadTime()?
wordpress
Basically, I would like to add something like this into my WordPress site (which obviously will also give the user an option to sign up for an account using WordPress' default sign up system): Is there any plugin or tutorial that may be helpful to accomplish this?
Try Make Your Site Social plugin which does most of the job for you
Login with OpenID, similar to Stack Exchange sites?
wordpress
When I use <code> add_menu_page </code> &amp; <code> add_submenu_page </code> to add menu items, <code> add_menu_page( 'Forms', 'Forms', 'administrator', 'forms', 'forms_job_menupage_cb' ); add_submenu_page( 'forms', 'Job Applications', 'Job Applications', 'administrator', 'job-applications', 'forms_job_menupage_cb' );...
Hi @JM at Work: Yes, it is unfortunately that the submenu page is added for every menu page. It would be nice if there were an option but alas, there currently is not . To remove the submenu page option in WordPress 3.1 or great use <code> remove_submenu_page() </code> with code like this in your theme's <code> functio...
Remove duplicate main - submenu in admin?
wordpress