question stringlengths 0 34.8k | answer stringlengths 0 28.3k | title stringlengths 7 150 | forum_tag stringclasses 12
values |
|---|---|---|---|
Say I have the following taxonomy terms: <code> Term 1 Term 1.1 Term 1.2 Term 2 Term 2.1 </code> How can I get only posts that are assigned to Term 1 and not include those that are assigned to Term 1.1 or Term 1.2? For example: <code> $pages = get_posts(array( 'post_type' => 'page', 'numberposts' => -1, 'tax_quer... | In looking at the WP_Tax_Query class in /wp-includes/taxonomy.php, I found that there is a 'include_children' option which defaults to true. I modified my original get_posts() call with the following, and it works great: <code> $pages = get_posts(array( 'post_type' => 'page', 'numberposts' => -1, 'tax_query' =>... | get_posts assigned to a specific custom taxonomy term, and not the term's children | wordpress |
I'm using Drill Down Ipod Menu and I'm really like the style of showing submenus , but I have two problems with it. 1-when i load a page it shows all submenus open for a second and I experience a Flash of Unstyled Content , it was good for a while when I changed style css but it backed again (i don't know if there's a ... | Your best bet would be to consult the author of plugin since it's using a custom jQuery plugin script. how can I prevent showing my menu un styled? You can add a class of <code> no-display </code> to the elements of the menu that are un styled as the page loads then in css set <code> .no-display {display:none;} </code>... | jQuery Drill Down iPod Menu FOUC and Selecting Current page | wordpress |
I'm looking for a nice way to attach an image as a thumbnail to a category. No plugin that I found does this. I have a category loop and it would nice to display a category thumbnail, not just the name and description. | Use the plugin Taxonomy Images by @mfields. | Thumbnail for categories / taxonomies plugin? | wordpress |
I am creating my first website in wordpress, and I have noticed some strange behavior. The website is really slow on the initial load. When I open the website after some time of inactivity, let's say an hour, the site loads extremely slow, over 5 sec. After that the website is just fast. Even when I close the browser a... | Maybe your PHP is running per CGI or FastCGI in a separate process that shuts down after a while of inactivity. Does it change if you register at an uptime monitoring service ? A cache plugin like W3 Total Cache may help too. | My website is slow on the initial load | wordpress |
I'm developing a functionality to let only customers and doctors have access to exam results. But i'm not so sure about the strenght of my code in securing view only to those authorised. I've gotten so far as to create the 'exam' post type to handle the information and added the metabox to save doctor and patient info ... | The easiest way is to use <code> if ( current_user_can( 'capability' ) ) // do stuff </code> . You'll find more about capabilities in the codex. You can also inspect the data some user has attached with normal <code> var_dump() </code> and else. I also got a pretty old plugin for that. But I'm not sure if it still work... | Restricting access to content | wordpress |
I have a code that call <code> get_the_title() </code> and it works, but <code> get_the_excerpt() </code> return empty. How can i make it work? This code is inside a plugin called "WP Facebook Open Graph protocol". Here's the part i want to change: <code> if (is_singular('post')) { if (has_excerpt($post->ID)) { echo... | got it using <code> my_excerpt($post->post_content, get_the_excerpt()) </code> and using the <code> my_excerpt() </code> function from stackexchange-url ("Using wp_trim_excerpt to get the_excerpt() outside the loop") | Get excerpt using get_the_excerpt outside a loop | wordpress |
I do not want to use any existing plugin. For WordPress-less projects, I would specify a PHP file in <code> href </code> <code> <a href="FileOnMySite.php">Click here</a> </code> <code> FileOnMySite.php </code> will be like <code> header('Location: http://www.MyaffiliateLink.com') </code> But I'll definitely... | I don't see why the same method can't still work in a WordPress site. If you specifically specify a file to link to that is a valid PHP file, available on your server, then it will still hit that file instead of hitting WordPress. If you are having issues with this working, make sure you don't have any rewrite rules in... | Writing a link cloaking plugin | wordpress |
I have a page with the slug <code> blog </code> . Mysite.com/blog correctly renders from the template file page-blog.php. However, it does not execute footer code from my theme that's conditioned on <code> is_page('blog') </code> , nor does it have an "Edit Page" link in the Admin bar. I also have a custom post type ca... | The problem was due to a secondary loop in the page—before this loop, the page knows it's a page; but after the loop (and in the footer, where the Admin Bar and my code would be rendered), the page thought it was the last post of the secondary loop. Neither wp_reset_query() nor wp_reset_postdata() worked; I am guessing... | Why doesn't my page know it's a page (won't return true for is_page())? | wordpress |
I'm pretty much a WP newbie, and I've noticed that in a lot of themes, there is the exact same code for displaying posts in three different places (single.php, archive.php, index.php etc) This just bugs me. It doesn't seem right to me, a programmer always trying to code as efficiently as possible. What is the best way ... | you could move the loop content into its own file and share that between the different template files using get_template_part() | Isn't the way posts are displayed very unefficient? | wordpress |
From an SEO perspective, i'm trying to add conditional title tags to my WP theme such that it echos a piece of text based on various categories. Assuming that my category id's are 1, 2, 3, 4 Then i'd like to add Title 1 if category id = 1, title 2 if category id = 2 and so on. Could someone assist in the correct php sy... | See codex page for category conditional tags - http://codex.wordpress.org/Conditional_Tags#A_Category_Page You can use them like so: <code> <title> <?php if ( is_category( '1' ) ) echo 'This is the news category'; ?> </title> </code> | Help with adding conditional title tags to header.php | wordpress |
I checked this post here stackexchange-url ("Making a plugin file accessible via url rewrite?") which seems to have the same problem as me but its for a plugin. But so far i am getting 404. <code> add_action( 'init', 'my_rewrite' ); function my_rewrite() { global $wp_rewrite; add_rewrite_rule('/$', '/wp-content/themes/... | Ok here is a test working solution: <code> <?php /* Plugin Name: wpse26719 Plugin URI: http://en.bainternet.info Description: Need to make a php file inside theme accessible via url Version: 1.0 Author: Bainternet Author URI: http://en.bainternet.info */ // Register a URL that will set this variable to true add_acti... | Need to make a php file inside theme accessible via url | wordpress |
In the book Beginning WordPress 3 the author advises that changing the default WP table prefixes can provide some slight security advantage (protects from SQL injection scripts). I found several articles that explain how to do this as well. I've also seen people arguing that it's not all that helpful. I thought I would... | I do this on every WP site I set up, and while it's no panacea for SQL issues moving forward as it's more obscurity than security, it does make me feel all warm and fuzzy inside. :) I have never had issues with it since I started the practice two years ago. A key to the process is pointed out in both articles you've li... | Changing Table Prefixes - once done, am I good to go going forward? | wordpress |
My server was hacked this weekend. By the Russians! Of the 50+ domains on my server, every single one had a hacked .htaccess file which was redirecting search results and a few other things to a russian site. I'm assuming that one of the many, many wordpress installs has a plugin with a security flaw. Two questions: Is... | Personal Opinion: I had the same thing with (mt) mediatemple twice last year. They told me/us that it was a wordpress issue, but it wasn't. I heard the same from dreamhost last year. So: don't think about it too much, just remove the hack and blame your host (again). Anyway: You could stackexchange-url ("read this thre... | What does a security risk in a plugin look like? | wordpress |
I know there are a few plugins (Custom Fields Template seems to be the most popular one) that lets me insert custom fields into the new-post.php template. But I'm wondering if I can add in a few fields without using a plugin -- just as a mock-up. Do I have to go into the core? | This article will get you there: http://andrewferguson.net/2008/09/26/using-add_meta_box/ | Inserting custom fields into new-post.php without using the Custom Fields Template plugin? | wordpress |
I have a wordpress network site. I have many sites in my network. Lets say i have two subsites like wordpress.mysite.com,joomla.mysite.com. If the user post wordpress related topic in joomla site then i would like to migrate it from joomla to wordpress. Just like stackoverflow. Is there any good multisite plugin availa... | I couldn't find best solution for this question. If anyone have this question as mine then you may check this plugin. This is not the best one. But just a recommendation. http://wordpress.org/extend/plugins/multipost-mu/ It actually duplicate the post. Thanks | Post migration from one site to another site in a network | wordpress |
I'm trying to style a custom menu here so that I can let other people manage this site alongside myself. What I'm trying to do is remove the text for the top level links while leaving the <code> a </code> as a block so the links are clickable, however when I try and remove the text using <code> text-indent: -999em; </c... | I think you can use the text-indent for this level, but you must set the text-indent for all a -tags of the class sub-menu also set to 0, not -999px. Example: <code> #menu-main-navigation .link-experience a { display: block; height: 63px; width: 167px; text-indent: -999px; } .sub-menu a { text-indent: 0px !important; }... | Custom menu styling | wordpress |
I have the following menu in my header: <code> <?php $args = array( 'menu' => 'Main Menu', 'container' => false, 'depth' => 1, 'items_wrap' => '%3$s', 'walker' => new Bar_List_Walker_Nav_Menu ); wp_nav_menu($args); ?> </code> and I want to make the output look like this: <code> link1 | link2 | link... | You can use the menu order inside the item to see if it's not first. If it isn't have it draw the character before the anchor. <code> class Bar_List_Walker_Nav_Menu extends Walker_Nav_Menu { private $separator = " | "; function start_el(&$output, $item, $depth, $args) { if($item->menu_order > 1){ $output .= $... | Bar separated navigation by extending Walker_Nav_Menu | wordpress |
I have the following code <code> $genres= array('action', 'comedy', 'horror'); foreach($genres as $genre){ $ret = wp_set_object_terms( $postId, $genre, 'genres'); } </code> But this code associates only horror as the genre. When I checked the DB too, I don't have a record for action and comedy. How do I associate all t... | You can pass an array of terms to <code> wp_set_object_terms </code> , there is no need for the for each: <code> $genres= array('action', 'comedy', 'horror'); $ret = wp_set_object_terms( $postId, $genres, 'genres'); </code> | wp_set_object_terms not working inside loop | wordpress |
need to customise a plugin function but would rather not edit the plugin itself so updates wont remove the custom changes. function iss in a class called UserAccessManager and the function is; <code> public function showGroupMembership($link, $postId) { $uamAccessHandler = &$this->getAccessHandler(); $groups = $... | I'm afraid you cannot alter the output of this function unless you directly modify the plugin code. The plugin author hasn't given you any filter to use. So what can you do about it? Continue to alter the plugin file and update each time the plugin updates. Ask the plugin author nicely to add a filter to this function.... | overwrite a plugin function in functions.php | wordpress |
I am using timthumb as the image size management script throughout my wordpress site but I just noticed that an empty image tag shows up even when there is no thumbnail. <code> <?php if(has_post_thumbnail()): $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full'); ?> <div class="wp-ca... | As commented above, you don't have to use TimThumb at all to get additional image sizes for your uploaded images. WordPress ships with the <code> add_image_size() </code> function. <code> // functions.php add_action('init', 'wpse26655_add_additional_image_sizes'); function wpse26655_add_additional_image_sizes() { add_i... | Show post thumbnail only if it exists using timthumb | wordpress |
I'm a bit confused as to why this isn't working - although it must be said I'm not that sure what <code> apply_filters() </code> and <code> add_filter </code> are doing, so any general tips would be great too! I want a query that brings up the five earlier posts on a single post page. I am sending the current post's da... | What are you attempting to filter? I'll assume you're trying to add a filter to a filter hook called <code> posts_before </code> . In which case, you need to add your filter to this hook, via <code> add_filter() </code> : <code> function mytheme_filter_posts_before( $where = '', $date) { $where .= " AND post_date < ... | What do add_filters() and apply_filter() do? | wordpress |
After long time am here,I have one question. I Installed my wordpress in localhost and i moved to live,while i forgot the admin password,so i reset it by phpmyadmin(using md5).now i try to login by using with correct password it's redirect to This page and shows You do not have sufficient permissions to access this pag... | Occasionally I've seen issues doing a manual reset of the password if salts have changed, or if there was an issue with the account before the reset. Some things to try: Are you sure you reset the password for the main admin account, usually ID #1? Trivial, I know, but has happened to me in the past. Try using the Emer... | You do not have sufficient permissions to access this page | wordpress |
I have some data that I'm pulling from an XML source and would like to display it in Wordpress. One solution would be to take the static markup that my theme generates and spaghetti-code my page with some PHP that grabs the data from the XML and prints it in the page. Easy enough, but now every time I make a change to ... | I would make a plugin out of the code that you are using to pull the XML. I've done this before for a client that was using a calendaring system that was a set of PHP files. I wrapped the calls to the calendar files in a plugin, and just called what I needed to from there. This preserved the look and feel of the site w... | Dynamic page outside Wordpress | wordpress |
Is there some guideline or rationale behind why some WP code functions are prefixed with <code> wp_ </code> ? eg: <code> wp_insert_post() </code> vs. <code> update_post_meta() </code> | This makes not that impressive answer, but - none . <code> get_ </code> is suffix usually means function returns something, <code> the_ </code> that function echoes something. <code> wp_ </code> doesn't carry technical meaning and inconsistency in naming is from many developers participating and lack of movement to uni... | Why do some core functions get wp_ while others do not? What's the rule? | wordpress |
I have a query in a custom widget (my first one!) which, if it's of custom post type <code> book </code> , retrieves the post ID. This then gets used in a WP_QUERY to retrieve data about the page. This works perfectly when in the static sidebar.php, but not in either a dynamic PHP Widget or as a custom widget in functi... | Solved it! I replaced <code> $ww_book_id = $post->ID; </code> with <code> $ww_book_id = get_the_ID(); </code> I'm not sure why <code> $post->ID; </code> was referencing all the posts in the widgetized version of this code. If anyone can tell me, I'd be very curious. | Code in custom widget queries all posts, when it should only query the current post | wordpress |
I'm currently designing a site for a client and I don't want anyone to be able to navigate to the homepage and see it. So currently the site is located in a subfolder of the main domain. Like so: http://gointrigue.com/beta/ What steps do I need to take to move the site to simply http://gointrigue.com/ when we are ready... | See Moving WordPress « WordPress Codex , or, keep all WP files (except index.php) in /beta/ and see Giving WordPress Its Own Directory « WordPress Codex. Use WordPress › Absolute Privacy « WordPress Plugins to make WP private until launch. | Best way to transfer Wordpress install to root of directory when I'm ready to launch? | wordpress |
I've got this category setup that includes several posts. By design it's not a blog, but a staff listing. Currently all of the staff members have their own posts with the category. I'd like to be able to sort the order they are displayed in in their parent category. How do I go about doing this in the most user friendl... | Now that I have a better understanding of the issue, I would recommend using custom fields to sort your posts. You can have a custom field (e.g., "order") and use it to indicate the order of your posts. You then need to use a custom query to order these posts when they are displayed. You can use a custom query like the... | Setting Custom Sort Order of Posts within a Category | wordpress |
In any SE site, there are suggestions that pop out when you are writing in the Tag field. Is there any way of doing something similar in Wordpress? (a simple vertical list is enough). (Maybe helped with jQuery). | It should do this by default if there are tags to suggest, but I think there's a little bit of a delay before the suggestions show. You can also choose from your most used tags, which some might find easier to use. | Is there any way of making post tags (or custom post type tags) pop up as suggestion as in StackExchange sites? | wordpress |
I'm about to create my own options pages for my WordPress theme and I'm a bit confused. I've seen a lot of themes that used arrays to generate options pages, it looked like this: <code> $options = array ( array( "name" => "Welcome Message", "type" => "title"), array( "type" => "open"), array( "name" => "Tit... | I would strongly recommend following the Theme Review guidelines for Theme Settings and Data Security . (If you intend for your Theme to be hosted in the WPORG repository, you will be required to follow these guidelines. Here's a brief summary: Themes are required to prefix all options, custom functions, custom variabl... | Two Ways Of Creating Wordpress Options Pages | wordpress |
By default WordPress prints http:// in front of URLS users add in their profile, which are called using the following code: <code> <?php the_author_meta('user_url'); ?> </code> Could somebody provide me the code to strip these URLS of "HTTP://" by default? (While still working as a link and not touching WP's back... | Assuming that the author's id is <code> $author_id </code> , the following code should work. You can of course use this to create your own function. <code> <?php $url = get_the_author_meta('user_url', $author_id); ?> <a href="<?php echo $url; ?>"><?php echo str_replace('http://', '', $url);?><... | Removing "HTTP://" From the_author_meta? | wordpress |
I notice that many Wordpress tips websites recommend using wp totalchache and similar plugins. I tried it on one site that gets a relatively small amount of traffic, and hardly notice a difference in load time. Is it smart to set up as a general rule, or does it it really depend on the site traffic? Same question for C... | Static page cache is trade-off of resources for speed. The larger and more complex site is, the more resources it takes to cache it. Since there is no such thing as unwanted speed , static cache of small sized site is one of the best performance improvements possible. Especially on shared hosting where other tweaking o... | Does a low traffic Wordpress site need a caching plugin and a CDN | wordpress |
I'm forced to use manual excerpts on a number of my posts to integrate them with a shortcode plugin. However, this is interfering with how they're being displayed on an archive page (using a page template). Is there a way to force WordPress to display an automated excerpt (ie, the first 80 words) on one page template o... | You can utilize the <code> wp_trim_excerpt </code> filter. In your callback function that filters the the excerpt text, you can test for the presence of a certain template; then, if that template is being used, you can go ahead and alter the excerpt in any way that you see fit. In order to determine which template is b... | Force WordPress to NOT display the manual excerpt | wordpress |
I'm working with custom post types to create a custom "product review" type. I'm customizing the UI to have fields for the "Reviewer", "Product", and their "Review". This doesn't really require a post title though, so I've removed that field. This is all working fine, but when I go to look at all Product Reveiws, the t... | Jeremy, Excellent work not just leaving it at "Auto Draft". It's tricky when these types of CPTs don't have titles. Here is some code I've used to accomplish a similar task. You'll need to adjust this for your situation, but it shows you a way to get this done. In particular, you can use the <code> wp_insert_post_data ... | Automatically generate custom post title based on meta | wordpress |
Is there a plugin to notify commenters of one post to receive emails about new comments made on that post? Only commenters who entered emails will be notified. | check this plugin out: http://wordpress.org/extend/plugins/subscribe-to-comments/ | Notify commenters about new replies | wordpress |
If anybody knows where to find a most popular tags hack, I would be forever grateful. I've searched and searched to no avail. | check this plugin: http://wordpress.org/extend/plugins/most-popular-tags/ And/ or see this codex: http://codex.wordpress.org/Template_Tags/wp_tag_cloud | Can't Find a "Most Popular Tags" Hack Anywhere | wordpress |
I'm currently building a simple intranet powered by wordpress. I need to show the stats (most read articles, user logins, etc..) to the administrator, but I can't use google analytics as the install is on a VPN without internet access. Do you know any reliable plugin to record and show stats on a local install of wordp... | I would recommend installing Piwik on your intranet using one of their plugins, though it will work just fine as a stand alone. http://piwik.org/ http://piwik.org/blog/2008/06/new-plugin-wordpress-piwik-integration/ | Stats for a wp powered intranet | wordpress |
http://i.stack.imgur.com/Yr35p.jpg As you can see in the picture above. I got two links for each page. I'm using <code> <div class="pagelink"><?php wp_link_pages('pagelink=Source %'); ?></div> </code> for the top one and the bottom one is automatically appearing because of <code> <!--nextpage-->... | Your theme is using old and deprecated function <code> link_pages </code> to display page-links for paginated posts. Just replace this chunk of code: <code> <div class="pagelink"><?php wp_link_pages('pagelink=Source %'); ?></div> <div class="format_text"> <?php the_content('<p>Read the ... | Getting two wp_link_pages output | wordpress |
I'm using the bbpress plugin. It has a custom post type called forums . I used to sort posts by changing its publishing date. But you can't do that with this custom post type. Any suggestions? | i used this code to create custom post template for specific post type <code> define(SINGLE_PATH, TEMPLATEPATH.'/single'); function product_single_page_template($product) { global $wp_query, $post; $type = get_post_type(); if ($type==true) if(file_exists(SINGLE_PATH . '-type-' . $type . '.php')) return SINGLE_PATH . '-... | What's an easy way of sorting custom post types manually? | wordpress |
I'm trying to make a layered wordpress menu, out of categories. Here's how it's going to look: I have no clue how to develop this, can't do it with <code> get_posts </code> (not sortable by parent/children), or <code> wp_list_categories </code> (can't pull thumbnails). Also, I have to assign thumbnails to categories so... | although @roikles offers a way to do it, I don't think it is very flexible as you will have to go back in the code when you want to add a new category. Another way of doing it can be to add the image of the subcategory as the description of the subcategory. To be able to do so, you will first need to allow XHTML in cat... | Implementing a tricky wordpress menu (nested categories + thumbnails) | wordpress |
I have a multiple-site WordPress install. I have decided to centralize as many of my libraries as possible into one spot, for obvious organizational reasons, and in order to reduce bloating. Many of those libraries can be used both in plugins and themes. My first idea is to create a ' myLibs ' (or other name) directory... | I would recommend creating a plugin that holds all of your libraries. In the main plugin file, set a constant that defines the path to the plugin folder so you can easily include the files with your other plugins/themes. | Where to save common libraries? | wordpress |
Are there any WordPress specific Javascript functions that could be used as helpers when writing custom code? I am thinking specifically of one that would pull back the base URL of your install, but any helper functions built into WordPress would be nice to know. | WordPress installs with a number of libraries/classes/plugins/etc that you can enqueue and use. For base url specifically, or any vars in general you need to access from javascript, use the api php functions, then pass it to your javascript via wp_localize_script . | Javascript Helpers | wordpress |
I'd like to be able to enter a post ID into the search box in order for the exact post to be returned in the search results. I'd also like to retain the ability to search the posts/page titles and content. eg, user enters '#123' in the search box, and the search results return just post 123. However, if I were to enter... | I previously asked and answered my own question about customizing a search. You can find that answer here: stackexchange-url ("The right way to create a custom search page for complex custom post types"). It'll be a good read to help you understand the following code. I'll use the <code> pre_get_posts </code> action to... | Search Using Post ID | wordpress |
I have a plugin page created with add_submenu_page. I want to add a new section there but nothing happens: <code> add_submenu_page('parent', 'Foo', 'Foo', 'manage_options', 'foo-settings', 'anothercallback'); add_settings_section('foo-settings-section', 'Settings', 'acallback', 'foo-settings'); </code> What's the right... | The <code> add_settings_section() </code> function simply registers a form section with a certain slug with WordPress. In order to get the section and all the fields you've added to it to display on a certain menu page, you need to include the <code> do_settings_sections($sections-slug) </code> method in the menu's cal... | Add section (add_settings_section) to a custom page (add_submenu_page) | wordpress |
I'm trying to create a custom wordpress title for a posts made under a custom post. Basically, its a version changelog for an application. I would like to only input the version number in the title field, and the output has to be standardized with a string accordingly. My custom post type is 'custom_version' and the ti... | The issue is that you are mixing up the <code> $title </code> variables. <code> $title </code> is the parameter passed to the <code> new_title </code> function, but then you use it as an array: <code> $title['custom_version'] </code> . Try this: <code> add_filter('the_title', 'new_title', 10, 2); function new_title($ti... | Customizing Wordpress the_title with add_filter | wordpress |
I'm trying to count the number of total posts of a custom post type "jobs". My query just returns "0" when I know there are posts. I don't think it is checking that the post type has posts, but I'm clueless as to why... any ideas? <code> <?php $jobs = new WP_Query(array( 'post_type' => 'jobs' ));?> <?php if... | The <code> wp_count_posts </code> function has parameter <code> $type </code> for post type to count, you should use this parameter if you want to get number of jobs like so: <code> $count_posts = wp_count_posts( 'jobs' )->publish; </code> | Counting the number of posts (custom post type) Query problems | wordpress |
I'm trying to activate permalinks on my Wordpress installation. When I activate them my menu links point to page names that have changed sometime ago which result in a 404. I don't really understand how I can configure this. When I edit the menu in the menu settings the names are the current ones. I use qtranslate. Can... | I found it. The box to edit the title had been invisible. I made it visible with the according checkbox in the options bar on the top. | Wordpress: Permalinks link to old names | wordpress |
I have created a custom post type named 'projects' with link custom taxonomy named 'projects'. I have added the five different project categories with this project taxonomy with two level of hierarchy custom post type ui . I tried to find function to get these five categories with taxonomy name 'projects' but i did not... | You will want to use <code> get_terms </code> . The following code show you how to access the terms. Please see the Codex page for get_terms for more information about the args that you can send to the function. I also show all of the data that is returned in the array of objects. <code> // Set your args $args = array(... | How to list the categories by custom taxonomy created? | wordpress |
I have a page named http://www.mysite.com/whitepapers/ and it worked fine. I have now added a physical "whitepapers" directory and has since broken my permalink for the page. I realize that it has something to do with content negotiation after reading stackexchange-url ("this post") but the fix did not work. | For those still looking for an answer, have a look at stackexchange-url ("WP Page and Subdirectory with same name") Basicalli I will have to rename the folder on my server. | Page URL not working due to physical directory | wordpress |
I've been stumped for days wondering why when I submit an empty string as a search term, it redirects to part of <code> loop.php </code> where I have the following code inserted: <code> <?php /* If there are no posts to display, such as an empty archive page */ ?> <?php if ( !(have_posts()) && !(is_sea... | I feel bad for answering my own question on here, but here's what I did. I created a custom search template, a custom <code> searchform.php </code> and changed my <code> header.php </code> to reflect my custom search page. What I did is rename the search box names to <code> search </code> instead of <code> s </code> to... | Change loop.php for empty search customization | wordpress |
Customer asks if a specific carousel plugin he uses can be widgetized. That means i should create a widget inside functions.php which calls the plugin's function. That means that the plugin's code has to be loaded first so taht the function be available to wordpress when the functions.php file is loaded, right? Would t... | The plugins are loaded right before theme (yes, I've been looking for excuse to use this): However it is wrong to think about either as point of code execution. For most cases everything should be hooked and executed no earlier than <code> init </code> hook. According to Codex widget registration with <code> register_w... | Between functions.php, widgets and plugins, which is loaded first? | wordpress |
I wish to use a function which is run only when a specific custom field is available. Something like: <code> if (custom_field_x_exists("name_of_the_custom_field")) : <Do some things>; endif; </code> How might it be done? | I think this should help <code> if ( get_post_meta( $post->ID, 'name_of_the_custom_field', true ) ) : // Do something endif; </code> | Using an "IF" statement based on the existence of custom field | wordpress |
I'm creating a Wordpress site for a client. In the future, my client would like to have a second site that uses Wordpress as well. Ideally, we'd like people that have accounts on the first site to be able to use that same account on the second site. Is this something that can be achieved with Wordpress Multisite? If so... | WordPress multisite only has one table for users, so yes, users can use the same account on both sites. You will just have to be sure to set the appropriate role on each site, as network users are not necessarily users of a given site. | Wordpress Multisite - Can 2 domains share a database of users? | wordpress |
I've got the following loop on my index.php template: <code> <div id="new_on"> <?php $args = array( 'meta_query' => array( 'meta_key' => 'is_url', 'meta_value' => 'yes', 'meta_compare' => 'NOT LIKE' ), ); $main_query = new WP_Query( $args ); while ( $main_query->have_posts() ) : $main_query->... | I think you're using wrong keys for <code> meta_query </code> array, also it expects nested arrays, even if you only have one query. Code below should help. <code> $args = array( 'meta_query' => array( array( 'key' => 'is_url', 'value' => 'yes', 'compare' => 'NOT LIKE' ) ), ); </code> | WP_Query not returning correct result with meta_query parameter | wordpress |
I am using a custom post type name <code> venue </code> and I am using a <code> <select> </code> dropdown on one of the contact form by loading up a custom module in CF7 but when the form is submitted, my data shortcode is not replaced with the data filled by the user. I just see this <code> [selected-venue] </co... | Name of the input field should match with the filler shortcode so that it returns data. I changed <code> $output = '<select name="contact_venue" </code> to <code> $output = '<select name="selected-venue" </code> and it works now. | Contact Form 7 Custom module | wordpress |
I know I can use <code> get_num_queries() </code> for the number of queries. However, how can I see what queries Wordpress actually makes? I've tried using $query but that didn't work. | See this codex page. in <code> wp-config.php </code> : <code> define('SAVEQUERIES', true); </code> then in your template: <code> if (current_user_can('administrator')){ global $wpdb; echo "<pre>"; print_r($wpdb->queries); echo "</pre>"; } </code> or without the above <code> SAVEQUERIES </code> , you can ... | view queries made? | wordpress |
I am looking for a simple way to minimize ads on a website I'm developing in WordPress by only showing ads (Google Adsense, to be precise) on the site upon a large influx of traffic. A large influx as defined as, say, more than 2x the normal hourly traffic (though the exact metric used to determine popularity is not th... | There is one wordpress plugin called " Search ads " that lets you do this. You can show adsense ads only to search engine users, which usually click on ads. As for regular readers from sources like bookmarks and manual address typing, ads will not show. Another plugin is " ad injection ". If you wish to do adsense trac... | Is there a simple way to only show ads on a WordPress page once it becomes popular? | wordpress |
I'm working on a plugin that was creating a table successfully. However, I decided to test it in a fresh install of Wordpress (on my local server) and now the table is not being created in my activation code. Instead I am getting the error message: The plugin generated 149 characters of unexpected output during activat... | <code> if( $installed_ver != $simple_location_version ) { </code> on first run, <code> $installed_ver </code> is an empty string and <code> $simple_location_version </code> is NULL, so this inequality test will fail and your SQL will never be executed. if you check for strict inequality, it will work: <code> if( $insta... | Problem creating a table with dbDelta | wordpress |
I'm creating a website that has two basic user groups: Subscribers and Editors. Bot can create posts via a custom form using <code> wp_insert_post() </code> , but Editors are allowed to mark a post as private, effectively sharing a single post only among other Editors. As Wordpress already filters private posts out of ... | So your problem is that you want to cache 2 Loops, WordPress do some stuff behind the hood to cache loops. What you might do is either activate a plugin like W3 Total Cache , but if you really need to perform caching of data for some of functionality there is some function/methods that will allow you utilize theses cac... | Can someone explain Wordpress caching, and what's the best in my scenario? | wordpress |
I'm building a plugin that requires its own set of admin pages. I know how to create the top-level link and how to add sub-menus to it. However, what seems to happen is when I create the top-level link, it also automatically adds a submenu page of the same name if I add another submenu page to it. I'm simply looking fo... | You just have set the name of the <code> $menu_slug </code> exactly the same as the parent slug. | Naming Admin Menus and Submenus | wordpress |
I've installed a single site WP. In one of my plugins, I have the following code: <code> if(is_multisite) { $upload_dir = get_upload_dir(); $_SESSION['root_image_dir'] = str_replace('\','/',$upload_dir['basedir']); echo 'IS MULTI.'; //<-- this is outputted every time } else { $_SESSION['root_image_dir'] = ''; echo '... | If that's the code you have in your plugin, you're writing it wrong. You have <code> if(is_multisite) </code> which is treating the string <code> is_multisite </code> as a constant and evalutation to true. Essentially you're writing <code> if(true) ... </code> Remember, <code> is_multisite() </code> is a function . You... | Why is 'is_multisite' returning true when it's a single install? | wordpress |
I have a site based on WordPress. This site has some functions for member only. One of the functions is a external script and I believe anyone can access this without authentication. I can add .htaccess to this script to prevent unauthorized access. But then my users have to login again and it's kind of inconvenient. I... | Just add this at the top of your file: <code> require_once($_SERVER['DOCUMENT_ROOT'].'/wp-blog-header.php'); // If you run multisite, you might nees this to prevent 404 error header('HTTP/1.1 200 OK'); </code> Note that the file must be in the same folder as your theme. Then you can use <code> is_user_logged_in </code>... | How to use WordPress authentication on non-WordPress page? | wordpress |
I'm working on a new blog which display in a list, on sidebar, some categories and the posts of them. In the index page, in main content, I list some post titles from other category "New". What I need is: when i click on one post link on sidebar to display in main content the post content via ajax or JQuery. | You will need to create a WordPress function that loads the post content and hook that into wp_ajax_nopriv. You will also need the jQuery ajax functions to send the $_POST data to your WordPress function via ajax and output the returned content in your empty div where you want it to display. A simple approach would be ... | How to load post content on index page using ajax when post title in sidebar is clicked | wordpress |
I have a custom post type <code> announcements </code> which obviously holds posts with weekly announcements. In my theme's header, I want to create a box which has the following semantics: <code> <div id="header-announcements"> <h3>Announcements</h3> <ul> <li><a href="post-permalink"&g... | The following should work, but isn't tested: <code> <div id="header-announcements"> <h3>Announcements</h3> <?php $queryObject = new WP_Query( 'post_type=announcements&posts_per_page=5' ); // The Loop! if ($queryObject->have_posts()) { ?> <ul> <?php while ($queryObject->have_po... | Grab 5 latest posts from custom post type 'announcements' | wordpress |
I have a jQuery ui tabs that load posts via ajax on sidebar. Now in a specific page i want to filter the query post via <code> is_page(); </code> conditional. But in my case its not working. <code> function load_home_classifieds($type){ $query = array( 'post_type' => 'classified', 'posts_per_page' => 5 ); if(is_p... | If this is executed within an ajax request, is_page() won't be set. the page you're making the request from was a previous request. you need to set something on the originating page to pass with your ajax request to let it know it's for your special case page. | is_page() conditional not working inside an AJAX function | wordpress |
I am using a script to import my vbulletin forum posts into wordpress as posts. One quick issue I ran into is there are numerous forum posts with the same title 'please help me'. When I go into the post edit screen the permalink will show 'please-help-me-2' for the second one, and 'please-help-me-3' for the third one. ... | There is a function called wp_insert_post that takes a parameter for post ID. If the post ID is an ID that already exists, this function will update the post with the information you pass in the function parameters. I think using that function you could find a way to retrieve all of your post ID's in an array and then ... | What 'function' will 'update' a post? | wordpress |
I am writing a plugin that requires a large chunk of html. Now the way how it is set up now works. <code> return <<<EOT <html> EOT; </code> But I want to split the file into different php files that i can include. Now I tried this, but it does not work: <code> ob_start(); include(plugin_dir_url( __FILE__... | When including files you don't want the URL, but the filesystem path instead. So... <code> include(dirname(__FILE__) . "/path/to/myfile.php"); </code> Remember to put the first forward slash in <code> /path/to/myfile.php </code> , since <code> dirname </code> doesn't include the trailing slash. | Include content of file into plugin (ob_start();;include;ob_get_clean()) without < < <EOT | wordpress |
Why is http://compassionpit.com/blog/ going through an infinite redirect loop? Here's my nginx conf file. The site is run by a nodejs server on port 8000 and Apache serves up the blog (wordpress) and the forum (phpBB). The forum is resolving just fine, at http://www.compassionpit.com/forum/ ... This webpage has a redir... | Is WordPress configured to use www or without www? Your server seems to be listening only for the <code> www </code> version and tries to redirect non- <code> www </code> requests to the <code> www </code> version. Considering that you provided a link to the non- <code> www </code> version of the domain above, my guess... | Blog has an infinite redirect loop | wordpress |
Is there a way to disable archives pages, specifically monthly archives? | Check this post by BetterWP. You may need to edit the code as it does not mention about monthly archives. | How to disable monthly archive | wordpress |
I'm using this excellent function to automatically add a category to my custom post type "Videos" on publish, if there's no category already chosen. This works great: <code> function add_video_category_automatically($post_ID) { global $wpdb; if(!has_term('','category',$post_ID)){ $cat = array(394); wp_set_object_terms(... | <code> wp_set_object_terms </code> Works better with term slug instead of term id so change this line: <code> $cat = array($category->term_id); </code> to: <code> $cat = array($category->slug); </code> | Add category to custom post type automatically, using category slug | wordpress |
I build a review site with Wordpress. I created a custom post type called "Reviews", inside this, theres two taxonomy, one called "Genres" and one called "Types". Inside the Genres, i have a couple of subcategory, action, comedy, drama etc... and inside the Types, i have 2 subcategory: Movies and TV Shows I want to cre... | The way that I would approach it is using the tax_query to create a query that looks for both the correct genre and type. For example, to query all Movies that are Drama: <code> $myquery['tax_query'] = array( array( 'taxonomy' => 'genre', 'terms' => array('drama'), 'field' => 'slug', ), array( 'taxonomy' =>... | Review site custom post type structure | wordpress |
For example I have 20 pages on a site. one of them is called bacon another called eggs. on the same site...lets say breakfast.com I have the permalinks set up properly and have used them successfully on all pages, including Eggs by way of this: www.breakfast.com/eggs?cooked=scrambled. This works 100% as it should. Howe... | WordPress has a list of reserved terms that you cannot use for taxonomies. From your question, I gather that "cooked" is a taxonomy that applies to eggs and "type" is a taxonomy that applies to sausage. Unfortunately, "type" is a reserved term in WordPress, so it interprets your query string differently than you expect... | Why would a GET variable one one page of a site cause a 404 error when a GET variable works on another page of a site? | wordpress |
Is there a quick way to add a list of countries as terms to a custom taxonomy called "Country"? Is there an existing import file, SQL script ect... I don't want to be there all day manually adding them. Any ideas would be great. | Try this. Note that I found this country array online and cannot vouch for it's accuracy. Also, I've set the taxonomy to the "country" taxonomy. Change all instances of that if it does not match your specific taxonomy name. You can add this to your functions.php file in your current theme. Reload WordPress and it shoul... | Fast way to add countries as a custom taxonomy term? | wordpress |
I am building a custom wordpress theme from a clients mockup. On the homepage there are 2 sliders, and 4-5 areas for recent posts of different types. I would like to have all the content be editable in wordpress what is the best way to create a post, apply some sortof value to it (category,taxonomy,tag,custom post type... | You can use WP_Query in your template to select groups of posts by type, category, tag, custom taxonomy, meta field, etc., and create additional loops: <code> <?php $news = new WP_Query("post_type=mynews&posts_per_page=1"); while($news->have_posts()) : $news->the_post(); the_title(); endwhile; $events = ne... | Best Practice for Displaying Categorized Posts on Front Page | wordpress |
I've tried everything. I've looked at every. single. question. here, on StackOverflow, the WP help forum, googled 10 pages deep and literally tried EVERY combination of code I could find, for the last 2 days, and can't get anything to work how I want it. Surely it can't be impossible? The goal seems so simple! THE GOAL... | @Chris_O is right... currently sticky posts are not supported in custom post types so it must have something to do with the theme you are using. Now disregarding the CPT problem... and assuming that it does work the same way wordpress stickies do then the goal that you are describing is exactly the way 'sticky' posts a... | Custom loops, sticky posts, and pagination nightmare | wordpress |
I have a very peculiar requirement, hopefully I can explain it without being too confusing. I created a page template where I list some properties I get from an external XML file, so far no problems, let's say the URL is like this: http://www.mysite.com/properties/ Each property has a link that should redirect the user... | Add this to your theme's functions.php, or put it in a plugin. <code> add_action( 'init', 'wpse26388_rewrites_init' ); function wpse26388_rewrites_init(){ add_rewrite_rule( 'properties/([0-9]+)/?$', 'index.php?pagename=properties&property_id=$matches[1]', 'top' ); } add_filter( 'query_vars', 'wpse26388_query_vars' ... | How to create custom URL routes? | wordpress |
My friend mentioned that there is a simple way to modify what users see in the admin sidebar based on their user role. I have a large number of custom post types, one for each user, and I need to limit these users (currently given the role 'author') access to only their own post type and the Posts (not even Pages). I a... | To anyone else having the same problem as me, I used the Role Scoper plugin , which is recommended by WordPress on their page that describes user roles. It has a very simple UI, and is easy to install and use. | WordPress User Roles, Custom Post Types, and Admin views | wordpress |
I'm doing an INSERT into a wordpress table and anything with an apostrophe is coming out <code> It's true </code> I tried using htmlspecialchars but I'm still getting the backslash. Is there any way to write it so that the user sees <code> It's true </code> While the table in the database sees: <code> It's true </code>... | When you retrieve the data make sure to call stripslashes, or stripslashes_deep if it's an array. <code> $name = stripslashes($name); </code> | How to deal with apostrophes | wordpress |
I want to remove the "page" bit from the URL when I use the <code> previous_posts_link </code> and <code> next_posts_link </code> . Right now, it looks like: http://mywebsite.com/page/2 I want it to look like this: http://mywebsite.com/2 How can I do it? Thanks! | So yeah, got the tumbleweed badge :(. I ended up doing a 301 with the .htaccess, but If someone has a better idea please share it! | remove the 'page' URL parameter in previous/next posts link | wordpress |
My site, http://www.cancer-study.com , has been hacked, and I can't login to wp-admin. Can you say how it has been hacked and what can I do to undo the damage? I have access to the host. | If you do a Google search, you will find many topics on this. Here are some links: First read this: http://codex.wordpress.org/FAQ_My_site_was_hacked Then take a look at these links: http://ottopress.com/2009/hacked-wordpress-backdoors/ http://wordpress.org/support/topic/268083#post-1065779 http://smackdown.blogsblogsb... | How was my WP site hacked | wordpress |
Where should I amend to make this happen? I should add somewhere target="blank_" Regards, | in the link tag of course: <code> <a href="<?php the_permalink(); ?>" target="_blank">link title</a> </code> but it is <code> _blank </code> and not <code> blank_ </code> | How to make that all permalinks would open in a new window? | wordpress |
I'd like to determine how many times a user has logged in. Does WordPress retain that information or will I have to add a db entry every time they log-in? <code> if(is_user_logged_in() && ($logged_in_times == 2)) { // do something } </code> | I don't think so. You will need to do something like this (untested): <code> add_action("wp_login", "my_login_function"); function my_login_function($username){ $userdata = get_user_by('login', $username); $n = get_user_meta($userdata->ID, "my_login_counter", true); if (! is_numeric($n)) $n = 0; $n = intval($n) + 1;... | Find out how many times the user has logged in | wordpress |
I had asked this question in a different way too, but no one replied there! I guess I should rephrase it here. My custom post is 'company'. I'm trying to add a custom rewrite rule. When the 'url http://domain..com/company/company-title-slug/replies ', is accessed, I want redirect to a custom template(applied to a page ... | I haven't tested it, but what about: <code> add_rewrite_rule('^company/(.+)/replies/(.*)?$','index.php?pagename=replies&reply_id=$matches[2]','top'); </code> | Need help with a custom rewrite rule - http://domain/custom post slug/replies | wordpress |
Scenario: Page displays a list of titles for a custom post type (video) with a selected "category" (in the taxonomy its called the subject). For example videos with the subject of "creative" Problem If there are titles present that match the the criteria then the list is displayed correctly but if there are no titles t... | Try <code> $loop->have_posts() </code> on if statement. See if it fixes the issue. | if/Else have_posts Else fails to echo message to page | wordpress |
Is it possible to limit a CPT to just one? What I'd like to accomplish is creating a CPT called "Home". It will manage any and all elements on the home page. I want to program it so when the user clicks on the "Manage Home Page" link they will go straight to the edit post screen. They will skip over the "All Post" scre... | I would suggest creating a Theme Options page for this purpose. stackexchange-url ("stackexchange-url add_options_page() in Codex. Or is there anything special in the post edit screen that you want to use that would be hard to get into the Theme Options page? | how to only have one custom post type post? | wordpress |
I'm trying to load plugins automatically by putting the plugins into <code> mu-plugins </code> folder. But if the plugin is put in a folder, it isn't loaded. I tried some popular plugins such as W3 Total Cache, WordPress SEO By Yoast, but all of them are not loaded. Does WordPress only loads plugins which are just sing... | Does WordPress only loads plugins which are just single files in mu-plugins? No, they do not need to be single files but you cannot use plugins in their own subfolders as in the standard <code> plugins/ </code> folder. The main plugin file (one with the specified plugin header info) has to be right there in <code> mu-p... | Plugins in mu-plugins folder are not loaded | wordpress |
very strange problem, that happens only in one specific template. part of the part "leaks" into the tag - and I can't figure out why. the "header.php" code: <code> <!DOCTYPE html> <html lang="he"> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IT=edge,chrome=IE8"&... | Can you be a little more specific on which part is 'leaking' into the body? It's hard to tell without running any code and having other parts of the theme to look at. | wordpress header leaks into body in a specific template | wordpress |
Can I use the theme uint test data in a demonstration site for a commercial theme? Or am I only allowed to use it for internal development? http://codex.wordpress.org/Theme_Unit_Test | Everything on the Codex is GPL (or can be considered as GPL-compatible). Insofar as any part of the Theme Unit Test data are copyrightable, unless stated otherwise you may assume that the WordPress Foundation holds the copyright, and that the work is released under the GPL. Feel free to use it however you see fit! | how is the theme unit test data licensed? | wordpress |
I'm integrating Mailchimp signup into a WP install and I have 2 questions. What is the best way or best plugin to integrate mailchimp signup? Is it possible to allow the user to select from multiple lists to be subscribed to. I realize the latter is more closely related to MailChimp but I'm hoping that someone has an a... | The current Mailchimp Plugin for Wordpress does not allow user to select multiple lists. Infact Mailchimp discourage this practice. Instead what they advocate is to create groups within the lists and then use segmenting while sending campaigns. These links might be useful MailChimp Documentation Google Groups discussio... | MailChimp integration that allows users to select from multiple lists | wordpress |
There is a function in a theme that I am using that does some pagination stuff. I do NOT want that function to show up on my home page (only), so I'm trying to set up an if/else statement but can't for the life of me can't get it to work right. Using the following code, the function shows up not only on the homepage bu... | Based on your pastes, i think what you're going for is.. <code> function cp_do_pagination() { if( is_home() || is_singular() /* || is_front_page() */ ) return; global $post; // <-- do you need this for something in particular? if( !function_exists('appthemes_pagination') ) return; appthemes_pagination(); } </code> T... | Exclude function from homepage only? | wordpress |
I've just developed a calendar plugin. To display a calendar in a template, I call <code> do_shortcode(args...); </code> . This works fine. But how can I call a function from my plugin that will return data? I don't want to use <code> include_once </code> - I really just want to call a function E.g. <code> $events = ca... | As long as the plugin is active, the function will work perfectly fine from any template. | How can I call plugin function from a custom template? | wordpress |
I'm working on a plug-in which will override the search results returned by Wordpress, with results from a custom XML feed. However, I'm not looking to do this on a separate page, but to replace the results Wordpress would normally display on the blogs search page with the results from my XML feed. I have been unable t... | You can use template_include filter hook to check if the current call is a search call and if so include your own template in which you can do what ever you want : <code> add_filter('template_include','my_custom_search_template'); function my_custom_search_template($template){ global $wp_query; if (!$wp_query->is_se... | How can I replace the search results displayed by Wordpress? | wordpress |
Is there any way that developing a Wordpress admin panel like this would be possible? http://deanelliott.me/wp-content/uploads/account-backend.jpg My client wants it to be displayed within the website template aswell. I really don't want to have to outsource this, but I'm stumped as to how to achieve this. Any help wou... | I second what @Viruthagiri said. You can also use the plugin Theme My Login if you want to hide the real WordPress control panel from your users and only show them their own profile/edit profile page, themed just like your site. Best of luck! | Extending the user profile | wordpress |
Is there a plugin that can access cPanel features from within Wordpress? In particular I'd like to be able to: View bandwidth, quota and other server info from the WP Dashboard Access my webmail Access the file manager to edit files (useful for .htaccess, php.ini and non-WP files) I know I can just open a new tab and l... | I do not believe there are any plugins specifically catered to cPanel, however there are a few plugins which will allow you to add an iFrame to your admin pages. I have not used any of these, and agree with the other commenter (Chip) who mentioned that it may pose a security risk. With that said, check out plugins like... | How do I access cPanel features within Wordpress? | wordpress |
Although the accounts on my server generally have a lower memory limit, I've configured my Wordpress user accounts with a memory limit of 32Mb using the php.ini file and <code> memory_limit = 32M </code> Unfortunately I've found that I'm still getting the odd memory error, even on small tests blogs. I've had to increas... | Obviously this question is a little squishy, as YMMV, but I've run several WP sites using W3TC and similar plugins to yours on 32M, and haven't had an issue. That being said, when are you typically running into issues? Is it on post submission? On gallery operations? Looking for a pattern there could be helpful. Let us... | What is a reasonable memory limit for Wordpress | wordpress |
I am using Wordpress for my website. I was working on CPANEL yesterday and was browsing <code> public-html/wp-admin folder </code> under the <code> File manager </code> . There were many files and I accidentally deleted the <code> admin-header.php </code> file. Where can I get an another copy of that file so that I can... | Couldn't see a download link on the Github page for downloading single files(i don't use it so maybe i'm just not seeing it). Alternatively you can download single files for WordPress from trac. Example: http://core.trac.wordpress.org/browser/tags/3.2.1/wp-admin/admin-header.php Scroll to the bottom of the page(or hit ... | Where can I find admin-header.php file online? | wordpress |
I created a taxonomy called "portfolio categories" for my portfolio custom post type. They're hierarchical and supposed to be behave like categories. when i'm editing a single portfolio post... i have a metabox where i can assign the proper portfolio category. It shows all categories at all the depths. but when i am on... | Pretty bizarre issue. I popped in that same code and successfully replicated the issue. I then removed the calls to <code> my_add_term </code> , reset my permalinks (not sure if this helped or not but worth mentioning that I did it), added an item, reloaded, and they all showed up in heirarchy as expected. In the calls... | Edit tags page for hierarchical taxonomy doesn't show taxonomies at all depths | wordpress |
I currently developing wordpress widget for my website. This widget will pull user latest post in my website and show in their blog. In the widget there is option for user to use their css or my css for the widget I use this code in my widget and its work perfectly but this code will always load the css. <code> add_act... | This is sort of sloppy as the style will still be enqueued regardless. In the code to display your widget, change the CSS selectors based on whether or not the user selected own style: <code> <?php $prefix = $instance['own_style'] ? 'ownstyle_' : 'pluginstyle_'; //then.... ?> <div id="<?php echo $prefix; ?&... | Use wp_enqueue_style based on user option in widget | wordpress |
I'm thinking about migrating a client's website from a super-old cms (xoops) to WP. However the site is quite old so I don't want him to lose any SEO juice he acquired through the years (PR: 2). Anything I'd have to consider doing the migration? (I was thinking about setting up WP on a separate folder and then moving i... | You should use a sitemap module to generate a list of URLs created by XOOPs [e.g. xSitemap ]. Then you have to set up your .htaccess to 301 redirect each URL to its corresponding page in the new Wordpress instance. Finally, you should consider installing a Wordpress plugin like Redirection to check for 404s and redirec... | Migrating from other CMS to WP - losing SEO juice? | wordpress |
I'm adding additional image sizes to my theme: functions.php <code> add_image_size( 'my-thumbnails', 122, 122, true ); </code> I used to get thumbnails URL like this: <code> wp_get_attachment_url(get_post_thumbnail_id($post->ID)); </code> And it works like a charm, but I'm not sure how to display 'my-thumbnails' ver... | You should use one of the following: <code> // Thumbnail wp_get_attachment_thumb_file( $GLOBALS['post']->ID ); // Custom wp_get_attachment_image_src( $attachment_id, $size='thumbnail' ); // Or: wp_get_attachment_image( $attachment_id, $size = 'thumbnail' ); </code> | Getting custom-sized featured image's URL? | wordpress |
<code> add_action('wp_head','add_gpp_gallery'); function add_gpp_gallery() { if( ( is_single() || is_page() ) && ( !is_page_template('page-blog.php') ) ){ remove_shortcode('gallery', 'gallery_shortcode'); add_shortcode('gallery', 'gpp_gallery_shortcode'); } } </code> Hi All, I pulled the above function out of t... | You can change the name of <code> add_gpp_gallery </code> function both in the callback and in the declaration to avoid the conflict between the original and your clone. Something like this... <code> add_action('wp_head','jason_add_gpp_gallery'); function jason_add_gpp_gallery() { if ( is_single() && 'your_post... | Override plugin with functions.php | wordpress |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.