question
stringlengths
0
34.8k
answer
stringlengths
0
28.3k
title
stringlengths
7
150
forum_tag
stringclasses
12 values
I can change label of comments by altering Comment(s) from parameter of following function: <code> comments_popup_link('No Comments;', '1 Comment;', '% Comments;'); </code> But, seems that title attribute is returned from core modules. Suggest me to alter title attribute without editing core modules.
If you look into the function <code> comments_popup_link() </code> you will see the following code at the end: <code> $title = the_title_attribute( array('echo' =&gt; 0 ) ); echo apply_filters( 'comments_popup_link_attributes', '' ); echo ' title="' . esc_attr( sprintf( __('Comment on %s'), $title ) ) . '"&gt;'; commen...
How to change title attribute returned by comments_popup_link()?
wordpress
First hope you will take a look example widget http://pastebin.com/2cL7BmgF There have male and female option. Let say I select male and I want add male.css to <code> wp_head </code> When I put something like this into the code it's not working. <code> add_action('wp_head','load_face'); function load_face() { wp_enqueu...
when calling a function within a class you need to use $this <code> prefixadd_action('wp_head',array(&amp;$this,'load_face')); </code> and you will need to populate the value of $sex <code> public function load_face($instance) { $sex = $instance['sex']; wp_enqueue_style('style', WP_PLUGIN_URL . '/sample/'.$sex.'.css', ...
How do I use add_action on custom widget?
wordpress
WordPress 3.1 added the Admin Bar feature, similar to the one used in WordPress.com websites, which appears on both the website and Dashboard for logged in users (if enabled in your User settings). I've updated to WP 3.1 and enabled both settings for the admin bar ("when viewing site" and "in dashboard"), as well as cl...
Do you have <code> &lt;?php wp_footer(); ?&gt; </code> in your footer.php? It should be right at the bottom before the closing tag http://voodoopress.com/2011/02/wordpress-3-1-admin-bar-upgrade-issues/
The new WordPress 3.1 "Admin Menu" isn't appearing on my site or in the Dashboard
wordpress
Here is the code I'm using to add a custom field to a post type I have set up. As you can see it creates an input box which allows me to add whatever I want. I want to put urls in this box (without the "http://", e.g. "example.com") and have them be automatically clickable. Is there a way? <code> add_action("admin_init...
put this in your functions.php: <code> function my_format_artist_links($urls) { $urls = explode(',', $urls); $links = array(); foreach ($urls as $url) { if (empty($url)) continue; $links[] = '&lt;a href="http://'.$url.'"&gt;'.$url.'&lt;/a&gt;'; } return implode(',', $links); } </code> and then replace <code> &lt;p&gt;&...
making urls clickable for wordpress custom post type field?
wordpress
I just recently upgraded to WordPress 3.1 a few moments ago. However, I noticed that when you have Post Types show up under a *main* menu page, it overrides the link fo th menu link. Here's my <code> register_post_type </code> arguments for "Visitor" post type. <code> $v_args = array( 'labels' =&gt; array ( 'name' =&gt...
From the codex : Note: When using 'some string' to show as a submenu of a menu page created by a plugin, this item will become the first submenu item, and replace the location of the top level link. If this isn't desired, the plugin that creates the menu page needs to set the add_action priority for admin_menu to 9 or ...
Ordering Submenu Pages in WP 3.1
wordpress
is there any way to display recent comments in a widget area only for one page ? = Comments that are belongs to one page. comments of one category but not from admin ( or some other user ) I want to have two widget on my home page 10 last comments for one page 10 last comments for one category except my own comments
I don't use widgets for this as you can easily create one and use <code> get_comments( $args ); </code> for the most cases for example: 10 last comments by page is : <code> $args = array( 'post_id' =&gt; $post_id, 'number' =&gt; 10, 'status' =&gt; 'approve'); $comments = get_comments($args); foreach($comments as $comme...
recent comments filter by author, page, category
wordpress
I have a post that belongs to two categories (Drinks, Food). The post appears on category pages under <code> /category/drinks </code> and <code> /category/food </code> When I click on the post under category archive <code> /category/drinks </code> it takes me to a post page that's in <code> /food/ </code> Is there any ...
If the template is using the permalink when generating the posts, it retrieves all the categories for a given post and then grabs the first category it gets after sorting them by Id. I see two ways around this: If you want to recreate your categories with the preferred order, then you should be set. However, if you hav...
Post belonging to many categories
wordpress
I just updated one of my blogs to the new wordpress 3.1 and i need to hide the admin menu that shows up on top of the pages. How do i disable it ? thanks
this is the simplest way. install showhide-adminbar. then all subscriber won't see the adminbar even they set to show it in viewing site. http://wordpress.org/extend/plugins/showhide-adminbar/
hide Wordpress 3.1 admin menu
wordpress
I am using the Media Library Categories plugin. It does not have much documentation, so I have concluded the way to implement it would be using the shortcode <code> [mediacategories categories="6"] </code> . I want to implement this directly into the theme template. So I have tried: <code> &lt;?php if(function_exists(d...
<code> do_shortcode() </code> just parses the string. You have to use <code> echo </code> or <code> print </code> to print it out. <code> function_exists() </code> expects a string that matches a function name. After looking at the plugin, I would try this code: <code> &lt;?php if ( function_exists( 'mediacategories_fu...
How to call shortcode function directly and pass $atts
wordpress
I've been playing around with Wordpress' menu functionality (wp_nav_menu and wp_list_pages) to build a menu for my site. It's coming along, but I'm still having some trouble getting the behaviour I'd like. What I'd like is something like the sidebar menu on this website (not WP): http://www.fairfood.org/facts/sustainab...
If you dont mind using a plugin I can tell you how I have gotten this to work in the past. Add the following code to your functions.php function get_root_parent($page_id) { global $wpdb; $parent = $wpdb-> get_var("SELECT post_parent FROM $wpdb-> posts WHERE post_type='page' AND ID = '$page_id'"); if ($parent == 0) retu...
Navigation menu with children shown only for current page
wordpress
( Moderator's Note: The original title was "viewing custom post types") I've setup a custom post type called <code> 'recordings' </code> with a custom taxonomy called <code> 'themes' </code> : <code> add_action('init', 'recordings'); function recordings() { $args = array( 'label' =&gt; __('Recordings'), 'singular_label...
Hi @don de lion: I think it might be as simple as you needing to set the Page Template to "recordingsPage" as you can see in the following screenshots: UPDATE Looking again at your code it seems you define your post type as plural ( <code> 'recordings' </code> ) and yet you refer to it as singular ( <code> 'recording' ...
Creating a Page to View the List of Posts for a Custom Post Type?
wordpress
In my web pages I want to use relative links instead of absolute links. However, pages do not allow php code inside them, so i cannot do to from a url in a relative manner. How does one get relative urls inside wordpress pages so that changing domain names wouldnt affect the links?
<code> $my_url = 'my/relative/url.php'; echo site_url($my_url); </code> site_url() when used by itself will return the absolute path to your blog. But, if you add an argument to it, as per my example above, it will prepend the absolute path to your path. Just make sure your URL doesn't contain a leading slash (eg: /thi...
How to use relative links on my pages?
wordpress
I'm trying to make a very simple widget that access tables contained within the same database instance as my Wordpress database, but are not wordpress tables. I'm using the wpdb class according to the codex . I'm not getting any errors, but I'm also not getting any results. Am I using the object appropriately? Or shoul...
If you really just want a single row, use <code> $wpdb-&gt;get_row($sql) </code> instead. But your query looks funny...it looks like you're trying to get the latest 'client status' for the user in which case your query should be: <code> 'SELECT status FROM Clients WHERE UserID = '.$current_user-&gt;ID.' ORDER BY ID DES...
Using $wpdb object in a widget
wordpress
I've found almost the same question: stackexchange-url ("stackexchange-url but the answer doesn't work for me. I have "portfolio" post type, and I'm working on widget displaying all portfolio items. This code works perfectly on page-portfolio: <code> $loop = new WP_Query( array( 'post_type' =&gt; 'portfolio', 'posts_pe...
It sounds like your widget references the global $loop for some reason. This could possibly be due to the internals of the Widget class or due to interference of other plugins, i guess. As a first step, to be on the safe side, try using a different variable name. The global loop is referred to as $loop, by simply renam...
Post_type doesn't work for widgets?
wordpress
I have a single-posttype.php and I'm trying to figure out how to display the image
Everything you need can be found on the Codex documentation page for post thumbnails. http://codex.wordpress.org/Post_Thumbnails Specifically i think you're looking for.. <code> &lt;?php the_post_thumbnail(); ?&gt; </code>
how do I display a featured image in a post type?
wordpress
in stackoverflow (stackexchange-url ("here")) there is a solution for collecting extra information from visitors, and i want to ask that, is it possible to show the collected information to other visitors in his/her comment section? Thanks...
In the link you have provided it shows how to get the value of the "collected" meta using <code> $twitter = get_comment_meta($comment_ID,'_twitter',true); </code> so all that is left for you to do is edit your comments loop and add the next few lines in it. <code> $extra_field = get_comment_meta($comment_ID,'_extra_fie...
show the meta values to visitors that collected via coment form
wordpress
<code> query_posts( array ( 'post__in' =&gt; array( 5, 76, 21, 56, 3 ) ) ); </code> I'd like to query the Loop using <code> post__in </code> and a set Wordpress IDs. I'd then like to run through the Loop in the exact order of the query. Does anyone know if that is possible?
Yes, using this plugin: http://wordpress.org/extend/plugins/sort-query-by-post-in/ Also see http://core.trac.wordpress.org/ticket/13729
Is it possible to query_posts using post__in and then Loop through them in the ordered they were queried?
wordpress
I haven't been working with WP for a while and noticed that there are some new features in WP 3+ such as creating meta data for taxonomies. I'd like to be able to add unique meta data setups for different categories on my posts - what would be the best approach for this? Take for example the following categories: "pres...
WordPress doen't have a term/texonomy meta table in its database so in order to save the meta data you will need to either create your own table hold the data, use the Options table to hold the data or use a plugin that creates that table for you like Simple Term Meta . some tutorials add meta data to categories using ...
WP 3.0.5: Best way to add custom metaboxes for post categories?
wordpress
I messed it up and I don't know how to fix it. I thought it would be easier if I just literally delete all the files and start over again. Is there a way to do it? I tried some tips in google to no avail. Neither 'svn cleanup' nor 'svn delete' works. :-(
In the root directory of your SVN checkout directory, try this: <code> svn revert -R svn update </code> That usually will restore it to the main state.
Restore svn trunk of my plugin repository to the initial state?
wordpress
I make a GET call to API, call is supposed to return no data: browser (and sniffer) give me 200-OK response with <code> null </code> text as body; <code> wp_remote_get() </code> gives me 200-OK response with string of binary garbage as body. Other API requests (that are supposed to and do return non-empty data) work pe...
[update] Support for compression method, used by MailChimp, had been implemented in WP core in version 3.3 . This issue came up again and this time I was able to reproduce and troubleshoot it. WordPress declares that is expects deflated data with high priority, but for some reason it cannot inflate some responses - the...
How do I troubleshoot responses with WP HTTP API?
wordpress
In wordpress is it possible to have different widgets on different pages, I mean, I am having a form widget which has to be just displayed on posts page, it should just display on single.php Is this possible? Is their any plugin for this?
Hi @ntechi : Look at the plugin Widget Logic .
Dynamic widgets
wordpress
i've got several posts which are tagged with "design", but also a page called "design". my question: i put some text into the design-page and would then display all posts which are tagged by "design". how is that possible? can i put a placeholder directly into the text or do i have to code it by myself in php? thx
You could easily modify the page template of your theme to include a section that reads "Related Posts" at the bottom and then execute a simple PHP query to get posts as follows: <code> &lt;?php query_posts('category_name=wordpress&amp;showposts=5'); ?&gt; &lt;?php while (have_posts()) : the_post(); ?&gt; &lt;li&gt; &l...
Include related posts on a page
wordpress
I am trying to add up custom fields from different posts. The array I created is not working. Here is the code. <code> &lt;?php $totalpricearray = query_posts('post_type=items&amp;author='.$thisauthorID.'&amp;tag='.$thispostID); while (have_posts()) : the_post(); $productprice = get_post_meta($post-&gt;ID, "productpric...
<code> &lt;?php $totalprice_posts = get_posts('post_type=items&amp;author='.$thisauthorID.'&amp;tag='.$thispostID.'&amp;numberposts=-1'); $totalprice_array = array(); foreach ($totalprice_posts as $post) { $productprice = get_post_meta($post-&gt;ID, "productprice", true); $productquantity = get_post_meta($post-&gt;ID, ...
Add custom fields from different posts
wordpress
I am trying to style a table in a Wordpress post, but am having difficulty getting it to work. I have set the post to HTML-editing mode and can get some of the styles to take, but not all. (To be honest, this is not the first time I have had trouble getting table styles to work.) The contents of the post (using contriv...
Alright, it’s solved. It turns out the problem is due to WordPress’ “auto-p” functionality and until/if it can be updated to recognize and ignore text inside <code> STYLE </code> and <code> SCRIPT </code> blocks, an easy workaround is to use the WP Unformatted plugin which makes it easy to toggle the auto-p function on...
Having Trouble Styling a Table in a Wordpress Post
wordpress
When I want to install a new Wordpress plugin, I do a search for the plugin I want, and I receive a list of results. Is there any way to sort the results by rating, or name? If not, it would be a useful addition to Wordpress.
If you search for plugins at http://wordpress.org/extend/plugins/ rather than through your WordPress install you get more options on your search results.
Sort plugins by rating
wordpress
I'm having product duplication issues while running two loops on a single page. Is there an equivalent to wp_reset_query for wp ecommerce? You can see the site at http://standingarmed.com/products-page You can see the loop here since it didn't format properly on the page. As you can see I set a variable to grab the fir...
You can use (according to docu over @wp-ecommerce) <code> global $wpsc_query; </code> to modify your query. Resetting the loop can be done with <code> wpsc_rewind_products(); </code> right before the second call to <code> while (wpsc_have_products()) : wpsc_the_product(); </code> For the final solution, pls read the co...
wp_reset_query equivalent for WP Ecommerce
wordpress
I've heard that Dreamweaver has been improved significantly in latest versions. Does anyone have experience in developing a theme or plugin using Dreamweaver? What are the pros/cons? Thanks in advance
I guess the only real cons are it offers nothing that you cannot get with other editors, but without the massive bloat and pricetag. An IDE comes down to a lot of personal preferences and feel, since you have a lot of choice, some people swear by Notepad++, TextMate, or Gedit, others prefer something with more PHP feat...
Is Dreamweaver CS5 a serious choice for theme/plugin development?
wordpress
does anyone know if there's a jQuery-navigation plugin with accordion animation which can be auto-applied to the wordpress default navigation? it should also support marking the current item (+ also its parent) - any ideas? thanks
Try using DropDown Menu. It worked perfectly for me. Good luck! :)
looking for navigation plugin (accordion)
wordpress
Why doesnt this work ? I am trying to selectively load scripts but the second if statement is not loading them where it should. <code> function my_init() { if (!is_admin()) { wp_deregister_script('jquery'); wp_register_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js', false, '1.5'); w...
I suspect you're doing this too early. The loop isn't setup yet when <code> init </code> is run, so you need to hook it somewhere else. <code> wp_print_scripts </code> and <code> wp_print_styles </code> or <code> get_header </code> are always nice choices. ;-)
Conditional statement not working in function
wordpress
I just updated a plugin that needed to be updated. The issue is they added support for OAuth, the problem this plugin and another are using the same OAuth classes. Is there a easy way to fix this? I've never messed with OAuth or classes in PHP, I'm not a programmer. Error: <code> PHP Fatal error: Cannot redeclare class...
Your code probably looks like this: <code> class OAuthSignatureMethod_HMAC_SHA1 { ... } </code> It should look like this: <code> if( ! class_exists( 'OAuthSignatureMethod_HMAC_SHA1' ) ) : class OAuthSignatureMethod_HMAC_SHA1 { ... } endif; </code> This is more a PHP issue than a WordPress issue, but if multiple plug-in...
Multiple plugins using the same OAuth class issues
wordpress
If I wanted to get a custom field of the current user I would use something like this. <code> &lt;?php echo get_user_meta($user_info-&gt;ID,'address_line_2',true);? </code> > This time however I want the author so I tried multiple version of the following to no avail. <code> &lt;?php $thisauthorID = get_the_author_ID()...
<code> get_the_author_meta() </code> != <code> get_user_meta() </code> . Change to: <code> echo get_the_author_meta('address', $thisauthorID); </code>
Author custom fields post meta, the code?
wordpress
I've upgraded to version 3.0. My site is wordswithfriends.net My administration panel looks like the following I thought there was supposed to be a special YouTube button which I don't seem to have. Adding media asks for URL + text and I just get a link not embedding.
According to the docs: http://codex.wordpress.org/Embeds as long as you have "Auto-embeds" checked in Administration > Settings > Media SubPanel you can paste in the youtube url and if it's on its own line the video should be embedded. Alternatively you can wrap it in the embed short code e.g. <code> [embed width="123"...
How do I embed a YouTube video in WordPress 3.0?
wordpress
Is there any way I can use <code> is_single() </code> inside of my plugin's functions.php file? Currently, this is what my code looks like: <code> if(is_single()) : function my_template() { include(PLUGINDIR . '/supersqueeze/all.php'); exit; } add_action('template_redirect', 'my_template'); endif; </code> But for some ...
The problem with your code is that you're checking is_single() when your plugin is first loaded, before the global query has run, so is_single() still returns false. You should move the is_single() check within your my_template function: <code> function my_template() { if(is_single() &amp;&amp; have_posts() &amp;&amp; ...
template_redirect for single posts w/ custom fields
wordpress
I'm working on a custom theme that is based off of Starkers html5 3.0 and use that theme's comment system. I have followed custom_form tutorials by Otto , Soapbox Dave , forlogos , and Deluxe Blog Tips . All of my code seems to be functioning properly except that I cannot get any of the fields outside of comment_form_d...
This code makes no sense: <code> function my_fields($fields) { $fields['new'] = '&lt;p&gt;red rover 1&lt;/p&gt;'; return $fields; } add_filter('comment_form_top','my_fields'); </code> I'm not even sure what it's supposed to do, because comment_form_top is an action, not a filter. If you want to add extra fields, you sh...
Why could my comment_form variable not be working?
wordpress
Is there a function to replace the active theme's stylesheet with a different one (not just adding a new one, but actually replacing the current one)? I'm developing a plugin, and using shortcodes (eg: [design style="dark"]) and I want this shortcode to remove the current stylesheet and apply a new one, along with new ...
Main stylesheet of theme is surprisingly rigid concept. It is usually semi-hardcoded in <code> header.php </code> before any meaningful hooks and is very hard to change by code and reliably. Since your context is actually wider and includes markup as well, you are better of hijacking template entirely, see <code> templ...
Using a Shortcode to Replace Themes Stylesheet?
wordpress
How would one go about allowing reader-submitted reviews of different custom-post-types? For example, if I had a site with a custom-post-type Restaurant and custom-post-type Accommodation. The review structure for each would basically be the same (name, email, comment and rating), and just the star-rating would be styl...
Yup, customizing comments should do the trick for you. No need to reinvent the wheel and you can take advantage of many plugins that take the comments functionality a few steps further. You can use some plugin to add the rating functionality ( GD star rating seems to be the most used one) or use comments meta fields to...
User-submitted reviews of different custom post types
wordpress
( Moderators Note: Original title was "custom template / wordpress functions?") I'd like to use a modified WordPress theme template and was wondering where I can find a reference for the .PHP functions that can be used within theme templates?
You can find an extensive function reference on the codex here. http://codex.wordpress.org/Function_Reference And there's also the WordPress PHP Doc which can be found here. http://phpdoc.wordpress.org Anything in particular you were looking for?
Function Reference Documenting Template Tags for use in Custom Theme Templates?
wordpress
I have a custom-post type with the standard meta boxes and some custom fields. How could I edit a post through a form in the frontend?
If you want to edit an existing post, try my Front-end Editor plugin. If you want to create new posts, try one of these: http://wordpress.org/extend/plugins/sidebar-post/ http://wordpress.org/extend/plugins/tdo-mini-forms/ http://www.deliciousdays.com/cforms-plugin/ http://wordpress.org/extend/plugins/posthaste
Front end post editing using a form
wordpress
I've added some code to my templates which automatically adds custom fields to cache some data that each post pulls in. Is there a way that I can track how many posts have had this custom field set?
You could run a custom query to count the amount of posts with a given key using <code> $wpdb </code> or more specifically using <code> get_var() </code> . If i assume you want to count published posts with a given key, then something like the folowing should do it..(though this is just an example). <code> function get...
Count how many posts have a custom field set
wordpress
I am trying to create a totally different profile page (not the one provided by Wordpress), since the layout and feel of the default profile page is too "Wordpress" for the users. Now I am successful in being able to present a page that can modify user meta data like firstname, lastname, city, zip code, etc. Now what s...
<code> wp_set_password( $password, $user_id ); </code> See reference for details.
How to change a user's password programatically
wordpress
The script below is taken from a plugin that converts all textareas in the category and tags editors to rich text editors. I'm using it to convert the category "Description" textarea input box to rich text. However, I have another text area on this same edit screen (one that I've added as a custom field) that I don't w...
Currently you're telling it to target all textareas on the page so you need to change <code> $init['mode'] = 'textareas'; </code> to <code> $init['mode'] = 'specific_textareas' </code> or <code> $init['mode'] = 'exact' </code> and then name the textarea by id where you have <code> $init['elements'] = 'category_descript...
How to un-attach rich text editor from named textarea elements
wordpress
I've got a client site which uses SSL for only a small chunk of pages where users purchase subscriptions. So, for those pages, we just make sure that any links into them have hrefs with https://etc and everything's fine. The problem is that once they're finished with the purchase and exit those pages using any links ma...
The WP HTTPS plugin will be your friend.
Is there a way to tell menu items to force non-SSL URLs?
wordpress
I saw some other similar threads but they were all for YouTube videos. I was wondering if the same could be done for videos hosted on other servers like blip. Here is an example of a blip video: http://blip.tv/file/4778330 This is how I currently have things set up: I have a custom post type for Videos with a meta box ...
You can use the Blip TV API: http://wiki.blip.tv/index.php/Blip.tv_API Look for "How do I find the thumbnail for an item?" Examples of the API can be found in the wiki e.g. the PHP Example: <code> include_once("blipPHP.php"); $blipPHP = new blipPHP("username", "password"); $respond = $blipPHP-&gt;info(4794325); </code>...
Getting a thumbnail for an external video as the thumbnail for a custom post type?
wordpress
I built my first plugin and after a bumpy start got my plugin downloadable from the WordPress. On my plugin's stats page it version 1.2.0 is the only active version in the pie chart. See: http://wordpress.org/extend/plugins/content-types-wordpress-plugin/stats Why is that?
stackexchange-url ("I'm having the same problem"). Take a look at the opening comments of content-types-wordpress-plugin.php, it looks like there are extra line breaks between each line , which may disrupt the parser that pulls out the version number, etc. If you don't see the extra breaks when you develop locally, you...
First Wordpress Plugin - Stat Issues
wordpress
Could someone please explain to me how this function works? I know what it does but when I look at the source code in the twenty_ten template, I don't get how all loops are being collected in one single loop.php ( I saw that file too). So how do for instance abstract away a certain common part of template and then reus...
Some very good introductory answers here. Basically, <code> get_template_part() </code> allows theme developers to set up an order of specificity of template files. Think of it similarly to specificity as it applies to CSS selectors. When designing something, you want to start with the bare minimum of specificity, so t...
How to use get_template_part()?
wordpress
Is there a way to give Wordpress the queue functionality that Tumblr has? Tumblr's queue, for those who don't know, is a way to space posts out without assigning specific post dates. For example, a Tumblr queue might be set to post every four hours between 9am and 5pm. Tumblr would drop the front post in the queue at 9...
The Time Release plugin comes close, but has a fixed update period. The functionality is there, though, and I'd guess the portion of code that does the checking/updating could be hacked to use whatever (still-fixed) frequency you want without too much trouble. EDIT 2.16.12 Found a couple others that come much closer to...
Wordpress Queue like Tumblr?
wordpress
I got the problem that i have to load my parent theme's <code> functions.php </code> file before my child theme's <code> functions.php </code> file loads. This is needed for the setup &amp; init procedure. I looked at the hooks inside /wp_core_root/wp-settings.php (named: <code> do_action('setup_theme'); </code> ). The...
Justin Tadlock recently wrote a great post about making a better functions.php file where (if I remember correctly) he deals with this exact issue. Unfortunately his site is down at the moment so I have to rely on my memory for now. (ouch it hurts.) You are on the right track with <code> after_setup_theme </code> hook....
How to load parent_theme functions.php before child_theme?
wordpress
Title sounds counter-intuitive but bear with me. :) I have options page, made with Settings API. When user enters invalid data I want to display error notice with <code> add_settings_error() </code> call. But! To determine that data is invalid I need to make an remote API call. That call relies on saved data. So I can'...
Ok, I think I have an idea what is going on. The list of notices to display is retrieved by <code> get_settings_errors() </code> ( source ). This function reads notices from global <code> $wp_settings_errors </code> unless there is <code> settings_errors </code> transient set, which trumps global var. When settings are...
How to display admin error notice if settings saved succesfully?
wordpress
I currently have a search box in my sites header, (on every page), which sends the search query to a page called 'Search', which uses a template called <code> searchpage </code> . The page/template uses Google custom search to display the results. Now this all works great, but I would like to use the built-in WordPress...
The standard search results can also be formatted with a theme file, by default <code> search.php </code> . You don't need to create a "fake" page for that. If you don't include any content from the page, and only use the theme file, you can just rename <code> searchpage.php </code> to <code> search.php </code> and it ...
Combine internal search with Google custom search?
wordpress
I'm looking to add some scripts and styles to particular taxonomy page. For example, I want to have a banner rotator only appear for posts that fall under the "issue" custom taxonomy. I've tried using the is_tax('issue') to control when the scripts and styles are enqueued but that doesn't seem to be working. Here's a s...
For a function that enqueues scripts, the action hook you use should actually be "wp_enqueue_scripts" for the front of the site, and "admin_enqueue_scripts" for the admin side of things. This is the proper time to enqueue scripts. While you can technically do it anytime before wp_head, this is the best place because it...
Custom Taxonomy-specific JavaScript
wordpress
I've found that my attachment templates are inheriting the enqueued scripts for single posts. My first instinct was to unenqueue these scripts one-by-one or to do an <code> is_attachment() </code> check before enqueueing them at all. It strikes me that a more robust way to do this might be to simply be to remove any an...
I haven't tried it, but this might do it: <code> global $wp_scripts; if (is_a($wp_scripts, 'WP_Scripts')) { $wp_scripts-&gt;queue = array(); } </code> Basically just resetting the scripts queue to blank. Should work, I think. You'd want this right at the top of your attachment template, probably. From an optimization p...
What's a good way to unenqueue all scripts for a single template page?
wordpress
I want script will add new rules to current <code> .htaccess </code> and user no need to ftp or edit it manually. Example, I use timthumb for resize image on my theme and want rewrite the URL and current <code> .htaccess </code> will be something like this. <code> &lt;IfModule mod_rewrite.c&gt; RewriteEngine On Rewrite...
You can add extra rules right after the <code> ^index\.php$ </code> line via the <code> WP_Rewrite </code> class, more specifically the <code> add_external_rule() </code> method. They are added to the <code> non_rewrite_rules </code> array, which is written in the <code> mod_rewrite_rules() </code> method . This is a v...
How to override .htaccess with new rules without ftp or edit it manual
wordpress
as the title states, I am trying to remove the <code> &lt;li&gt;&lt;/li&gt; </code> tags from the list that gets generated with <code> wp_list_pages() </code> . My thinking is to somehow run a for/foreach loop through the menu items and remove the <code> &lt;li&gt;&lt;/li&gt; </code> tags using <code> str_replace() </c...
You could try to remove them, but maybe it's easier to not generate them in the first place. The page list is displayed by a Walker . This is a class that "walks" over all the items in the tree, and displays them. <code> wp_list_pages() </code> by default (via <code> walk_page_tree() </code> ) uses the <code> Walker_Pa...
removing tags from wp_list_pages() using PHP
wordpress
I know this question is asked many times on stack-exchange, but I am with something new I want to have three Drop Down Boxes and a search button, the drop-down boxes will contain terms of 3 custom taxonomies, when I will select three values in it and hit search, I will get results which will be having these three terms...
Wordpress in version prior to 3.1 does not support querying multiple taxonomies, you will need to install Scribu's plugin Query Multiple Taxonomies to fix that. and in order to get the dropdown select box you can use <code> wp_dropdown_categories() </code> like this: <code> $args = array( 'taxonomy' =&gt; 'location', '...
Multiple Drop-Down custom taxonomies search
wordpress
Do I do this exactly the same way as I would with normal posts? I use a $featured_cat global variable and pull that out. Should I do the same here? Or should I use an associated custom taxonomy? Or perhaps I am over-thinking it? Would there really be a benefit with taxonomies? What's the right approach here, guys?
Register a video post type and a "Featured Taxonomy" "Featured Custom Meta Select Box The Post type: <code> function c3m_reg_vid_post() { $labels = array( 'name' =&gt; _x('Videos', 'post type general name'), 'singular_name' =&gt; _x('Video', 'post type singular name'), 'add_new' =&gt; _x('Add New', 'video'), 'add_new_i...
How do I create a featured post within a custom post type?
wordpress
I was wondering if it is possible to have the wordpress search results displayed on a different page? At the moment they are displayed on <code> http://www.mysite.com/?s=searchterm </code> but I would like them displayed on my search-results template page, so <code> http://www.mysite.com/search/?s=searchterm </code> . ...
You created a page with the slug <code> search </code> to "capture" that URL, but WordPress by default already uses that URL for search results. So you were "lucky" that this worked for you, and this is the reason stackexchange-url ("the redirect supermethod mentioned") will work. So, instead of creating a "fake" page ...
How can i move search results onto a specific page?
wordpress
I just imported my posts from blogger into wordpress. In doing this, the tags were converted to categories for some strange reason. I am now trying to convert them back into tag using wordpress' built in converter. However, whenever I click on the "Category to tag converter" link, it directs me to the import page "/imp...
It's not actually included with WordPress, you'll need to download it. Plugin can be found here. http://wordpress.org/extend/plugins/wpcat2tag-importer/ Once that's activated you'll be able to reach the importer at. yoursite.com/wp-admin/import.php?import=wpcat2tag Hope that helps.
Wordpress “Categories to tags converter” not working. Pointing to import.php instead
wordpress
Every time I export a database using the Export Tool in wp-admin. There are two things left out: The category 'checked' (I have to do that all over again every time I export the posts). Also I can't download the pictures because I usually work in my localhost. How to export absolutely everything (100%) from the databas...
Hi @janoChen To export everything in the database, go to your hosting provider's control panel such as CPanel and find out how to do "an SQL dump" . An SQL dump is a text file containing the SQL script to rebuild your database on your local computer. You can often do that in software your host may provide named phpMyAd...
Is there an easy way of exporting posts with their category already asigned and pictures from localhost?
wordpress
I have a pulldown menu in a custom write box that classification numbers. How can I populate a select box on the front end that will: a) be populated with all the possible values defined in the functions script b) have the value chosen in wp-admin be selected on page load in the pulldown menu? This question piggybacks ...
Still not sure what exactly what you aiming for, but having come back to this question i wanted to at least try to offer a solution. So try this out, and see if that's the kind of thing you had in mind with the dropdown... ? <code> add_action( 'add_meta_boxes', 'add_inventory_metaboxes' ); function add_inventory_metabo...
How to make a pulldown menu display custom meta terms in a theme?
wordpress
I'd like to hide certain menus like Media, Privacy, and Permalinks. I've been using the following code to hide entire parent menus but not sure how to go about for submenus. <code> function remove_menus () { global $menu; $restricted = array(__('Links'), __('Comments'), __('Appearance'), __('Tools')); end ($menu); whil...
If you would like to code it yourself, here is a good tutorial for customizing the Admin Menu. http://sixrevisions.com/wordpress/how-to-customize-the-wordpress-admin-area/ Copying from the tutorial, they remove the Editor sublink: <code> function remove_editor_menu() { remove_action('admin_menu', '_add_themes_utility_l...
How can I hide certain submenus of the Settings tab in the dashboard?
wordpress
Ok, I'm developing my own widget and I've a HUGE problem. I don't know how to fetch and eventually save html selects value. Simple example: <code> /* initialize TITLE */ function widget( $args, $instance ) { extract( $args ); $title = apply_filters('widget_title', $instance['title'] ); (...) /* update code for TITLE */...
See my comment above...you're using <code> get_field_id() </code> on the name-attribute, where it should be <code> get_field_name() </code> . <code> get_field_id() </code> returns <code> 'widget-'.$this-&gt;id_base.'-'.$this-&gt;number.'-'.$field_name </code> , whereas <code> get_field_name() </code> returns <code> 'wi...
Wordpress select dropdown list in widget
wordpress
right now, a thumbnail will be either 150px in height or in width, depending if it's landscape or portrait. Is there a way to make them always the same width and scale them in height accordingly, without squaring them? Kind regards
Use <code> add_image_size() </code> in your <code> functions.php </code> : <code> add_image_size( 'post-icon', 150); </code> ...and then use this in your template: <code> &lt;?php the_post_thumbnail('post-icon'); ?&gt; </code>
How to create thumbnails with a fixed width, so all of them will have the same width?
wordpress
I'm calling the function below after each "save changes" on my plugin's settings file via the sanitization callback. The plugin allows the end user to change their category base, and needs to completely rewrite the permalinks in order to avoid 404 errors. However, I'm still getting 404s. The only way I can resolve them...
Check the code in wp-admin/options-permalink.php lines 91 to 129 (3.0.5). Compare if you do all that.
404 errors after plugin options update and category base change
wordpress
How can I create a homepage like Wordpress.com. I am currently using wordpress MS and would like to display the latest posts across the network on the homepage. How is this possible?
This theme sort of does the same thing http://wordpress.org/extend/themes/goodtheme-lead
Create a homepage like Wordpress.com?
wordpress
When I create a custom taxonomy, what template file is being used to display the page? How might I create a custom listing page for my custom taxonomy. eg. I have a custom taxonomy skills. In it are values like: PHP, MySQL, HTML/CSS/JS ... When users goto say <code> /skills/php </code> they will see all posts containin...
It really depends on your theme. Term archive views are governed by the rules of template hierarchy which means that more than one template may display these archives. For your project, I would suggest that you create a new template file called "taxonomy-skills.php". This file will get use only for archives of skills e...
What template is used for a custom taxonomy page?
wordpress
I see that theres no way to get a formatted date from a function like <code> echo get_the_date($post-&gt;ID, 'd M Y'); </code> <code> get_the_date </code> only works with the current <code> $post </code> . If I used <code> get_posts() </code> how can I format the date. With pure PHP I can do something like ... <code> e...
<code> echo date('Y-m-d h:i:s', strtotime($cp-&gt;post_date)); </code> ... or better use the wordpress functionado <code> echo mysql2date('Y-m-d h:i:s', $cp-&gt;post_date); </code>
Whats the way to format a date after using get_posts()
wordpress
I'm currently using the following bit of code to display related posts on my single template. <code> &lt;?php $orig_post = $post; global $post; $tags = wp_get_post_tags($post-&gt;ID); if ($tags) { $tag_ids = array(); foreach($tags as $individual_tag) $tag_ids[] = $individual_tag-&gt;term_id; $args=array( 'tag__in' =&gt...
Something exactly like <code> 'post_type' =&gt; 'videos' </code> somewhere in your <code> $args </code> array :)
related posts - pulling tags from a specific post type
wordpress
I'm trying to create a custom API endpoint in WordPress, and I need to redirect requests to a virtual page in the root of WordPress to an actual page that ships with my plug-in. So basically, all requests to the one page are actually routed to the other. Example: <code> http://mysite.com/my-api.php </code> => <code> ht...
There are two types of rewrite rules in WordPress: internal rules (stored in the database and parsed by WP::parse_request() ), and external rules (stored in <code> .htaccess </code> and parsed by Apache). You can choose either way, depending on how much of WordPress you need in your called file. External Rules: The ext...
How do you create a "virtual" page in WordPress
wordpress
How can I get all children posts regardless of parent. If you require more info: The setup I have is like this: I have a custom post type "Project". I will create top level pages as the "main" project page. Then I will have children pages as something like a project blog. Mainly for WIP posts. I will have a Portfolio p...
Couple of possible ways. Use <code> get_pages() </code> with <code> parent =&gt; 0 </code> to fetch top-level ones and put them as <code> post__not_in </code> in query. Filter <code> posts_where </code> to add <code> AND post_parent &gt; 0 </code> when necessary.
How can I query for all children posts regardless of parent
wordpress
After creating a custom post type like below, I still dont get any option to set the parent of the post, am I missing something? <code> register_post_type( 'projects', array( 'labels' =&gt; array( 'name' =&gt; 'Projects', 'singular_name' =&gt; 'Project' ), 'public' =&gt; true, 'capability_type' =&gt; 'post', 'supports'...
Try adding 'page-attributes' to the supports flags: <code> 'supports' =&gt; array(..., 'page-attributes') </code> .
After creating hierarchical post type, still not getting any way to set parent
wordpress
WordPress v 3.0.4 multisite-network enabled, local installation w MAMP 1.9.4, PHP 5.3.2, Theme: Twentyten child TWO PROBLEMS: 1) Display of header image thumbnails in admin panel and 2) path to favicon.ico for child theme (used for main site at root) - both defined in the functions.php file inside child theme folder. C...
After removing the .DS_Store file from the images/headers folder, the Header admin panel is displaying the header image thumbnails perfectly! And yes, it is important to remove .DS_Store files before migrating the site to live server, or they will hitch a free ride and end up on the server. So Mac users, pay attention....
Twentyten Child Theme: header images display messed up in admin panel
wordpress
Hello there, I would like to add a front menu button (viz. Home, About, Archive etc.) to my blog that links to another website. WordPress only shows the pages that I have created using dashboard in the front menu. I hope my question is clear. Let's assume I have a Yoga blog and a Yoga store at another website. I'd like...
Lightword theme as wp_nav_menu enabled so you can create your menu from the Appearance → Menus panel where you have Custom Links and that is just what you are looking for. you can read more on how to use WordPress Menus panel Hope this helps
How do I add a front menu button that redirects to another website or sub-domain?
wordpress
Problem: Add a hook that automatically adds a short tag to video attachments when inserted from the Media Library (video) tab: Update: This works under the 'Media Library' tab — and doesn't break image inserts etc.: <code> add_filter('media_send_to_editor', 'my_filter_iste', 20, 3); function my_filter_iste($html, $id, ...
There's a <code> get_image_send_to_editor() </code> function in wp-admin/includes/media.php that runs this: <code> apply_filters( 'image_send_to_editor', $html, $id, $caption, $title, $align, $url, $size, $alt ); </code> . Try hooking that filter. Edit: Help with the filter call... Your call to hook the callback would ...
Add new "Insert Into Post" button with another function
wordpress
I am working on creating an administration menu within WordPress for a plugin. I have successfully registered the menu using add_menu_page() and it shows in the sidebar as expected. I have also added a couple of sections within the menu using add_submenu_page(). It appears that WordPress (running 3.05) is not correctly...
Try this: <code> add_menu_page(__('My Plugin', 'myplugin'),__('My Plugin', 'myplugin'), 'edit_posts','my-plugin-dashboard','my_plugin_dashboard','icon'); // dashboard submenu - this fails to highlight with current add_submenu_page('my-plugin-dashboard', __('Dashboard','myplugin'), __('Dashboard','myplugin'), 'edit_post...
Current class on admin menu using add_submenu_page()
wordpress
I am not sure why but I have used <code> get_posts() </code> to query for some data. Then I used <code> setup_postdata() </code> ... I think its used so that I can use functions like <code> the_permalink() </code> etc with the new post data? <code> &lt;?php foreach ($childPosts as $cp) : setup_postdata($cp); ?&gt; &lt;...
I could be wrong, but from what I'm seeing, "setup_postdata()" should be used when doing a custom select query (not just query_posts): http://codex.wordpress.org/Displaying_Posts_Using_a_Custom_Select_Query As well, if you want to use tags like "the_title()" and "the_permalink()" with that custom select query ... you'l...
setup_postdata() does not seem to be working?
wordpress
So I created a custom post type like <code> add_action('init', 'create_post_type'); function create_post_type() { register_post_type( 'portfolio', array( 'labels' =&gt; array( 'name' =&gt; 'Portfolio', 'add_new_item' =&gt; 'Add New Portfolio Item', 'edit_item' =&gt; 'Edit Portfolio Item' ), 'public' =&gt; true, 'capabi...
All that does is reset the rewrite rules. You could do the same by visiting the permalinks page and clicking save. You do need to reset them once but not every time. There is no need to flush every time you call register_post_type
After creating custom post type, URL to custom posts are invalid
wordpress
I have been considering using the <code> the_editor </code> function to create WYSIWYG editors in my own pages. Is using the WordPress's inbuilt WYSIWYG editor in a plugin meant for general distribution advisable? Is it considered a part of the API that we can rely on to not change and break the plugin in future versio...
Yes using the built in editor is the right way to do it. WordPress prizes backwards compatibility so the function should continue to work forever.
Is Using WordPress Supplied WYSIWYG Advisable?
wordpress
I have created a fairly unexciting custom type (Event) and an equally vanilla custom taxonomy (Venue). Whenever a user creates an Event, I want them to be required to either create a new Venue or select an existing Venue. How can I make this a required field when publishing? It seems like the sort of thing that should ...
You can hook an 'init' action callback in which you get the post-type and if it's 'event' check $_POST for if your taxonomy value is empty. If it's empty, you can then reset $_POST['action'] to 'edit', so that post.php simply reloads the editor. And you can inject $_GET['message'] = 11 and add your (11th) response mess...
Require Custom Taxonomy for Custom Type
wordpress
I have this dilemma whereby I'd like FB-Connect or a similar tool to automatically push custom data found in Custom Post Types to Facebook. Here's an example (it only works because it's a manual workaround). The final result is/should be this: I can achieve that by placing this in the header: <code> if (is_singular('ad...
If anyone else is interested, this is how I solved it: I created a custom feed as a page template. As RSS 2.0 doesn't support images for each entry/item, I created an Atom feed instead; all that contains is the image and the text as I have it formatted in my question above. Then I use the facebook app RSS Graffiti to a...
How would you feed Custom Post Types to Facebook?
wordpress
Can I have custom taxonomies but with icons associated with them? Example: I want a list of skills I used for my portfolio item (eg. PHP, MySQL, CSS etc). Instead of text, I thought of displaying icons. So I needto somehow set icons for my taxonomies. How might I do it? Is it very complex? How might it look or whats it...
I'd suggest the Taxonomy Images Plugin . It says it's in Beta but I've used it on a few sites already and it works great.
Custom Taxonomies but with Icons associated?
wordpress
I am aware of creating a shortcode this way: <code> function font_fam($atts, $content = null){ extract(shortcode_atts(array( 'f' =&gt; '', ), $atts )); return '&lt;span style="font-family:'.$f.'"&gt;'.$content.'&lt;/span&gt;'; } add_shortcode ('f','font_fam'); </code> And to use it would be like this right: <code> [f f...
Try this: <code> function font_fam($atts, $content = null) { extract(shortcode_atts(array( 'f' =&gt; isset($atts[0]) ? $atts[0] : '' , ), $atts)); return '&lt;span style="font-family:' . $f . '"&gt;' . $content . '&lt;/span&gt;'; } add_shortcode ('f','font_fam'); </code>
Shortcode But Without The Equals Sign?
wordpress
Hei, i've been developing a few plugins over the last few weeks that i want to share, soon, such as: a 'helper'-plugin, that eases the creation of standard option pages a photo contest manager a subcription signup manager (a rewrite of 'user role subscriptions' by Byrd) a basic affiliate ad campain manager with referra...
The plugins have to be licensed under the GPL and no, you don't have to set up your own site for them. More info here: http://wordpress.org/extend/plugins/about/
Plugin Repostitory Questions
wordpress
I just integrated High Slide to my wordpress site, which I found over here http://highslide.com/editor/ I am displaying a form in this high slide window, but the problem is, I have youtube video on my every post and it is overlapping the form and the window, Check this image I dont want this overlapping, and also when ...
The problem you have is not with highslide, but rather with your youtube embed. You need to add <code> &lt;param name="wmode" value="transparent"&gt; </code> to the object tag and <code> wmode="transparent" </code> to the embed tag. If you're using the iframe version I think it's <code> allowtransparency="true" </code>...
highslide is overlapped
wordpress
I am signing up to add a widget to wordpress.org here: http://wordpress.org/extend/plugins/add/ What do I put for the field "Plugin URL"? Would that URL be the svn repository I am currently hosting my widget (a personal svn repo) or would that be a URL of a website where the widget is being used?
When adding a plugin to WordPress.org plugin repository you need to host the plugin somewhere (anywhere) and that is the "Plugin URL" so the good guys at WordPress could download it, test it and approve it to be listed. so just upload it to your host and enter the url to the zip file. Once it gets approved you will get...
Adding a Widget : what to put in plugin URL
wordpress
Pretty much what the question says. I used simple fields, but I'm unsure in WP how to get the information back to display on a page?
EAMann helped me and I was able to get the meta data from clicking on "show custom field keys" and using get_post_meta();
When using Simple Fields plugin, how do I pull the information out of the database to display on a page?
wordpress
How to alter the default widget to display a tag cloud of a custom taxonomy?
Don't know of any but you can easily create your own: <code> &lt;?php add_action("widgets_init", array('Widget_Custom_tax_tag_cloud', 'register')); class Widget_Custom_tax_tag_cloud { function control(){ echo 'No control panel'; } function widget($args){ echo $args['before_widget']; echo $args['before_title'] . 'Your w...
Widget to display custom taxonomy tag cloud
wordpress
I'm trying to display different content depending on the taxonomy that was been selected. For example I have a taxonomy named Type. Inside that taxonomy I have several different children, one is "Photography." I'd like the single of a "Photography" to have a full width instead of it having a sidebar. You can do this in...
Try <code> function has_type( $type, $_post = null ) { if ( empty( $type) ) return false; if ( $_post ) $_post = get_post( $_post ); else $_post =&amp; $GLOBALS['post']; if ( !$_post ) return false; $r = is_object_in_term( $_post-&gt;ID, 'type', $type); if ( is_wp_error( $r ) ) return false; return $r; } </code> Usage:...
Function like in_category for custom taxonomies
wordpress
Every time I insert an image into my post, the default link is to the image attachment page. How can I change it so it always links to the File address?
Answered a similar question on the .org forums very recently . To sum it up though.. Go to http://example.com/wp-admin/options.php (replace <code> example.com </code> with your website address) Scroll down the page until you see <code> image_default_link_type </code> Set that option to either <code> file </code> , <cod...
Link to File URL by default
wordpress
I would like to create a shortcode that will extract information for a custom post, and display it within a Page or regular Post. Specific use case: I have a custom post type "Film" for a film festival website. The films are displayed with their own single-film.php, but occasionally the site owners want to write a post...
There are great tutorials about shortcodes all over the web and some good examples stackexchange-url ("here") but just to get you started: <code> add_shortcode('film_q', 'film_shortcode_query'); function film_shortcode_query($atts, $content){ extract(shortcode_atts(array( // a few default values 'posts_per_page' =&gt; ...
How would I create a shortcode to display a custom post within a page or regular post?
wordpress
I'm using a metabox script that works great for having absolute control over the design and placement of the metabox fields. There is one problem: I can't remember where I found the script and need to add a select box. This script does not use arrays as most metabox scripts do. What function can I use to sucessfully ad...
Basically you need to add the html of the select dropdown at your <code> function inventory_information() </code> which is the function that actually displays the metabox: <code> // The Event Location Metabox function inventory_information() { global $post; // Noncename needed to verify where the data originated echo '...
How to add a select menu to this metabox code?
wordpress
How can I edit a user profile in the front end with a form? first name, last name, username, email address and password
You can do that by copy your theme's page.php to a new file named something like user-profile.php and add to the very top of it this code: <code> &lt;?php /** * Template Name: User Profile * * Allow users to update their profiles from Frontend. * */ /* Get user info. */ global $current_user, $wp_roles; get_currentuseri...
How to edit a user profile on the front end?
wordpress
The Settings API is a convenient way to add administrative options. Tutorials on the settings API hook register_setting to admin_init. But what if you also want to programmatically change the same options outside of the Settings API? For example, use the Settings API to maintain a base value for option X. In addition, ...
Now i've thought about it(Mark is me, i use another account when i'm at other locations) all registering a setting does is prepare options.php to accept your incoming form data when a valid nonce is present and also provides a means to hook a sanitization method to the submission of that data. It's really a convenience...
Where to hook register_settings for Settings API when also want to update options outside of Settings API?
wordpress
I'm trying to create a filter using two meta_values. Example. If the current page has meta values red and blue, only display queried pages that have both red and blue and none that have just red or just blue. I thought this could be accomplished with two meta values <code> 'meta_value' =&gt; $red, $blue </code> but app...
'meta_query' is what you're looking for: http://scribu.net/wordpress/advanced-metadata-queries.html
Filtering multiple meta_values
wordpress
Sorry the question might not make sense. I basically have a custom post type called "Projects" and I need to create a way to filter attributes of the project like "name", "type", etc. For example if I have a project type called airplane, and another project type called airplane. I would want to be able to search for al...
This is how I did it. If you have your custom post type as "projects", and your category as "airplane". If you're not planning on using the pre-build loop you would make another one called loop-projects.php. However, it's not necessary. <code> &lt;?php $args = array( 'numberposts' =&gt; 5, 'post_type' =&gt; 'projects',...
How do I create filters for custom post types?
wordpress
I never used custom fields so I got a bit exited. I'm not sure if I'm overusing them: (I'm using them to display the title of images and images themselves. (big and small ones). I used to do it with custom post types but it didn't make sense since those images belong only to that single posts. Any suggestions?
With the limited view we can see of how you're using the custom fields, I don't think you're over-using them. However, I would try to clean things up a bit. "Featured Image" and "Featured Title" obviously are related to the same image. So are "Main Left Image" and "Main Left Title." Rather than using public custom fiel...
Am I overusing custom fields (for adding nearly 5 images and their titles)?
wordpress
This is from the codex: <code> &lt;?php if ( get_post_meta($post-&gt;ID, 'thumb', true) ) : ?&gt; &lt;a href="&lt;?php the_permalink() ?&gt;" rel="bookmark"&gt; &lt;img class="thumb" src="&lt;?php echo get_post_meta($post-&gt;ID, 'thumb', true) ?&gt;" alt="&lt;?php the_title(); ?&gt;" /&gt; &lt;/a&gt; &lt;?php endif; ?...
<code> &lt;?php if ( $mainbar_left_title &amp;&amp; $mainbar_left_image ) : ?&gt; </code> See http://www.php.net/manual/en/language.operators.logical.php
How would an if statement surrounding a custom field with two variables (holding values) look like?
wordpress
To use jQuery UI accordion, I need markup like <code> &lt;h3&gt;Module 1&lt;/h3&gt; &lt;div&gt; &lt;!-- module content here --&gt; &lt;/div&gt; &lt;h3&gt;Module 2&lt;/h3&gt; &lt;div&gt; &lt;!-- module content here --&gt; &lt;/div&gt; ... </code> How can I setup my side bar like that? Or perhaps I somehow change the way...
When you register your sidebar, you can change how it handles those things with the <code> before_title </code> , <code> after_title </code> , <code> before_widget </code> , and <code> after_widget </code> arguments. For example: <code> register_sidebar(array( 'before_widget' =&gt; '', 'before_title' =&gt; '&lt;h3&gt;'...
How to setup sidebar modules to use jQuery Accordian
wordpress
I have recently moved server and upgraded my wordpress install to the latest version. Now if I try to access /feed, I get a 404. It used to work. /?feed=atom works correctly. Thanks. UPDATE : I fixed it. Virtual host definition had AllowOverrides turned off, so .htaccess was not being picked up. Thanks all for the comm...
Wordpress writes url rewriting rules to the .htaccess file, but apache will only use the .htaccess file if AllowOverrides is allowed for the directory where the .htaccess is located. I enabled it by setting <code> AllowOverride All </code> in the virtualhost configuration, and my permalinks are now working again.
after server upgrade, if I enable custom permalinks, my /feed stops working
wordpress
I can't find the option to hide the page title. Is there some other plugin required to get this functionality? If you look in this video video you can see the option to set the page title. I don't have this option. I'm not looking for a code solution here, I need something which will allow end users to hide the title.
the videos shows options that come with the headway theme, in order to see them you must use the headway theme. it's not a build in functionality of WordPress, however you can use the_title filter to replace or remove the title for a specific post based on custom fields values like so: <code> function my_title_filter($...
Hide page title in Wordpress 3.0
wordpress
I just upgraded the List Category Posts plugin from .17 to .18.3, and it broke my customised template :(. My setup: WP 3.0.4 multisite network enabled, local installation with MAMP, PHP 5.3.2. LCP plugin installed automatically. Works fine with the default template. However, you've rewritten the code such that the temp...
Thank you for reporting on this issue. Regarding the template system, I once more updated it, thinking the new version is easier to the user. I know it still lacks a big rewrite to make it user-friendly. The underlying code is pretty much set to use any new idea for it. I added some upgrade notices for version 0.17 and...
List Category Posts rewrite necessitates rewrite of customised templates
wordpress