question stringlengths 0 34.8k | answer stringlengths 0 28.3k | title stringlengths 7 150 | forum_tag stringclasses 12
values |
|---|---|---|---|
I've pretty much finished building a site based around a theme that uses a custom post type called portfolio. Now, having just switched my permalinks to a custom structure, posts of that type display as www.mywebsite.com/portfolio/postname I want it to be called 'projects' instead of portfolio so it displays www.mywebs... | I might not have understood your questions fully, but can't you just change the rewrite slug for your custom post type to /projects instead of /portfolio? | Easy way to change custom post type name for permalinks? | wordpress |
Hii i have seen many blogs which posted thing in the same design for example if you see this http://www.songs-pk.info/2011/nayika-malayalam-2011/ there page create alwayz in the same style download button and play button and the same td tr combination how can i make this mean did we just have to give links once we crea... | Create <code> category-<slug>.php </code> or <code> category-<ID>.php </code> in your theme. e.g. category-jazz.php to view songs categorized in jazz category and category-rock.php to view songs categorized in rock category. PS> This answer is based upon your title. I couldn't understand what you have writt... | How To make Custom page of every Category | wordpress |
I'm moving a wordpress CMS installation from one host to another. Pretty straightforward I think. I have moved applications running on a Tomcat server but not wordpress. Is the following correct - Restore the database from backup - Can I create a backup dump using wordpress admin GUI or do I need to manually restore on... | If you're just changing servers it's easiest just to move the entire installation over and clone the database (manually from db admin), then update wp-config.php to point to the correct database. If the domain name is changing you'll need to update all the domain name values in the database also. I find this script is ... | Setting up wordpress on a hosting server for the first time | wordpress |
Okay Now I'm editing old problem because its done but now i've new problem I've knowledge of mysql queries but not wordpress queries I'm doing this with mysql queries and its working well but server is going damn slow i know i'm running about 30 query per page load so is there any way to do it easily with help of wordp... | You can do this on background using some ajax on page load, here is an untested example to show the idea. <code> jQuery(function() { jQuery.get('http://domain.tld/remote'); }); <?php function is_ajax() { return (isset($_SERVER['HTTP_X_REQUESTED_WITH']) and strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttpreq... | Get full content from feeds and save a duplicate copy in my site | wordpress |
I have an RSS feed ( link ) that I would like to display as a widget inside one of my posts. The wordpress RSS widget already does that on the sidebar, is there some solution to have it in the post? The best solution would latter let me do something like: So I could embed this also on other sites. Thanks. | if you know php you could add it to a template using wp function http://codex.wordpress.org/Function_Reference/the_widget or there is wp code to pull in a feed and list it http://codex.wordpress.org/Function_Reference/fetch_feed if you want a non coding solution, there are some plugins like: http://webdesign.anmari.com... | How to display an RSS feed widget inside a page? | wordpress |
I have created a custom post type called Products, on the product pages i have a menu in the left sidebar. This menu is made up of categories for the products. Is it possible to have my products automatically added to the category menu based the category of the product? For example, i make a product, i give it a catego... | I've found this plugin that does exactly what i needed. http://wordpress.org/extend/plugins/collapsing-categories/ | Auto add pages to category menu | wordpress |
In web development, I get used to place css/js files under separate folders (css folder, js folder ..etc). What I am experiencing in WordPress is that I cannot access these folders in WordPress Admin Editor Page, the editor only displays the files under the main theme folder, not the nested folders. Is there an option ... | The theme editor is located under /wp-admin/theme-editor.php and uses <code> get_current_theme(); </code> to give you the first files to edit. From the returned <code> array </code> of theme data, it uses <code> 'Template Dir' </code> to locate the directory and <code> 'Template Files' </code> to give you a list of fil... | CSS/JS files in WordPress | wordpress |
<code> function save_details( $post_id ){ if ( wp_is_post_revision( $post_id ) ) $post_id = wp_is_post_revision( $post_id ); update_post_meta( $post_id, "testimonyname", $_POST["testimonyname"] ); } add_action('save_post', 'save_details', 10, 1); </code> I have a custom post type with a custom field, but after adding s... | <code> if(isset($_POST["testimonyname"])) </code> Placing this code before the update_post_meta lines worked perfectly. | Add New Post (Custom Post Type) Deletes 1 Post's Custom Meta Data | wordpress |
Is it possible to tell if a user is logged into Wordpress from looking at the cookies which are set on a site? If not, how could I add hooks to the login success and logout actions and set my own cookies? | You could use Javascript <code> <script type="text/javascript"> function getCookie(c_name) { var i,x,y,ARRcookies=document.cookie.split(";"); for (i=0;i<ARRcookies.length;i++) { x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("=")); y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1); x=x.replace(/^\s+|\s+$/g,... | Is it possible to tell if a user is logged into Wordpress from looking at the cookies which are set? | wordpress |
I am developing an admin-only plugin, which uses some ajax calls in its interface. The website itself also relies on ajax calls on its front-end, too. I'd like to be able to identify when the WP is loaded due to "simple backend call", "AJAX backend call" or "AJAX frontend call". The use case, in its simplest form, coul... | I understand the problem you are having, I was thinking of the same thing. It is not really a problem tho, it's more a matter of good programming design and have a good separation of front-end and back-end. Now the way I have managed to solve this is doing the following: I hope you are calling your AJAX action with <co... | Determining whether it's a AJAX call from front-end or from back-end | wordpress |
I have a custom post type called Projects. When viewing a single 'project' post I have next/prev buttons to navigate through them. I also want to display text saying "Project 2 of 4" or ideally pagination icons. This is easy on index.php but I can't work out how to do this on a single post page. Thanks | You could create a new query for all posts in your custom post type, then iterate through each and match it to the current post id to figure out its position. <code> // save current id to match later $current_project_id = $post->ID; $args = array( 'post_type' => 'project', 'posts_per_page' => -1 ); $all_projec... | Display "Post 2 of 4" on single post page? | wordpress |
I've been researching how to display thumbnails with rounded images, but every solution ends up running out of gas. One trick I tried was wrapping the thumbnail in a division with the same size and shape, showing the image, but with CSS of "opacity:0" so that the actual image doesn't show. What shows is the background ... | You can get the thumbnail URL with wp_get_attachment_image_src and get_post_thumbnail_id : <code> $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'thumbnail' ); echo $src[0]; </code> | Thumbnail Image Rounded Corners w CSS (or any other good method) | wordpress |
I am using a custom page template for my portfolio. The code is calling the correct number of posts per page but for some reason the pagination links won't show up :-S My query <code> <?php $loop = new WP_Query(array('post_type' => 'portfolio', 'posts_per_page' => 2)); ?> <?php while ( $loop->have_pos... | <code> <?php /* Template Name: Portfolio */ ?> <?php get_header(); ?> <div id="full_container"> <div id="portfolio_content"> <div id="portfolio_wrap"> <div id="content"> <?php $loop = new WP_Query(array('post_type' => 'portfolio', 'posts_per_page' => 2)); ?> <?php whil... | Next & Previous (Pagination in this case) Not Appearing | wordpress |
Is there some global kind of functions.php file that works for any theme? The problem is here: When I change a functions.php file in any theme, I need to take care of two changes: First, I need to take care of the updates of that theme. Second, I need to take care of changing the theme of the site. So, instead of makin... | The difference between theme and non-theme code is organizational rather than technical. Any code that is active contributes to resulting environment, does not matter where it is loaded from. There is number of places where code gets loaded from, which are not part of WordPress core: <code> wp-config.php </code> config... | Is there any global functions.php file which works for any theme? | wordpress |
I need to be able to switch between the current page taxonomy so I can load in the appropriate menu: <code> $current_tax = 'need to get this from somewhere'; switch ($current_tax) { case 'tax1': // load menu1 break; case 'tax3': // load menu2 default: break; } </code> I'm not sure which method is best to get the curren... | Just replace tax_name with the desired taxonomie <code> $tax = wp_get_post_terms($post->ID, 'tax_name'); echo $tax[0]->slug; </code> | What is the current page's Taxonomy? | wordpress |
When the calendar widget is activated in the sidebar, it generates the following validation error (W3C markup validation): The summary attribute is obsolete. Consider describing the structure of the table in a caption element or in a figure element containing the table; or, simplify the structure of the table so that n... | Update to 3.2.2. The summary attribute has been removed. See line 1149 \wp-includes\general-template.php WP v3.1.4: <code> $calendar_output = '<table id="wp-calendar" summary="' . esc_attr__('Calendar') . '"> </code> WP v3.2.2: <code> $calendar_output = '<table id="wp-calendar"> </code> Alternatives... To m... | WP calendar summary attribute validation error | wordpress |
Why does hitting the enter key in Visual Editor add <code> <p> </code> instead of <code> <br> </code> ? What I want sometimes is a new line that starts immediately after the previous line. Unfortunately, the visual editor automatically wraps my new line in a <code> <p> </code> tag when all I really wa... | Hit <code> Shift + Enter </code> and you''ll get <code> <br> </code> | Why does hitting enter in Visual Editor add instead of ? | wordpress |
I created a custom post type in my function.php of the theme and some a taxonomy for them. I added 2 categories in my taxonomy (first, second) and added some post in my new custom post. I want to make a loop that will select from my custom posts only the ones in the first category (Taxonomy) Or I want a archive that wi... | Before the loop starts use query_posts . Available parameters are here . Something like this: <code> global $wp_query; query_posts( array( 'post_type' => 'mycustomname', 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'mytaxonomyname', 'field' => 'slug', 'terms' => array( 'myterm1slug'... | Loop custom post type by taxonomy (Category) | wordpress |
How do I post a YouTube video so that an image of the video also appears as a thumbnail in the list of posts. Here's the blog in case that helps: http://wordfruit.com/blog | MayBe This Plugin can help you out : http://wordpress.org/extend/plugins/video-thumbnails/ But if you want to do this manually then you can get Video Image from this Link : http://img.youtube.com/vi/SgGVitTU9F8/0.jpg Replace "SgGVitTU9F8" to your video id | How to make an image of a YouTube video appear as a thumbnail in the list of blog posts | wordpress |
The images in this blog post: http://wordfruit.com/blog/the-hole-through-the-earth-3/ ...have borders around them -- hatched lines. But in this post: http://wordfruit.com/blog/copywriting-for-fish/ there's no border around the image. The images in the first example above I think I posted using the 'From url' function. ... | this is more a css problem than wordpress related - check style.css of your theme: the 'border' (actually a padding with background image) is only set for left, right, and center aligned images (like those from your first link), not for those with .alignnone (those from your second link): <code> #content img.alignleft,... | How to post images on my blog with a pre-defined border | wordpress |
Is it possible to add thumbnails to blog post listings independent of images in a blog post -- e.g. if there is no image in the blog post, can I add a thumbnail image? | Is it possible to add thumbnails to blog post listings independent of images in a blog post set the 'featured image' when writing/editing your post; and use <code> the_post_thumbnail() </code> within the loop, in the template. e.g. if there is no image in the blog post, can I add a thumbnail image? dependent on a post ... | Adding thumbnails independent of images in blog posts | wordpress |
Anyone know how to change the text inside the Twentyeleven search field from "Search" to another choice? | Open <code> searchform.php </code> Find this in line 12 and edit Search as you wish <code> placeholder="<?php esc_attr_e( 'Search', 'twentyeleven' ); ?>" </code> | Change Twentyeleven Search Form Text | wordpress |
I have downloaded a theme and modified few things and customised it according to my needs. Now I want to remove the credits i.e. the back link to the designers site. I want to know if its legal for me to remove that. What are the terms and conditions? Theme is http://diovo.com/links/voidy/ Credits is a backlink: Theme ... | Theme licensing information is typically included in <code> style.css </code> . According to that Voidy theme is at least partially under GPL license (version not specified): The CSS, XHTML and design is released under GPL There is no issue with removing front-end credits/link from GPL-licensed theme. | How to determine if it is legal to remove credit link from theme? | wordpress |
On my website, any trailing slash is resulting in an error. How do I fix this? Example: http://example.com/content - no error http://example.com/content/ - error | What do you have going on with your site? If different pages have different headers, and the Contact page is a different theme. It allows the trailing slash/: http://liberaltech.net/pseudoscience/contact/ Looking at the page source I notice that you have a favicon before the document declaration. Try turning off plugin... | Trailing slash results in an error: | wordpress |
I got this in my theme: <code> register_sidebar_widget(array('Sidebar Login', 'widgets'), 'widget_sidebarLogin'); </code> i want to change this to the updated Command aka <code> wp_register_sidebar_widget </code> But i seem to miss something cuz the widget doesent load after the change.. I tried this: <code> wp_registe... | <code> function widget_sidebarLogin() { echo "Content of Your Widget"; } wp_register_sidebar_widget( 'sidebarLoginId', // your unique widget id 'SidebarLogin', // widget name 'widget_sidebarLogin', // callback function array( // options 'description' => 'Some Descriptions' ) ); </code> | trying to Change to wp_register_sidebar_widget | wordpress |
Is there a function that can check if an enqueued script has a call to wp_localize_script attached to it? | Try this: <code> function is_localized($tag) { global $wp_scripts; $data = $wp_scripts->get_data( $tag, 'data' ); return ! empty( $data ); } </code> | Find out if enqueued script uses wp_localize_script? | wordpress |
I've been developing a wordpress plugin that has an admin section with a form to add and edit various things. Now after an admin submits the form I wanted to redirect if successful (to show updated values) or show the various error messages if not. I got the header errors from trying wp_redirect and after looking throu... | well it looks like I worked this out. On the actual admin page I need to declare my $errors array as global as well <code> global $errors; </code> I guess wordpress must somehow box the admin page into a function and so the $errors array was not referencing the global var. | Redirect plugin after form submit or show errors | wordpress |
I need to dequeue some scripts but still have access to the vars passed via their wp_localize_script calls. Is there a way to do that? | I don't think so, since localize output is tied to script's print event. You will probably have to access that data and output it in some other way. | Dequeue script, but still use wp_localize_script to pass vars | wordpress |
I show excerpts of all posts at this site. Which works fine. However, I would like show content for posts of a specific category, while keeping all others showing excerpts. Is it possible, without a plugin? With a filter in functions.php, etc.? Working with 3.1.4, twentyten. | You can use the <code> in_category </code> function to test if the current post in the loop is in the specific category you want to display full content for. For example <code> if ( in_category( 'my_category') ) : the_content(); else : the_excerpt(); endif; </code> For more information on the <code> in_category </code>... | How to show content for posts of a specific category only | wordpress |
In the themes folder for my blog, there are three folders and one file: The file is index.php and the folders are: twentyeleven / wordfruit / twentyten The blog is at http://wordfruit.com/blog Obviously folders could be given any label, but I think the folders are organised fairly logically. Question 1: Is 'twentyeleve... | Your site is not using a Child Theme. It is currently using the WordFruit Theme, and this Theme does not declare any Theme as a Template . If it were , you would see a <code> Template: parent-theme </code> header tag (where "parent-theme" would be, e.g. <code> twentyeleven </code> if it were using Twenty Eleven as its ... | Which is the child theme and which is the parent theme? | wordpress |
I'm trying to add a nonce to my plugin's Ajax. I'm not sure why I'm getting this error: Fatal error: Call to undefined function wp_create_nonce() In my php file : <code> wp_localize_script('my-ajax-handle', 'the_ajax_script', array('ajaxurl'=> admin_url('admin-ajax.php'), 'my_nonce' => wp_create_nonce('myajax-non... | More context would be helpful. Is that all the code found in your plugin or functions file directly? Or are you hooking in to something via <code> add_action </code> . Anyway, what's probably wrong is that you're calling <code> wp_localize_script </code> and <code> wp_enqueue_script </code> outside of an action. <code>... | Fatal error: Call to undefined function wp_create_nonce() | wordpress |
I use this to call posts: <code> <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $per_page = get_option('to_count_archives'); query_posts("posts_per_page=".$per_page."&paged=".$paged."&cat=".$cat); if (have_posts()) ?> <?php while (have_posts()) : the_post(); ?> </code> And it ... | It's because when you call <code> query_posts </code> , you're overwriting the original query with a new one, you have to get the original query and reset the things you want to change. <code> global $query_string; $per_page = get_option( 'to_count_archives' ); query_posts( $query_string . '&posts_per_page=' . $per... | How do I call posts with a certain tag? | wordpress |
http://wordpress.org/extend/plugins/bbpress/ bbpress' language folder ( wp-content/plugins/bbpress/bbp-languages ) have that warning: <code> /** * Do not put custom translations here. They will be deleted on bbPress updates. * * Keep custom bbPress translations in /wp-content/languages/ */ </code> Actually this is not ... | You have to replace the call to BBpress’ language file. A good place to do this is a language specific file in your general languages directory. For Turkish it would probably be a file named <code> tr_TR.php </code> . This will be loaded automatically and only if it matches the language of your blog. It will not be ove... | How to keep plugin translates after updates? | wordpress |
Someone knows any plugin or method to allow users to upload files into their profiles? I mean i can link those files later to their profiles is the files are linked to users some way. I want to allow my users to upload papers, pdf , etc and then show those files on their profiles. Thanks in advance!! | I found this great plugin called "Uploadify Integration" by Mike Allen that did the trick. | Upload files into buddypress profiles | wordpress |
I don't know if this is a WordPress question or a CSS question... On my blog, in the list of post summaries, an image from a post appears beside the post's summary in the list of posts. But that only happens with one post. Other posts have images, but no thumbnail image appears in the list of post summaries. I want to ... | It's hard to tell without seeing the theme files but I assume the one image is displaying because it is set as the "Post Thumbnail" or "Featured Image" on that particular post and that all other posts aren't using that feature. The easy solution in that case would be to make sure you set any images you use in the post ... | How do I make images appear in the beside blog post summaries? | wordpress |
I have a question regarding permalinks and rewriting url's. I am writing a translation plugin and I would like to add the language shortcode in my url (Something like http://eyewebz.com/EN/other_permalinks). Currently I am assigning a $_Session-variable to hold the current selected language, but this isn't really visib... | There's not a good way to prepend a permalink with a URI base that I know of and keep WordPress happy at the same time. You can however add the language to the end of the URI with <code> add_rewrite_endpoint() </code> ; <code> add_action('init', 'foobar_rewrite_tag'); function foobar_rewrite_tag(){ $languages = array('... | Rewriting every url | wordpress |
i need to redirect users after login. I use <code> wp_login_form </code> to provide a login form on the frontpage. After a user entered username and password i'd like to redirect to a custom url, like http://myurl.com/username/ where 'username' is the name the user entered. Could i somehow filter <code> login_redirect ... | You can filter and set where you want to redirect to which user or role with the plugin Peter's Login Redirect . | wp_login_form: Redirect to dynamic url according to username | wordpress |
I have a custom post type called <code> portfolio </code> and a custom taxonomy called <code> build-type </code> (acting as categories) I am trying to query <code> portfolio </code> posts by <code> build-type </code> ID e.g. all Portfolio posts in "Hotels" (id=4 for that taxonomy) <code> // gets the ID from a custom fi... | The reason this isn't working is because 'tax_query' needs to be an array of arrays (confusing, I know). <code> ... 'tax_query' => array( array( 'taxonomy' => 'build-type', ... </code> It is that way so you can group a few different rules together. | Query posts by custom taxonomy ID | wordpress |
I have post titles which begin with a price, eg: $199,900 - 123 Street. I am using the code below, and I'm unable to get the order by title ascending to work properly. Any suggestions please. <code> <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'cat' =>21, 'posts_per_page' =... | If you're trying to get them to order by ascending price, the problem is that ordering by title is a string comparison, not numeric. A solution would be to put the price in a custom field and orderby your custom field rather than title. You would add a <code> meta_key </code> param with the name of your meta key, and o... | wp_query order by title | wordpress |
This code, when used in the header, automatically adds a arrow to wp_title. How do I remove this? <code> <title><?php bloginfo('name'); ?><?php wp_title(); ?></title> </code> | Check out the documentation for wp_title() , as there are several things you can do to format it how you want. Using the following code will remove the double arrows in the title: <code> <title><?php bloginfo('name'); ?> <?php wp_title("",true); ?></title> </code> | WordPress Meta Title Separator | wordpress |
Does it matter if I enqueue a script on just the page I need it to be used? As opposed to functions.php? Or, what is the best practice? In this example I need a rotator just on the front page of my site. And if I do enqueue it on the page, is there a best place to put it? Thanks very much. | Go with functions.php. Use the wp_enqueue_scripts action to call this function, or admin_enqueue_scripts to call it on the admin side. Calling it outside of an action can lead to problems. See #11526 for details. Source: http://codex.wordpress.org/Function_Reference/wp_enqueue_script <code> function themename_load_js()... | Enqueuing Script in functions.php vs on the page | wordpress |
I'm trying to figure out how to make it so that as soon as the post-new.php page for a custom post type is loaded, the post is saved. Basically, I'm trying to make sure the post has it's postID saved before anyone even starts entering anything. I suppose I could probably "fake-click" the "Save Draft" button, but I'm wo... | This should work. It's the way press-this gets the post id when you click the bookbarklet. <code> add_action( 'load-post-new.php', 'prefix_save_it' ); function prefix_save_it() { // define some basic variables $quick = array(); $quick['post_status'] = 'draft'; // set as draft first $quick['post_category'] = isset($_POS... | How can I default a new post to being saved? | wordpress |
Thought this would be straight forward... given a tag page such as <code> http://domain.com/blog/tag/tag-1/ </code> how can I retrieve the <code> post_id </code> while on that page? The usual suspects such as <code> url_to_postid </code> and <code> $post->ID </code> or <code> $wp_query->post->ID </code> do not... | A tag page would be like other archive pages in that a loop of posts would be displayed, even if only one post has been assigned that tag. You're check for post ID needs to happen during the <code> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> </code> loop. | How to retrieve the post_id of a tag page? | wordpress |
As usual, rewrite stumped me! I've built a custom search for searching through comments and comment meta, using a flat table. I'm using a rewrite rule as follows: <code> ..../search/reviews/<parameters> </code> I'm sending a query var 'args' which is group of key/val pairs to search against, to my custom template... | I used a jQuery trick to achieve this. I changed <code> submit </code> to a <code> button </code> and used jQuery to form the desired URL. If nothing was entered in the search form, then I redirected to the 404 URL. | Overwrite WP's default search rule to redirect to my own template | wordpress |
This is driving me nuts and I'm hoping someone knows of a way around it. Say I have a permalink structure of <code> /%postname%/ </code> and I have URLs like <code> www.domain.com/blog/post-name/ </code> . So I go about linking and what have you out in the big bad internet. But, now I decide I want to add a static home... | It sounds like user error to me, or possibly a plug-in. I am leaning towards operator error. WordPress just gives you the vehicle, your the one at the wheel. The good thing about WordPress is it allows people without the knowledge it takes to build a website a chance to jump right in, sink or swim. It's all a matter of... | How to get Wordpress to NOT alter the permalink structure when adding a static page? | wordpress |
I've been working with Wordpress off and on for years now, but I haven't gotten entirely immersed with the framework. I have no problem creating plugins that use custom post types, but I'm looking to add a new section in the admin that isn't for posts, but rather my own custom tables. I know how to create the custom ta... | Check out the Administration Menus section in the Codex, I actually used it pretty heavily over the last couple days to create a sub-menu and it helped a lot. It goes into detail on the top level menus as well. You'll specifically need the add_menu_page() function to create the top level menu, as well as the add_submen... | Create New Admin Menu Section - Like how custom post type works, in a way | wordpress |
I need to add a RewriteRule to my site. I have tried in .htaccess with no luck, it doesn't get parsed, so I'm all but giving up on that. I found the documentation on add_rewrite_rule, but have no idea where I'm supposed to use it. I am not writing a plugin. I need to put in one simple rule. I went to the functions.php ... | <code> add_rewrite_rule </code> is for converting a URL structure to query vars and routing requests through <code> index.php </code> , you can't point to other URLs and use flags like you would in htaccess rewrites. for what you're trying to achieve, doing it via htaccess is the simplest way. your rule should work if ... | Where do I USE add_rewrite_rule? | wordpress |
Many plugins don't provide a documented way to access their functions from within PHP (e.g. when building a custom theme), but only shortcodes to insert in posts. Is there a standard way of executing shortcode from within PHP as if it were part of the content? Like so (this is made up): <code> $gallery_html = execute_s... | You can execute shortcodes using the do_shortcode() function <code> $gallery_html = do_shortcode('[gallery]'); </code> | Is there a way to parse shortcodes in PHP? | wordpress |
Thanks to stackexchange-url ("Rarst's clever answer"), I'm succesfully using these bits to remove the classes from the custom menu markup... <code> add_filter('nav_menu_css_class', 'discard_menu_classes', 10, 2); function discard_menu_classes($classes, $item) { return (array)get_post_meta( $item->ID, '_menu_item_cla... | Sure, you can filter out all the classes but the ones you want. <code> add_filter('nav_menu_css_class', 'discard_menu_classes', 10, 2); function discard_menu_classes($classes, $item) { $classes = array_filter( $classes, create_function( '$class', 'return in_array( $class, array( "current-menu-item", "current-menu-paren... | Removing all classes from nav_menu except current-menu-item and current-menu-parent | wordpress |
first of all I'd like to thank you for all the great work you're doing. I've found a lot of useful infos and tricks taking a look around in Wordpress Answers. Well, I'm here to ask so that's my question: I need to make several "sort by" pages with different criteria. The first I made was "sort by title" and I use a bun... | after some trials I've got one solution that seems to be good but I need some tweaking help <code> <ul class="list-ensemble"> <?php $terms = get_terms("production_co_type"); $count = count($terms); if ( $count > 0 ){ echo "<ul>"; foreach ( $terms as $term ) { echo '<li class="title">' . $term-&g... | Sort posts alphabetically by category/custom taxonomy, insert divider between different types | wordpress |
I've got a custom post type with a file upload field. In my template file i'm using this to display a link to that file. <code> <a href="<?php the_field('downloads'); ?>">Download PDF</a> </code> What i want is to be able to have it display the file title. So instead of Download PDF it will say the fi... | I've used a work around for this. Instead of using the title name for the file i've added another field to use as the title. Not the way i intended but it works. | File Attachment display title in template | wordpress |
I've found that <code> is_front_page </code> appears to return true when I'm viewing the home page and have a single sticky post assigned there. It also returns true when I've assigned a page as the static front page via Settings > Reading . Why would I ever want to use <code> is_home() </code> ? | <code> is_front_page() </code> returns true if the user is on the page or page of posts that is set to the front page on <code> Settings->Reading->Front page displays </code> So if you set <code> about us </code> as the front page then this conditional will only be true if showing the <code> about us </code> page... | When to use is_home() vs is_front_page()? | wordpress |
I asked a very similar question earlier today (stackexchange-url and thought I had the answer, but now it appears otherwise. If I have a post/page with the original permalink of <code> http://mydomain.com/blog/my-post/ </code> for example, and I set that as the static home page of the blog, I am unable to get the origi... | Edit: Wow. I mistyped a bunch the first time around. Hopefully nobody read that. All corrected now. /edit I went code spelunking... :) Short version, the workaround would be this: <code> <?php $front_page_id = get_option( 'page_on_front' ); $my_permalink = _get_page_link( $front_page_id ); ?> </code> If you look ... | How to get the true permalink of the static home page? | wordpress |
On a large multisite install with 200 authors I need the author on new posts to default to none. I unset the post_author div and moved it to the publish box (where it should be anyway) and wrote a new post_author_meta_box function since there is no way to change the wp_dropdown_users $args. <--track ticket. It works... | I figured out a solution so I'm leaving the question up as it might be helpful to someone else. <code> if ( 'auto-draft' == $post->post_status ) : $selected = false; else : $selected = $post->post_author; endif; </code> | Set default post author to none on new post | wordpress |
I can't figure out how to get the original post_id of a specific page if that page has been set as the static posts page of the blog. I have a page that normally has a post_id of 95, but as soon as I set it to the static posts page, it returns a post_id of 0 and it's causing me lots of headaches. How can I retrieve the... | the id of the posts page is: <code> $posts_page_id = get_option( 'page_for_posts' ); </code> the conditional tag for the posts page would be: <code> is_home() </code> edit: the id of the static front page is: <code> $front_page_id = get_option( 'page_on_front' ); </code> | How to get the original post_id of a static home page? | wordpress |
I'm wondering if there is a good way to tell which archive page a post came from. I essentially just need the post's position in the total order, then divide it by the 'posts_per_page' option. The hangup I'm having is getting that position or offset of where the post sits. EDIT: All while being on the SINGLE POST templ... | Alright, nevermind. I got this solved by doing this at the top of the single post template: <code> $position_query = array( 'post_type' => 'portfolio', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => -1 ); $position_posts = get_posts($position_query); $count = 0; foreach ($position_posts as $p... | A way to detect which page a post is on | wordpress |
I'm trying to get info into my network sites page in a column. Below works great to grab the network site ID for each site. How can I make it display the option_value for the item (blog_expire) in the option_name column within my blogname_options table? <code> class Add_Blog_ID { public static function init() { $class ... | here is a modified version of your class that should work: <code> class Add_Blog_ID { public static function init() { $class = __CLASS__ ; if ( empty( $GLOBALS[ $class ] ) ) $GLOBALS[ $class ] = new $class; } public function __construct() { add_filter( 'wpmu_blogs_columns', array( $this, 'get_id' ) ); add_action( 'mana... | Add new column to sites page | wordpress |
When I'm on archives pages I am using the code below to query posts. In my theme options to_count_home calls the number of posts. WordPress isn't generating the correct number of pages based on posts_per_page. Instead it is generating pages based on the number of posts per page I have selected in my default WordPress s... | You are not modifying your query, but nuking it completely. Please see <code> query_posts() </code> documentation in Codex on how to correctly re-run query with changed arguments. | Query Posts Creates 404 Error | wordpress |
I am working on a multi-user WordPress setup and have made it so a particular type of user can only see and interact with posts, images, pages etc that they have authored. The code to make this happen looks like this: <code> add_filter('pre_get_posts', 'current_author_posts'); function current_author_posts($query) { if... | I got this almost working, but refinements are needed to fit the specifics of the question and to deal with Attachments and Post-Types differently (see comments in code)... First, I think it's worth noting how I found the filter: <code> apply_filters( 'views_' . $screen->id, $views ) </code> inspect element do a glo... | Update post counts (published, draft, unattached) in admin interface | wordpress |
<code> Warning: Cannot modify header information - headers already sent by (output started at /home/ezekiel/public_html/boxsponsive/wp- content/themes/BoxSponsive-Portfolio/class.wp-less-styles.php:3) in /home/ezekiel/public_html/boxsponsive/wp-includes/pluggable.php on line 934 </code> So, I'm sure that you've all see... | Goin with @One Trick Pony... Change: <code> <?php /* You really don't want to touch this file if you don't know what you're doing. */ ?> <?php class WP_LESS_Styles extends WP_Dependencies { .... </code> To: <code> <?php /* You really don't want to touch this file if you don't know what you're doing.*/ class... | Warning: Cannot modify header information (with a twist) | wordpress |
Is there any place that has free hosting for wordpress and allows custom themes? I have seen a bunch that offer free hosting but none that seem to allow custom themes. I guess I should add a Little more about why I want it to be free I just want to throw up a site for a couple days to fool around with the theme get som... | www.POWRHOST.com offers unlimited free hosting for Wordpress and other apps. Free cPanel, free scripts, free auto-install. Update 14.02.2012 I just learned the hard way that each 30 days of "inactivity", the Powrhost system auto-deletes your entire blog and contents. You'll get an email that your "free account" has bee... | Free Wordpress Hosting with Custom Themes? | wordpress |
When logged in, the admin bar adds the following to my page <code> <head> </code> section: <code> <style media="screen" type="text/css"> html { margin-top: 28px !important; } * html body { margin-top: 28px !important; } </style> </code> Now, I can remove this by disabling the admin bar <code> /* Disab... | <code> function hide_admin_bar_from_front_end(){ if (is_blog_admin()) { return true; } return false; } add_filter( 'show_admin_bar', 'hide_admin_bar_from_front_end' ); </code> | How do I remove the admin bar (styling) from frontend only? | wordpress |
Simply put - how might I completely hide media files uploaded by any other users other then themselves? Id like to disable access to these links & files since they are a way for non-admin users to be able to access and edit a custom post type that is normally not visible to them otherwise in the backend of wordpres... | Actually you can, and here's how to do it: This code hides all posts and media that do not belong to the currently logged in author (you can change it to apply to other user roles). It also fixes the post and media count on the filter bars (e.g. All | Images | Videos | Unattached). <code> // Show only posts and media r... | How to hide media uploads by other users in the Media menu? | wordpress |
I'm building a horizontal menu and some of the entries on that menu will have dropdowns (sub-menus), and some won't. Those that have sub-menus are not actually pages. They're just meant to be guides for the dropdowns. For instance, say the the horizontal menu is like follows: Home | About Us | Products | Directions | C... | I have a few idea's: set the custom link to "#" which won't return anything Add a custom class to the items then use jquery to remove the links: http://wpgarage.com/code-snippets/how-to-remove-the-link-to-parent-pages-when-using-wp_list_pages-in-wordpress-navigation/ PHP equivilate to the jquery method: http://bavotasa... | How make top level menu item not have link, but have sub-menus that are linked? | wordpress |
I'm showing a list of users like so: <code> <ul> <?php $directors = get_users('role=director'); foreach ($directors as $director) { $dir_id = $director->ID; $dir_order = get_user_meta($dir_id, 'exit_director_order', TRUE); $dir_link = get_bloginfo('home').'/?author='.$dir_id; if ($dir_id == $director_id ) {... | Here's the solution. Comments included: <code> <?php $results = get_users('role=director'); foreach ($results as $result) { // Get data about each user as an object $user = get_userdata($result->ID); // Create a flat array with only the fields we need $directors[$user->ID] = array( 'dir_order' => $user->... | Order users by custom user meta | wordpress |
I'm trying to write to an XML file in a WordPress Plugin. I'm on my local machine, a Mac running MAMP. I have PHP 5.2.13 My code is: <code> $file_handle = fopen('markers.xml', 'w'); $stringdata = "Test Info"; fwrite($file_handle, $stringdata); fclose($file_handle); </code> I get the following error: Warning: fopen(mark... | Check folder permissions too. Also See this post http://www.php.net/manual/en/function.fopen.php#105465 - suggests he had to change to absolute from relative to get around error message. Set of debug suggestions here: http://www.wrensoft.com/forum/showthread.php?t=786 1) folder permissions 2) upper/lowercase 3) abs/rel... | Failed to Open Stream: Permission Denied While Writing to an XML File in a WordPress Plugin | wordpress |
I'm having difficulty searching for the answer to this question since {} and [] don't seem to affect search queries. My question is simple: how are these syntaxes different in meaning? <code> {short_code}{/short_code} [short_code][/short_code] </code> | To WordPress, as it parses through the content, only the tags using square brackets will be treated as short codes. The curly bracket example given would not be parsed by the WordPress core. It is possible the tag would be parsed by a plugin or theme if they are looking for hooks in the content that they don't want han... | shortcodes between square and curly brackets | wordpress |
I already know how to remove a metabox from my custom post type edit page. However I want to remove the comments metabox but still allow commenting for the post. Because I notice when I do remove it, it disables comments. Any function I can use? | Don't remove this via CSS. The _POST part is also active and WP save the data! Use the hooks to remove meta boxes; code by scratch. <code> function fb_remove_comments_meta_boxes() { remove_meta_box( 'commentstatusdiv', 'post', 'normal' ); remove_meta_box( 'commentstatusdiv', 'page', 'normal' ); // remove trackbacks rem... | Remove Comments Metabox but still allow comments | wordpress |
I'm following a tutorial . I've included the hover.js with the following code: <code> $(function() { // OPACITY OF BUTTON SET TO 50% $(".imgopacity").css("opacity","0.5"); // ON MOUSE OVER $(".imgopacity").hover(function () { // SET OPACITY TO 100% $(this).stop().animate({ opacity: 1.0 }, "slow"); }, // ON MOUSE OUT fu... | Going through your source - jQuery Source - it seeems that <code> noConflict() </code> is getting called right at the end. To fix your hover.js then would look something like this: <code> jQuery(function($) { //Allow the use of $ namespace in this function. // OPACITY OF BUTTON SET TO 50% $(".imgopacity").css("opacity"... | WordPress Jquery Fade in, Fade out effect | wordpress |
When I create a new page and put <code> <br class="clear"> </code> into the HTML view it gets rendered as <code> <p> <br class="clear"> </p> </code> This causes problems with the theme <code> http://www.gallyapp.com/tf_themes/?theme=Lotus </code> where the <code> <br> </code> is not wrappe... | Use shortcode instead of <code> <br class="clear"> </code> | How can I prevent Wordpress to wrap into a paragragraph | wordpress |
Is there a function that allows me to change the filename of an attachment, based on the Attachment ID I have? Thanks! Dennis | This will allow you to rename an attachment as soon as its uploaded: <code> add_action('add_attachment', 'rename_attacment'); function rename_attacment($post_ID){ $post = get_post($post_ID); $file = get_attached_file($post_ID); $path = pathinfo($file); //dirname = File Path //basename = Filename.Extension //extension =... | Change attachment filename | wordpress |
I am wanting to see the actual SQL that worpress is running to build certain pages, is there a debug method or some other way to outpout this or view it? | You can use any one of these filters from /wp-includes/query.php <code> posts_where_request posts_groupby_request posts_join_request posts_orderby_request posts_distinct_request posts_fields_request post_limits_request </code> You can print certain parts of the query to the screen to see what's going on under the hood.... | Display SQL that wordpress is running | wordpress |
I have multiple wordpress websites that uses the same files and database but with different table prefixes, I use a plugin " Shortcode Exec PHP " and I would like to use the same shortcodes on all the sites, but this plugin doesn't use it's own table, it used the update_option function from wp to store the data. So I t... | You will need to restore the database prefix after using it , with something like this <code> global $wpdb; $previousPrefix=$wpdb->prefix; $wpdb->prefix="mainsiteprefix_"; //Database access goes here $wpdb->prefix=$previousPrefix; </code> or you can create a new wpdb object like this: <code> $wpdb2 = new wpdb(... | Making plugin to use different table prefix cause permission problem | wordpress |
I'm using this code <code> <?php $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0'); $subpages = ($post->post_parent) ? wp_list_pages('title_li=&child_of='.$post->post_parent.'&echo=0') : wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0') ; if ($children) {... | Just pass <code> number=5 </code> and it should work since <code> wp_list_pages() </code> uses <code> get_pages() </code> which has number parameter, and also if you look at wp_list_pages codex entry at the bottom under change log you can see that it take the <code> number </code> parameter since version 2.8 | wp_list_page with something like showpost | wordpress |
What im trying to do is echo a class depending on witch of 3 Main "Parent" Categories the content was posted in , here is my code so far <code> <article class="post <?php if ( in_category( 'dream-it' )){ echo 'dreamit'; } if ( in_category( 'build-it' )){ echo 'buildit'; } if ( in_category( 'get-the-hell-out' )){ ... | you probably need to get the parent category of each of the post's categories first. <code> <?php $parent_cat = array(); $post_cats = get_the_category($post->ID); foreach( $post_cats as $post_cat ) { if( $post_cat->parent ) $parent_cat[] = get_category( $post_cat->parent )->slug; } ?> <article clas... | Echo class depending on Parent category | wordpress |
I'm trying to right align (class="alignright") a YouTube video AND allow my client to edit the surrounding text in the future using the visual editor. I simply added class="alignright" to the tag containing the embed using the HTML editor however when any changes are made to the text using the visual editor WordPress s... | Use an id and CSS selector for the element and align it in your stylesheet. | Right align a youtube video | wordpress |
i have a childtheme from twentyeleven, i created a 'inicio' (name) custom menu, how can I apply it? tried: <code> <?php wp_nav_menu( array( 'theme_location' => 'inicio' ) ); ?> </code> but not working (not even change visible) EDIT Trying now: header.php: (child) <code> <?php //wp_nav_menu( array( 'theme_lo... | You should have a theme locations dropdown titled inicio, select the menu you created here and it will work. Alternately, if you just want to replace the main menu, select inicio in the Theme Locations box under Primary Menu. | New custom menu created. how to apply it? | wordpress |
I've got a cpt called 'blog', now I would like to list all authors that contributed to that cpt. Also I would like to list all blogposts (from the 'blog' cpt) grouped in months, like wp_get_archives() does. Authors. I tried to use wp_list_authors but it only lists authors from regular posts, not cpt's. I only want list... | This should have been two different questions but anyway, I needed to use <code> wp_list_authors </code> for custom post type so i created this function: <code> function get_authors_ids_by_post_type($type = null,$args = ''){ if ($type === null) return; global $wpdb; $defaults = array( 'orderby' => 'name', 'order' =&... | Listing authors and date archive from custom post type | wordpress |
So I'm trying to query some posts from 1 category only and it does seem to be working. I tried get_post() also but no luck and after awhile I just caved and used query_posts (which is apparently bad practice). Here's my code: <code> <div id="primary"> <div id="content" role="main"> <?php query_posts('slu... | Weird Problem!, try the following: Make sure that the targeted categories are not empty. If you are using custom post type,include it in the query <code> 'post_type'=>'advertisement' </code> for example. If the targeted categories are special taxonomies,make sure to include it in the query : <code> 'term'=>'cars'... | Wordpress Query Posts From Category Post on Static Page | wordpress |
I am working on a community portal that may in future cater to extremely large user base. All users have about 50 settings that needs to be stored to the user meta. These settings would be frequently accessed and overwritten with new values when the user saves changes to their profile. This would lead to extremely larg... | To answer your questions: Would these high number of calls to update_user_meta cause any performance degradation? The Higher the number of calls to the database the slower its going to work since every query takes some (not much but still) time. Which of the two appears to be a better solution? Recently I finished a pr... | update_user_meta: How many is too many? | wordpress |
What function actually renders the wp_admin_bar? And how can I call it? I want to print out just the nodes / DOM for the actual menu. It would end up rendering something like this: <code> <div id="wpadminbar"> <div class="quicklinks"> <ul> .... </ul> </div> </div> </code> I couldn't ... | WordPress admin bar is rendered by <code> render() </code> method in <code> WP_Admin_Bar </code> class, also you may need to check <code> wp_admin_bar_render() </code> , it add few hooks before and after rendering and also calls this method | What function actually renders the wp_admin_bar ? How can I call it? | wordpress |
I'm using media_sideload_image to download images from the web and store them. However, the problem is that the ones from youtube are always called "hqdefault.jpg", which means that it will override the existing image. There are three ways of fixing this: How can I change the attachment structure so that it includes th... | When I started using <code> media_sideload_image() </code> , I found it pretty useless as it returned a full html tag, instead of the attachment ID, so I created my own version of it which replicates all the functionality of <code> media_sideload_image() </code> and adds some very useful stuff, like: saving the sideloa... | media_sideload_image file name? | wordpress |
Is it possible to have a custom page template in a different folder? I'm setting up a little framework for WordPress that I can use over and over for themes and just for the sake of being tidy I want to put custom page templates inside a different folder rather than the root of the theme directory. How would one go abo... | WordPress uses <code> get_page_template() </code> to determine the template file to use which can be altered by filters: <code> //for pages add_filter( 'page_template', 'My_custom_page_template' ); function My_custom_page_template( $page_template ) { if ( is_page( 'my-custom-page-slug' ) ) { $page_template = 'pathto/cu... | WordPress Custom Page Template in a different directory | wordpress |
I have a local install of Wordpress running & I am suddenly getting these errors in my console when I open a modal window (such as file upload): <code> Uncaught SyntaxError: Unexpected token ILLEGAL media-upload.php:75Uncaught ReferenceError: jQuery is not defined media-upload.php:89Uncaught ReferenceError: SWFUplo... | Ok this appears to have been solved by turning on <code> short open tag </code> and <code> zlib output compression </code> in the php settings of WAMP | Uncaught SyntaxError: Unexpected Token Illegal | wordpress |
wp-admin table lists - like post list Is there a API or something to build table lists in wp-admin? With table lists I mean like the list of posts for example. It has columns, sorting, paging and so on. Admin loop - the right way When I create my loop I want it to look and feel like the core code, build it the right wa... | Yes, in version 3.1 <code> WP_List_Table </code> class was introduced and admin started to move to using it. As of 3.2.x it currently is not officially declared to be stable API to be used by developers, but in practice it is usually more viable approach than building tables from scratch anyway. On admin loops - admin ... | Admin table list API? | wordpress |
I develop my first wordpress plugin. I have not really found a tutorial "easy to use", so I started it. Currently, the "add_menu" did not add my link to manage settings. Yet when I activate my plugin, wordpress does not display an error and tells me "extension enabled" Can you help me? Here is my code. file "affiliatio... | Ok, Here is the solution. In fact, in the args of <code> add_action() </code> or <code> add_options_page() </code> , I thought it was necessary to <code> array("filename", "function") </code> ... the good write is <code> array("object", "method") </code> | Add admin settings and options | wordpress |
I am creating 2 custom post types, and with the one displaying a list of the posts in #2. I am 90% of the way there, have the select showing but can't get it populated with the custom post types posts from #2. I am using get_posts to create the array, and then echoing into the select. <code> $option_list = get_pages( a... | If 'Partners' is a custom post type, then why don't you use get_posts ? Try using it... <code> $pages = get_posts(array('post_type' => 'partners', 'posts_per_page'=> -1, 'post_status' => 'publish')); echo '<select name="activitymeta_sel" id="activitymeta_sel">'; echo '<option value="">Select Partne... | Displayling list of Custom Post Type Posts | wordpress |
I literally don't know where to begin with this. The only wp_nav_menu() documentation I found was http://codex.wordpress.org/Function_Reference/wp_nav_menu and all submenu docs reference a different function or layout. What can I do? | Just drag and drop menu items in admin area. Submenu will automaticly appears in html. Then you can style it with css as you wish. Dropdown or something else. | Add a submenu to wp_nav_menu | wordpress |
Hi to all I would like to create a big Wordpress network with this structure: sitename.com (Main website) cat1.sitename.com (sub website) cat11.cat1.sitename.com (sub-sub website) cat12.cat2.sitename.com (sub-sub website) cat2.sitename.com (sub website) cat21.cat1.sitename.com (sub-sub website) cat22.cat2.sitename.com ... | While this question is several months old and you've probably figured something out already, I figured it was worth answering anyway. This is possible to do using the WP Multi Network Plugin . WordPress has the underlying structure to accomplish this, but no accompanying UI -- this plugin merely offers that interface. ... | How to create Sub Sub domain Multi User blogs? | wordpress |
I have a page in my Wordpress site that calculates post popularity and updates several meta fields on the posts and calls a few functions as well. This page is set to "Private" so that only myself and other admins can see it. Is there a way to load this page automatically every 6, 12, or 24 hours? I'd be satisfied with... | You could use the WP-Cron functions to scheduled events. Note though that this is pseudo-cron- it requires someone (or a bot) visit your site for the events to execute. To fire events more reliably, search for scheduling cron jobs (linux) or scheduled tasks (win). Depending on your hosting, you may have access to simpl... | Automatically load Wordpress page on server every XX hours | wordpress |
I have a plugin that I want to ensure runs ONLY on singular posts, pages, etc. I'm using the is_singular() function and it works great - except that all it does is return execution to the rest of the plugin if I do this: <code> function singular_check(){ if(is_singular()) return; } </code> I'm executing it in a hook li... | A possible solution would be to hook in way late (template redirect, for example), do your conditional check. If it passes, include (or require) a file that contains the stuff needed. <code> <?php add_action( 'template_redirect', 'wpse30291_template_redirect' ); function wpse30291_template_redirect() { if( ! is_sing... | How to exit a plugin's execution mid-stream? | wordpress |
I am working on a plugin where I am trying to create a "archive like" page with permalinks. Here is what I have so far: I've created a query var "experience" I've created custom SQL selects using - "post_join" and "post_where" hooks I've created a custom template using the "template_redirect" hook I've added custom per... | Just write a function that checks if permalinks are on by checking whether <code> get_option( 'permalink_structure' ) </code> is empty or false and generates the appropriate link given the <code> $id </code> . Something along the lines of the <code> get_permalink() </code> function which either looks at the <code> $pos... | How to link to custom "archive like" page with custom permalink rules "dynamically" | wordpress |
I've checked around and haven't seen an answer which works as of yet. I have a WP_Query with the following arguements: <code> $args = array( 'post_status' => 'publish', 'post_type' => 'listing', 'meta_key' => 'client_feedback_score', 'orderby' => 'client_feedback_score', 'order' => 'DESC' ); $query = new... | <code> orderby </code> should be <code> meta_value_num </code> , or <code> meta_value </code> , not the name of the key. See WP_Query orderby parameters. | WP_Query - Order results by meta value | wordpress |
Morning all, I'm having some issues with excluding my custom post-type 'events' from my index.php loop for my Blog page. I simply want to display the posts from my actual Blog, which I assume come under the post-type 'post', but when I try to display the 'post' type it also shows my 'events' post-type. Here's my loop c... | Try using the following before " <code> if (have posts().. </code> " <code> $args = array( 'post_type' => 'post', 'orderby' => 'rand', 'showposts' => '1' ); query_posts( $args ); </code> | Problems excluding a custom post-type from the loop | wordpress |
I am working on my user back end access in which users can control a few posts based on post type as well as submit posts in a few other areas (Guides and Encyclopedia entries). The single post types they have access to have a large amount of meta-data and taxonomies to choose from/enter data into. I was thinking of sp... | I decided against the idea. Answered my question for clarity. | Split post edit screen into sub-edit screens for users, is this good or bad, and is it possible? | wordpress |
I'm wondering if it is possible to add different classes to second/third/fourth/etc-level items that have children in Appearance > Menus tree? That's how I call the menu: <code> <?php $menu_args = array( 'container' => '', 'menu_class' => '', 'menu_id' => 'my-menu', 'walker' => new Description_Walker); w... | There are two ways of doing this: Javascript. You could use JQuery to select the <code> <li> </code> that have <code> <ul> </code> children of class 'sub-menu', inserting content, or appending a CSS class which you then style. For example: <code> $('.sub-menu').parent().addClass('myclass') </code> PHP, a ne... | Adding a class (arrows) to main menu links that have children? | wordpress |
I'm moving a WordPress installation from /blog to the root directory on the server. There weren't more than ten blog posts in the blog, but I'm concerned about Google finding dead urls. Is there an easy way to handle redirects? A plugin, etc. Or a simple best practice? Thanks very much. | see if this plugin can work for you: http://wordpress.org/extend/plugins/quick-pagepost-redirect-plugin/ | Moving WP from /blog to root directory | wordpress |
Whats the difference between a nightly build and the latest stable download, and what is the ideal use case for each? On the Nightly Build Page it says: Development of WordPress moves fairly quickly and day-to-day things break as often as they are fixed. This high churn is part of our development process that aims to p... | Stable release of WP is the one meant for production. Any serious issues (such as security) are addressed via minor releases. Some of the fixes for not that serious issues can be received ahead of schedule with Hotfix plugin. Non-stable versions are usually run by WordPress developers for the sake of experimentation an... | Downloading Wordpress: Nightly Build vs. Stable Download | wordpress |
So let's say i register a custom taxonomy called: <code> Clients </code> With a few terms such as: <code> Microsoft, IBM, Apple </code> Under a CPT (custom post type) called <code> projects </code> : Permalinks <code> /%year%/%monthnum%/%taxonomy%/%postname%/ </code> this is the structure i am using; http://www.example... | You need to write a custom rule. I did similar stuff for a recent project. Create a template, and assign it to a page, with slug as 'clients' (or anything you like, but change the slug in the following rule as well). Try the following code, use functions.php : <code> add_action('init', 'custom_rule'); function custom_r... | Custom Post Types, Custom Taxonomies and Permalinks ? | wordpress |
I have 2 functions about the wp_remote_get. I wanna write all data ( functions output ) into the txt file ? How to ? the functions; <code> // facebook function hayransayisi(){ $fb_id = '206938902665808'; $count = get_transient('fan_count'); if ($count !== false) return $count; $count = 0; $data = wp_remote_get('http://... | How does these functions relate to writing file? Do you want to write to file in general or modify functions to accomplish that? Simple approach - do it with PHP, for example with <code> file_put_contents() </code> . However between different hosting configurations this is not always reliable. Actually workflows in WP ... | How to write txt file? | wordpress |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.