question
stringlengths
0
34.8k
answer
stringlengths
0
28.3k
title
stringlengths
7
150
forum_tag
stringclasses
12 values
i went to upgrade my plugins and it never came back .. now when i go to my blog i get an error stating: <code> The service is unavailable. </code> i tried renaming the "upgrade" folder under wp-content but that didn't seem to do anything. Any suggestions?
This is definitely not error message produced by WordPress, so it comes from server software. Please check server logs (if you have access and skills) and ask your hosting support to look into it. It is hard to make a good guess from this little information.
WordPress crashes with "The service is unavailable." after trying to upgrade plugins
wordpress
For some reason, my posts content (the content placed outside of the shortcodes I have set up) is only displaying below all the shortcodes, no matter where I place content in the post. For example, I could set up a post like this: <code> [boxes cat="Features"] </code> <code> test content here </code> <code> [boxes cat=...
Are your shortcodes setup correctly? This usually means that your shortcode handling is echoing the shortcode content instead of returning it as a string. For your case, while you are including a file in your shortcode, I doubt that you have the file setup to return the output instead of echo'ing it. Try this instead: ...
Post Content Displaying Below ALL Shortcodes Content
wordpress
If possible I want to insert the ID of a post(from a custom post type) into the html of the post itself when its loaded in the viewport. The scenario is that the content of the custom post type is surrounded by a <code> &lt;div&gt; </code> . I want to append an 'id' to the <code> &lt;div&gt; </code> that includes the I...
Try: <code> &lt;div id="&lt;?php the_title(); ?&gt;-&lt;?php the_ID(); ?&gt;"&gt; </code> This should give you a result of: <code> &lt;div id="Post Title-PostID"&gt; </code> Giving you a unique wrapper for each post.
Is it possible to read the ID of a post and then insert it into the html of the post?
wordpress
I am attempting to resolve a problem I continue to have with the media library. Essentially, what I am looking to do is "automatically" assign media which is uploaded from a custom post type "edit post" page to a predefined category. Based on other answers on this site I have found various people discussing solution (o...
I think you can go about the filter <code> list_terms_exclusions </code> , but i don`t tested. example: <code> function fb_list_terms_exclusions($args) { if ( 'media-upload-popup' != $where ) return $where; if ( !current_user_can('manage_categories') ) $where = " AND t.slug NOT IN ('uncategorized', 'category-2')"; // s...
How do I modify the "Insert Media" lightbox in the admin to only show media items from a category?
wordpress
I found a plugin called Multiple Post Thumbnails and followed the directions in getting it set up. Everything shows up correctly in the admin dashboard (i.e. shows two sections to upload two separate thumbnails) but after I set the two thumbnails for each post and view the page which displays those posts, only the firs...
Dude, you're doing this the hard way. You can do what you want totally with a single 'featured post thumbnail'. Read the documentation about thumbnail sizes in themes. You can inject custom thumbnail sizes in your themes funcitons.php and then give them as a parameter to the (get_)the_post_thumbnail() function. Please ...
Multiple featured image thumbnails for post types (Multiple Post Thumbnails plugin)
wordpress
I have a widget area on my posts category pages and am wondering if there is a way to dynamically add a link to the first post as well as the current post of the category. I think the first post can be hardcoded since it will never change, but the current one will. I wonder what sort of php madness that can do this? I ...
you can use wp-pagenavi and set the "number of pages to show" to 3 so you will get [first] [6] [ 7 ] [8] [last] now if you just need the names of the post then you could do something like this: <code> global $wp_query; //curent post $thePostID = $wp_query-&gt;post-&gt;ID; $my_query = new WP_Query(array('cat' =&gt; get_...
Post Navigation
wordpress
I have a previously created thread here, but was recommended to make a new one: stackexchange-url ("I need basic help with custom post types.") Basically here's my project: I have to create a back-end wordpress gui user input section. The user will enter details about their projects like name, location, what it is, som...
There are several user access plugins available, including one called Members . The settings panel for the Members plugin is in Settings > > Members Components. From there you can enable what you want. To edit roles you have to enable the Edit Roles component, then go to Users > > Roles. Click on the role you want to e...
create a back-end wordpress content submission using custom post type
wordpress
I'm using the following code I got from the Wordpress codex : <code> &lt;?php // Displaying Child pages of the current page in post format $mypages = get_pages('child_of='.$post-&gt;ID.'&amp;sort_column=post_date&amp;sort_order=desc'); $count = 0; foreach($mypages as $page) { $content = $page-&gt;post_content; if(!$con...
You're not inside a regular loop, or at least not one where global post variables are set, so <code> the_post_thumbnail </code> does not have an ID to fetch a thumbnail for.. Use <code> get_the_post_thumbnai( $page-&gt;ID ) </code> instead and it should work fine.
Displaying Child pages of the current page in post format and their thumbnails (featured image)?
wordpress
I have a custom post type called 'projects' ( pastebin ) and I have a page called Projects set up in my dashboard which is set to display the Projects template. ( pastebin ) The problem is when I use WP_PageNavi to incorporate pagination and click on page 2, I get an error 404. I read somewhere that this is because cus...
As you can see in the rewrite analyzer, <code> /projects/page/2/ </code> sets <code> projects=page&amp;page=/2 </code> instead of <code> pagename=projects&amp;paged=2 </code> as we would like. So you just need to add a rewrite rule for this special case (in the <code> register_projects() </code> function, after you reg...
Custom post type archive with pagination?
wordpress
I am displaying a post gallery inside a custom post type, using the following in my single-custom.php template: <code> &lt;?php echo do_shortcode('[gallery id="'.$post-&gt;ID.'" link="file" columns="5" orderby="menu_order"]'); ?&gt; </code> One of the things included in the output is <code> title="filename" </code> in ...
The <code> [gallery] </code> shortcode is parsed by <code> gallery_shortcode() </code> , which calls <code> wp_get_attachment_link() </code> , which in turns calls <code> wp_get_attachment_image() </code> . This latter function writes the <code> &lt;img&gt; </code> tag with the <code> title </code> attribute. You're lu...
How do I filter title and alt attributes in the gallery shortcode?
wordpress
I would like to manually edit the code my my wordpress pages. The WP interface only allows me to individually edit the CSS or PHP. The Page Edit feature gives me access to a certain part of the code, excluding the Body Tag. Kindly help me locate my files on the server. Thanks for your help! :)
WordPress stores content in the database, there are not any physical files with the content of the pages(or posts). The theme's template files control how to render and display your site, you can find those files in <code> wp-content/themes/YOUR-ACTIVE-THEME-NAME-HERE </code> .. You can find lots of information on them...
In which directory do I find the HTML file of my wordpress pages?
wordpress
I have a wordpress custom theme that started giving a weird error out from the blue. Every time you post a comment it will return a javascript alert with all the content of the page. I haven't made any changes to the theme that would have effect in this so I have no idea why is this happening, I tried removing all the ...
I tried removing all the javascript of the theme, updating the comments related files in the server (the same error happens locally) The problem is a result of this file(you obviously didn't disable that one in testing). http://www.faf.fi/wp-content/themes/faf/scripts/js/functions.js Blocking that script in my browser ...
Comment form in wordpress theme returns a javascript alert
wordpress
I have a friend who has a background in graphic design. She has taken a particular interest to web design. I am a software developer/system administrator, not a web developer, and I'm certainly not a designer; I couldn't design a good-looking site to save my life. However, I am aware of the technologies involved and th...
I thought Build Your Own Wicked Wordpress Themes was really helpful. Note that the book actually uses the Thematic Framework for point of reference and example code. A book that has been fantastic, and therefore I recommend, is called Digging Into WordPress.
Which WordPress books should I recommend to a beginning web designer?
wordpress
I have <code> &lt;?php $folioPosts = get_posts(array('category_name' =&gt; 'portfolio', 'numberposts' =&gt; 3)); if ($folioPosts-&gt;have_posts()) : foreach ($folioPosts as $folioPost) : setup_postdata($folioPost); ?&gt; &lt;article class="col3"&gt; &lt;?php if (has_post_thumbnail()) : ?&gt; &lt;p&gt;&lt;a href="&lt;?p...
get_posts() </code> returns an array, not a <code> WP_Query </code> object. If you want to use <code> have_posts() </code> and related functions, use a "raw" <code> WP_Query </code> object.
Am I using get_posts wrong?
wordpress
I have installed wordpress for my site. I am trying to insert posts using function <code> wp_insert_post() </code> from my self-made script. <code> content of my post contains video-embed code of google. &lt;object width="480" height="385"&gt;&lt;param name="movie" value="http://www.youtube.com/v/-T9omX2XD2s?fs=1&amp;h...
I'm only guessing but it sounds like your insert method is tripping up on one of WordPress's filter functions (e.g. wp_filter_kses ). If you need a more exact answer, please update your question to include some of the code you're using to insert the post content.
want to stop stripping out from my post content
wordpress
My single.php file has the following code: <code> &lt;?php // Set and display custom field $intro_image = get_post_meta($post-&gt;ID, 'Intro Image', true); ?&gt; &lt;div class="block-1"&gt; &lt;img src="&lt;?php echo $intro_image; ?&gt;" alt="" /&gt; &lt;/div&gt; &lt;?php ?&gt; </code> The user will have to type Intro ...
your best option is to create a custom meta box with-in your theme and then the user will have it no matter if he typed it once before. <code> // Hook into WordPress add_action( 'admin_init', 'add_custom_metabox' ); add_action( 'save_post', 'save_custom_intro_image' ); /** * Add meta box */ function add_custom_metabox(...
Making custom field's 'Name' available in the dropdown list by default in a theme?
wordpress
Let's say I have a single.php file with a certain layout (graphic intensive). I want to create a sort of plain-text version of the same page that is only called when the user clicks the provided link. I can create single-plaintxt.php but how would I go about generating a link and/or function that would only load the pa...
you can do it like this: <code> //add my_print to query vars function add_print_query_vars($vars) { // add my_print to the valid list of variables $new_vars = array('my_print'); $vars = $new_vars + $vars; return $vars; } add_filter('query_vars', 'add_print_query_vars'); </code> then add a template redirect based on tha...
Load post with a different template?
wordpress
In the script below, the post__not_in argument does not appear to be working unless I hardcode the post ids inside the array(). Anything stand out? If an item is in the category, but also in the post__not_in, what get's precedent? get_option('sticky_posts') is a single item array with var_dump = array(1) { [0]=> int(6)...
try: <code> $not_in = get_option('sticky_posts'); $not_in[] = $post-&gt;ID; $myposts = get_posts( array('cat' =&gt; "$cat,-$catHidden", 'post__not_in' =&gt; $not_in, 'numberposts' =&gt; 10; ) ); foreach($myposts as $idx=&gt;$post){//do something} </code> hope this helps
What's wrong with this post__not_in argument?
wordpress
I currently have my blog at <code> alexangas.com </code> and would like to move it to <code> www.alexangas.com </code> . Is this as simple as changing the WordPress Address and Site Address in Settings? How can I ensure that users hitting <code> alexangas.com/someblogpost </code> are automatically redirected to <code> ...
Yes. I just did an experiment on my own site to verify that changing those settings will redirect between www and non-www as you specify.
How do I redirect my blog posts to a subdomain?
wordpress
How can i get wordpress posts content by post id?
Simple as it gets <code> $my_postid = 12;//This is page id or post id $content_post = get_post($my_postid); $content = $content_post-&gt;post_content; $content = apply_filters('the_content', $content); $content = str_replace(']]&gt;', ']]&amp;gt;', $content); echo $content; </code>
Get wordpress post content by post id
wordpress
Could somebody help me make a custom page template? I'd like to have a basic page (with sidebars, header and footers) and a table for data. I'd like the data to be taken from custom fields. Something like this: Name: (name key) Location: (location key) etc...
Ok, first step is to create a page template, this is the easy part, and there's no query manipulation needed here, you're not changing the query, simply looking at the page that's already in the query, so that's a simple case of creating a basic loop, like so...(noting that i've placed a special page template comment a...
Custom Page Template
wordpress
get_terms allows me to get all taxonomy values, but how do I limit this to a certain post? I don't see anyway to feed a specific post ID to get_terms: http://codex.wordpress.org/Function_Reference/get_terms Perhaps there is another way to achieve this?
Ahah! I need to use get_the_terms instead, as this will accept a post ID. http://codex.wordpress.org/Function_Reference/get_the_terms
How do I get terms as a list for a specific post?
wordpress
I'm using WPML for multi-language website. It works really well except for custom taxonomies. In admin, I can only join foreign posts to foreign taxonomies (which is exactly what it should do) but on the public area, when retrieving taxonomies it seems that the current language is ignored: I get all taxonomies. Any hel...
I found out that when retrieving the taxonomy you have to do this : <code> $args = array( 'hide_empty' =&gt; true, 'taxonomy' =&gt; 'projet_thematique' ); $thematiques = get_terms('projet_thematique', $args); </code> The thing was done by adding the 'taxonomy' as an argument as well. I hope it will be usefull for other...
WPML taxonomies not translated
wordpress
I need to showing message in post , but after one month from publish date. I try to make it before ask you, but I can't this is my code <code> $publish_date = $post-&gt;post_date_gmt; $today = date('d-m-Y h:i:s'); $nextMonth = mktime(0 , $publish_date('m')+1 , 0 , 0 , 0,0); echo 'Publish Date:'.$publish_date.'&lt;br/&g...
Custom conditional I wrote for my theme (mostly to kick some widgets and ads from newer posts), works nicely: <code> function is_old_post( $days = 14 ) { if( !is_single() ) return false; $id = get_the_ID(); $date = get_post_field( 'post_date', $id ); if( strtotime( $date ) &lt; strtotime( "-{$days} days" ) ) return tru...
I want to print a message in post " After one month from publish date"
wordpress
I am using the wordpress menus on a website, but the problem is that one of the links on that menu is www.homepage.com/#order So, when I am on the homepage, both "home" and "order" links on the menu contain the class current_page_item, which with my css it makes them appear both as the active button. How can I make it ...
a bit hacky, but it works: <code> add_filter('nav_menu_css_class', 'remove_some_menu_classes', 420 ,3); function remove_some_menu_classes($classes, $item, $args){ if(strpos($item-&gt;url, '#order') !== false) // in the 2nd array put the classes you want removed return array_diff($classes, array('current_page_item', 'cu...
Wordpress menu: How to make www.link.com/#name never contain current_page_item class?
wordpress
How can I get the post id from a permalink like "http://localhost/wordpress/animals/cat" in functions.php, I have tried url_to_postid() and get_page_by_path() but none seem to work.
Hi @Tirithen: Have you tried (which assumes your custom post type is <code> 'animal' </code> and not <code> 'animals' </code> ): <code> $post = get_page_by_path('cat',OBJECT,'animal'); </code>
How to get the post id from a permalink?
wordpress
I'm probably missing something unless it's really not possible, for some reason I can't get my function to only execute on the new and edit page of a custom post type (the new not being a problem): I'm currently using: <code> if ((isset($_GET['post_type']) &amp;&amp; $_GET['post_type'] == 'events') || (isset($post_type...
Ok, total revision on my original answer, which just turned into a mess. The issue with your code is that you're firing on init, this covers every admin page, and additionally it's too early to check admin vars to work out the current page(though you could just check <code> $_GET </code> if you really need to run code ...
Selecting New & Edit Page for Custom Post Types
wordpress
I have a wordpress site running on one domain that has the main 'client' domain for the site redirecting to it. I've got my Wordpress Address/Site Address entered correcting in Wordpress, and the .htaccess is formatted properly afaik. Everything else seems to work properly other than this issue. So I have Janrain Engag...
Can you try this fix and see if it resolved your issue?
Janrain/Simple Modal under Redirected Domain
wordpress
<code> $args = array( 'post_type' =&gt; 'attachment', 'numberposts' =&gt; null, 'post_status' =&gt; null, 'post_parent' =&gt; $post-&gt;ID ); $attachments = get_posts($args); if ($attachments) { foreach ($attachments as $attachment) { echo apply_filters('the_title', $attachment-&gt;post_title); the_attachment_link($att...
For the first one, you can add <code> 'exclude' =&gt; get_post_thumbnail_id() </code> as a parameter (as shown here). For the second one, you can add <code> 'post_mime_type' =&gt; 'application/pdf' </code> , but I'm not sure that would always work, afaik, pdfs have more than one mime type.
Get all post attachments except featured image
wordpress
What is the best way to strip *the_content* of html tags and needless spaces on the front end? I'm building a special use theme that needs to allow users who can edit_post to make changes on the front end, but I only want this text area to support plain text. My current code: <code> &lt;?php if ( !current_user_can( 'ed...
You will have to worry about formats beeing over written. Ex. <code> &lt;p&gt;Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. ____Stet clita kasd gubergren...
Best way to strip the_content of html on the front end?
wordpress
Based on the passion engendered with the responses to this question. It appears that the answer is a resounding "Nothing!" or "leave it to plugin developers to handle, WP is already secure enough"... So I guess I'm way off base with the question? It appears to have stirred a hornet's nest and that was not the intent. N...
RE: Username - admin Since version 3.0 the installer asks the user to provide a username for the main account, you obviously won't get this option if you upgrade from an older version(because it's not a new installation). You can see an image of this here: http://codex.wordpress.org/Installing_WordPress#Step_5:_Run_the...
Should WordPress Add Options to Enhance Security or Leave it to plugin developers?
wordpress
I have a custom post type "Listing" and I want to get all Listings that have a custom field <code> gateway_value != 'Yes' </code> , and order the results by another custom field, <code> location_level1_value </code> . I can get the queries to work separately, but I can't combine them: Query 1 (sort by location): <code>...
You could use the query to filter the content as you intended by using the 'meta_query' with filtering options, and for the order part, just add/modify the following parameters: 'orderby' => 'meta_value' 'meta_key' => 'location_level1_value' 'order' => 'ASC' <code> $wp_query = new WP_Query( array ( 'post_type' =&gt; 'l...
Filter by one custom field, order by another?
wordpress
<code> wp_delete_attachment() </code> is very comprehensive and wipes every trace of attachment from database and disk. Is there easy way to keep original file? Forking under another name is not an option, because other functions like <code> wp_delete_post() </code> will still call original version.
Year and some later with much improved skills, behold: <code> Keep_Deleted_Attachment_File::on_load(); /** * Keep original file when deleting attachments. */ class Keep_Deleted_Attachment_File { static private $file; static function on_load() { add_action( 'init', array( __CLASS__, 'init' ) ); } static function init() ...
How to cleanly delete attachment but retain original file?
wordpress
Not much noticeable when working with individual posts, but when you create or delete multiple thousands in bulk and by code - process is quite slow. Are there any good tweaks to apply and corners to cut? Context: <code> wp_insert_post() </code> with categories and tags passed; add several custom fields; create and ass...
When updating post taxonomies, you can call <code> wp_defer_term_counting( true ) </code> before you do your mass operation, and then <code> wp_defer_term_counting( false ) </code> to update the term counts only once per term.
Optimize post insert and delete for bulk operations?
wordpress
I have a form that allows any registered user to submit a post (it's a custom post type - forum related), and I'm using <code> wp_insert_post() </code> to insert it into the db. From what I've seen in this function a sanitize_post() function is run automatically, but I think this only handles db escaping and such. So h...
When a post is created/edited from the admin, edit_post() is called. This function simply collects all the $_POST arguments and passes them to wp_update_post(). wp_update_post() then does some more logical checks and passes the data along to wp_insert_post(). wp_insert_post() calls sanitize_post(), which does all the h...
Submitting posts from the front end - sanitizing data
wordpress
I am creating a child theme using twentyten as my base. I am looking for a way to remove the features of adding custom header and background without touching <code> functions.php </code> file in the parent theme. no luck with this :( <code> function my_child_theme_setup() { remove_theme_support('custom-background'); re...
Both the header and background image features setup some globals in order to work, unsetting those globals seems to have some effect, and at the least removes them from the administration side. <code> add_action('after_setup_theme', 'remove_theme_features', 11 ); function remove_theme_features() { $GLOBALS['custom_back...
Removing custom background and header feature in child theme
wordpress
This question is mainly to get some clarification on best practice for setting up a WordPress Multi-Site. As I have not done this before. I have outlined the scenario below. All help is greatly appreciated. Two Sites with very similar front-ends and an almost identical press section that is managed by WordPress. Site O...
Multisite does not have cross-posting built in. you can do what you want with one of these: http://wordpress.org/extend/plugins/threewp-broadcast/ http://wordpress.org/extend/plugins/multipost-mu/
WordPress Multi Site Best Practice
wordpress
A theme is in development that echo's fields from the users account on their themed account page. This is the standard format. <code> &lt;?php echo $current_user-&gt;user_lastname;?&gt; </code> Thats all well and good. But there are 13 additional fields added via the plugin register plus. How do we echo them? This for ...
Hi @Robin I Knight: Have you tried this? <code> &lt;?php echo get_user_meta($current_user-&gt;ID,'user_post_code',true);?&gt; </code>
Display additional user fields
wordpress
I am trying to call plugins on a theme page. Specifically I am after the 'User Avatar' theme but their will be other later. How do I call a plugin on a theme? Presumable something linke <code> &lt;?php </code> ...plugin name... <code> ;?&gt; </code> but that isn't it. Any ideas. Marvellous
You must check the documentation of the plugin. Is it supporting shortcodes? Do sometingh like <code> &lt;? do_shortcode('[plugin_shortcode]'); ?&gt; </code> Has function to call in the theme? Do something like <code> &lt;? my_plugin_function(); ?&gt; </code>
Calling a plugin in theme development
wordpress
Looking for a little help getting to grips with a quote, part of which is producing quarterly reports consisting on all the posts from that quarter. My question is two fold - Is there a plugin that can do this sort of thing? Or of not, any clue as to where to start coding it? Cheers
You are looking for a mailing plugin that can send mails in digests. One example is Subscribe2 , which can be set from once hourly to weekly, but you can probably modify the code so it extends to quarterly mailings.
Send batch of posts as HTML Email?
wordpress
I need to completely replace WP's login form with the login form of an external service. The actions and filters I've found (eg login_form, login_head) seem to rely on WP's login process starting. I suppose I could do a redirect from here, but is there a cleaner way of sending a user to another URL if they attempt to b...
Short and simple: No. You'll find a lot of stuff for wp-login.php on trac, but it seems that it won't change.
Completely replacing the login form
wordpress
I'm having an issue with using wp_insert_post. I'm adding the ability for a post of one type to create a post of another type with the first post as the post parent. I was testing out a few things using the save_posts filter. I created a function that simply creates a post and then hooked that function to the save_post...
you can check what post type is calling the 'save_post' action try: <code> public function save() { global $post; if (!$post-&gt;post_type = 'video'){ $my_child = array( 'post_title' =&gt; $this-&gt;_child_type, 'post_content' =&gt; "test content", 'post_status' =&gt; 'publish', 'post_type' =&gt; "video", 'post_parent'...
Problems wp_insert_post and save_posts filter
wordpress
Every time I attempt to upload a plugin or theme, I am asked for the FTP password. Is there a way to save this within Wordpress, or do I have to enter it every time? Thanks.
You can save this information on your wp-config.php file: <code> define('FTP_HOST', 'ftp_host'); define('FTP_USER', 'ftp_username'); define('FTP_PASS', 'ftp_password'); </code> More info (WordPress Codex)
How to save Admin FTP password
wordpress
In the administration under Your Profile, which is where I suspect it would be, I can't find anything relating to gravatar
The only place that gravatars are administered in WordPress core (without plugins, that is) is on the discussion settings page: If you want to access YOUR gravatar, go to http://gravatar.com and set up your profile. WordPress is set to automatically interface with gravatar using your user's email address to identify yo...
How do I accesss gravatar?
wordpress
I have typical parent and child categories setup as follows: Food potatoes corn beats Sports soccer football hockey etc. In my index.php template I'd like to list the categories of the specific post. The problem is, when I use the_category() it lists the parent categories twice. I'm using the following code: <code> &lt...
Have you tagged the post in Food, Food:Corn, and Food:potatoes? Try categorizing it in Food:corn and Food:potatoes only. I do not believe that there is a means to exclude categories from the_category() function. You will have to use another function to create a custom query to do so. Try some of these .
Exclude parent categories from the_category() within the loop
wordpress
How can I load regular post tags as values for autocomplete field? What I have now is pretermined values like this: <code> var data = {items: [ {value: "1", name: "Siemens"}, {value: "2", name: "Phillips"}, {value: "3", name: "Whirlpool"}, {value: "4", name: "LG"} }; $("#input_1_3").autoSuggest(data.items, {selectedIte...
<code> if(isset($_GET['get_tags'])): $output = array(); foreach(get_terms('post_tag') as $key =&gt; $term): // filter by $_GET['q'] here if you need to, // for eg. if(strpos($term-&gt;name, $_GET['q']) !== false)... $output[$key]['value'] = $key; $output[$key]['name'] = $term-&gt;name; endforeach; header("Content-type:...
Tags as autocomplete values
wordpress
This is a continuation of stackexchange-url ("this post"). I've built my form and managed to get the correct taxonomy terms listed as a dropdown, but I'm wondering what action I should be using in my form and how I can recall the options selected in the same form on the results page? This is the code I've written so fa...
If you leave the <code> action </code> attribute empty, the form will post back to the current URL. However , if your <code> method </code> attribute is <code> get </code> , the form will post back to current URL, minus the current query string . If you want to keep the current query string, you can use hidden inputs t...
Correct way to use a form to to filter custom posts by taxonomy terms?
wordpress
I must be annoying your with all these permalink questions :) The code I'm using for the loop is: <code> // hijack stupid WP globals to get pagination working... global $wp_query; $temp = $wp_query; $paged = get_query_var('paged') ? get_query_var('paged') : 1; $wp_query = new WP_Query(); $wp_query-&gt;query(array( 'pos...
When you use <code> paged </code> on a single post, it's checking for a paginated post, not pages of posts. Because your topics don't have paginated content, it's assuming it's a mistake and redirecting to the 'first' page of the topic, long before your custom loop is ever touched. So, in this instance, <code> paged </...
Pretty paged permalinks in custom post type loop
wordpress
Basically here's my project: I have to create a back-end wordpress gui user input section. The user will enter details about their projects like name, location, what it is, some other details. A page will display the top 9 recent or so in a 3x3 grid. There will be a search bar to search projects for related tags. I hav...
Hi @jeff: This list of plugins should give you what you need: Custom Post Type Plugins UPDATE Try this plugin as it lets you set up fields for the user to enter into: Simple Fields
I need basic help with custom post types
wordpress
Right now the title of a post page on my blog reads like this... Blog Name > > Blog Archive > > Post Title I don't see the need for "Blog Archive" to be in there and would like to remove it. I've looked in single.php and style.css and I'm not seeing any reference to "Blog Archive" in there that I can remove. Any sugges...
I just realized that you're talking about the browser "title" at the top; that wasn't clear from your original post Go into your <code> header.php </code> and at the top look for this line <code> &lt;title&gt;&lt;?php bloginfo('name'); ?&gt; &lt;?php if ( is_single() ) { ?&gt; &amp;raquo; Blog Archive &lt;?php } ?&gt; ...
Lose "Blog Archive" from page title
wordpress
I have a Multisite Wordpress installation with 7 different blogs. I want to show an aggregate of the summaries of posts from those 7 blogs in the main blog. Do you know a good way to do this?
A couple of plugins, depending what you wanted. http://wordpress.org/extend/plugins/wordpress-mu-sitewide-tags/ Despite the name, it pulls in all posts to the main blog or a blog called 'tags'. http://wordpress.org/extend/plugins/diamond-multisite-widgets/ Give a list of the latest posts network-wide, all in a handy wi...
Aggregate Summaries of Posts of Different Blogs in Multisite Instance
wordpress
I have a custom post type named Reportage, added in functions.php: <code> add_action( 'init', 'create_post_type' ); function create_post_type() { register_post_type( 'reportage', array( 'labels' =&gt; array( 'name' =&gt; __( 'Reportage' ), 'singular_name' =&gt; __( 'Reportage' ) ), 'public' =&gt; true, 'taxonomies' =&g...
My plugin Custom Post Permalinks does this. http://wordpress.org/extend/plugins/custom-post-permalinks
Get a permalink structure of /%posttype%/%category%/%postname%
wordpress
Is there a plugin or another easy way to get debug versions of the external Javascript libraries? ("External" because they were not written by the WordPress team, not because they come from Google or another CDN). If I define the <code> SCRIPT_DEBUG </code> constant to <code> true </code> , I get debug (non-minified) v...
I created a version for TinyMCE, it was not too hard. The trick was to hijack <code> includes_url </code> , this was the only way to change the path to the TinyMCE script. I created a plugin that has non-minified versions of TinyMCE 3.2.7 (WP 2.9 and 3.0) and 3.3.9.3 (WP 3.1). You can download it via Dropbox , let me k...
Using development versions of jQuery, TinyMCE, ...?
wordpress
I have a favicon that is a remnant of a disactivated wordpress theme. I can't find the favicon file in the theme folder, or the wordpress or server root. I have added my own reference to a new favicon, but the old one is still displayed. &lt;link rel="icon" type="image/png" href=" http://www.steve.doig.com.au/wordpress...
The default favicon location on your server gives a 404: http://www.steve.doig.com.au/favicon.ico Your blogs homepage source-code related to linking to another location is: &lt;link rel="icon" type="image/png" href="http://www.steve.doig.com.au/wordpress/wp-content/themes/grid-focus-public-10/images/favicon.ico"> Note:...
Can't delete unwanted favicon
wordpress
I have written a basic gallery plugin that uses wp_enqueue_style to include a stylesheet on the page. I'd like for the WordPress theme to be able to override the style of the plugin which means I'd like to my plugin to play nice and output the css file before the theme css file. wp_enqueue_style has a <code> deps </cod...
First issue - you have dependency backwards. Depending on something means loading after dependency, while you want earlier. Second issue - theme's stylesheet doesn't actually use enqueue, it is usually codded directly in <code> header.php </code> file of theme. And since it seems to come before <code> wp_head() </code>...
What parameter should I pass to wp_enqueue_style to depend on the themes stylesheet?
wordpress
I have had a small number of users on my blog whiching to change thier username. I was reading that is in stored in the DB but where is it and how do I change it.
You can look at the <code> user_login </code> column at the <code> wp_users </code> table. You can edit these values using any database tool (my favorite is PHPMyadmin http://www.phpmyadmin.net/home_page/index.php ),
Changing a username
wordpress
Using the Wordpress default theme 2010 1.1, shortcodes work on the main blog page and individual post pages, but are being stripped out on category and archive pages. For example, stick in the theme's functions.php: <code> add_shortcode('tsc', 'tsc_process_shortcode' ); function tsc_process_shortcode($atts, $content = ...
Shortcodes are stripped from the excerpt before filters are applied. Try something more like this: <code> function tsc_execute_shortcodes_in_excerpts( $text, $raw_text ){ if(empty($raw_text)){ $text = get_the_content(''); $text = apply_filters('the_content', $text); $text = str_replace(']]&gt;', ']]&amp;gt;', $text); $...
stop shortcode stripping in category and archive pages
wordpress
I need to apply unit testing for one of my plugins. I recently re designed it into classes, so unit testing should be easier to apply now. What are some effective strategies to unit test my plugin? I need a way to use WordPress' functions used in the plugin, but I shouldn't need a running WordPress site (just test data...
As an ex-software engineer building large business types who landed in an interactive agency let me give you a few thoughts on testing when developing for Wordpress: Your Unit Testing should test the smallest amount of behavior that a class can perform. Each class should be able to be tested independently of Wordpress....
Unit testing for plugin development
wordpress
I'm trying to add my plugin interface to the Category Editor. I've easily attached it to the post and page editor using the add_meta_box() filter, but there does not appear to be an add_meta_box hook on the category editor. So, since I'm already adding some extra fields to the category edit screen using add_filter('edi...
you can do that as long as <code> &lt;!--This is where I would call my plugin interface--&gt; </code> outputs the HTML form fields.
Can I attach a plugin via my add_filter callback contents?
wordpress
I'm trying to get a list of roles and filter them by a specific capability (custom). I've ran across stackexchange-url ("this post"), but I'd like to filter the roles by whether they're capable to, say, <code> edit_post </code> . -Zack
Untested, but should be easily extendable(or something you can take ideas from). <code> function roles_have_cap( $roles = false, $cap ) { global $wp_roles; if( !isset( $wp_roles ) || !isset( $cap ) ) return false; if( !$roles ) $roles = array_keys( $wp_roles-&gt;roles ); if( !is_array( $roles ) ) $roles = array( $roles...
Filter list of rules based on a capability
wordpress
I created a 'forum' taxonomy, using these rules: <code> register_taxonomy( 'forum', array('topic'), array( 'public' =&gt; true, 'name' =&gt; _a('Forums'), 'singular_name' =&gt; _a('Forum'), 'show_ui' =&gt; true, 'show_in_nav_menus' =&gt; true, 'hierarchical' =&gt; true, 'labels' =&gt; array( 'name' =&gt; _a('Forums'), ...
URL Design has been important to be for well over a decade; I even wrote a blog about it several years back. And while WordPress is sum is a brilliant bit of software unfortunately it's URL rewrite system is just short of brain dead (IMHO, of course. :) Anyway, glad to see people caring about URL design! The answer I'm...
Remove taxonomy slug from a custom hierarchical taxonomy permalink
wordpress
This question might seem a little silly but I was wondering what is the differences between WP.com and WP.org? I know the main differences like you can't edit a them file without paying for it, you might get some ads and you get a youname.wordpress.com domain but what are the little features that make the difference.
WordPress.com is web service . WordPress.org is software product . Think bus vs car. You can ride both, but bus is owned by someone else and what you can do with it is limited.
WordPress.com vs WordPress.org
wordpress
Is there a fast way to get the count (number) of post children of a certain post? (The post has a custom post type) I don't want to use WP_Query for this because I don't need all the extra data... LE: based on wyrfel's answer I ended up using: <code> function reply_count($topic, $type = 'topic-reply'){ global $wpdb; $c...
<code> class MyClass { ... function post_count_filter($where) { global $wpdb; str_replace("WHERE", "WHERE ".$wpdb-&gt;posts.".post_parent = ".$this-&gt;count_parent." AND", $where); return $where; } function count_children($post_id) { $this-&gt;count_parent = $post_id; add_filter('query', ( &amp;$this, 'post_count_filt...
Get the post children count of a post
wordpress
I'm looking for a way to import tweets into Wordpress as posts. In fact, I want to display tweets about a certain topic on a page in Wordpress. So page A would contain tweets about hashtag x, and page B would contain tweets hashtag y. There is at least one plugin that imports tweets (Tweet-Import), but it can only impo...
I wrote a shortcode function based on "Twitter Hash Tag Widget" plugin just copy this function to your themes functions.php file <code> function tweets_by_hashtag_9867($atts, $content = null){ extract(shortcode_atts(array( "hashtag" =&gt; 'default_tag', "number" =&gt; 5, ), $atts)); $api_url = 'http://search.twitter.co...
Importing Tweets with certain hashtags into Wordpress
wordpress
I've got a php script that is called when the user is editing the category. However, although the page renders fine for the most part, at the point where the image upload button should appear, I'm seeing this message: Rendering of admin template /home/site/public_html/wp-content/themes/mytheme/folder/subfolfer/admin/fi...
Looks like an error related to the HeadSpace2 plugin, see. http://urbangiraffe.com/support/topic/rendering-of-admin-template-failed-2 http://urbangiraffe.com/support/topic/rendering-of-admin-template-failed-continued Perhaps the plugin has template support which you've enabled but not created the appropriate file for i...
"Rendering of admin template [path to template] failed"
wordpress
I'm trying to pass error messages or regular messages from a page that processes a form post request to the page it then redirects to (after processing). Since i want to get rid of the POST request header (you know...browsers trying to repost on page reload), i need to redirect (no include or using same page, possible)...
Hehe, got it meself, just a little too late, unfortunately, now i have to change half the stuff again... set_transient(), get_transient() and delete_transient() will be my friends Edit: More on this...i now realized that my wp_options table is full of _transient_xyz records, coming from WP itself. So that indicates tha...
Is there any way to pass messages from a script to a redirect target in a hidden fashion?
wordpress
I know how to get a custom field value for a specific post. <code> get_post_meta($post_id, $key, $single); </code> What I need is to get all the values associated with a specific custom post key, across all posts . Anyone knows of an efficient way to do this? I wouldn't want to loop through all post id's in the DB. Exa...
One possible approach would be to use one of the helper methods in the WPDB class to do a more refined meta based query. The caveat to using some of these functions however, is that you don't usually get back a simple array of data and usually have to make needless references to object properties, even if you're only c...
getting all values for a custom field key (cross-post)
wordpress
I transferred a website to VPS and when I open that website, the home page takes too long to load, for me its taking 30-35 secs just to display the home page, but when I navigate the internal pages it loads in normal speed, I also tried this when all of my plugins were deactivated, but no change, it was taking time to ...
There was a thread on wp-hackers in December which could be related: Avoid query_post on frontpage on wp initialization . You may give Sergey Biryukov’s code a try: I was able to cancel the initial query with this code in the active theme's functions.php file: <code> function cancel_first_query() { remove_filter('posts...
homepage loading too slow
wordpress
I'm developing a web application with user submissions, i'm not too hot on mod-rewrite and was hoping there is a way to utilise WordPress' amazing rewrite engine and incorporate this somehow into my PHP/AJAX web application?
I suggest you don't try to take out the <code> WP_Rewrite </code> class and re-use it in your application, but look at other frameworks instead. Many MVC frameworks have nice rewrite engines, that not only offer more flexibility in handling incoming URLs, but also generating internal links according to these formats. T...
Use WordPress' URL rewrite engine
wordpress
I've been using a custom YOURLS system to create my own URL shortener for my blog network for a while now. Everything works just great with only a few exceptions (bugs already reported to the developer). But I'm aiming for something a bit more complicated that's not included in the existing WordPress YOURLS plug-in. Cu...
I would probably go about this way: The plugin has a function called: <code> wp_ozh_yourls_send_tweet($tweet); </code> as you can see it accepts the tweet message and posts it to twitter, also it has another function called: <code> wp_ozh_yourls_geturl( $post_id ); </code> which accepts a post id and returns a shorturl...
Advanced Integration - WordPress + YOURLS
wordpress
I just changed my header from a background to an image, as that seemed to be the easiest way to link the entire header to my main page (after a whole lot of trial and error with other methods). The one problem is that the image is now overlapping my sidebar instead of the other way around. It's also overlapping some of...
I'm not much of a CSS guru myself, but I think the z-index property might be helpful here. Check this link on Smashing Magazine: The Z-Index CSS property: A comprehensive look .
Header image is overlapping sidebar?
wordpress
In my website there are many authors who can publish posts but some of them are uploading images bigger than 1M , and I want to reduce the max upload size to 500 kb.
You can forbid uploads of a specific size (or for other reasons) in the <code> wp_handle_upload_prefilter </code> hook that is used in the <code> wp_handle_upload() </code> function . It get's the file array passed, it's a single item in the PHP standard superglobal <code> $_FILES </code> one that is documented in the ...
How to Reduce the Maximum Upload File Size?
wordpress
I've got a plugin that attaches itself to both the post and page editors to read and write to the post_content object. I'd like to also attach my plugin to the category manager edit screen. In the code below, lines 1 and 2 attach it to the post and page editor, but line 3, a shot in the dark, is not yet doing the trick...
I'm pretty sure that even if you add that meta box at the bottom of the category edit you will still have the problem of meta table for categories, and i bet that your meta_box 'save' function saves as postmeta data table. However this can be done using the options table here is an how to add extra fields to categories...
add_meta_box() to Category Edit Screen?
wordpress
I am generating a navigation menu on my website using the wp_list_pages() function and I also am using a couple of custom post types with a post type archive function. How would I go about adding a link to the wp_list_pages function to also include a link to my post type. The menu is as follows: Home Tour &amp; Arrival...
I solved this issue a different way. I created a page called 'sponsors' and then created a custom page template that ignored any content entered into the editor and used some custom Wordpress queries to get content from my custom post type. It's so simple and works so well as well. The benefit is I have a page that is ...
Including link to custom post type in 'wp_list_pages' function
wordpress
I'm having trouble setting up permalinks for a custom post type. Below is the code from my init function: <code> register_post_type('topic', array( ... 'hierarchical' =&gt; true, 'query_var' =&gt; true, 'rewrite' =&gt; false, ... )); if(get_option('permalink_structure')!= ''): global $wp_rewrite; $wp_rewrite-&gt;add_re...
My plugin Custom Post Permalinks does this sort of thing for you: http://wordpress.org/extend/plugins/custom-post-permalinks If you'd rather use your own solution, I'll need a bit more information, such as the registration code for the forums taxonomy. Just guessing, I'm thinking the regex for a forum looks identical t...
Custom post type permalinks giving 404s
wordpress
Is there anyway to show different information shown about custom post types in their list in the admin, wp-admin/edit.php?post_type=myposttype ? Obviously I could rip it apart by adding php or js to the admin_head action, but is there a core wp way.
If you mean change the columns that show op on the list of posts/custom post types the there is a "WordPress way" to do that, take a look at http://shibashake.com/wordpress-theme/add-custom-post-type-columns and stackexchange-url ("jan answer to a similar question") Hope this Helps
Change headers in admin posts list
wordpress
I recently moved a blog from one host to another and now have a problem with a permalink - rather than opening up a page, it now opens an attachment. The blog is using WP 3.0.4, running on PHP 5 and IIS 7.0. The permalinks are set to use "/%postname%/" and the web.config is as suggested in the Codex . The blog was move...
Attachments are stored with their filename (minus extension) as the post name. So if you uploaded an attachment that's called map.xyz, it would have the same name as your page. So first, check your Media Library if you have a 'map' attachment. Secondly, check if your 'map' page still exists and still has the same slug....
Permalink opens attachment instead of page
wordpress
i've downloaded a wordpress web to my local machine and tried setting it up. the problem: when trying to login, wordpress will always redirect to the online url. the only way i found was changing the siteurl manually in phpmyadmin to my local machine's ip address. is there a better solution? the problem about doing tha...
Open up your <code> wp-config.php </code> file try adding the following to it: <code> define( 'WP_SITEURL', 'http://localhost/your_wordpress_folder' ); define( 'WP_HOME', 'http://localhost/your_wordpress_folder' ); </code>
Wordpress on a local machine redirecting to online url
wordpress
I am having a problem. I am running WP 3.05 with one custom taxonomy. Here is the code to create the taxonomy: <code> function create_property_taxonomies() { // Add new taxonomy, make it hierarchical (like categories) $labels = array( 'name' =&gt; _x( 'Property Types', 'taxonomy general name' ), 'singular_name' =&gt; _...
Sorry guys, this is becoming a habit, but I found a solution, as follows: set rewrite to false in taxonomy registration: register_taxonomy('property_type',array('sbproperty'), array( 'hierarchical' => true, 'labels' => $labels, 'show_ui' => true, 'query_var' => true, 'rewrite' => false )); And create my own rule <code>...
Permalink Problems
wordpress
The function get_users_of_blog() is to be deprecated in WP 3.1.0 but the current production release is 3.0.5. Does it make since to have the documentation reflect a nightly change when the production version of get_users_of_blog() is still the primary function used to fetch a list of users? Or is it fine so long as the...
The codex is some kind of a mess. General behavior is to let users (re)write it and then go over it and change what they (whoever this is) think. Ex. The Codex lacks a lot of functions in the function reference. On some places you already got the 3.1 explanations, on other completely outdated stuff. Sometimes you'll fi...
Codex Version Focus on Production or Nightly?
wordpress
My server has 756m of RAM. Every few days I get [error] server reached MaxClients setting, consider raising the MaxClients setting
Just to break cycle of "doesn't belong here". WordPress basically has no specific requirements for web server itself (which doesn't even have to be Apache), aside from permalinks. The message you are getting seems to be performance-related and may or may not be connected to you using WordPress. For starters check if yo...
What are some good Apache settings to use with wordpress?
wordpress
I want to be able to customize the WordPress edit posts screen to filter based on a custom field (or whatever). Unfortunately I'm not sure what filter or hook to use here, and instead of opening the code myself, figured I'd throw the question out here. Just to be clear, I'm talking about this screen. Essentially I want...
You need a to use a few hooks for that take a look at stackexchange-url ("mike's answer") to a similar question. Hope this Helps
Is There a WordPress Hook to Filter the Edit Posts View?
wordpress
I'm trying to create a forum system using WP's custom post types - two post types as Topic/Reply and a Forum taxonomy. I have created a singular template for the topic post type, in which I added a reply form. The problem is that when I submit the form I get a 404 page. This is the form template: <code> &lt;div class="...
it was the "topic" name field. It seems you can't use reserved terms in $_POST, and "topic" is a post type name, so its probably one of them...
404 Error on form submission within custom post type
wordpress
I need to find if a post with a custom field X equal to Y exists in a wordpress installation. Should I do it with a simple sql query or is there something build in that can help me achieve it?
You can use the WP_Query (); to check that like this: <code> $my_query = new WP_Query(); $my_query-&gt;query(array( 'meta_key' =&gt; 'X', 'meta_value' =&gt; 'Y')); if ( $my_query-&gt;have_posts() ){ //it exists } else { //it's not here } </code> Hope this helps.
How to find if a post with custom_field == X exists?
wordpress
I know I can control the length of excerpts using a filter , however it sets the length globally. In my case I have different lengths of excerpts on three different pages. This is what I have now. I'd like to improve it so it doesn't truncate words. <code> $content_to_excerpt = strip_tags( strip_shortcodes( get_the_con...
Set the filter dynamically based on the page you are loading. If category archive pages have a 100 word excerpt, but posts have a 10 word excerpt, and everything else uses the default: <code> function my_custom_excerpt_length( $orig ) { if( is_category() ) { return 100; } elseif( is_single() ) { return 10; } return $or...
Excerpts that don't truncate words
wordpress
How can I find out if I am on the 1st page of my home page. I have my page setup like below where I want to display the 1st 2 posts taking up full width. then the rest 1/2. But I want this behaviour on the 1st page only, how can I do that? What condition do I use?
I'm assuming that you're talking about the "home page" when you say "1st page only". Or are you talking about the first "paginated" page of your posts? If its the prior, you'd probably want to use the "is_front_page()" conditional if you're using a single page.php template. Or maybe it'd be easier to make a "page-home....
How to know if I am on 1st page
wordpress
The default WP media manager does not appear to offer the ability to change an image's filename. Are there any plugins available that allow this functionality?
Try the Media File Renamer .
Any way to change the actual filename of an image from media manager?
wordpress
The other day, I switched from 2010 default them to Semiologic, then back. When back to the 2010, all my appearance/widgets had gone back to the default. Does this often happen? What is the best practice? Should I always do a database backup before trying new themes, then restore if I don't like it? Or is there somethi...
Storing widgets is complex topic. Basically it is such a multi-level-array-mess on the inside that very few people try to make sense of it (and even fewer succeed). :) As far as I understand it myself while we can manipulate cute sidebar names on the surface, deep inside it is getting deconstructed to numerical IDs. So...
Switching themes without losing widgets?
wordpress
I'm building a custom homepage for a client where they want to have a few changeable boxes to link to specific pages, or posts, within the site. I've added custom fields to the homepage so that they need only enter the page/post ID, and then it will display the proper post or page. And I'd like it to be flexible enough...
Try this: <code> query_posts(array( 'p' =&gt; $topright, 'post_type' =&gt; array('post', 'page'), )); </code>
use query_posts to return a post OR a page by ID
wordpress
I'm looking for a way to change the WordPress favicon. Any hints how to do this?
You should add it on your theme's header.php file with this code (W3C standard code): <code> &lt;link rel="icon" type="image/png" href="http://yourblog.com/favicon.png"&gt; </code>
How to change the WordPress favicon?
wordpress
I'm setting up a simple web site for a member of my family, using wordpress as a CMS. I've already registered a domain name and I'm about to set up wordpress. I want them to be able to edit the site content online (using wordpress's admin interface) and view the site, but I don't want the site to be available to the pu...
I also have had problems with the maintenance plugins. What you can do instead (if you are familiar with HTML) is create a simple "Closed for Maintenance" page. Save the page as xindex.html . Upload the xindex.page to the same directory as your WordPress installation. You Wordpress installation comes with two files ind...
Wordpress CMS - hide content from public while in editing stages
wordpress
Today morning on valentines I received a shocking mail from my WordPress site, Don't know what to do, Can anyone help me out in this Subject: [Online MBA] High memory usage notification Sent: Feb 13, 2011 11:33 PM WordPress memory usage exceeded 64 MB WordPress peak memory usage: 114.87 MB Number of database queries: 1...
This mail seems to come from the TPC! Memory Usage plugin . The description includes Send e-mail notification if memory usage reaches threshold setting , and it seems that is what happened here. Either change your plugins so they use less memory, increase the notification limit, or remove this plugin.
Notification mail about high memory usage?
wordpress
How can I implement pagination like shown in the title perhaps something similar to most sites
I can across this awesome tutorial just the other day: http://design.sparklette.net/teaches/how-to-add-wordpress-pagination-without-a-plugin/ which is a modified version of this one: http://www.kriesi.at/archives/how-to-build-a-wordpress-post-pagination-without-plugin
How to implement pagination eg. newer - 3 - 4 - 5 - 6 - 7 - older
wordpress
I just tried an automatic upgrade of List Category Posts plugin to version 0.17.2 on WordPress 3.0.5. I think I had 0.17.1 before. It installed but failed to activate: <code> Plugin could not be activated because it triggered a fatal error. Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_F...
Yes, I've asked for issues to be reported here, so that you can get answers from the larger community of WordPress users and developers at WordPress Answers. Regarding the issue, other user also reported it, and it is due to the webhost using PHP 4. Line 10 of CatListDisplayer.php declares a private attribute. PHP 4 do...
List Category Posts plugin upgrade fails with fatal error
wordpress
If I have a loop running from a category query like : <code> &lt;?php $the_query = new WP_Query('cat=1&amp;showposts=50&amp;orderby=title&amp;order=asc');?&gt; &lt;ul&gt; &lt;?php while ($the_query-&gt;have_posts()) : $the_query-&gt;the_post();?&gt; &lt;li&gt;.. &lt;/li&gt;&lt;?php wp_reset_query(); ?&gt; &lt;?php endw...
Create Columns for your query and easy display In themes is probably more useful to have something that fits well into template tags and the loop. My first answer didn't focus on that much. Additionally I thought it's a bit too complicated for a quick adoption. An easier approach that popped into my mind was to extend ...
How to split a loop into multiple columns
wordpress
I'm using the theme Starkers which is based on twentyten. My twenty ten theme do place child pages below its parent page. But the new theme (based on Starkers) I'm developing doesn't (it just place it in the first level). My theme header.php: <code> &lt;div id="access" role="navigation"&gt; &lt;?php wp_nav_menu( array(...
Check the twenty ten themes function file, there should be a function to register menus. After adding it to your theme you'll have a new tab in your admin panel under appearance called menu where you can set the menu's items and sub items. Line 96 in the functions.php file <code> // This theme uses wp_nav_menu() in one...
Child pages don't become submenus (as in the twenty-ten theme)?
wordpress
I'm working on a shortcode function that returns a category image, a link to the category, the last three posts in that category, and another link to the category. See my code below: <code> add_shortcode('caticons_listing','bm_caticons_listing'); function bm_caticons_listing($atts) { extract( shortcode_atts( array( 'in...
First, need to lose <code> query_posts() </code> - it should never be used for secondary loops. Try something like this: <code> $posts = get_posts( array( 'cat' =&gt; $category-&gt;term_id, 'numberposts' =&gt; 3, )); foreach( $posts as $post ) { $listing_code .= get_permalink( $post-&gt;ID ); //or whatever } </code>
Output loop to function return?
wordpress
How should I handle post thumbnails? Do most people put them in custom fields? Use a plugin? How do themes on ThemeForest handle this? Also different theme will have different size requirements? So moving from 1 theme to the next could cause alot of problems? Thumbnails may come in different sizes too
Since WordPress 2.9, you can add thumbnail support to your theme by adding this to the theme's functions.php file: <code> if ( function_exists( 'add_theme_support' ) ) { add_theme_support( 'post-thumbnails' ); } </code> When this is done, you'll be able to add a feature image to your post on Posts, Pages or Custom Post...
How to handle thumbnails
wordpress
We are currently in development on a new site. Categories (&amp; tags) are pretty much meaningless for us because we've implemented custom posts &amp; taxonomies. By default, because I have enabled pretty permalinks, if I create a post titled, "Mubarak steps down" without selecting a category, Wordpress will give me th...
For the SEO part you might get better answers on stackexchange-url ("the Pro Webmasters Stack Exchange"). I will focus on the performance. From your example I assume your permalink structure was <code> %category%/%postname%/ </code> . Because of the way WordPress parses the incoming URL, this will result in verbose pag...
Pros and cons of using [taxonomy name] in place of [category name]?
wordpress
I'm wondering what the preferred method is for dealing with AJAX calls. Should one use the same plugin php file to process the POST or a separate one? Which is cleaner or safer?
the "safer and cleaner" way would be to use admin-ajax.php that comes with wordpress and <code> wp_ajax </code> hook to call you processing function from your plugin file and use wp-nonce to check the integrity of the call. for example: your ajax JQuery call would be <code> &lt;script type="text/javascript" &gt; jQuery...
What's the preferred method of writing AJAX-enabled plugins?
wordpress