question
stringlengths
0
34.8k
answer
stringlengths
0
28.3k
title
stringlengths
7
150
forum_tag
stringclasses
12 values
Is there a way to use the <code> register_taxonomy </code> function to create child taxonomies to a specific parent taxonomy in a hierarchical structure? For example: Let's say I'm creating a theme for selling cars where users can activate it and it automatically creates a hierarchical taxonomy called "Make". Is there ...
I think you mean you want to create terms in your taxonomy? Have a look at stackexchange-url ("this answer") for detecting when a theme is activated. Then use wp_insert_term to insert the terms into your taxonomy.
Create Child Taxonomies
wordpress
I had a theme in 3.0b2 that was registering custom post types and displaying them in the admin menu just fine -- after upgrading to 3.1.2, they no longer appear in the sidebar admin menu (although they do get queried properly from the theme pages for the non-admin portions of the site). <code> show_ui </code> is set to...
Remove the errors in your registering function: <code> 'Gigs' </code> is not part of the default language file. Either add your text domain as second parameter or drop the translation function. <code> '_builtin' =&gt; true </code> is wrong. Remove the parameter; it is for native post types only. <code> 'supports' =&gt;...
Custom post type menu missing after 3.0b2 -> 3.1.2 upgrade
wordpress
Say I just have a dumb .php file sitting on my WP server and I wanted it to access WP info through the API, how would I go about doing that? For example if I wanted to call <code> bloginfo('url'); </code> As I have scored myself a downvote (with no explanation) I will expound upon why I am interested in this. Sure I ca...
You mean something like this? <code> &lt;?php require 'path/to/wordpress/wp-blog-header.php'; bloginfo('url'); ?&gt; </code>
Hook any php file into the wordpress api
wordpress
Can't figure out why this won't work: <code> function my_get_attachment_link($html){ $postid = get_the_ID(); $html = str_replace('&lt;a','&lt;a rel="shadowbox['.$postid.']"',$html); return $html; } add_filter('wp_get_attachment_link','my_get_attachment_link',10,1); </code> Just trying to hook up all the images on a sin...
Your code only works if you are actually calling <code> wp_get_attachment_link() </code> somewhere in your template . If you're not calling the function, then the <code> apply_filters() </code> inside the function will never get called, and therefore your code will have nothing into which to hook.
Can't filter wp_get_attachment_link
wordpress
I've found a way to insert a customized gallery inside my wordpress template but I'm not sure this is the better way. I've uploaded my images with the default image uploader of wordpress to manage the photos, than I've removed it from the post article and managed the media from the <code> loop-single.php </code> page t...
I'm good with everything except for the removed it from the post article part. Leaving the images attached to the Post actually makes it easier to work with the images, because you can query them by <code> post_parent </code> . Also: what do you mean by managed the media from the <code> post-template.php </code> ? Are ...
Customizing the gallery of the post correctly
wordpress
How do i get output of this in alphabetical order <code> &lt;?php $termID = 5; $taxonomyName = 'area'; $termchildren = get_term_children( $termID, $taxonomyName ); echo '&lt;ul&gt;'; foreach ($termchildren as $child) { $term = get_term_by( 'id', $child, $taxonomyName ); echo '&lt;li&gt;&lt;a href="' . get_term_link( $t...
<code> get_term_children() </code> only outputs the term IDs, and you later get details for each term using <code> get_term_by() </code> . You can combine these queries in one using <code> get_terms() </code> with the <code> child_of </code> argument: <code> get_terms( $taxonomyName, array( 'child_of' =&gt; $termID ) )...
How to get_term_children output in alphabetical order?
wordpress
Im using a WordPress transient, which expires after an hour, to store a value which is an integer. Im trying to use <code> switch() </code> and multiple <code> case() </code> statements to evaluate if the transient exists or not (i.e true or false). Here are my questions: Which comparison operator ( <code> = </code> , ...
Does it have to use a switch? why not something like this: <code> if ( false === ( $value = get_transient( 'value' ) ) ) { // this code runs when there is no valid transient set } else { // this code runs when there is a valid transient set } </code> If the a transient returns a value it will not return true. It return...
get_transient(), PHP switch(), and comparison operators
wordpress
I have a website where users can register, login and their edit profile, they can comment but not post. What I am looking for is a way to display a user profile page (where I display the gravatar and the info about the user) clicking on the username. The url must be something like "www.mywebsite.com/user/username". I k...
Every registered user can have profile, they don't need to have posts. To change Wordpress author's profile permalink, paste the following code in your functions.php: <code> function change_author_permalink_base() { global $wp_rewrite; $wp_rewrite-&gt;author_base = "user"; } add_filter( 'init', 'change_author_permalink...
Display a registered user profile page
wordpress
I am using this script to get the last time a user logged in <code> function get_last_login($user_id) { $last_login = get_user_meta($user_id, 'last_login', true); echo human_time_diff($last_login) . " " . __('ago'); } </code> I am calling it in author.php with <code> &lt;p&gt;Last login: &lt;?php get_last_login($userda...
Are you formatting the <code> mysql2date() </code> input string as <code> 'Y-m-d H:i:s' </code> , as specified in the Codex? Also, why not use this same format as <code> $date_format </code> ? EDIT: What output do you get for <code> $last_login? </code> The second argument in <code> human_time_diff() </code> is optiona...
Display last login time
wordpress
Basically there are sub-sites that inherit all the pages. But I have worked out ways for each page to be unique to their location, by creating a shortcode that pulls in the Blog Description. The point is I am not trying to spam the web, but this site needs to reach different people in different towns. And I don't want ...
I think that is possible with the plugin WordPress MU Sitewide Tags: ( http://wordpress.org/extend/plugins/wordpress-mu-sitewide-tags/ ) With that plugin you can republish content from all sites OR a selection and you can choose to publish it to the main site OR to a new subsite.
How can I automatically duplicate a site's pages onto network site?
wordpress
What is the best method (as of 3.1 or 3.2 beta) to sort a custom post type archive by a given taxonomy term? I'm trying to make a staff page and I want to sort employees by department. So the taxonomy would be <code> staff </code> and the terms to sort would be <code> sales </code> and <code> support </code> . I tried ...
Good question - I'm fairly sure you can't do this just using wp_query. You'll need to either add a posts_groupby filter, or just query the database directly. This previous question and answer might be helpful stackexchange-url ("Using wp_query is it possible to orderby taxonomy?")
Sort Custom Post Type Archive by Taxonomy Term
wordpress
I was trying to set up a few pages the other day that would hold an authors information (only to be accessed from the author snippet at the bottom of posts), and obviously these pages are showing up in the <code> &lt;?php wp_list_pages('title_li='); ?&gt; </code> , I made sure of my page order (0-5 are the pages that m...
it sounds from your text that you are using the number you gave it under 'page attributes' 'order'; use the page ID instead for the 'exclude'.
Excluding Pages not working
wordpress
Now im getting a couple of disposable email accounts in users table, how can I avoid this nasty situation?
You might need this plugin: http://wordpress.org/extend/plugins/no-disposable-email/
How to disable or protect against disposable email accounts?
wordpress
I'm using twentyten and have overloaded home.php to do some custom stuff. However, I would still like to have a page that lists all of my recent posts, archive-style. I can get to an archive page for any given category with myblog/category/category-name. But I'd like to get to an archive that just lists all recent post...
No, there is no "full archive" page like you describe created by default. This would basically be the twentyten index page set to display "your latest posts." If you don't want to access the archives via some sort of filter (category, author, year, month etc.) then you will need to create your own archive template and ...
What is the link to my default "archive" page?
wordpress
On my Wordpress site I have a three level navigation. In the second level of every main navigation item is a "toolkit" page. I would like to highlight this page in the navigation. Is there anyway that I can add a class to a page, so that I could style its navigation link separately? Is there a plugin out there that wou...
You could also simply use css: <code> #menu-item-ID </code> (where "ID" is the unique ID of the page/post/category/whatever).
Add class to navigation link of page
wordpress
I'm running WP 3.1.2 on an Apche server with the latest PHP installed. My WP is setup for a subdirectory multisite. The themes for the sites are usually a modified TwentyTen theme. After installing a new plugin, I activate per site, not network, and I'm able to then click through to a few links in the admin UI before I...
I ended up migrating to a new server and that fixed all the problems. I think something was corrupted on the original server after an update.
Plugin error after installation
wordpress
Im trying to build a shortcode which calls an HTML table with a fixed number of columns and a variable number of rows depending on the context. Its hard to manage &mdash; or even build, multiple tables over and over through HTML. I've had no trouble creating fixed columns and rows through shortcodes. To illustrate thro...
pass your data in single variables delimited by some char: <code> [myproduct cols="name,quantity,price" data="name1,5,2.00,name2,3,3.25"] </code> then explode it into an array and output. I didn't bother with table markup here, but you get the idea: <code> function myproduct_func( $atts ) { extract( shortcode_atts( arr...
Shortcodes, HTML tables, and multiple rows
wordpress
I want to have a central "data" sheet that is regularly drawn upon for types of posts that are submitted. Lets say I had a movie review site, but also want to let people post other info, like Trivia or some such. So I would have 2 custom posts types (or perhaps one if I let Reviews just be handled in Posts). I want bot...
I'd suggest to use Posts 2 Posts plugin, see plugins page and wiki for more information
Any way to make posts inherit properties/taxonomies through a single assigned taxonomy
wordpress
How can I get all enqueued styles or scripts and then deregister them all at once?
I hope you know what you are doing. You can wp_print_styles and wp_print_scripts action hooks and then get the global $wp_styles and $wp_scripts object variables in their respective hooks. The "registered" attribute lists registered scripts and the "queue" attribute lists queue scripts on both of the above objects. An ...
How can I de-register ALL styles all at once? And same with Javascript?
wordpress
Just noticed that 3.1 added a new filter to customize queries: posts_clauses. All I could find about it is that instead of using the separate query filters like posts_where or posts_join, you can edit them all in one go. I was wondering if someone could give an example of the usage of the new "posts_clauses" filter?
Below is the query I found somewhere and was going through it. The purpose of query is to sort the posts based on taxonomy. So, I am sharing the code so it might help you understand the use of posts_clauses. <code> function color_clauses_mike( $clauses, $query ) { global $wpdb; if ( isset( $query-&gt;query['orderby'] )...
Usage of the new "posts_clauses" filter in Wordpress 3.1?
wordpress
I'm writing a plugin, bar , which is dependent on another plugin, foo , being activated, and I need the functions from foo to be available when bar loads. Normally plugins are loaded in alphabetical order based on the directory name, so bar is loaded before foo . If I rename the bar directory to zbar then it gets loade...
No matter what, your constructor of bar will always run before the action is called in your code. I ran into this scenario a while back, and you're mostly there for how I did it. Simply put - comment out everything inside this_plugin_last function, and put your $bar = new bar(); inside there. and just do all of the log...
Changing Plugin Load Order
wordpress
This is somewhat of a follow-up to a question I asked some time ago: stackexchange-url ("Trying to design nice category drilldown with one &quot;held&quot; taxonomy and a repeatable list of categories") I've sort of got a better idea of what I want, but only a vague idea of how to accomplish it and I was hoping to get ...
There's a way to set custom post-type search. I can only head you in the right direction and answer the first part of your question. The other part about COOKIES you'll have to review php documentation. Also, I don't know exactly what the other <code> $_REQUEST </code> variables you may have set for your custom post ty...
Using Wordpress to make a "Product Search" type navigation drilldown
wordpress
My query is currently sorting by end date. How can I make it so it will sort by the start date? <code> $args = array ('post_type' =&gt; 'events', 'meta_query' =&gt; array( array( 'key' =&gt; 'start_date', 'value' =&gt; $min_date, 'compare' =&gt; '&gt;' ), array( 'key' =&gt; 'start_date', 'value' =&gt; $max_date, 'compa...
try adding: <code> 'meta_key' =&gt; 'start_date' </code>
How to "orderby" the first array in a meta_query that uses multiply keys?
wordpress
Ok, so I have registered a few custom post types and a few taxonomies. Now, for the life of me, I cannot figure out the code I need to add a Custom Field to my Custom Post Type. I need a drop down and a single line text area. But I also need to have separate fields for post types. So, say post type one has 3 fields and...
This is probably more complicated than you think, I would look into using a framework: http://wpgear.org/#meta-fields If you want to write your own , here are some decent tutorials: http://net.tutsplus.com/tutorials/wordpress/creating-custom-fields-for-attachments-in-wordpress/ http://sltaylor.co.uk/blog/control-your-o...
How to Add Custom Fields to a Custom Post Type?
wordpress
Is there a way to have specific css on the homepage and use a different one for all the other pages?
Yes there is. You can add this to your themes header. <code> &lt;?php if(is_home()){ // we are on the home page echo '&lt;link rel="stylesheet" src="your_stylesheet" /&gt;'; } ?&gt; </code> You can also use other conditional tags to find out if you are on nearly every type of WordPress page. Conditional Tags Following ...
Specific css on homepage, different one for other pages
wordpress
Tried them both and they don't seem to be working, am I missing something? <code> add_action('admin_footer', 'jupload_scripts'); wp_register_script('jquery-ui', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js', array('jquery'), '1.8.6'); wp_enqueue_script( 'jquery-ui' ); } </code>
As per Wordpress Codex its best to register and queue your scripts with the hook dedicated for them, even if you want your script to be added to footer. So the correct way of doing it will be: <code> function jupload_scripts() { wp_enqueue_script( 'jquery-ui', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquer...
Hooks: admin_footer and admin_print_footer_scripts not working?
wordpress
Some days ago I've upgraded my single-site WP installation to support a multi-site WP website. So I've created two new sites and set the same theme I was using on my single WP blog before. But unluckily, looking at the HTML source, I've noticed that these new sites use a different path to retrieve their theme. They bot...
I've just discovered that /$SITENAME/wp-content redirects to /wp-content, so that my visitors don't load the themes three times.
How to set a single theme directory on a multisite blog?
wordpress
I'm trying to be a good thememaker and pass all my settings through the Settings API, but I'm running into some difficulty in the sanitization callback function. The core of the problem is this: the $input variable, passed in by default, is empty. My $_POST[options group] is coming through just fine (it has everything ...
Answering my own question by way of an answer Chip has embedded in his excellent settings tutorial , namely: it's all about Correlating Function Arguments. Apparently some of the variable names/options group names I was using weren't lining up correctly.
Why might $input (Settings API) be coming through empty?
wordpress
I've just had one questions solved over here: stackexchange-url ("How to display posts from a single category within a custom taxonomy.") Now I'm wondering how to take this code: <code> &lt;?php $args = array( 'posts_per_page' =&gt; 1, 'post_type' =&gt; 'inventory', 'tax_query' =&gt; array( array( 'taxonomy' =&gt; 'inv...
Take a look at category post shortcode to get an idea and here is the plugin with minor modifications to call your post type and taxonomy: <code> // Taxonomy category shortcode function cat_func($atts) { extract(shortcode_atts(array( 'class_name' =&gt; 'cat-post', 'totalposts' =&gt; '-1', 'category' =&gt; '', 'thumbnai...
How to call custom taxonomy categories with shortcodes
wordpress
I created a custom post type, two custom taxonomies and displayed them in the 'manage post section, but I'm getting the following warning: Warning: Missing argument 2 for manage_posts_custom_column() in /home/aleche23/alexchen.info/wp-content/themes/techozoic-fluid/functions/custom-post-types.php on line 95 Picture: <c...
Change line 93 from <code> add_filter('manage_posts_custom_column', 'manage_posts_custom_column'); </code> to <code> add_filter('manage_posts_custom_column', 'manage_posts_custom_column', 10, 2); </code> The fourth argument specifies how many arguments the function <code> manage_posts_custom_column </code> accepts (one...
Getting the warning: Missing argument 2 for manage_posts_custom_column()?
wordpress
i'm trying to implement a custom post template for all posts filed under a specific category. I'm making use of WP-O-Matic plugin that puts in the RSS feeds in this category and would like to make a bit of customization for the branding on posts filed under this particular category. I found the below code from here: ht...
<code> $cat-&gt;1176 </code> cannot be a property of an object. PHP Manual : A valid variable name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. As a regular expression, it would be expressed thus: '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*' Use <code> $cat-&gt;term_id <...
Using custom post template
wordpress
There any way to run a shortcut that is in a meta box? I'm trying to execute the shortcut but does nothing, is that if the code comes from the wordpress editor does not have any problem
use <code> do_shortcode() </code> on your meta box content: http://codex.wordpress.org/Function_Reference/do_shortcode
ShortCut on meta boxes
wordpress
I have been going crazy trying to google up what these globals are. What are allowedposttags and allowedtags? What is the difference between the two? Is there a list of all WP Globals and an explanation of what they are? For MCE Editor - to allow users not logged in to use lists and underline + strikethrough add follow...
These are arrays that are used by the wp_kses library. Basically they are white lists of html tags and attributes that WordPress allows in posts and comments. If memory serves correctly, "allowedposttags" is used for sanitizing post_content while "allowedtags" is used for comments.
What are allowedposttags and allowedtags?
wordpress
How do I create a random post but it shouldnt be change when the page is refreshed I want a random post that will last for a day and after 24 hours or a day, it will change randomly the post , will be that possible? or are there a plugin that exactly does that , actually what Im trying to create is like a "Random Tip F...
Here is some code doing what you've asked and using the ideas others have highlighted: <code> &lt;?php if ( false === ( $totd_trans_post_id = get_transient( 'totd_trans_post_id' ) ) ) { $args = array('numberposts' =&gt; 1, 'orderby' =&gt; 'rand'); $totd = get_posts($args); $midnight = strtotime('midnight +1 day'); $tim...
How do I create a random post that will last for a day
wordpress
I'm writing a theme where I'd like to give users the ability, via a theme option, to specify a typeface for their site with Google Web Fonts . If a user wants to embed a font like, say, News Cycle , then the code needs to specify this in two places, in a <code> &lt;link&gt; </code> tag within the <code> &lt;head&gt; </...
Wouldn't a better solution be to build your own list of available fonts, and then let the user select which font to use? That way, your validation is much easier, and also, you have more control over how you use/implement the specific setting. In any case, you should be able to do what you want, within your sanitizatio...
How to change a specific character in a theme option value - replace a space with a plus sign
wordpress
I'm setting up a simple WP install to host a friend's podcast, and looking into various podcasting plugins. I need something that makes it easy to upload a podcast, attach it to a post, and publish a feed I can provide to iTunes. Most of the buzz seems to indicate that PodPress and Blubrry PowerPress are the two best p...
My opinion may not be totally fair, as I haven't tried both lately. But I used podpress for a while. THe problem was that every time WP did a major upgrade, podpress would quit working. I'm using podcastnig plugins for DJ music hosting on rvoodoo.com. Downtime sucks for my artists. So after about a year of having it br...
Blubrry PowerPress vs. PodPress?
wordpress
I'm trying to test my wordpress page with some simple jQuery script but it won't work. I've loaded the script with <code> wp_enqueue_script('jquery'); </code> in <code> functions.php </code> as explained in the wordpress guide but something's buggy. I'm testing the page using <code> FireBug </code> installed in <code> ...
jQuery needs to be outside the wrapper like so: <code> &lt;script type="text/javascript"&gt; (function($) { $(document).ready(function() { alert('hello?'); }); })(jQuery); &lt;/script&gt; </code> Edit: A better way would be: <code> jQuery(document).ready(function($) { // $() will work as an alias for jQuery() inside of...
Firebug says jQuery is loaded but $() and jQuery() are not defined
wordpress
is it possible to change the author base slug in dependency of the role? For example, authors get example.com/ninja/%username% and subscribers get example.com/trainee/%username% ? I am thinking of something like: <code> add_action('init', 'set_new_author_base'); function set_new_author_base() { global $wp_rewrite; if($...
In your example, the author rewrite pattern changes from <code> /author/[authorname]/ </code> to <code> /[author_level]/[author_name]/ </code> . If we allow <code> [author_level] </code> to be anything, we will get into conflict with the rules for pages, because <code> /[anything]/[anything]/ </code> can be either an a...
Change Author Base Slug for different Roles
wordpress
Is there a help desk solution plugin (free or paid) for Wordpress? Ideally a visitor would be able to create a ticket from the WP site and the admin would see it via email and in the admin portal of WP. Also offer the option for invoicing per ticket. Edit: The plugin has to play well with my theme without having to alt...
I have been looking at the WordPress Advanced Ticket System plugin . The free version has an admin interface to submit tickets but front end ticket submission requires the paid version .
HelpDesk solution for Wordpress
wordpress
In the Admin section I'm using quesry posts to get the title and content of a custom post this query_posts('post_type=sfnewsletter'); will get me the content I need but unfortunately what I need to do now is to pass the ID of the custom post via a form and then retrieve that content I've tried <code> query_posts('p=32'...
<code> query_posts('post_type=sfnewsletter&amp;p=32'); </code>
What is the ID parameter for custom post types in query_posts?
wordpress
I am using the Custom Post Type feature in Wordpress 3 to create an Events section for my website. I am able to get this to display by using the relevante template files, but I also want the event listings visible on other pages. I've done this with the normal post types but these are based on category IDs which Custom...
I've figured out the answer using the Wordpress forum. Solution below: <code> &lt;?php query_posts( array( 'country' =&gt; 'event-england' ) ); ?&gt; &lt;?php if( is_tax() ) { global $wp_query; $term = $wp_query-&gt;get_queried_object(); $title = $term-&gt;name; } ?&gt; &lt;ul&gt; &lt;span class="tax-title"&gt;&lt;?php...
Loop for custom post types filtered by a taxonomy
wordpress
I want to have a login username and password field in the header, and a registration link beside it. I want the registration link to go away once the user is logged in and the login fields to be replace with a logout link. I have found these two snippets but they don't help me achieve what I want.
<code> wp_login_form(); // Codex: http://codex.wordpress.org/Function_Reference/wp_login_form // or: wp_loginout(); // Codex: http://codex.wordpress.org/Function_Reference/wp_loginout if ( ! is_user_logged_in() ) // Codex: http://codex.wordpress.org/Function_Reference/is_user_logged_in wp_register('', ''); // Codex: ht...
How do I add Login fields and registration link to the header?
wordpress
Is there someway to change the title in wp-admin? Been looking all over google but no one seem to mention it. I simply want to get rid of "&#8212; WordPress" and possibly change the "&lsaquo;" into some other symbol. Any ideas?
<code> add_filter('admin_title', 'my_admin_title', 10, 2); function my_admin_title($admin_title, $title) { return get_bloginfo('name').' &amp;bull; '.$title; } </code> You could also do a <code> str_replace </code> on <code> $admin_title </code> to remove "— WordPress" and change "‹". Look at the top of the <code> wp-a...
Change page title in admin area
wordpress
I am working on a custom theme where there is option to upload images . I have certain check-boxes in the form which the users select as per where the image has to go. My form code is as follows : <code> &lt;input type="checkbox" class="input" name="vtype[]" value="3"/&gt; &lt;input type="checkbox" class="input" name="...
Currently you are passing on this value: <code> 'post_category' =&gt; array('3,4,5') // This is a single string </code> While you should be doing this: <code> 'post_category' =&gt; array(3,4,5) // Three separate values </code> Don't forget to sanitize the POST values neither: <code> // Initialize categories $post_categ...
How to use multiple check-box values to work in a function and insert values in database
wordpress
I'm contemplating a widget with quite a number of options, which will make for a lengthy widget form. To improve the user experience with this form, I'd like to divide it into sections. I don't feel like re-inventing the wheel, so what are some examples of widgets that have fairly complex forms (especially those which ...
How about native Thickbox with the native jQuery tabs for example: the widget it self is simple and only has a link but one you click on it the thickbox pops up and shows all of the options grouped by tabs: let me know what you think I'll fetch the code for you.
Complex widget form UI - examples and best practices
wordpress
I'm using a little function below to list out the post_terms. The function is outputting very specific markup for the grouping, filter, and href attributes (this is a term selector for the jQuery isotope plugin). <code> $terms = get_terms("post_tag"); $count = count($terms); if($count &gt; 0){ echo '&lt;div class="opti...
This is how the links are created in <code> wp_generate_tag_cloud </code> (wp-includes/category-template.php) <code> foreach ( $tags as $key =&gt; $tag ) { $count = $counts[ $key ]; $real_count = $real_counts[ $key ]; $tag_link = '#' != $tag-&gt;link ? esc_url( $tag-&gt;link ) : '#'; $tag_id = isset($tags[ $key ]-&gt;i...
Customizing the wordpress tag-cloud output
wordpress
What is the difference between custom taxonomies and page templates and custom post types? I think I understand that taxonomy is used to organize data. CPTs are used to give your data a different design. but can't a template be used instead of CPT? or are they used in combination? and can't categories be used instead o...
Taxonomies are categorizations of data. Tags are a taxonomy. Categories are another taxonomy. If you are building a movie website and want to show which actors starred in which movie, "Movies" would be a custom taxonomy. Custom Post Types are really just custom data items. They're stored just like posts and pages, but ...
What are the differences between custom post type and custom page templates?
wordpress
Error message below: Warning: Cannot modify header information - headers already sent by (output started at /home/content/79/7603579/html/listings/wp-content/themes/OIB theme/functions.php:519) in /home/content/79/7603579/html/listings/wp-includes/pluggable.php on line 897 EDIT: Code around <code> functions.php </code>...
Your <code> functions.php </code> file is outputting instead of returning something, on line 519. Can you post whatever code/functions are around Line 519? EDIT: You have a syntax error in your <code> cpt_Search_category_Filter() </code> function. You have a couple stray semi-colons after closing braces. Change this: <...
Error messages when adding code to function.php or trying to delete inactive plugin files
wordpress
So what I want to do is too have a function similar to a category or tag, but a little more robust. It's for a podcast to list of guests for each episode . Ideally this would do a few things: Guest Data For each guest (added to an episode), display their: name, photo, twitter id, url. Guest Page Clicking on their photo...
So what I did was make a custom post type for guests profiles, and use "posts 2 posts" to connect them to specific episodes. The plugin has functions to both list the connected guests on episode pages, and list all episodes associated with that guest on their profile pages. http://wordpress.org/extend/plugins/posts-to-...
Podcast Guest List
wordpress
I used the Custom Post UI plugin to create a custom post type called 'business_sold'. I assigned each custom post to one of six categories and an additional one called 'All'. I used a standard WP widgetized menu to list the 'Business Sold' categories, but my custom posts are not called on a search of any category. I ca...
Category archive by default it search for posts and not your custom type, you need to tell WordPress to search for your custom type, paste this code in your theme's functions.php file: <code> function cpt_Search_category_Filter($query) { $post_type = array('post','business_sold'); if ($query-&gt;is_search || $query-&gt...
My custom posts that are assigned to categories, are not called on a category search using a Category Menu
wordpress
I need to add multiple css files from a css framework to my editor-style.css file. The point is that i don't want to update the editor-style.css file anytime there's a new update from either my theme or the css framework. Is there a filter or hook to add more than one stylesheet ? (I'm aware of <code> @import </code> ,...
<code> add_editor_style( $stylesheet ); </code> http://codex.wordpress.org/Function_Reference/add_editor_style
Is there a filter for editor-style.css file?
wordpress
Ok so i am trying to use WordPress's custom fields and have them working but now i have some php code i need help with. <code> &lt;a href="&lt;?php echo get_post_meta( $post-&gt;ID, '_ct_text_4dc9e9f74d000', true ); ?&gt;"&gt;Go To Store!&lt;/a&gt; </code> The above code is what i have for right now. Is there a way to ...
You mean something like this? <code> $customhref = get_post_meta( $post-&gt;ID, '_ct_text_4dc9e9f74d000', true ); if ( $customhref ) { ?&gt; &lt;a href="&lt;?php echo $customhref; ?&gt;"&gt;Go To Store!&lt;/a&gt; &lt;?php } else { echo 'N/A'; } </code>
Custom Field IF/ELSE PHP
wordpress
I recently upgraded WordPress from 3.0.x to 3.1.2. I had set it up to use custom post types before the upgrade. I need make a list of events that are occurring that started in the past until they occur. For example, if an event started today at Noon, it should show up in this list until it ends, which could be tomorrow...
Here is example from Codex on using <code> BETWEEN </code> with new format of meta query, which covers multiple fields as well: <code> $args = array( 'post_type' =&gt; 'product', 'meta_query' =&gt; array( array( 'key' =&gt; 'color', 'value' =&gt; 'blue', 'compare' =&gt; 'NOT LIKE' ), array( 'key' =&gt; 'price', 'value'...
How to query custom post types with multiple keys?
wordpress
I'm finding that if I have errors in my code that's being called by my custom widget's form() method, I don't see any error display - the only indication I have is that in Admin > Appearance > Widgets the sidebars are all gone. What can be done to: a) avoid completely destroying all sidebars in Admin whenever your code...
Since the question was asked in May, the WP core team released the Admin Debug Bar , and its ancillary plugin Debug Bar Console is exactly the balm to ease any WP Programmer's pain.
Debugging / displaying errors in WP_Widget-> form()
wordpress
i want to show the syntaxis in some posts about how to run a shortcode, I mean, something like this [myshortcode] but without running it, is that possible?
If you use double brackets, WordPress will not execute the shortcode but just display it with single brackets. So <code> [[gallery]] </code> becomes [gallery] in your post.
how to show the syntaxis of a shortcode
wordpress
any suggestions on how to get rid of ul tag wrapped around li tags in custom menu here at http://www.blueoceanportfolios.com/careers/ the custom menu is outputted with nested tags around like <code> &lt;ul id="menu-home" class="navLeft"&gt;&lt;li&gt;&lt;a href="http://www.blueoceanportfolios.com/careers/"&gt;Home&lt;/a...
The <code> container </code> argument controls what is one level higher - around <code> &lt;ul&gt; </code> . What you need is <code> items_wrap </code> argument that controls the list wrap and defaults to <code> &lt;ul id="%1$s" class="%2$s"&gt;%3$s&lt;/ul&gt; </code> . Removing the ul wrap in Codex gives following exa...
removing the list container from the custom menu output
wordpress
I'm new to SQL and am wondering if I need to use <code> wpdb-&gt;prepare </code> for the following query to a table I've created <code> global $wpdb; $tablename = $wpdb-&gt;prefix . "my_custom_table"; $sql = "SELECT * FROM " . $tablename . " ORDER BY date_created DESC"; $resulst = $wpdb-&gt;get_results( $sql , ARRAY_A ...
Its best practice to always use <code> prepare </code> but the main use of it is to prevent against SQL injection attacks, and since there is no input from the users/visitors or they can't effect the query then that is not an issue in your current example. but like i said before its best practice to use it and once you...
Should I use wpdb prepare?
wordpress
I'm using get_pages() function to get all subpages from a page like this: <code> $childrens = get_pages(array('child_of' =&gt; 7, 'sort_column' =&gt; 'post_date', 'sort_order' =&gt; 'DESC', 'depth' =&gt; -1)); </code> This is supossed to get me a list of all pages (no matter if direct children, children of children, et...
after looking around a bit I managed it to make it work using the following: <code> function sort_pages_by_date($a, $b){ if ($a-&gt;post_date == $b-&gt;post_date) return 0; if ($a-&gt;post_date &lt; $b-&gt;post_date) return -1; return 1; } function get_filtered_news($pages) { usort($pages, 'sort_pages_by_date'); rsort(...
get_pages() not ordering as it should
wordpress
I wish to create a podcast directory site. For which, I'd like the users of my site to be able to upload audio files which are "large" (e.g: more then 2 or 8 MB), and to make that upload "easily" go to the correct field in a relevant plugin (such as "podcasting") Any suggestions will be welcomed.
Just to add to what other have said, beyond changing your php.ini settings, upload size is limited mainly by the browser/connection. There are more reliable browser bases solutions that use java/flash or a combination of tech that allow for uploads reliably up to 100MB. http://www.plupload.com/ http://www.swfupload.org...
Creating a podcast directory site - how to allow user to upload "large" files?
wordpress
I am using the members plugin and have a custom post type of "listing" When I navigate to listings in the backend, I can edit. quickedit, and view. There is no option to trash. I am logged in as the admin. <code> add_action('init', 'listing_init'); function listing_init() { $labels = array( 'name' =&gt; _x('Listing', '...
Might you need one of these Admin capabilities ? delete_others_pages delete_others_posts delete_pages delete_plugins delete_posts delete_private_pages delete_private_posts delete_published_pages delete_published_posts Unless you've modified the default capabilities for Administrator, to remove one or more of these capa...
How do I "trash" a custom post type post while logged in as Admin
wordpress
On the site I'm currently developing I am using 'Custom Post Type UI' to manage my custom post types. Within this I can manage the description for any of the new custom post types that I have created. How would I go about editing the description of the default 'posts' post type? I am outputting this description under t...
you can use <code> global $wp_post_types </code> to edit the description for example: <code> add_action('init' , 'edit_post_description'); function edit_post_description(){ global $wp_post_types; $wp_post_types['post'] -&gt;description = 'type your description here...'; } </code>
Post Type Description for 'Posts'
wordpress
I've created a custom sidebar with this code in my theme's functions.php: <code> register_sidebar(array( 'name' =&gt; __('Article - Below Content'), 'id' =&gt; 'zg-article-footer', 'description' =&gt; 'Use this sidebar to place widgets that will appear directly underneath the Article' )); </code> When I navigate to App...
This is default behavior. I believe that sidebars are listed by ID in <code> Dashboard -&gt; Appearance -&gt; Widgets </code> , and that the sidebar with ID <code> 0 </code> is always open in the default view.
Why is my custom sidebar always open on the widgets screen in Admin?
wordpress
I'd like to count the number of posts created for every category, so: <code> 12 Works (12 posts in works category) 36 Pictures (36 posts in pictures category) 17 Furnitures (17 posts in furnitures category) </code> How can I do that?
You can use wp_list_categories() function and set show_count to 1 (true) http://codex.wordpress.org/Template_Tags/wp_list_categories
Count the posts number for every category
wordpress
Thanks to stackexchange-url ("Otto")'s excellent post on advanced taxonomy queries , I (mostly) understand how to create multi-taxonomy and multi-term queries. However, what I don't know is how to build those dynamically based on user input. I'd really like to end up with something like Amazon.com has on their site, wi...
I am a little fuzzy on specifics of technical side, but I think general outline would be following: Interface - you will need to either submit this as form by button or JavaScript. Query variables - you will need to register custom variable(s) via <code> query_vars </code> filter so your custom data is not discarded fr...
How to build a multi-taxonomy, multi-term query based on user input
wordpress
The title pretty much says what I'm trying to accomplish, but more specifically I have a plugin that I made and it creates a custom post type, lets call them <code> newpages </code> . On these pages I have used <code> template_redirect </code> to take over the design of the pages, but some plugins appear, but I don't w...
I don't see why not. Hook to <code> template_redirect </code> (you already did). Conditionals should work at this point, so use <code> is_single() </code> / <code> is_singular() </code> / etc to check for what you need. Use <code> remove_action() </code> / <code> remove_filter() </code> to unhook unwanted functionality...
Disable Individual Plugins (specifically in Custom Post Types) on a per-post basis?
wordpress
Mike Schindel provided me this code long time ago: <code> &lt;?php /** * Create the Blocks custom post type and the Sections custom taxonomy */ add_action('init', 'my_init_method'); if (!class_exists('YourSite_Blocks')) { class YourSite_Blocks { static function on_load() { add_action('init',array(__CLASS__,'init')); ad...
What is the error message being generated? Also, to avoid conflicts, all custom Theme functions, classes, options, constants, etc. should be prefixed uniquely , e.g. using <code> theme-slug </code> . It is highly likely that a generic function name like <code> my_init_method </code> is used by another Plugin or Theme. ...
Is there any way of not using my_init_method in the following code (that creates a custom post type)?
wordpress
What's the best way to ensure that post and page slugs use underscores instead of hyphens, without needing to edit the slug manually (or updating the page manually) Current permalink: <code> www.&lt;domain&gt;.com/2011/05/this-is-a-test-post/ </code> Desired permalink <code> www.&lt;domain&gt;.com/2011/05/this_is_a_tes...
IMO hooking into sanitize_title is probably the best way to go here. Check out this plugin by Mark Jaquith which does something similar: http://txfx.net/files/wordpress/periods-in-titles.phps As for updating the old posts, I would just write a simple script that would generate sql to manually update everything. (code n...
Using underscores instead of hyphens in the permalink
wordpress
I just made my first plugin and it got approved by WordPress. Great news for me, but now what? The "instructions" on the Codex are anything but clear for me. I did find an article on Dig WP and I managed to get to the 3rd line of code. After that no joy. Does anyone here have a clear set of instructions on how to do th...
Step 1 - Make sure things are formatted correctly WordPress itself depends on the headers at the top of your main plugin file. In many cases, if your plugin is "My Cool Plugin" this file is <code> my-cool-plugin.php </code> in the main directory of your folder. Make sure the top part of the file follows this format: <c...
How to add plugin to WordPress Repository?
wordpress
I need guidance to edit the WordPress plugin and theme files via phpmyadmin If I want to edit a particular plugin file or remove a plugin completely from database, I could able to find them ,but I can able to find the data tables for options , comments, links etc. I don't know how to edit/remove a particular plugin or ...
Plugins and themes are no in the database, they are physical files under wp-content directory, and that is why you CAN'T find them in the database nor edit them from phpmyadmin. However WordPress has a built in editor for plugins and themes files. For themes its under appearances -> editor and for plugins its under plu...
How do i edit the plugin files in DataBase via phpMyAdmin?
wordpress
I'm new with <code> wordpress </code> and I would like to understand better if it's possible to create pages with an url based on the <code> category </code> and then the <code> post title </code> , so: something like <code> http://mysite.com/category-name/the-post-title </code> or <code> http://mysite.com/category-nam...
Yes, any of those are possible and configurable under <code> Settings &gt; Permalinks </code> . Have a look at the Permalinks page for other possibilities. One thing to note though, it's suggested to add a number at the beginning of your permalinks to reduce the number of rewrite rules WordPress has to generate to reso...
Posts URL structure like site.com/category/the-post-title
wordpress
I have a WP_Query returning a list of posts of a particular post type and with a certain meta_value (custom field value) Is there a way generate an RSS feed based of these results ?
Look at this: http://www.seodenver.com/custom-rss-feed-in-wordpress/
How can I generate a RSS feed based on a custom WP_Query?
wordpress
Okay I have a custom loop within the main loop of the page that shows 4 posts but obviously excludes the current main post. I'll show you: <code> &lt;?php $my_query = new WP_Query( "cat=3&amp;posts_per_page=4" ); if ( $my_query-&gt;have_posts() ) : while ( $my_query-&gt;have_posts() ) : $my_query-&gt;the_post(); if($po...
change your query to: <code> &lt;?php $my_query = new WP_Query( array("cat" =&gt; 3, "posts_per_page" =&gt; 4, "post__not_in" =&gt; array($mainPost))); </code> http://codex.wordpress.org/Function_Reference/WP_Query#Post_.26_Page_Parameters
Exclude current post but keep the same posts-per_page amount
wordpress
I would like to be able to create a rotating background image that resizes with the browser window. I would like to also be able to set a certain amount of images to rotate per page or at the least start at a random number. Here is an example > http://www.theme-dutch.com/presents/screen/ Is there a plugin for this? I a...
You can use CSS3 <code> background-size </code> to make your background-images stretch to cover the area of the box. If you then create a containing box positioned absolutely over the whole page, you can put your slides in there. At that point it is just a matter of fading them in and out, something which can be easily...
Wordpress Rotating Background Images
wordpress
I have an two wordpress sites that I would like to host on the same domain. One is already up and running, the other is sitting in waiting. Can I get the second as a subdomain, or simple within a folder, to run on the same domain (different DB) without converting to multisite?
Point the subdomain to the same directory as the main site, and define different settings in your wp-config.php per <code> $_SERVER['HTTP_HOST'] </code> : Example from my local setup: <code> switch ( $_SERVER['HTTP_HOST'] ) { case 'zzl.dev': $table_prefix = 'zzl_'; $table_name = 'zzl'; break; case 'wpbuch.dev': $table_...
Can I run a second wordpress site as a subdomain without using multisite?
wordpress
I made a WordPress plugin like this: <code> Class MY_CLASS { //codes } Global $myclass; $myclass = New MY_CLASS (); </code> After installed and activated the plugin, can I use this class in other plugins without including the myclass.php file? For example, in another plugin: <code> Global $myclass; $myclass-&gt;a = 'do...
Technically, it is possible. But I would use a slightly different approach. If your second plugin is loaded first you get an error. If you want to replace the class in another plugin, it is hard to do this. So hook into <code> plugins_loaded </code> with a specific priority to create the object and use the object in yo...
Does an activated plugin automatically mean its methods are available to other WP functions?
wordpress
I like to use the new taxonomy to make a little CRM, really simple <code> contact - name - tel - email - company </code> Fine, the secretary will enter all the name in the database of the cms (WordPress), and i will have all those in, able to display it like a list or whatever i like 1) first question, do i reinvent th...
I used http://rolopress.com/ a while back and have nice features for contact administration
Get something out from taxonomy
wordpress
I am trying to list only the posts from a single category of my custom taxonomy. I have created a custom post type called "Inventory" and a custom taxonomy called "Inventory Category". I then created a number of categories using the "Inventory Category" taxonomy. I would now like to display the posts from only a single...
I believe your looking for something like this <code> &lt;?php $args = array( 'posts_per_page' =&gt; 1, 'post_type' =&gt; 'inventory', 'tax_query' =&gt; array( array( 'taxonomy' =&gt; 'inventory-category', 'field' =&gt; 'slug', 'terms' =&gt; array( 'bulk-racks' ) ) ) ); query_posts( $args ); while ( have_posts() ): the...
How to display posts from a single category within a custom taxonomy
wordpress
Enabling minify is causing cforms (ajax enabled forms) to produce the following error on submit, whereby it hangs: POST dearearth.net/wp-content/plugins/cforms/lib_ajax.php 500 (Internal Server Error) Current minify settings: http://loomn.it/baK Form page: http://dearearth.net/contact Any suggestions on how to get past...
I believe its a bug which is currently being attended to. Read the article below, which describes the current versions problems. W3 Total Cache Minify Bug Make sure that you've upgraded to the latest version in case its been resolved.
W3 Total Cache Minify + cforms II = POST /wp-content/plugins/cforms/lib_ajax.php 500 (Internal Server Error)
wordpress
Is there a way to accomplish this by the functions.php file ? I tried: <code> add_filter( 'gettext', 'change_post_to_article' ); add_filter( 'ngettext', 'change_post_to_article' ); function change_post_to_article( $translated ) { $translated = str_ireplace( 'Post', 'Article', $translated ); return $translated; </code> ...
This is essentially a duplicate of this question: stackexchange-url ("Is there a way to change &#39;Posts&#39; to be &#39;Portfolio&#39; is the WP backend?")
Rename "post" to "article" throughout the admin back end
wordpress
Right, here's the deal. I've got a loop of which displays news posts, these posts can belong to special categories (not normal categories) and I want to be able to filter by them. If I wasn't too interested in aesthetics I'd use a link like this: <code> domain.com/news?filter=cat1 </code> But instead what I want to do ...
WordPress also has a rewriting mechanism, it's better to use that instead of doing it in the <code> .htaccess </code> file. You can add your own rewrite rules to it. In your case we want to store the <code> cat1 </code> part in a separate query variable, so we also need to tell WordPress to allow this query variable (i...
Hijacking the URL for filtering
wordpress
I'm writing a customised walker class for wp_nav_menu and want to be able to specify if an li contains a submenu. So I want my markup to be: <code> &lt;li class="has_children [other-wordpress-classes]"&gt; &lt;a class="parent-link"&gt;Some item&lt;/a&gt; &lt;ul class="sub-menu"&gt; </code> I know how to add and remove ...
<code> start_el() </code> should get this information in its <code> $args </code> parameter, but it appears WordPress only fills this in if <code> $args </code> is an array , while for the custom navigation menus it is an object. This is reported in a Trac ticket. But no problem, you can fill this in yourself, if you a...
Add 'has_children' class to parent li when modifying Walker_Nav_Menu
wordpress
This seems pretty straightforward using cookies in straight HTML. In wordpress, how do I do this? AFAIK, wordpress only provides cookies functions for logging/logged in users. How about when I don't want the user to log in to show my greetings?
if you are not looking at coding it yourself then WP Greet Box( http://wordpress.org/extend/plugins/wp-greet-box/ ) could be used to achieve this. This plugin automatically loads a greeting message based on the referrer and it even allows you to customize the greetings, set time out to auto close the greeting etc. The ...
Show greetings on first time visitors?
wordpress
I'm looking for a solution to notify/force all users in an MU network to change their passwords. Any ideas of a solution out there as a plug-in?
You can use PassExpire force all users to change password at next login. Or set it to expires user passwords after 60 (Variable) days and requires a password change on login. Note: This is community wiki answer for this Question (as @tony-zeoli has already answered his own question).
Force all users in MU to change their passwords
wordpress
I've a class which has a function that check and creates table in database. In order to do so i need to use WordPress $wpdb object. I need the function to run only on first plugin activation, so i use the function: <code> register_activation_hook ( __FILE__, array( 'MemorialCandles', 'dbInstall' ) ); </code> The proble...
Try: <code> register_activation_hook ( __FILE__, array( new MemorialCandles(), 'dbInstall' ) ); </code> Or define dbInstall as ´static´ and use that to set the table name instead the constructor, which I think is the best approach.
Call External Object in Class Function During Callback
wordpress
I recently adjusted the twentyten theme to display archives in a three column grid. In doing so, it seems that the archive has lost the ability to display posts from the specified taxonomy. For instance, a taxonomy type is 'Flowers', with a specific flower being 'Rose'. When the 'Rose' archive is displayed, it simply l...
you can add the current term to you query so if its category, tag or custom taxonomy you will get the posts with the current term, try changing this: <code> query_posts('cat=0&amp;posts_per_page=12&amp;paged='.$paged); </code> with this: <code> $term_slug = get_query_var( 'term' ); $taxonomyName = get_query_var( 'taxon...
Creating an Archive using a Custom Taxonomy
wordpress
I'm trying to use some conditional logic to compare custom fields in my query, but a bit stuck. How would I get all posts with ReleasedProject AND PermanentArtist set to 'true'? Here's what I have so far, I'm assuming it's something to do with 'compare': Thanks osu EDIT : To clarify what I want to do - I'm trying to ex...
If you want all posts that have <code> ReleasedProject </code> AND <code> PermanentArtist </code> both set to true, you need to change the <code> value </code> keys for both of those to <code> 'true' </code> . If you want to exclude all posts that have both of those set to <code> 'false' </code> , you need to add <code...
WP 3.1 meta_query for multiple custom field values
wordpress
I am converting a website from straight html (with tables! Ugh!) to WordPress. The company has a new design every year, and but keeps an archive of their old site(s) with the old design(s) on their website, so people can look back over the years. Keeping the old HTML archives on a WP site What would you recommend to ke...
Checkout Stephanie Leary's HTML Import Plugin . She is an expert on importing old HTML pages into WordPress. You just point the plugin at the existing HTML pages on your server and it pulls them in. To archive you could create a custom taxonomy for the years and use WordPress archive pages to display them.
Retaining old HTML archives and displaying themes conditionally
wordpress
I'm still struggling to get my head around this whole hooking into things, so I'm really stuck on trying to do the following task: If update_post_meta is fired then check to see if the meta_key is equal to something (I want to trigger some code if a particular meta_key is used). If the meta key I'm looking for then run...
The <code> update_post_meta </code> hooks are called from the more generic <code> update_metadata() </code> function, so you might not have found it directly. The three hooks are: <code> update_post_metadata </code> , a filter which allows you to "hijack" the metadata update and do something else. If you hook up a func...
How to hook update_post_meta and delete_post_meta?
wordpress
How can I move theme and plugin (widget) settings from a WordPress.com site to a self-hosted installation? My client is moving from <code> hissite.wordpress.com </code> to his own host at <code> hissite.com </code> . I have moved over the content using the Import/Export feature, but I can't access the theme and widget ...
First off, check if the theme is available in wordpress.org themes: http://wordpress.org/extend/themes/ If it's not, find the name of the theme developer and contact them. Many developers of wordpress.com themes are happy for people to use their themes on self-hosted WordPress blogs. The developer's name and contact de...
Moving WordPress.com theme and widget settings to self-hosted site?
wordpress
I'm a small-timer, so I was amazed at this question: stackexchange-url ("Ideal WP multisite server setup for up to 1000 sites?"). I know that WordPress is a highly flexible platform, but what types of entities/businesses would need or use this type of setup? In situations like this is there much redundant content? How ...
Let's see how many use cases I can come up with in 20 seconds (grin) School and university sites where every student gets a blog Community sites (BuddyPress) where every member gets a blog (i.e. Dieting sites like SparkPeople.com) News organizations where the many personalities get a blog (i.e. CBS, CNN, etc.) Business...
Mega WordPress Applications WPMU or otherwise
wordpress
I'm building a category picker select list. I just need to populate an array of categorys like so: <code> $myCats = array("null" =&gt; "None (default)", "1" =&gt; "Uncategorized", "2" =&gt; "Second Category", etc..) </code> Does WP have an existing method call I can use to pull this data alone? I may need to exclude so...
Can't you use wp_dropdown_categories ? <code> wp_dropdown_categories('show_option_none=Select category&amp;exclude=1,2,3&amp;selected=6'); </code>
Method to retrieve category names and IDs only as an array?
wordpress
This isn't as simple of a question as you may think. Basically I have a C# program that is hitting the worpdress site and the wp_schedule doesn't seem to fire off. If I go to the site with my firefox browser then it seems to fire-off. Soooo what's the difference here? What exactly causes the cron to fire? Is it the HTT...
The WP-Cron functions are not actually cron functions. Instead of a cron running and executing tasks precisely as scheduled, it waits until the frontend or admin is loaded, checks if any jobs are scheduled and then fires as needed. To execute the cron jobs, WP loads <code> wp-cron.php </code> , which is located in the ...
What causes wp_schedule_single_event to fire off?
wordpress
I'm displaying a comment outside the comment template, getting it with <code> get_comments() </code> and echoing the <code> comment_content </code> . My problem is that the comment loses the formatting (paragraphs, line breaks, etc...). In my template I'm using TinyMCEComments (TinyMCE on comment form). Someone pointed...
applying the 'the_content' filter could work: <code> &lt;?php echo apply_filters('the_content', $comment-&gt;comment_content); ?&gt; </code>
Comment formatting with comment_content
wordpress
I'm using Greg's Threaded Comment Numbering plugin to number the comments. Actually I'm displaying a number beside of each parent comment (no threaded comments numbers). I have 2 problems that I have already tried to solve, but without results: I am displaying the top comment with a different layout, I need to start th...
<code> // inside your callback function: static $ancestors = null; $parent = (int) $comment-&gt;comment_parent; // Modify INITIAL VALUE here: $init_val = (int) 1; $is_child = false; if ( $parent &gt; (int) 0 ) { $is_child = true; $ancestors[] = $parent; $child_counter = count( $ancestors ) + $init_val; } /* * Only need...
Get threaded comments number
wordpress
I have about 100 posts, and I want to create pages that only show 10 on each. How would I go about this?
You need to add the following query argument: <code> posts_per_page </code> <code> global $query_string; query_posts( $query_string . '&amp;posts_per_page=10' ); </code>
I have a custom post type with many posts. How do I split the list into multiple pages?
wordpress
Is there a plugin or a hack such that I can make short updates similar to twitter's on my own wordpress blog? Perhaps making use of a custom post type or something on those lines? What i'm trying to achieve is to create short (150 character limit) posts different to the regular posts on the blog. Once these short updat...
If you just want to add a character counter for your excerpt, use this function and js. The Php for your functions.php <code> // This goes in your functions.php file inside your themes folder // Add theme support for post formats add_theme_support( 'post-formats', array( 'aside', 'status' ) ); // Add the character coun...
How to post twitter like updates on wordpress
wordpress
On the site I am currently developing I have used custom post types for the different types of content it contains (News, Podcasts, Press Releases etc). How would I go about showing the label (plus a bit of text) for each section above the loop? For example: Press Releases Some text under the heading. Press Release 1 P...
If the template page in question is the archive index for the custom post type, you can simply create a custom template file, <code> archive-{post-type}.php </code> , and add in the Title and custom text. If you don't want to create a custom template file, you can use this boolean as a conditional in your existing <cod...
Custom Post Types - Current section heading above the loop?
wordpress
Let me preface by saying I don't really understand Add_Filter, but I think that I want to be using it here. If not please let me know. I want to modify wp_get_attachment_link so that the link url changes. So for example if I click on a thumbnail in a gallery instead of going directly to the file I want it to go to www....
Look at the function in <code> wp-includes/post-template.php </code> . There you see what information you can get: <code> apply_filters( 'wp_get_attachment_link' , "&lt;a href='$url' title='$post_title'&gt;$link_text&lt;/a&gt;" , $id , $size , $permalink , $icon , $text ); </code> Note that you cannot access the <code>...
Add_Filter example for wp_get_attachment_link
wordpress
I created a contact form for my sidebar that is working perfectly in Chrome but not in IE or FF. I've been staring at it for hours and can't find out what I did wrong. I'm not getting any errors anywhere, but when I submit it in FF or IE, it logs "nope" in my console and echos out a message of -1 in #jvmsg. My html is:...
are you logged-in with all browsers? since <code> add_action('wp_ajax_contact_form', 'ajax_contact'); </code> only works for logged in users, so to fix it you need to change it: <code> add_action('wp_ajax_nopriv_contact_form', 'ajax_contact'); </code> if you want your function to work for visitors as well as users.
AJAX Contact Form Issue
wordpress
Hey Guys, I'm trying to build pagination links for the next/previous cousin page. For example, my page structure is like this: Top Level A a1 a2 B b1 b2 When I'm on a2, I want the 'Previous Page' link to go to a1, but the 'Next Page' link to go to b1 (skipping B). I'm using great Next Page, Not Next Post plugin at the ...
I solved this by getting all pages, assigning them by level, and then getting the next page of the same level. If you also want the previous page then you should probably cache the functionality that groups the pages by level. <code> function wpse16875_next_page_same_level_link() { $next_page_same_level = wpse16875_nex...
Get next/previous cousin page
wordpress