question stringlengths 0 34.8k | answer stringlengths 0 28.3k | title stringlengths 7 150 | forum_tag stringclasses 12
values |
|---|---|---|---|
Is it possible to make a "page, not a blog post" the main entry on your site? I'd like to be able to create a summary of the latest content as the first page the user visits on my site. I'm using Wordpress 3.0.3 | yes, it's a simple setup in your wordpress settings, so, go to your Admin area => Settings => Reading and select to use a Static Page as a Front Page, from the drop down menu select the page you want to use and put inside the content you want/need, just don't put a Loop inside. | Making a wordpress page the index on the site? | wordpress |
My client wants me to install a plugin from here: http://www.maxblogpress.com/plugins/mpo/ that optimizes how WP pings. If you read the article, the version he mentioned were 2.1 and 2.3, if I am not wrong. Does this issue still exist? | I'd stay away from this particular plugin, as far as I remember this developer requires registration and forces email subscription on you. As for issue itself - does your client has particular issue to worry about pings at all? | Wordpress ping spam issue with Ping services? | wordpress |
I'd like the user to install WP and have the default content loaded automatically but i don't want to have to write in in PHP in the wp_install_defaults(); I'd much rather export an xml file each time i make a change to the default and just bundle that with the install. Thanks. | have a look at the file wp-admin/includes/import.php, you'll find the necessary functions in there. | How to import WP XML file automatically on installation? | wordpress |
How do you replace the default title for first comment? Mr WordPress on Hello world! I could not able to locate this in theme's comments.php file I want to edit the title 'Mr wordpress on Hello world' to Admin on -Site Name- How can I replace the default text created with about us page? This is an example of a WordPres... | I can only answer your first two questions as I do not know anything about multisites. The default comment and content in the 'About Us" page is not coming from the theme files, but rather the database. They are the default posts/pages/comments accessed by the backend not by the theme files. To get to this content and ... | Replacing the default content created while the site creation | wordpress |
In WordPress, I'm trying to create a Custom Post Box that will allow one post to be manually connected to another post. The easiest way to illustrate this request was to mockup what I would like the final Post Box to look like. That mockup can be viewed here » http://cl.ly/3hI3 Requirements: The Post Box needs to resem... | Hey Mike -- does it need to be connected to another post , or can it be a custom taxonomy or custom field? | How do I create a Custom Post Box that Connects Different Posts Together | wordpress |
Currently my theme calls upon <code> get_comments_link() </code> to create the standard anchor #comments to link to the comments below the post, as does the <code> get_comments_pagenum_link() </code> function on paginated comments. I would like to replace the #comments anchor in these functions with any other string, w... | So the solution to the <code> get_comments_pagenum_link() </code> function is straightforward enough: <code> add_filter('get_comments_pagenum_link' , 'new_get_comments_pagenum_link'); function new_get_comments_pagenum_link($content) { $content = str_ireplace('#comments' , '#other', $content); return $content; } </code>... | Changing the comments link produced by the get_comments_link() and get_comments_pagenum_link() functions | wordpress |
I have a problem with WP that need your help. Some of my posts have content that was applied "wp_autop" filters already. This filter turned all double break lines into <code> <p> </code> tag. I want to the opposite thing: turn all <code> <p> </code> tag into double break lines. Do you have any suggestions? ... | I just ran into this situation. Here is a function I used to undo wpautop. I might be missing something, but this is a good start: <code> function reverse_wpautop($s) { //remove any new lines already in there $s = str_replace("\n", "", $s); //remove all <p> $s = str_replace("<p>", "", $s); //replace <br ... | Is there un-wp_autop function? | wordpress |
I have this code on my functions.php for getting shorturl over bit.ly <code> function bitly() { global $post; $bitly = file_get_contents('http://api.bit.ly/v3/shorten?login=USER&apiKey=KEY&longUrl='.urlencode(get_permalink($post->ID)).'&format=txt'); echo $bitly; } </code> but, sometimes i got error like... | I agree that this is PHP rather than WP question. To bring it closer to WP I do suggest to take a look at following functionality: HTTP API is highly suggested for making HTTP requests; <code> add_post_meta() </code> and related meta functions to store post-specific information; <code> the_shortlink() </code> function,... | file_get_contents - failed to open stream | wordpress |
I'm creating a theme that uses only the homepage. When a button is clicked, the content for that section is loaded into a div on the homepage via AJAX (script below). <code> $.ajaxSetup ({ cache: false }); var ajax_load = "<center><img src='<?php bloginfo("template_url"); ?>/images/loading.gif' alt='Load... | So if you say there are no errors, I'm assumming that your problem is the AJAX request changing the DOM, and your scripts being loaded before that. If the document changes, you'll need to tell your scripts that, so they will fire their events on the new content. So: Either you reload all scripts again after the AJAX up... | Loading dynamic content with AJAX breaking jQuery | wordpress |
I'd like to give users a little welcome message on their first login to the admin area. Once they hide the message it should not appear again. I noticed admin_notice is a hook but don't know where to start. Thanks. | something like: <code> add_action('admin_notices', 'my_notice'); add_action('wp_ajax_hide_my_notice', 'hide_my_notice'); function hide_my_notice(){ check_ajax_referer('hide-my-notice'); $user = wp_get_current_user(); // update status for this user $seen_notice = get_option('my_notice'); $seen_notice[$user->ID] = tru... | Add a notice to users upon first login to the admin area | wordpress |
Does anyone know of a galley plug-in which would have this kind of functionality? <code> ------------------------------------------- | | | | | | | | | | <-image shows whatever thumbnail is clicked | | | | | | | | | | ------------------------------------------- ----- ----- ----- ----- ----- ----- | | | | | | | | | | ... | Photospace http://wordpress.org/extend/plugins/photospace/ If you want to just use jquery I recommend http://www.twospy.com/galleriffic/ galleriffic. | Plug-in for gallery with thumbnails? | wordpress |
what are the differences between wp_users and wp_usermeta tables? i use wp-email-login plugin and i just noticed that if a user change his email in the profile page it saved in the wp_usermeta table and not in the wp_users table, this is a problem cause the user have to use the first email to login successful, if he us... | wp_users is the primary table, with a fixed list of columns. wp_usermeta is an additional table for storing arbitrary information (custom fields). The wp_users table already has a user_email column, so I don't know why the plugin uses wp_usermeta. I guess the best person to ask would be the plugin author himself. | what are the differences between wp_users and wp_usermeta tables? | wordpress |
Hoping to benefit from the experience of others. This question is really multiple potential questions so I'm hoping someone can steer me to the best solution to keep me from all the trial and error. Background So I have set up a WordPress v3.0.3 site currently with about 20 users and about 25 pages of content and I rea... | "However it seems that I can't just convert to multisite" I have no idea why he told you that, because it is possible. I mean,.... it's kind of the whole point of why multisite was merged in - so existing sites could just turn it on. User roles on the main site will stay exactly the same. there may be a couple plugins ... | Shared User Tables on 2 WordPress Sites; "Main" Site and "Discuss" using P2? | wordpress |
I was editing a wordpress theme. Where i need to replace default wp login link with custom login link. Problem is, <code> comment_reply_link() </code> function is returning the default link. And i dont want to edit wp-include/comment-template.php Is there any other way, so that without manipulation of any wordpress fil... | you can simple make a check if user is logged in and show him the reply button, if is not you can show him a custom link to your login file. something like this: <code> <?php if ( !is_user_logged_in() ) : ?> <a href="<?php bloginfo('url'); ?>/login"><?php _e('Reply', 'artdev'); ?></a> <... | How to edit comment_reply_link | wordpress |
Just found this site via the WP-Hackers List, been using WordPress for years (make a living partially thanks to it) and never stumbled on this site! Posted this on the WP-Hackers list, but didn't find a solution. I know WordPress 3.1 has removed the nofollow attribute from the comment Reply link (WordPress 3.1 beta loo... | functions.php: <code> function remove_nofollow($link, $args, $comment, $post){ return str_replace("rel='nofollow'", "", $link); } add_filter('comment_reply_link', 'remove_nofollow', 420, 4); </code> | Editing the Comment Reply Link | wordpress |
i'm building a widget to login from the sidebar and print errors if any, so everything is working fine except that when i login it returns an error: Warning: Cannot modify header information - headers already sent..... the code of the widget: <code> <?php // Custom Login/Meta Widget function widget_artdev_meta() { ?... | Don't use both <code> wp_login() </code> and <code> wp_signon() </code> . They do the same thing, but first one is deprecated Use the 2.8 widget API Put <code> wp_signon() </code> inside a function that you hook on the <code> init </code> tag (You can handle the errors in the <code> widget() </code> function) | Sidebar login widget with error print, returns an error | wordpress |
i asked this question previously, which solved my problem, but further i am having still problem with it, i have a function to display tweets of a user which fetch from a custom field, the custom field code is working perfect, cause when i <code> echo the get_post_meta </code> in my single.php i get the value which is ... | So many issues here... First, I'm not sure what this line is doing: <code> add_action('admin_menu', 'tweet_fetch1'); </code> If you don't actually have a function called tweet_fetch1 that runs when the admin loads, you should remove this add_action. And if you do have such a function, why is your add_action in this loc... | get_post_meta() problem again | wordpress |
I'm registering taxonomy in my functions.php file: <code> register_taxonomy("our_gallery_types", array("gallery"), array("hierarchical" => true, "label" => "Categories", "singular_label" => "Category", "rewrite" => true)); </code> And it works perfectly. But I want also to automatically create two terms in ... | use wp_insert_term() (after you register the taxonomy) You can also check if a term exists() before doing that, to save some useless db queries... | Create terms when registering taxonomy? | wordpress |
currently I have 3 parent page types with multiple child pages under each. Feature * feat 1 * feat 2 .. Creative * creat 1 * creat 2 ... Info * info 1 * info 2 ... I have been successful with pulling the children page content onto the parent page, but now I want to get the children of Feature and Creative onto Creative... | Like AmbitiousAmoeba mentioned, you'll need to perform a few <code> get_pages </code> calls to lookup the pages for each child, merge the results together, and iterate over those results. I worked up an example for you, because it's fiddly trying to merge arrays when they have matching indexes, the only thing you shoul... | Child page from 2 different parent pages | wordpress |
I'm working on a site based on a fluid width css template which sets a max-width on images to the width of the column containing them, and I need to remove the inline width and height dimension attributes that WordPress adds to images. I'm doing it with my featured images with this filter: <code> add_filter( 'post_thum... | Thanks all! The image_send_to_editor filter was the one I was looking for... thanks @t31os for pointing it out. Here's my functions now. <code> add_filter( 'post_thumbnail_html', 'remove_thumbnail_dimensions', 10 ); add_filter( 'image_send_to_editor', 'remove_thumbnail_dimensions', 10 ); function remove_thumbnail_dimen... | Filter to remove image dimension attributes? | wordpress |
I'm in a pickle and unfortunately, have almost zero working understanding of mod_rewrite/apache stuff. Here's what's going on: I've got a hierarchal custom post type with parents and children. On my test server, before I can see any of the custom posts, i needed to go to the permalinks settings page and hit refresh. Th... | So it turns out the difference between the working site and the broken site was actually in the code (thank god). 'query_var' needs to be set to => "true". There's still a little funkiness, where posts with the same name (but different parents and thus different permalinks) seem like they auto direct to the earliest in... | Custom Post Type Child Won't Come Through With Pretty Permalinks | wordpress |
I'm looking for some options for creating a horizontal flyout/rollover menu from the WordPress categories listing when category items have child nodes. Ideally, all in css, but I can include javascript or enqueue jQuery too. | A lot of themes have a menu like this. The CSS I'm usually using (I left the visual stuff like colors out): (assumming the container is a div and its class is <code> .nav </code> ) <code> /* 1st level items are layed out horizontally */ .nav li{ position:relative; float:left; } /* level 2+ */ .nav ul ul{ position:absol... | Making a horizontal flyout menu from WordPress category listing | wordpress |
The <code> get_blog_list() </code> function has been deprecated from v3.0. How does one get a list of blogs in a multisite blog? | Trac has some discussion and code for possible replacement in future version, ticket #14511 new function - wp_get_sites($args) . | How to Get a List of Sub Blogs without Using get_blog_list()? | wordpress |
The going through the mu functions source I come across references to two different ids for sub-blogs - site id and blog ids. In what context is each used? | site_id = the ID of the parent site (the domain, eg. wordpress.com) blog_id = the ID of the parent site's blog(s) (usually sub-domains, eg mary.wordress.com) | What is difference between blog id and site id? | wordpress |
I am having a wordpress blog at http://thelazy.info/ . By default, only one post is displayed on the page. I want to increase the default content on the main page to 5-10 posts with a small ting of comments. Is there some plugin or setting to do that in buddypress/wordpress. | By default, only one post is displayed on the page I can see several posts on your main page(6 total), please clarify what you mean. with a small ting of comments. Sorry, what? More details/clarification please. Would have liked to have posted this as a comment but i'm not sure if you can quote properly there.. (feel f... | Summary and Comments on Main landing Page | wordpress |
I'm facing a strange problem: <code> <?php $loop = new WP_Query( array( 'post_type' => 'ff', 'orderby' => 'menu_order', 'order' => 'ASC', 'posts_per_page' => 10 ) ); while ( $loop->have_posts() ) : $loop->the_post(); ?> (...) <?php endwhile; ?> </code> This code displays all posts of "ff" ... | Are you absolutely sure <code> ff_show </code> is correct slug? I have suspicions about that underscore... <code> category </code> is not valid query argument at all, it is probably simply discarded. Had you tried this query with id instead of slug? <code> cat </code> argument. Edit. Wait, you are trying to query custo... | Displaying posts of given category | wordpress |
I have this loop in my wordpress site which displays the latest posts with their titles, I want to display the post content after the title. I normally retrieve it with the function get_the_content but I cannot make it work in this case. This is the loop: <code> while ( $q_query->have_posts() ) { $q_query->next_p... | try this instead: <code> ... global $post; while ($q_query->have_posts()){ $q_query->the_post(); $loophtml .= "<li><span class='list-question-title'>" . "<a class='list-answer-link' href='" . get_permalink() ."'>" . get_the_title() . "</a></span>"; $loophtml .= get_the_content(); $lo... | How do I display the function the_content in this loop? | wordpress |
The following url resolves to the category template: http://localhost/author/myusername/?category_name=somecategory I have a <code> category-somecategory.php </code> template and just a generic <code> author.php </code> template. Is there any way to make such a url use the <code> author.php </code> template instead of ... | You could change the template loaded by hooking onto <code> template_include </code> , checking if <code> is_author </code> and <code> is_category </code> are both set, then switch the template for inclusion to the author template instead. Give this a shot.. <code> add_filter( 'template_include', 'my_template_setter' )... | How to control template resolution if both Author and Category filter in place? | wordpress |
I'm trying to add code to my themes functions.php to display fields created with the Cimy user extra fields plugin in the dashboard users.php. I know that I need to use manage_users_columns, but beyond that I'm stuck. Anyone familiar enough with the plugin to help me get the proper fields to display? | I hacked my way into figuring this out. Here's the code for reference: <code> function theme_column_userfield( $defaults ) { $defaults['theme-usercolumn-userfield'] = __('fieldname', 'user-column'); return $defaults; } function theme_custom_column_userfield($value, $column_name, $id) { if( $column_name == 'theme-userco... | show cimy user fields in users.php with manage_users_columns | wordpress |
I am using Multi-site installation. I don't want all the widgets appear under widgets.php on dashboard .So I tried to find a way to remove or hide unnecessary widgets . SO that the new sub-sites under my Multi-site created won't have much widgets. So the users don't get confuse with lot of widgets . I tried to find the... | Add this to your functions.php file: <code> function jpb_unregister_widgets(){ unregister_widget('WP_Widget_Pages'); unregister_widget('WP_Widget_Calendar'); unregister_widget('WP_Widget_Archives'); unregister_widget('WP_Widget_Links'); unregister_widget('WP_Widget_Meta'); unregister_widget('WP_Widget_Search'); unregis... | How to hide or remove unwanted widgets on Multisite installation? | wordpress |
I have a custom post type that is just a paginated post and acts as a slideshow. How can I make it so that the reader can choose an option to have the slideshow advance automatically to the next page after some preset interval (like 10 seconds)? | Hi @matt: To achieve what you are asking you need to add some code to queue up a Javascript file and then the Javascript file itself. You can put the code that follows in your theme's <code> functions.php </code> file. You'll note it uses <code> is_admin() </code> to avoid loading the Javascript code in your <code> /wp... | Script to Automatically Advance to the Next Page of a Paginated Post | wordpress |
How to set the menu active state for a custom posttype and category, given a custom taxonomy term? I have a custom taxonomy: region, a custom posttype: business, and use the categories taxonomy. My custom primary menu consists of the region terms. When I select a region, the corresponding menu item is highlighted OK. T... | When you create a custom menu item for the custom post type archive you have to include the entire url and not just '/your-custom-post-type-name'. If you use the entire url the wordpress url rewrite function will check it against all the other menu items as well as against all your pages and so on. What you end up with... | Set menu active state for custom posttype and category, given custom taxonomy term | wordpress |
How to rewrite permalinks for a custom posttype and custom taxonomy? I have a custom taxonomy: region, and a custom posttype: business. Now, how to rewrite the permalink, so that for a category, the fixed "category" part is replaced with the custom taxonomy term: <code> /%region%/%category%/ </code> for a business: <co... | The Custom Post Permalinks (Wordpress Plugin) from John P. Bloch did the trick for me. Great /flexible plugin! | Rewrite permalinks for custom posttype and custom taxonomy | wordpress |
I'm trying to output a unique widget ID inside my mult-instance widgets. So far the following hasn't worked. Is there a unique ID and how do I call it? Thanks. <code> function widget($args, $instance) { // outputs the content of the widget extract( $args ); $widget_id = $instance['widget_id']; ?> <?php echo $widg... | You can get the instance ID with <code> echo $this->id; </code> ( <code> $this </code> is the class instance) The only time you can't get this id is from the <code> form() </code> function, right after you just dropped the widget (stackexchange-url ("here")'s the reason why) | Calling the widget id of a mult-instance widget from inside the widget? | wordpress |
I have a vertical menu using the superfish script that shows categories in a custom 'productcategory' taxonomy. This menu has multiple levels, and is hierarchical.At the bottom of each branch of the tree we have the end category which represents a range of products, which the client does not want to show in this menu. ... | I've made some progress based on walker classes but havent gotten ti working quite as needed because wordpress doesnt appear to handle the root nodes of the taxonomy tree in the same way as the child ones. As a result, it prunes the end menu items, but if the parent of that node is a root level node, it prunes the node... | Controlling Taxonomy Category listings to hide and unhide specifics | wordpress |
this is a silly question, but i dont know, can anyone help me out in this i want to <code> echo get_post_meta() </code> on a url, but i am getting parse error i am having a function, where in the between of url one field can be filled by the value of custom field here is the code <code> ($doc->load('http://twitter.c... | Remove the echo. In PHP, you only use echo when you want to send the result as text to the browser. If you want to use the value in PHP (like you are trying to do), then you leave out the echo and add $post-> ID, 'meta_field_you_want', true to get_post_meta(); | echo get_post_meta() | wordpress |
Im building a directory site and for each business listing I wanted to include a printable coupon. I would want users to be able to click the coupon image (or link) and a printable version of the coupon to show up. I looked around for solutions but couldn't find anything that could help. Any help would be appreciated. ... | You might be probably looking for a plugin that offer's groupon-like functionality ( “Groupon 1.0 started on a WordPress blog.” ). By googling I learned that there is a plugin called WP Coupon (Wordpress Plugin) ( review ). No idea if it fits in what you need, but it looks like it does what you're looking for. But it's... | How to add coupon printer? | wordpress |
Currently I have the loop listing posts between two dates using the <code> posts_where </code> filter: <code> function filter_where( $where = '' ) { $where .= " AND post_date >= '2000-01-01' AND post_date <= 2004-12-31' "; return where; } add_filter('posts_where', 'filter_where'); query_posts($query_string); whil... | Thanks to stackexchange-url ("AmbitiousAmoeba") for the answer. The following improved code solves the problem: <code> function filter_where( $where = '' ) { global $wpdb; $where .= " AND (($wpdb->postmeta.meta_key = 'original_date' AND $wpdb->postmeta.meta_value >= '2000-01-01') AND ($wpdb->postmeta.meta_k... | How to correctly call custom field dates into a posts_where filter using SQL statements | wordpress |
I have a bunch of pages and I only want to include 2 or 3 pages on my main menu. How would I do that? Currently my code looks like this: <code> wp_page_menu('include=156,572,542&sort_column=menu_order&echo=0'); </code> If I am going to insert <code> exclude=x pages </code> , it wouldn't make sense because there... | try <code> ... echo preg_replace('/<ul>/', '<ul class="sf-menu">', wp_page_menu( array( 'include' => '11,13,7,9,4', 'sort_column' => 'menu_order', 'echo' => 0)), 1); </code> or <code> ... echo preg_replace('/<ul>/', '<ul class="sf-menu">', wp_page_menu( array( 'include' => array(11,1... | Exclude all pages except a few? | wordpress |
I've posted a bug-report about this a few months ago (on WordPress trac (Widget Instance Form Update Bug)) and I thought I'd try writing about it here too. Maybe someone has a better solution to this issue than me. Basically the problem is that if you drop a widget into a sidebar, the widget form doesn't get updated un... | I did battle with a similar situation recently. Ajax in widgets is no joke! Need to write some pretty crazy code to get things to work across instances. I'm not familiar with live query, but if you say it checks the DOM every second, I might have a less intense solution for you: <code> var get_widget_id = function ( se... | Update widget form after drag-and-drop (WP save bug) | wordpress |
i have a code which is use to display twitter tweets but the problem is, it is displaying before the content of post, i know the problem is with echo, cause it is echoing first and then the post is coming, so the post comes after the tweets, when i tried to make the echoes to return then the tweets are not coming here ... | Functions can only return one value. Change all the <code> echo </code> statements in your <code> tweet </code> function to concatenate a string, then return the string at the end of the function. | echo or return? | wordpress |
Currently I am working on adding a breadcrumb without a plugin to a site. I found several possibilities on how to do that, but what I specifically want is to take one Page out of the trail. My current trail is as follows: home - products - productgroup - productsubgroup - productname What I want it to become is: home -... | Based on the code your used my guess is it would be as simple as adding a <code> unset($bcarray[0]); </code> to their code on line 15. Here is the code in it's entirety: <code> function write_breadcrumb() { $pid = $post->ID; $trail = "<a href='/'>Home</a>"; if (is_front_page()) : // do nothing elseif (is... | delete a page from a breadcrumb trail | wordpress |
I am writing a plugin for the back end but I need to add javascript that is created in a for loop to the head of the page. How do i do this? Steve | Hi @Steve Clark: I think what you are looking for is here (Look for the section entitled "Load Scripts only on pages where needed"): <a href="stackexchange-url What is the best way to add custom javascript files to the site? | Adding custom Javascript to the head tag in Admin | wordpress |
my question may look like stackexchange-url ("Pagination not working with custom loop"), but there is a different. I use the custom loop for display flash game. I want to make a pagination on page games by category. category.php : <code> <?php if ($cat) { $cols = 2; $rows = 4; $paged = (('paged')) ? get_query_var('p... | If this is the main loop you use to display posts on your page, you should not execute a new loop but modify the existing loop that WordPress will execute anyway. This way you can be sure that all extra query parameters will be taken into account. Here we want to display posts of type <code> game </code> and limit the ... | Pagination with custom loop | wordpress |
this rss feed question was resolved but now when i tried this code <code> <a href="<?php echo get_post_comments_feed_link($feed); ?>">RSS feed of this post</a> </code> on my archives page,then i am getting the wrong url feed what i want is when i click on the this feed, then i should get all the feeds... | Not entirely sure. This is template tag and should be used in Loop, but for single post page it works fine most of the time even outside of Loop. Seems to from quick test. Disregard that. The issue is you were forgetting to <code> echo </code> it. :) Also there is specialized template tag for comment feeds: <code> get_... | rss feed code help | wordpress |
I have created a page template for the front page of a site I am building using WordPress. I am displaying the 3 latest posts on this page and all works fine except for the display of the author of the post. I am using the following code <code> <?php $recentposts=get_posts('showposts=3'); if ($recentposts) { foreach... | Any reason this is commented out? <code> //setup_postdata($post); </code> This function setups global variables for current post and author data is pulled from one of those. | the_author() returns empty string | wordpress |
I'd like to rename files during upload and set their names to the post slug the files are being attached to, plus some random characters (a simple incremental counter will de just fine) to make the filenames different. In other words, if I'm uploading/attaching images to the post whose page slug is "test-page-slug", I'... | You'll want to hook in to the wp_handle_upload_prefilter filter (which I can't find any documentation on, but seems pretty simple). I've tried this out locally, and it seems to work for me: <code> function wpsx_5505_modify_uploaded_file_names($arr) { // Get the parent post ID, if there is one if( isset($_REQUEST['post_... | Rename files during upload using variables | wordpress |
Basically we're (ab)using Category to determine whether a post is a News post or a Blog post, and so it's not a category in the traditional sense to the outside world. I'd like the category to not be indexed by feed-readers/crawlers, only the tags. I found an easy way to do it with an easy change to 1 function in the c... | Tricky. It lumps categories and tags together pretty good. Had couple of approaches here is least messy: <code> add_filter('the_category_rss', 'remove_rss_categories'); function remove_rss_categories( $the_list ) { $categories = get_the_category(); foreach ($categories as $category) $the_list = str_replace("<categor... | How to not treat categories as tags in feeds | wordpress |
I have a need to customize some posts from the loop. Here's the deal: My site is set to 10 posts per page. On post #2,#5, #7 (on every page), I want to display specific background. What's the best solution for this kind of problem? | This should do it: <code> $real_current_post = $wp_query->current_post + 1; switch( $real_current_post ){ case 2: // Do something for 2 break; case 5: // Do something for 5 break; case 7: // Do something for 7 break; } </code> You may need to globalize $wp_query, but as long as you're using the normal template hiera... | How to track post number on the_loop | wordpress |
Which function can be used to get the user's object using the username? I've tried get_userdatabylogin() but the function seemed to throw an error: Parse error, unexpected T_STRING on line xx The function was called like so: get_userdatabylogin($username); | That function should do what you want. Are you sure the error is not elsewhere? You can also try using the <code> get_user_by() </code> ( source ) function: <code> $user = get_user_by('login', 'MaryJane'); </code> This is the same as <code> get_userdatabylogin('MaryJane'); </code> | Function Get User Object By Username? | wordpress |
I am trying to manually upgrade my wordpress to the latest version (3.0.3)-- after autoupgrade fails. After the upgrade everything works fine except for one little nagging message at the top of my admin area: An automated WordPress update has failed to complete - please attempt the update again now I search the Interne... | I think what Rarst means is that it is a .file (or hidden file) much like the .htaccess file. If you are browsing your files, there is an option to show hidden files. Once that option is chosen, you will most likely also see the .maintenance file | "An automated WordPress update has failed to complete - please attempt the update again now"-- But there is no .maintenance file | wordpress |
I don't need to search for pages in my site and only want to search posts, is there a way to do it? Thanks | The below should make the page post type no longer search-able. <code> function remove_pages_from_search() { global $wp_post_types; $wp_post_types['page']->exclude_from_search = true; } add_action('init', 'remove_pages_from_search'); </code> | How do I remove Pages from search? | wordpress |
I'm attempting to use the 'feature image' feature of Wordpress to make a full screen background, that resizes to fit the browser window using jQuery The bit I'm stuck on is adding a custom id (#bgimg) to the code generated by this: <code> <div class="background"><?php the_post_thumbnail (array(1024,768));?>... | Use get_the_post_thumbnail() instead. It allows you to pass in an array of attributes for the image tag that gets returned. For example: <code> $attr = array( 'id' => 'YOUR-UNIQUE-ID', ); echo get_the_post_thumbnail( $id, 'thumbnail', $attr ); </code> EDIT: I'm dumb. the_post_thumbnail() also lets you do that. Try p... | adding an id to the_post_thumbnail | wordpress |
My goal is to only show posts with opening hours after business hours, for a given day. So, e.g. I have a (custom) post with following meta_key and meta_value: meta_key = 'monday, meta_value = '14:00 - 22:00' The business hours are fixed: '08:00 - 18:00' I'd like to add a filter to my custom wp_query. Only, I am gettin... | You can use the WP query_posts to filter about your custom values; ean example: <code> query_posts('meta_key=my_type&meta_compare=<=&my_value=20&orderby=my_value'); if (have_posts()) : while ( have_posts() ) : the_post(); </code> But, i think you must replace the time-values for readable string, maybe wo... | Custom wp_query time filter on meta_value | wordpress |
I'm using a custom post type for a portfolio. I have a few option in there, bring saved by <code> update_post_meta() </code> , it seems to work fine, but then out of the blue (within the hour), the data deletes its self. I have looked in the DB and all custom metadata values are empty. I'm a little stumped really. Here... | I've been using this for a while to solve exactly your issue, I think I got it from the codex somewhere. But it works. <code> // verify if this is an auto save routine. // If it is our form has not been submitted, so we dont want to do anything if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) return $post_id;... | Post metadata deletes itself | wordpress |
I'm wondering why I only get one result in my search. My search query is this: http://www.norwegianfashion.no/?s=oslo+fashion+week If I search google, you'll see I got plenty of hits: http://www.google.no/search?hl=en&client=opera&hs=GTw&rls=en-GB&q=oslo+fashion+week+site%3Awww.norwegianfashion.no&a... | What template does search page use? It is either generic <code> index.php </code> or specialized <code> search.php </code> . What does Loop in that template look like? I suspect this might be Loop issue that is set to only dislpay single post, instead of iterating all of them. | Any reason why search result lists only one entry? | wordpress |
I have a little bug on my WordPress... When I added a custom field, I have no ajax, I need to saved the draft or publish to see the update. And after I saved my post, the custom field display twice. <code> name : Steffi name : Steffi </code> Help, please ! Thanks Update : Console with Firebug <code> _ajax_nonce 0 _ajax... | Hey guys, I found THE solution. Problems : Custom field display twice. No Ajax/jQuery visual feedback. If you've been working on the file <code> function.php </code> , make sure you remove extra line breaks. Particularly at the top and <code> the bottom of your file </code> ... If you have some line breaks, your xml go... | Wordpress: custom field display twice | wordpress |
I want to migrate a group's site from Joomla to WordPress. The group has a library for members and lends books for certain periods of time, etc. (Regular library functionality). Although the site doesn't have a library functionality in it now, it would be something cool to add. And there's probably some plugin to add t... | just come across this which looks like it might be what you're looking for Web Librarian by Deepsoft. http://www.deepsoft.com/home/products/web-librarian/ appears to be free, and released under a GNU license etc | Library plugin for WordPress | wordpress |
this code works fine. the problem i have is that when i submit it only checks the parent category not the subcategory even though i specified both a parent and a subcategory. please. what am i doing wrong. ohh if you look in the html chunk, the <code> 7 </code> is parent cat and the numbers after the comma are the subc... | The problem is, you can't make an array like that in PHP. Trying to cast a string that contains a comma separated list as an array just produces an array with a single value--your comma separated string. You want to use php's explode function to create the array. It takes a string an splits it into a bona fide array ba... | post to subcategory and parent in wp_insert_post | wordpress |
I'm trying to add the post content in the header but for some reason it doesn't show anything. However it does retrieve the post content. I wrote this: <code> <div <?php post_class() ?> id="post-<?php the_ID(); ?>"> <?php the_title(); ?> <?php the_content(); ?> </code> I tried and and none... | The simplest solution is to call the_post() to setup the post data before calling the template functions. <code> <?php if(have_posts()) : the_post(); ?> //your header code here <?php rewind_posts(); //to set the post pointer back to the beginning ?> <?php else : ?> //alternative header code here <?... | How do I show current post content in the header? | wordpress |
As above Background info Main problem: users pay to post an ad on the website Solution: they sign up as contributors and I publish their posts once the payment is received, after that they can make any edit to their posts | There is a capability in WordPress called "edit_published_posts". Contributors do not have this capability by default (refer to the Roles and Capabilities Codex page to see the out-of-box role configurations). You can add this capability to the contributor role with code like this: <code> // get the "contributor" role ... | How do I let contributors edit their posts after being approved once? | wordpress |
SOLUTION I've gone with Update 3 and have got it working. What I had misunderstood, was that I believed that a rewrite rule would change <code> designers/?designer=some-designer&bid=9 </code> to <code> /designers/some-designer </code> . But it is of course the other way around. I've been doing some research, but I ... | Some background on rewrite rules The WP Rewrite system looks complicated, but in fact it's not that hard to understand how it works. It is used to parse pretty URLs ( <code> /designers/ </code> ) as if they were non-pretty ( <code> /index.php?pagename=designers </code> ). The basic idea is that you have a list of rewri... | Need help with add_rewrite_rule | wordpress |
I want to create a plugin that will place a few elements on the post edit page. How do I do this? Is there an action that is run after before the post_edit page is loaded? | Here's a nice tutorial on how to create custom meta boxes in the dashboard: http://www.deluxeblogtips.com/2010/04/how-to-create-meta-box-wordpress-post.html | Extend the Admin Post/Edit page | wordpress |
My theme creates several widget areas for the end user. However, I've got a slight problem in that, if multiple widgets are dropped onto any sidebar container, the resulting code in "view source" is not wrapped in a single container div. For example, here's what it looks like Start of a single widget container: <code> ... | Sidebar functionality doesn't handle wrapping container, you need to add that on template level. Here is example markup of <code> sidebar-primary.php </code> template (taken from Hybrid theme and simplified a bit): <code> if ( is_active_sidebar( 'primary' ) ) : ?> <div id="primary" class="sidebar aside"> <?... | How do you force a sidebar widget to have a container div around all child widgets? | wordpress |
I'm creating a separate (simple) directory that does not use any internal WP permalinks or pretty link structure. I've been studying how to make my own custom SEF URLs for this part of my site, and almost have it (or thought so). I have a separate table with records like this: <code> id | section | category | co_name 1... | Modifying the URL structure always consists of two parts: one two modify the URLs you generate with your code, and one to handle the incoming URLs of the new structure. The latter part is done by modifying the rewrite rules. I have just written a detailed explanation of the relevant rewrite functionality in stackexchan... | How do I display a friendly URL link in the frontend? | wordpress |
I'd like to be able to choose an object from another custom post type I've created when adding a second type. Similar to the way you can choose an author for a post. So when creating a post of type B there would be a dropdown of all the post As that the current author has created. Is there a way to do this? Thanks for ... | The simplest way is probably this plugin: Posts 2 Posts http://wordpress.org/extend/plugins/posts-to-posts/ | Is there a way to relate custom post types? | wordpress |
Has anyone used any of the Wordpress Weather Plugins? Any recommendations? Anyone tried out more than one? Hoping to get pointed in the right direction before I dive in. | What do you actually need plugin to do? Interconnect IT folks had recently released pretty cool Weather Widget . | Weather Plugin Recommendation | wordpress |
This plugin is a simple demo test to see if I can dynamically populate a pre-existing widget area with text. In this case, my theme has created the widget area "home-header-widget" and I'm trying to populate it with the contents of 'text' below. I'm stuck at the line... <code> $sidebars_widgets[$sidebar_id] = "widget_t... | There are a few mistakes in your code: You need to specify the instance ID manually, for eg. 2. If you want to append a text widget, and not overwrite the sidebar's contents, then try using <code> $id = count($opts)+1 </code> , or you could just generate a random ID. Use the widget_ID_base-instance_ID in <code> $sideba... | Possible to preset a widget's contents via a plugin script? | wordpress |
I just installed WP 3.1 Beta 2 on my test server. I noticed that it ships with a new <code> l10n.js </code> file that gets automatically inserted into the header. I did a bit of digging and it has something to do with localization. I'm guessing that many people don't use this, so I'm wondering how I could remove it? If... | It contains the <code> convertEntities() </code> function that (as the name says) converts HTML entities to their actual value. It is mostly used for scripts that send over localization data from PHP to the JS side using <code> wp_localize_script() </code> . Just search for <code> l10n_print_after </code> in the code b... | What does l10n.js do in WordPress 3.1? And how do I remove it? | wordpress |
Is there a plug-in that can incorporate a StackExchange-like flag system on a WordPress blog? Then registered users can flag an article/post so that the admin or moderator can review the post later and decide whether the post should be published or not. | I still dint found any separate plugin for the same. However i did the same by doing some modifications in My Favorite plugin | StackExchange-like flag system for WordPress | wordpress |
Is it possible to bring intellisense (autocomplete) in the search box of the website???? | So you want more general autocomplete, rather than something specific (like blog tags for example)? If you use (or will consider using) Google Custom Search (which is very popular option to replace native WP search), they made it quite easy to enable native autocomplete with it. See: Autocompletion of queries in Custom... | intellisense in wp search | wordpress |
I would very much like to know if there is a widget that exists that would let me show the current page's associated taxonomy terms (preferably hierarchically) in a widget. For example, if the current post has a Taxonomy term "Tom Hanks" in the Taxonomy of "Actor", the widget would list "Actor" then "Tom Hanks". Even t... | This is a simple conversion of the Taxonomy terms list plugin to a widget: <code> class WPSE_5394_Widget extends WP_Widget { public function __construct() { parent::__construct( 'wpse5394_widget', 'Taxonomy Terms List' ); } public function widget( $sidebar_args, $widget_options ) { if ( ! is_single() ) { // I don't thi... | List a current posts' taxonomy terms in a widget in Wordpress | wordpress |
Hey all, i'm using the plugin wp-Lifestream in its 0.99.9.6 version (the 0.99.9.8-BETAdoesnt work for me) and i was wondering if it was possible to associate a fb page feed rather than a profile feed. So far i didnt find any answer to that. Thanks in advance. | If you're talking about subscribing to a page's wall (not notifications feed), then yes, you can do that. To find the feed for the wall, the easiest thing is to visit the target Facebook page in Firefox. Click the RSS icon in the address bar and choose "Subscribe to THE PAGE NAME". This will bring you to the actual fee... | How to grab facebook page feed? | wordpress |
I was wondering what you guys are doing to dress up your blogs ? any plugins that add some cool effects like snow flakes, maybe greeting popup, footer, music, header rotation, list of new years resolution, wishlist widget display .... I was wondering what you doing to dress up your blog around holidays, maybe we can co... | Themes The Free Themes Directory at WordPress.org just updated its list of featured themes, and now includes two different Christmas-related themes: Red Christmas This Christmas Plug-ins The most commonly used holiday/Winter plug-in is the snow plug-in featured on WordPress.com: Snow Storm There are also 35 different p... | Suggestions for Dressing up blog for the holidays | wordpress |
i have a piece of code which is helped to display the description of custom taxonomies but i want to put <code> <h1> </code> tag for the title of description, but that description box doesn't takes html tags, so how can i implement html tags to my description here is my code <code> <div class="featured post"&g... | H1 tags around the descriptions? <code> echo '<h1>' . term_description() . '</h1>'; </code> UPDATE: Add link to plugin to allow HTML in term descriptions. WordPress Plugins - Allow HTML in Category Descriptions This will work with custom taxonomies to. http://wordpress.org/extend/plugins/allow-html-in-categ... | term_description help | wordpress |
Just a quick question that might help a tad bit with security. I noticed that the readme.html file has the version number listed. It reappears after each upgrade and so do the licence.txt, and wp-config-sample.php. Is there a easy way to have WordPress auto remove these files after an upgrade? I already block the versi... | You don't really need to remove these files. It's much easier to just block access to them. If you are using pretty URL's you already have an .htaccess file. Using .htaccess to block the files is secure and you only have to add a directive once. Blocking files is done by adding a directive to .htaccess like this: <code... | Prevent access or auto-delete readme.html, license.txt, wp-config-sample.php | wordpress |
I'm testing a script to create a database insert. Is this the correct syntax for the insert or do I need to obtain a reference to global $wpdb and use that? <code> <?php /* Plugin Name: Test Database Insert */ function test_db_insert() { INSERT wp_terms(term_id, 'name', slug) VALUES (1, 'test', 'test'); INSERT wp_te... | This seems like raw SQL that won't make sense to PHP at all. You can run this queries, as raw queries using <code> $wpdb->query() </code> but it's more proper to use its <code> $wpdb->insert() </code> method. See wpdb Class > INSERT rows in Codex. | Correct syntax for database inserts from plugin? | wordpress |
i have a function in my plugin <code> append_the_content($content) </code> this is used to display my function inside the post, but it is coming before the post, i want to make it after the post, for this i tried this code, but then too its not coming <code> function parse_twitter_feed($feed, $prefix, $tweetprefix, $tw... | Edited, try this <code> <?php function parse_twitter_feed($feed, $prefix, $tweetprefix, $tweetsuffix, $suffix) { $feed = str_replace("&lt;", "<", $feed); $feed = str_replace("&gt;", ">", $feed); $clean = explode("<content type=\"html\">", $feed); $amount = count($clean) - 1; $output = $prefix; fo... | append_content help | wordpress |
can anyone tell me what's the best way to redirect a general category page to a specific one? for example: <code> categoryName1 -> subcategoryName1 -> subCategoryName2 -> subCategoryName3 categoryName2 -> subCategoryName4 </code> and when i click in the menu "categoryName1" (but not on "categoryName2") i'm ... | If you are looking for some simple redirect solution, in a stackexchange-url ("previous answer") the following two were suggested: Redirection (Wordpress Plugin) Simple 301 Redirects (Wordpress Plugin) With those or a comparable plugin it should be possible that you can add the redirects you need to your site. | redirecting from a general category page to another specific one | wordpress |
Basically I want to develop the ability to search comments on my site. A form with input field where the visitor can enter a search string, which tells WP to display only comments that contain that search phrase. I think the best way to do this is by making a custom comments_template() function, then filtering out comm... | You create your own <code> comments_template </code> , it can be a duplicate function of the default one, the only changes are the database queries anyway. But you need your own function as WP doesn't help you with filters here. SO, name it <code> my_comments_template() </code> : <code> $filter = mysql_real_escape_stri... | Comment filtering (search) | wordpress |
I am developing a site that will need to have a slider with 4-8 images, but only on certain page-types. These pages must be editable and the sliders must be able to be updated whenever I'd like. I can easily do the slider and the page theme, it's just the dynamic slider area that is getting me. I've been theming wordpr... | Well your options are to hook the slider into the page/post media gallery using something like get_children or get_posts attachments. Another option is to use a custom "image" field for the slider images and query them using query_posts. | Custom Slider Per Page created | wordpress |
I have a site that I'm having so much trouble to try to sort the order of a list of Pages based on their tag. I've build this site over a year ago, with wordpress at the time there isn't any tag support for Page, so I used the plugin called tags4page. And I believe they still don't have tag support for pages ? Anyhow, ... | You could merge order parameters into the query when it's a tag page.. Replace the following lines. <code> <?php /* If this is a tag archive */ if( is_tag() ) { ?> <h2>Lawyers in <i><?php single_tag_title(); ?></i> Practice Area:</h2> <?php } ?> </code> with.. <code> <?php i... | Sort list of Wordpress Page under tag when is_tag() called | wordpress |
My girlfriend has a very popular blog, but we are growing beyond current bandwidth limit (1TB). Adsense doesn't pay enough for an expensive CDN. What recommendations can you make about image hosting. Preferably a plugin, or something that can easily be implemented. | Its not recommended often enough, but Flickr is an excellent image host for blogs as well. Their pro account costs only $25/year. You get unlimited image, video uploads and no bandwidth limit. If you don't want your blog image uploads populating your personal photostream, you can easily create a separate account for it... | Best image hosting service | wordpress |
I've found a widget that I need to add to more than one sidebar widget area. However, apparently its been coded so that once you drag it from "available widgets" over to a sidebar widget, it disappears from the "available widgets" listing. I'd like to use it in more than one sidebar. What determines this in the widget ... | Sounds like your widget written in the old (pre 2.8) style rather than using the widget class. If that's the case, you need to add code in a few different places to handle multiple instances (it's not a simple option you can turn on or off). Check out this page in the Codex, and this article about creating a multiple i... | How to add multiple copies of a widget from "available widgets" | wordpress |
I would like to upload a PDF file with spaces in it, and I want to do this using the uploader in the rich text editor (really, I want other, less savvy people to be able to do it, so convoluted workarounds are not really an option). Trouble is, Wordpress (3.0.3) insists on replacing spaces with hyphens and lowercasing ... | "despite the fact that it's just not necessary" I think you'd be surprised by how unnecessary looking stuff has a tendency of becoming absolutely necessary on some poorly configured servers. Else yes, it can be overridden using filters. You're looking into overriding the stuff in <code> sanitize_file_name() </code> , w... | Prevent renaming of uploaded media | wordpress |
I want to create a Groupon.com clone. Do you think WordPress is the right system? If not, do you have any other recommendations? Any tips/tricks you have? What are the recommended plug-ins? If anyone has any better CMS option, I'd love a recommendation... | You can build a clone of just about any website using WordPress. The question, though, is how much work are you willing to put into it? Since you're already asking for tips/tricks and plug-ins, I'm guessing you want to make a quick clone that requires little to no additional development time. That said, here are the ba... | WordPress as a Groupon clone | wordpress |
I have a PHP script that I need to run as a cron job. However this script needs access to the WP API ( <code> get_pages() </code> , <code> get_post_meta() </code> and <code> get_permalink() </code> specifically). I've followed the instructions at http://codex.wordpress.org/Integrating_WordPress_with_Your_Website, but t... | WordPress expects the $_SERVER variables to be setup as if it were a normal web request. Also, I would suggest loading wp-load.php instead of wp-blog-header.php since you probably don't need the WP class or the template loader to run. Here is how I normally start any scripts I need to interact with WP from command line... | Access WordPress API Outside of WordPress (command-line PHP) | wordpress |
The dashboard conveniently tells me how many posts, pages, and comments I have. I would like it to tell me how many articles, videos and cartoons I have too (three custom post types registered with my theme). How would I go about including these into the "Right Now" panel on the dashboard? | Yes, there are several actions within that widget, including <code> right_now_content_table_end </code> . Example: <code> function my_right_now() { $num_widgets = wp_count_posts( 'widget' ); $num = number_format_i18n( $num_widgets->publish ); $text = _n( 'Widget', 'Widgets', $num_widgets->publish ); if ( current_... | Adding Custom Post Type Counts to the Dashboard | wordpress |
I have a custom role, "Ministry Representative", which is able to log in and create and manage their own "Opportunities" and "Events", which is each a custom post type. On the front end of the site, you can filter opportunities or events by "Ministry", which is a custom taxonomy associated with both the "Opportunities"... | I was able to come up with a work around! First, I used Role Scoper to limit a user account to a specific term - in this case, a Ministry Representative is limited to the name of their Ministry in the "ministries" taxonomy. Then, I used the WPAlchemy class to create a custom metabox that would list the terms and, since... | Associating an "author" with a custom taxonomy | wordpress |
I am looking for a way that I could add some code to my wordpress template to display the time of a post in relative terms. So if, for example, I posted something 5 minutes ago it would say something along the lines of Posted 6 minutes ago or 2 days ago, or 1 week ago. You get the idea. Could anyone give me some guidan... | WordPress actually has an obscure and little known function called <code> human_time_diff() </code> that does this. It takes two arguments; the first is the earlier timestamp, and the second is the later timestamp. Both should be Unix timestamps. The first argument is required, but the second is optional, and will use ... | Relative Time On Posts | wordpress |
I'm using wordpress for a large non-profit with many sites. I'd like to decrease the amount of installation steps for the people setting up their sites. Is it possible to make a WP install that automatically activates the plugins, themes and default content I choose? | Sure. <code> wp_install_defaults() </code> is a pluggable function. (As are wp_new_blog_notification() and wp_upgrade(), in case you ever need to override those too.) <code> # in wp-config.php if ( defined('WP_INSTALLING') && WP_INSTALLING ) { include_once dirname(__FILE__) . '/wp-content/install.php'; } # in w... | Automatically enable custom theme, plugins and default content on installation? | wordpress |
this code is working perfect for me, but just want to know, how can i bring this after my post, currently all my tweets are coming before the post, how can i make it before the post?? <code> function parse_twitter_feed($feed, $prefix, $tweetprefix, $tweetsuffix, $suffix) { $feed = str_replace("&lt;", "<", $feed)... | I'm not completely sure what you want, but I noticed with position that echo not always give the right position try to build up a large string and then echo the complete results or just return the results. like this: $output .= echo $prefix; $output .= echo $tweetprefix; $output .= echo $cleaner[0]; $output .= echo $tw... | plugin backend help | wordpress |
How can I create a form that allows people to submit questions / ideas that once submitted creates a post in wordpress? | The excellent Gravity Forms plugin makes this extremely easy. It's not free (starts at $39), but I highly recommend it. I am not affiliated with the Gravity Forms team in any way - I'm just a satisfied customer! | Form that creates posts | wordpress |
I have the following foreach witch gets all the content in several groups. I am using Magic Fields. <code> <?php $omtaleseksjoner = get_group('Seksjoner'); foreach($omtaleseksjoner as $seksjoner){ echo "<h3>" . $seksjoner['sectiontitle'][1] . "</h3>"; echo $seksjoner['sectioncontent'][1]; } ?> </code>... | You can keep tracks of number of cycles and run extras when counter matches. Something like this: <code> $array = array(1,2,3,4,5); $i = 0; foreach($array as $set) { if(2 == $i) echo 'after 2'; if(4 == $i) echo 'after 4'; echo $set; $i++; } </code> I must note that this is more of PHP basics and really has nothing to d... | Add content in between of foreach | wordpress |
i'm using this plugin to show an exapandable/collapsible widget-menu in my sidebar. http://wordpress.org/extend/plugins/folding-category-widget it works very well! the question, not directly connected with this plugin, is: how can i also show in the list, all posts related to a category (title + a href)? for example: <... | Well the simplest way I can think of is something like this... <code> <ul class="categories"> <?php $categories = get_categories(); //can add parameters here to swtich the order, etc; if(!empty(categories)): foreach($categories as $i => $category): ?> <li class="category"> <span><?php echo... | show posts names and links in the sidebar list as categories child | wordpress |
I have a custom page template that loops through all custom posts with the post_type of "product_listing" AND the custom taxonomy "product_cat" of "shirts" and returns 4 posts per page (as seen below:) <code> <?php $loop = new WP_Query( array( 'post_type' => 'product_listing', 'product_cat' => 'shirts', 'posts... | Apparently I needed to loop the function to set the variable: <code> <!-- BEGIN CODE FOR PRODUCT AREA --> <?php $prod_cats = get_terms('product_cat'); foreach ($prod_cats as $prod_cat) { $cat_name = $prod_cat->name; ?> <div id="products"> <!-- post begin --> <?php $loop = new WP_Query( arr... | Dynamic variable for custom taxonomy in loop? | wordpress |
I just installed a friends blog on my LAMP stack, which has mod_rewrite enabled (I'm using it for clean URLs on my Drupal installs on the same server). For some reason, WordPress (3.0.3) isn't recognizing that mod_rewrite is enabled. In the Permalinks menu it's displaying options for PATHINFO permalinks (with index.php... | The output of $_SERVER['SERVER_SOFTWARE'] is WebServerX That looks like your problem - check out this line in <code> wp-includes/vars.php </code> : <code> /** * Whether the server software is Apache or something else * @global bool $is_apache */ $is_apache = (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false || s... | mod_rewrite enabled but Permalinks show index.php | wordpress |
What is the "best" setup for <code> robots.txt </code> ? I'm using the following permalink structure <code> /%category%/%postname%/ </code> . My <code> robots.txt </code> currently looks like this (copied from somewhere a long time ago): <code> User-agent: * Disallow: /cgi-bin Disallow: /wp-admin Disallow: /wp-includes... | FWIW, trackback URLs issue redirects and have no content, so they won't get indexed. And at the risk of not answering the question, RE your points 2 and 3: http://googlewebmastercentral.blogspot.com/2008/09/demystifying-duplicate-content-penalty.html Put otherwise, I think you're wasting your time worrying about dup co... | What is a good robots.txt? | wordpress |
How can I show 'Read more' links in rss feed instead of showing excerpt? The settings in reading only allow to choose between full content and excerpt. | You can, but you shouldn't. RSS feeds are built in XML. Not in HTML. Links in XML don't have meaning because they're HTML elements. However, because XML can be read by most HTML parsers (i.e. web browsers), you can easily mistake an XML document for an HTML one (the prevalence of XHTML helps to blur this line even furt... | Show 'Read more' in rss feed | wordpress |
This is driving me nuts and I'm sure it's simple but nothing I search for comes up with a simple structure (everything is very complex). I have a custom post type "product_listing" and a custom taxonomy of "product_cat" (which is hierarchical and should be have like categories). I simply want my URLs to look like this:... | Change <code> slug </code> in your post type arguments to <code> products/%product_cat% </code> , and <code> slug </code> in your taxonomy arguments to just <code> products </code> , then flush your rewrite rules. WordPress should now handle <code> /products/my-product-cat/post-name/ </code> ! Now finally, we need to h... | Custom post types, taxonomies, and permalinks | wordpress |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.