question stringlengths 0 34.8k | answer stringlengths 0 28.3k | title stringlengths 7 150 | forum_tag stringclasses 12
values |
|---|---|---|---|
Essentially I want this... http://oldtimemusic.com/otlinks.html I want to have an index of letters each pointing to a page with links for that letter along with a description. I'm wondering if there is some way I can do that with a wordpress plugin or maybe even the out of the box link functionality? I'd just rather no... | I think the Wordpress bookmarks feature would work grand here. Here's how I got this to work (generically). Go to Links-> Link Categories and add all the letters of the alphabet as categories Create a new link, add a description and notes, and assign it to a specific alphabetical category. Create a page template (as sh... | Is there an easy way to create a links index page? | wordpress |
Im currently building a small store section on a site of mine with the use of CPT's & Custom Tax's for the first time. So far Ive successfully got my CPT's & Tax's working as expected however since this is my first time Im still a bit stumped about the best approach to take to present this content via templates... | I found what appears to be the solution I needed after a lot of digging so I figured if anyone else might need the example, here it is... http://mondaybynoon.com/2011/05/20/revisiting-custom-post-types-taxonomies-permalinks-slugs/ | Most appropriate way to display CPT's by children terms of custom taxonomies while retaining desired permalink structure? | wordpress |
I usually type my posts directly via the HTML textarea, but I forget quite often to add anchors to the -Elements. Can they automatically be added with the text of the heading? How can this be achieved? Does a plugin exist for this? | It is not exactly what I was looking for, but Table of Contents Plus also adds anchors to my headings. | How can I get automatically anchors for every h2-heading? | wordpress |
My feed links don't work, even after I add this code to functions.php: <code> add_theme_support('automatic-feed-links'); </code> When I try go to mysite.com/feed or mysite.com/?feed=rss or any of the links specified in the Codex , I don't get a feed with my content. In Safari, I get this: Safari could not update this f... | The problem is that the front page is set to a static page. This became clear when I noticed that my feed problem was specific to the front page—feeds for taxonomy archives and post type archives work fine. Only the front page feed was causing trouble. One way around this is to create a feed template. My starting point... | Feed links not working even with add_theme_support('automatic-feed-links') | wordpress |
I am using the WordPress (Appearance > Menus) feature to create a custom navigation menu. I created a menu item that has a dropdown and would like to activate the dropdown menu with a click rather than mouse hover. How would I go about doing this? I'm familiar wit jQuery, I just don't know how to remove the current hov... | The hover is part of the theme you are using. You need to find whats causing the dropdown on hover and remove it. It'll either be javascript controlled or css. You can test if its javascript by disabling javascript, although is may have a css fallback. If its CSS use firebug to find the selectors for the nav menu. In y... | How do I remove WordPress Custom Menus hover event and replace it with jQuery onclick? | wordpress |
I'm looking to create a custom Google map that plots several markers on it that then shows custom data in the popup when the marker is clicked. I've setup the pages in WP in this manner: Map (parent page) Company one (child) Company two (child) Company three (child) ...and so on. I want the map to be on the map page an... | I've done something similar using gmaps (http://gmap.nurtext.de/). You might want to take a look at that. It's self explanatory and there's quite a bit of documentation IF you google around. | Google map that plot's several markers - each one with custom data | wordpress |
I'm having a bit of a problem with my custom post types... My post type is called 'videos'. I have all of the posts showing on their single page using the 'single.php' template. But when I take the post name out of the url and keep /videos/, I get a 404 - but I want to list all of the 'videos' here. I tried using archi... | You need to add the arg 'has_archive' => true. Hope this helps! | How to display custom post types using single-[post_type] and archive-[post-type]? | wordpress |
I know how to add fields to custom post types one at a time. I was wondering if there is a way to add a field to the default post type as well as all the custom post types at once? Thanks | You can't use the <code> add_meta_box() </code> function with an array of post types unfortunately although it would be a good core contribution. The way to do this at the moment is to get an array of your post types and loop over them calling your <code> add_meta_box() </code> line for each one eg: <code> foreach( get... | Add field to all custom post types | wordpress |
I'm creating a custom Google map that plots multiple markers. View the link as it will make it easier to explain what is happening and what I want If you click on each marker it shows company names that are grabbed from the child pages. At the moment it's showing ALL the company names on each marker. How can I show jus... | Use the <code> offset </code> argument, and only get 1 result: <code> global $my_page_offset; if(!isset($my_page_offset)) $my_page_offset = 0; $pages = get_pages(array( 'child_of' => $post->ID, 'sort_column' => 'menu_order', 'offset' => $my_page_offset, 'number' => 1, )); $my_page_offset++; ... </code> I... | Stepping through a foreach loop - adding +1 to the end of it so next time it loops it starts on item 2 | wordpress |
If you go to http://redoakchrysler.net/vehicles/new-vehicle-inventory and select 2012 from the drop down menu in the years list, you will be taken to a 'page not found' page. But if you select any other year, or any other option in the drop down menus, it performs the search correctly. Has anyone ever experienced this ... | Change $year to another variable. | Form Data Causes "Page Not Found" | wordpress |
In a theme I'm building, there are two main types of page. One is a product-gallery, one is for general info. I'd like to use <code> wp_get_pages() </code> or <code> wp_list_pages() </code> twice in the sidebar, one with a list of one type of page, and one with the other. I don't want to hard-code <code> include </code... | Create a hierarchical custom post type , then pass <code> post_type </code> to wp_list_pages : <code> $args = array( 'post_type'=>'gallery' ); wp_list_pages( $args ); </code> | Is there a way to make a custom Page type? | wordpress |
Image galleries display those images that were uploaded to that post, by default. If I wanted to move an image to a different post, so it appeared there instead, would I have to delete and re-upload? Or, is there a way to re-assign an image that's already in the Media Library? | This works for me: http://wordpress.org/support/topic/detach-amp-re-attach-media-attachment-images-from-posts#post-1609173 I've saved this as a snippet in my IDE for use in projects. Very handy! | Can I attach an image to a different post? | wordpress |
Inside of a Wordpress category metabox or any custom taxonomy box for that matter there is a link with the text "+ Add New Category" is there a way this link can be removed preferably without resorting to JS or CSS hacks to hide it? A way to hide it using some kind of filter or action hook would be best. If no action h... | The default metaboxes are registred in the file <code> wp-admin/includes/meta-boxes.php </code> . There you can find the function <code> post_categories_meta_box() </code> which will generate the taxonomy metabox. Currently there is no hook available to filter the output. But you can do one of the following: Use <code>... | How To Remove The "+ Add New Category" Link From A Category Metabox | wordpress |
Can you upload it somewhere or send to my email? | You can still find the most recent version in WordPress.org's plugin Subversion . | Does anyone have the Custom Post Permalinks plugin from John P. Bloch? | wordpress |
In my one project I am using old 2.8.4 version of word press. So If In url wrong category name is there then it is going to the page 404 page not found. But I want that still it should go to the archive page only. In latest version of wordpress it is like that only. It is going to category page if i specify wrong categ... | You should really upgrade to the latest version. If you won't do that then simply copy your archives.php and paste it into the 404.php file. | In a url where Category Id is wrong It is showing wrong it is going to the page not found page | wordpress |
What's the easiest way to duplicate an entire navigation menu? I don't care if it involves SQL commands or whatnot. I just have some really big menus that I'd like to duplicate. Didn't see a plugin to do this. For clarification, I wan to duplicate the menu so I can make some edits to it and use it as a secondary menu e... | UPDATE: The "easiest" way is to use my new plugin: http://wordpress.org/extend/plugins/enhanced-menu-editor/ It's not approved yet, but once it is I'll publish the widget. Not only does it allow for copying menus, but you can also synchronize the menu structure you establish in the menu editor to the page heirarchy of ... | What's the easiest way to duplicate an entire navigation menu? | wordpress |
I am trying to add an option to create a child page from the wordpress all pages screen. I found this link, but cannot get it working properly. It is exactly what I need, but I need help fixing it http://sltaylor.co.uk/blog/easy-child-page-creation-wordpress/ <code> function slt_childPageAction( $actions, $page ) { $ac... | If you mean the 404 error: <code> function slt_childPageAction( $actions, $page ) { $actions["create-child"] = '<a href="'.add_query_arg(array('post_type' => 'page', 'parent_id' => $page->ID), admin_url('post-new.php')).'" title="Create a new page with this page as its parent">Create child</a>'; re... | Create Wordpress child page from page actions | wordpress |
I just wasted 1 day trying to make wp threaded comments works... and I think I'm finally done!!!! except that it doesn't work properly - well it doesn't work the way I want ! :) Child comments get displayed inside the comment li - I don't like this behavior, I'd prefer wp to display it right below the parent comment li... | What you need is a custom <code> Walker </code> . You will probably use <code> wp_list_comments() </code> somewhere in your <code> comments.php </code> template file. There you can pass a <code> walker </code> parameter in the argument array to tell WordPress you want to style the list on your own. This requires you to... | wordpress threaded comments - customize nested ul / how child ul is displayd | wordpress |
Quite a simple question really, but unsure how to do it. I have this little bit of code: <code> <li><span> <?php if ( function_exists('get_custom_field_value') ){ get_custom_field_value('Essential info 5', true); } ?> </span></li> </code> ...and I want to find out how I can adjust it so th... | use empty function to check if the return value is empty or not: <code> <?php if ( function_exists('get_custom_field_value') ): $custom_field_value = get_custom_field_value('Essential info 5', true); if(!empty($custom_field_value)): ?> <li><span> <?php echo $custom_field_value; ?> </span>&... | Only display custom field if it there is a value inside | wordpress |
Was wondering if anyone knows here if the API at api.wordpress.org is free to use without keys. I haven't really found any information about key registration. I'd like to use it to make a few requests a day, really not many < 50 requests. What's the official way to go about consuming that API? Thanks! | So far as I know, it's available to use. Your site already hits it a few times each day for plugin updates, theme updates, etc. It's not really well-documented, though ... so when you start building your code, please document what calls you're using and how you're using them in the Codex so everyone else can benefit. | What is the official way to consume the Wordpress API? (api.wordpress.org) | wordpress |
I have a Contact Us page which is showing 9 locations on the sidebar by querying the custom post type "Distributors." I want the user to be able to use a drop down that is populated by the taxonomy "Location." For example, if the user selects "California" from the drop down, it will automatically update the list with j... | use this code for populating parent dropdown. <code> <select id="parent"> <option>-</option> <?php if(taxonomy_exists('parent_taxonomy_name')): $results = get_terms('parent_taxonomy_name',array('fields'=>'all','parent'=>0)); if ($results): foreach ($results as $result): ?> <option value... | Change or update WordPress loop based on dropdown selection | wordpress |
Looking to create a customized single.php for my posts. In one column I'd like to display all images added through the add media function (inserted into post). In the next column all other content associated with the post (except images). What I need is the proper / best practice method of doing so. I am just beginning... | <code> <div class="content"> <?php if(have_posts()) : while(have_posts()) : the_post(); ?> <div class="images"> <?php $args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => $post->ID ); $attachments = get_posts($args); if ($attachment... | How to access & display images from a post without textual content ( and vice versa) according to best wordpress practices | wordpress |
I'm trying to replace some custom strings in my content before saving the post. I have got the $data["post_content"] which includes strings like %replaceContent:{type}% . Now I need to extract that string, read the {type} and replace the string afterwards depending on what's inside of {type}. I imagine this would best ... | This belongs to stackoverflow. Here's a solution anyway: <code> $content = preg_replace_callback('/\%replaceContent:{(.*?)}\%/', 'do_replacements', $content); function do_replacements($matches){ $type = $matches[1]; // here's your {type} $replacement = "...replacement for {$type}"; return $replacement; } </code> | Extract Information from post content (using regex?) | wordpress |
I followed the Settings API page and used the example to get the following code: http://pastebin.com/CUA7nLCR When I change <code> $settingsPage </code> to <code> general </code> , <code> reading </code> , <code> writing </code> , etc. this all works flawlessly but when I change it to <code> permalink </code> it does s... | I ran into this very same issue and I have a workaround. Hopefully it will be fixed in the upcoming 3.3 release as this trac ticket suggests . The workaround basically replicates the important bits of the wp-admin/options.php file where settings registered via the settings API are processed. The reason additional perma... | How can you store your option at the permalink settings page? | wordpress |
What is stored in the WP database to let WP know I uploaded an image as a post thumbnail? I'm looking at the wp_posts table but I can't find anything. | It' stored in the post meta table as <code> _thumbnail_id </code> . The thumbnail is actually a "post" entry too, I think it's stored as an "attachment" post type. So the <code> _thumbnail_id </code> meta value will be the ID which points to that attachment. | How do WP know an image is a post thumbnail | wordpress |
I have a homepage that has many different parts to it. So a s single editor can get convoluted very quickly. Is there a way to break it up so that many editors attribute to this single page? If so, what's your technique? | For this you should use this plugin: http://wordpress.org/extend/plugins/magic-fields/ It will enable you to specify any kind of content for a given post or page. This new version already uses wordpress custom post types. | In Wordpress, how do you make several different editors for a single page? | wordpress |
Ok, I registered a new sidebar and have added some functionality to my theme so you can choose which sidebar to display from the back-end (using meta fields). It's working on all pages, except on a custom-page.php I created. I've tried just about anything and can't get my head around why my selected sidebar isn't displ... | Found the solution. I forgot to add wp_reset_query(); which should always be added when using custom queries. | Sidebar not displaying on custom-page.php | wordpress |
I would like to use the english interface for the back-end but I would like to set it to native language for an editor. I know WPML has this feature, but I don't want to install the unsupported WPML just for this reason. What I am looking is a tiny plugin which gives a switchbox for the user profile page for setting th... | Have you seen http://wordpress.org/extend/plugins/wp-native-dashboard/? I think it does exactly what you are asking. Also 'interesting' is http://wordpress.org/extend/plugins/in-their-language/ which attempts to set the locale automatically based n browser settings. | How to set back-end language per user? | wordpress |
I'm trying to create a template which will read a tag from the page, then display all the custom posts which share that tag. So for example, I have a custom post type called 'block', and a taxonomy on the block which is called 'appearson', and a tag of that taxonomy called 'products'. I also have a products page, which... | Solution: <code> <?php $blocktaxonomy = wp_get_object_terms($post->ID, 'appearson'); $blocktaxonomy = $blocktaxonomy [0]; query_posts( array( 'post_type' => 'block', 'appearson' => $blocktaxonomy - >name ) ); if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> </code> | List custom posts by custom taxonomy | wordpress |
I've been researching this, but there are so many choices I'm confused. What I would like to do is display two loops on a static page that: the first loop displays all posts with the tag "featured" the first loop displays the thumbnail as well the second loop displays all other posts, excluding the ones already feature... | Query first set of posts (probably with <code> get_posts() </code> , unless you feel up to using <code> WP_Query </code> directly). Loop through it, display, save their IDs in some variable. Loop through them again, display thumbnails. Query second set of posts, excluding IDs saved earlier via <code> post__not_in </cod... | Best Way to Display Posts by Tag (not category) | wordpress |
When I set my permalink to '/%category%/%postname%.html' this will work for all the posts, but the pages still don't have a .html at the end. Is there a way I can fix that? | Here's a very basic plugin that does just that: .html on Pages | How can you change the permalink for pages? | wordpress |
I created a plugin in order to replace some content in the post with information from a xml file. To parse the file I'd like to use xml2ary and the <code> wp_insert_post_data </code> filter. I got the content replacement working with a teststring and I can also parse the xml in a script outside of WordPress. But when I... | Of course I shouldn't save my XML Array in $data. -.- | mysql_real_escape_string() error using xml2ary in Wordpress plugin | wordpress |
The wp_title-generated <code> <title> </code> in my custom taxonomy archive pages contains the singular taxonomy name with a colon. I can't figure out where this is coming from (or if it's default Wordpress behavior), and I'd like to remove it. For example, in the archive page for the term 'Vanilla' in a taxonomy... | Use <code> wp_title </code> filter to control output <code> function mamaduka_remove_tax_name( $title, $sep, $seplocation ) { if ( is_tax() ) { $term_title = single_term_title( '', false ); // Determines position of separator if ( 'right' == $seplocation ) { $title = $term_title . " $sep "; } else { $title = " $sep " .... | How to remove "Taxonomy name:" from wp_title | wordpress |
So I'm using all static pages and I specify that in my WP settings. When I specify what the 'Front Page' should be it turns my link in to Title Case instead of all Capital Letters like I would prefer. I have set in all caps in the title of my page so I'm not sure why it is converting it or how to stop it from convertin... | I suspect that the problem is that you're using the default, fallback navigation menu instead of a defined, custom navigation menu. (The "Home" link you're seeing is the default home link output by <code> wp_page_menu() </code> .) Go to Dashboard -> Appearance -> Menus , to define and apply a custom navigation menu. By... | Auto Changing Text Case | wordpress |
I'm not including the wp_head() call in my header.php, but I would like to include the feed links for each post. Is it possible to call wp_head() with arguments only to include specific functionality? Or alternately, can you call specific functionality (admin toolbar css, feed links, etc) directly? | all <code> wp_head() </code> does is run all the actions attached to it: <code> function wp_head() { do_action('wp_head'); } </code> you can call <code> get_feed_link() </code> directly. however - it's important to note you're going to break most plugins by not calling <code> wp_head() </code> a better route may be to ... | including post-specific feed without full wp_head() | wordpress |
I'm currently developing an intranet and I am using Justin Tadlock's Members plugin to control roles and capabilities. I have created a <code> HR </code> role to allow Human Resources staff to create and edit user accounts. All staff created in WP are given the <code> contributor </code> role with a select few members ... | Worked it out with a bit of time. Here is the code I am using: <code> <?php /* Plugin Name: Restrict User Editing Own Profile Plugin URI: http://www.philosophydesign.com Description: Restricts users from editing their own profile information. Author: Scott Cariss Version: 0.1 Author URI: http://www.philosophydesign.... | Disallow user from editing their own profile information | wordpress |
I'm using these filters to clean the head of my theme: <code> remove_action('wp_head', 'wp_generator'); remove_action('wp_head', 'rsd_link'); remove_action('wp_head', 'feed_links', 2); remove_action('wp_head', 'index_rel_link'); remove_action('wp_head', 'wlwmanifest_link'); remove_action('wp_head', 'feed_links_extra', ... | You shouldn't remove them. They are important for search engines like Google. EDIT: As this A has been downvoted by someone who seems to not know anything about it, here are some additions: Core Code insertion The related trac ticket Google Webmaster Central Article about changes & impact on SEO | How to remove "prev, next, shortlink" from wp_head()? | wordpress |
Hey guys I'm trying to activate a sidebar for wp widgets. So my HTML looks like this: <code> <aside id="leftSidebar"> <section> <h3></h3> <div class="contents"></div> </section> </aside> </code> So I want to put the widget inside "contents" and its title in h3 tag. How my... | You would register the sidebar in the functions.php file with something like this: <code> <?php register_sidebar(array('name'=>'custom-content', 'before_widget' => '<section>', 'after_widget' => "</section>", 'before_title' => '<h3>', 'after_title' => "</h3>" )); ?> </code> ... | activate custom sidebar widgets | wordpress |
I would like to know how to order the terms in some taxonomy according to their frequency of use in posts in the last 30 days. What I am looking for is the most optimal method how to add "orderby" parameter or apply the array compare on the list of the terms or maybe some smart SQL select. I know this would include som... | First thing's first -- You'll have to add that table. The way you do that if you were writing this in a plugin is as follows: <code> function customtaxorder_init() { global $wpdb; $init_query = $wpdb->query("SHOW COLUMNS FROM $wpdb->terms LIKE 'term_order'"); if ($init_query == 0) { $wpdb->query("ALTER TABLE $... | Order taxonomy terms by the frequency of use in the last 30 days | wordpress |
i was wondering if you could help me : i would like to change the center of my page only with my posts : (all my posts will be in the same category) : how can i construct the page : so : 1.my menu in header.php 2.a single post in the center of the page 3.and the bottom div in footer.php, which contains the menu for the... | In the Twenty Ten theme they are using a file called loop.php. It defines the loop for different page templates and defines theme accordingly inside loop.php. That's what allows them to use get_template_part. Depending on your theme and how it's set up will determine how to go what your asking. If all of your pages or ... | what template-part to call, to have my post in the center of the page? | wordpress |
I'm trying to implement what seemed like a relatively straight forward idea, basically I am building an access control plugin to control viewing and editing of a custom post type (in this case 'Projects'). How I intend for it to work is that there are multiple users who either have read-only access or read/write access... | I can suggest another method. First of all: grant full access to projects post type (stackexchange-url ("Example")). At the user profile add allowed posts' id. Then use below filter to restrict access if post id isn't allowed. <code> function allow_user_to_edit_cpt_filter( $capauser, $capask, $param){ global $wpdb; $al... | How to assign specific users the capability to edit specific pages / posts / custom post types | wordpress |
So I have a static paged website and I want to make pages without title, but I still need the titles for the navigation to pick it up. How can I get rid of the Page.php (the_post()) from displaying the page title? | Somewhere in your page.php template will be a tag containing <code> the_title() </code> , and that's what you have to delete. In my Wordpress theme, for example, the code looks like this: <code> <?php if ( have_posts() ) : ?> <?php while ( have_posts() ) : the_post(); ?> <div class="entry"> <div &l... | Static Website No Titles But Still Nav | wordpress |
I am editing a costum theme. I was trying to add excerpt to the homepage. The homepage is costum. The excerpt show just fine but the image refuses to be displayed it seems. This is my code: <code> $args = array( 'numberposts' => 5, 'category' => 3,4,5,6,7 ); $posts = query_posts( $args . '&orderby=date&or... | If you add support for Post Thumbnails, you can use its own function instead of <code> get_post_meta() </code> , see codex for more information - http://codex.wordpress.org/Post_Thumbnails#Function_Reference Use following code in your theme: <code> <div class="postcont> <?php if ( has_post_thumbnail() ) { the_... | Show image in excerpt post. Image not displaying | wordpress |
I'm creating a simple slideshow on the side where i want to show 4 images from a post, i searched around i found this code that simply uses the build in gallery function <code> <li><?php echo do_shortcode('[gallery id="'.$post->ID.'"]'); ?></li> </code> the problem is that it spits out the entire g... | There is no way to limit the gallery query in the shortcode_gallery function. However, you can get the child attachments of a post using the following. <code> $attachments = get_children( array('post_parent' => $post->id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image... | Wordpress gallery shortag | wordpress |
Tried setting the thumbnail size, but left medium + large to 0 0 to disable them, still all 3 were generated. Is there anyway to selectively disable these via functions.php? | You can disable the medium and large image sizes by using the 'intermediate_image_sizes' filter: <code> function remove_image_sizes($image_sizes){ foreach($image_sizes as $key => $size){ if($size == 'large' || $size == 'medium') unset($image_sizes[$key]); } return $image_sizes; } add_filter('intermediate_image_sizes... | How to disable multiple thumbnail generation? | wordpress |
I know this is a mess, but can someone tell me why I can't save to checkbox option in this plugin? <code> /* Runs when plugin is activated */ register_activation_hook(__FILE__,'vigtigt_besked_install'); /* Runs on plugin deactivation*/ register_deactivation_hook( __FILE__, 'vigtigt_besked_remove' ); function vigtig_bes... | Not sure where you're adding this functionality, but I don't see anywhere in this code where you use the update_option() function. Above your form HTML you should check if the form has posted data, then update the option. <code> //Do nonce checking here and $tweak = $_POST['tweakfunction1'] ? $_POST['tweakfunction1'] :... | Can't save checkbox option | wordpress |
Hi I need a recommendation for a plugin, preferably free, that enables me to block a page's content. I only need this for a few pages, and the users must be able to buy the content on an individual page basis. Thanks | I would use a membership plugin such as: WPMU Dev Membership - http://premium.wpmudev.org/project/membership Wishlist Member - http://member.wishlistproducts.com/ I've personally used both and they work great. With these plugins, you would setup a membership level specifically for each page content you wish to sell. Yo... | Plugin Recommendation for selling one page content | wordpress |
I recently encountered a strange thing for the first time with Wordpress...all of my text boxes in every widget sidebar disappeared! Other widgets are still there. Has this happened to anyone else? I am using 10 different sidebars on 10 different templates and all text widgets have failed. Is there a limit to how many ... | I decided to use Widget Logic instead of so many sidebars and that seems to have at leat circumvented the issue. | Disappearing Widget Text area | wordpress |
I'm searching for an FAQ plugin, which should have 'was this post useful' option (it can be implemented as a set of plugins as well, not necessary to be all-in-one plugin). Generally FAQ can be implemented as category with posts, but I'll need expand/collapse JS only in that category, and I need the 'was this post usef... | Anyway Feedback provides this functionality. It can be enabled per post type, so I've registered custom post type, enabled the feedback for this post type, and registered the category taxonomy, so I can post FAQ questions in any category. | 'Was this post useful' plugin | wordpress |
I'm using shortcodes to insert some image links to my posts I grab from XML files (by an ID). As this needs to be executed just once it's not necessary to this everytime a user loads the page. So how can I replace the Shortcode with the needed content as soon as i save/publish/update the page? | That's not how shortcodes work. Shortcodes are meant to be interpreted whenever the page is rendered - they're used when WordPress filters the page/post content. What you're looking for is a content template. A tag the user can add to the page that will be converted into something else when the post is saved, like an R... | Execute Shortcodes when submitting post | wordpress |
I have been reading all of the similar answers on here for hours but can't find anything basic enough for my needs. I have a non-hierarchical custom post type "inventory". I have one custom taxonomy "division" which is the inventory category I'd like the permalink URL for a single page to be: <code> sitename.com/divisi... | If all you wanted was 'division' in the URL, the trick is to register the custom post type with the slug option: 'rewrite' => array( 'slug' => 'division', 'with_front' => false ), However, since you want to substitute the current value of the division tag for the word division, the answer is much more interesting. What... | Custom Taxonomy URL | wordpress |
This sounds dead bang simple, but I just can't figure it out. I want the following functionality: If user is not logged in and they try to access anywhere on the site (including the homepage) - send them to a specific page. I tried, adding the following but received a "not redirecting properly" message: <code> if (!is_... | The reason why you are getting a <code> not redirecting properly </code> message is because you are creating an endless loop of redirects. They get redirected to <code> /public </code> but because they are not logged in they get redirected again and again and again... Try this code instead: <code> if( ! is_user_logged_... | Controller functionality - if user is not logged in send them to specific page (not wp_login) | wordpress |
I have spent days now trying to figure this out, StackOverflow is my last resort. All I want is the following: http://www.mydomain.com/my-post-stype/my-top-level-category/my-sub-level-category/my-page.html For posts this is insane easy, just adding /%category%/%postname%.html as a permalink does the trick. However for ... | I've just gotten my head around Doing something similar. This is adapted from this tutorial For your post type registration make sure that query_var, publicly_queryable, and has_archive are set to true and rewrite is set to false. Next up is the code here . Edit: sorry, but code hinting is completely not working for me... | How can you make permalink work for custom post type and taxonomy? | wordpress |
As with anything in Wordpress it seems there are 20 way to do something, but after several weeks of extensive searching I really haven't found more then a couple tutorials floating around that really mirror each other in writing conventions which always makes me a little uneasy when this is the way I learn so I wanted ... | I have a sort of "plugin library" that contains a base class for meta boxes . Basically all it contains are a bunch of methods that generate form fields and some tabbed navigation stuff that I do for meta boxes that contain a lot of stuff. This just let's me more rapidly develop the meta box without having to worry abo... | Cleanest way to code "Custom Write Panels/Meta Boxes"? | wordpress |
Note that this is not a question about how to change / edit a CPT's description. It's more about "why the heck is it provided?" because I haven't found anywhere either in the Admin back-end or the front end, where this description is actually shown. What am I missing? | There's not really a good usage of the description in WP. However, if you wish to extend the Wordpress functionality and use the description in your theme or plugins, it's available to you with the following: <code> global $wp_post_types; $post_type = 'my_cpt'; $description = $wp_post_types[$post_type]->description;... | Where is a custom post type's "description" surfaced in WordPress? | wordpress |
Websockets are a cool, cutting-edge technology wrapped into HTML5. Basically, you can open a websocket to enable persistent, 2-way communication with a web server. The client (user interface) can spontaneously send messages, and the server can send messages too. Existing technology (JavaScript) requires everything to b... | WebSockets use the websockets protocol: WS:/example.com/yourscript.js and open a synchronous connection - meaning the connection is held open and dedicated to the browser. httpd servers, like apache2 (used by most shared hosting providers) use the http protocol: <code> http://example.com/yourscript.js </code> and open ... | Can WordPress be made to support websockets? | wordpress |
I want to add a PHP <code> str_replace </code> to the <code> add_filter('the_content') </code> function. I believe my problem is that the shortcodes are loading after the <code> str_replace </code> is called. I have a shortcode that outputs a form, i want to make it that in all HTML form tags, the attribute <code> auto... | You can change the priority of actions and filters, it's the third argument of <code> add_filter </code> (and <code> add_action </code> ) and it defaults to 10. So change it to a high number and have your filter fire way after the shortcodes and other stuff are inserted. <code> <?php add_filter('the_content', 'disab... | add_filter the_content str_replace after shortcode | wordpress |
I am using wp_delete_post function to delete the selected posts shown on the front-end (in my theme page). Posts are being deleted successfully. <code> // delete all selected posts foreach( $_POST['list_id'] as $listID ) { if( wp_delete_post( $listID ) ) { echo 'hi'; } } </code> In my function.php file i added the foll... | You need to use <code> before_delete_post </code> action. As its already very late when <code> delete_post </code> action is run. Wordpress un-attach all the attachments before running <code> delete_post </code> action. So when you run <code> get_posts </code> in your <code> delete_attachment </code> function there are... | add_action not using 'delete_post' action with wp_delete_post | wordpress |
I am looking for a solution to reuse the header and footer navigation links (with style, of course) in one of my WordPress website for several other WordPress sites. Please note that I'm trying to share header and footer among WordPress sites, not from WordPress site to a PHP page. The sites I'm referring to are on the... | I would think that your best bet is option 3 (multisite) if possible. Once you've got your network of sites set up you can then specify which menu to use as described here . Doing the other solutions (a more rough and ready 'hardcoded' approach) will almost certainly give you headaches in the future. Having multisite s... | How to reuse parts of WordPress site e.g. header, footer, part of header for multiple WordPress sites? | wordpress |
So I have a page that display posts from a certain category. If that is the category, its outputs one way, otherwise, it outputs another. The problem is, the pagination is only working on the 'other' catgeories. The code for the pagination, and all the data is exactly the same. The only things thats changing is the dis... | Change your <code> query_posts </code> call to include global <code> $query_string </code> variable. Your query_posts should look like following: <code> <?php global $query_string; query_posts( $query_string . 'cat='.$cat ); ?> </code> | Next / Previous Posts not working | wordpress |
I've seen a couple of questions that address this problem but I can't seem to get it to work based on the answers given. I have 2 plugins that I've written myself that output content via shortcodes. Both must be displayed on the same page, so on my page I have something like this: <code> [shortcode1] Some Content [shor... | Replacing echo with return doesn't work because your function is immediately terminated once it hits a return. See PHP docs for return . It would be helpful to see your actual code, but the general concept within your shortcode function would be: <code> $output = ''; // initialize output while( $your_shortcode_query-&g... | post content and shortcode content displaying out of order | wordpress |
I'm currently working on a custom loop/query where I need to add the permalink of a post to the array of posts I'm retrieving from the DB. Sadly <code> get_permalink() </code> produces one additional DB request for every call, which can get pretty intense as I'm listing all posts on one page. I first thought it might b... | My workaround for this problem: <code> unset( $post->filter ); $url = get_permalink( $post ); </code> | Why does `get_permalink()` produces an add. DB request without $post-> filter? | wordpress |
I have a custom meta box, its just a straight-up text field, for an event date, formatted: YYYY/MM/DD ...I'd like to save that as a date stamp (so i can sort by event date), and display just the pretty date format on the design side (ie: 2011/09/24 becomes September, 24th, 2011). I was using this tutorial as a guide: h... | You don't have to store it as a timestamp to order by date, yyyy/mm/dd will work just fine. As for converting the format: <code> $date = '2011/09/19'; $date = strtotime( $date ); echo date( 'F j, Y', $date ); </code> see php's strtotime and date EDIT- oh, maybe I misunderstood, thought you said timestamp, not date. any... | Save metadata as a timestamp, display as a "pretty" date | wordpress |
I've just successfully enabled networks in WP 3.2.1. However, at top right, I have no Network Admin under my (admin) username. If I go to /wp-admin/network, I receive " You do not have sufficient permissions to access this page ." In my WP_Sitemeta table, site_admins is set to <code> a:2:{i:0;N;i:1;s:3:"My_Username";} ... | I installed Wordpress 3.2.1 fresh on a new domain, and then enabled Multi-Site, which functioned as documented. I could reach /wp-admin/network without problems. Comparing the database of this WP with the problem installation, in the wp_sitemeta table, admin_email was not set for the problem site. Also, wp_sitemeta > s... | No Network/Super admin after enabling Network | wordpress |
I am adding items to a CPT Admin menu using <code> add_submenu_page </code> which works great, but they are added to the bottom of the sub-menu after the CPT options. I want to be able to have them on top , but I suppose this question can also apply to ordering all Admin based sub-menu items. What I tried ( not working... | The filter 'custom_menu_order' will not work on the menu order because apply_filters in wp-admin/includes/menu.php supplies false as the filtered content. You can try changing false to $menu and the filter works grand. Since we obviously can't touch the core, here's how I got it to work: <code> function custom_menu_ord... | Order Admin sub-menu items? | wordpress |
Is there anyway to show in a template for a post, how many times that post has been viewed, like hits without some sort of plugin? It seems wordpress would have this built in, but I am unable to find any template tags for such a think in the documentation? | Not in core. You can use post meta to store this information on page loads. If you have caching plugins enabled, you might want to increment the hit counter with an AJAX call, otherwise you can just add this directly in your single.php and page.php templates: <code> //Add to functions.php function get_hits(){ global $p... | Does wordpress have a post hit counter? | wordpress |
When I try to title an admin menu link <code> # </code> or <code> &#35; </code> , I get a fatal error before the admin menu is loaded: Fatal error: Cannot access empty property in /path/to/wp-includes/class-wp-admin-bar.php on line 79 The error does not occur if I use an alphanumeric menu title like <code> My admin... | I figured out the problem: You must specify an ID in the add_menu array if the title is not alphanumeric. So, this code worked: <code> function my_admin_bar_menu() { global $wp_admin_bar; if ( !is_super_admin() || !is_admin_bar_showing() ) return; $wp_admin_bar->add_menu( array( 'title' => __( '#'), 'id' => __... | Fatal error when using '#' character as an admin menu link title | wordpress |
I have a custom page and template, that I'm passing a query-string to. It has a wordpress permalink like so /mypage/ I want to be able to add another rule so that the permalink receives a slug /mypage/this-slug is rewrote to /mypage/?myslug=this-slug | This should work for you- <code> function wpse28906_rewrites_init(){ add_rewrite_rule( 'mypage/([^/]+)/?$', 'index.php?pagename=mypage&myslug=$matches[1]', 'top' ); } add_action( 'init', 'wpse28906_rewrites_init' ); function wpse28906_query_vars( $query_vars ){ $query_vars[] = 'myslug'; return $query_vars; } add_fi... | url rewrite .htaccess extension to permalink | wordpress |
I know there is going to be an easy way to do this but I just can't seem to find the best practice for the following; I have a plugin which when complete should generate HTML on every page, I want it to do this without the need for JavaScript and I want it to be independent of the theme when possible. It will appear on... | Use <code> the_content </code> or <code> the_title </code> / <code> single_post_title </code> (?) filter and simply prepend/append what you need. Also take a look at the Action/Filter API Reference . @Example: <code> /** * Appends the authors initials to the content. * Mimics paper magazines that have a trailing short ... | Creating a plugin that will display text on every page | wordpress |
This code is from my page <code> single-publication.php </code> . It outputs the relevant custom fields etc (here wrapped in template tags), but <code> the_content() </code> won't output the post content. I've resorted to using <code> $post->post_content </code> (which works), but the mystery remains: <code> <div... | There's a good chance your HTML is not included in the loop. Make sure your code looks like this: <code> if(have_posts()): while(have_posts()): the_post(); ?> <div class="publication-info"> <?php printf("<h2>%s</h2>", get_the_title() ); ?> <div class="publication-meta publication-credit"&g... | why doesn't the_content() work in this {single-custom_post_type.php} page? | wordpress |
I just made a new wordpress theme for a code type site, I am currently at 920px wide, I am curious what most people are using for a width now days, I would like to go wider but I just want to know if there is any kind of standard or common width that most people use? | A width of 950-960px should be ok for most screen resolutions. Css Frameworks/Libraries like blueprint, 960gs, etc. use the same width. | Common page width? | wordpress |
I am looking for a plugin or a way to list first five posts as new. It should be just a small picture added in the index.php. Any ideas of how I could achieve this? Thanks! | This is pretty easy. <code> //Include this above your loop $i = 0; //Counter if(have_posts())while(have_posts())the_post(); //include this in your loop $i++; if($i <= 5) echo "<img src='http://urltoinewimage' alt='Image Title' />"; //Stop including in your loop the_title(); the_content(); endwhile; else: endif... | How to list first (etc. 5) posts as new? | wordpress |
Some of you might know that I've been really struggling with trying to enqueue Javascript to my Wordpress theme and I just can't get it to work. I need to get this done somehow. I will keep this question updated, I will edit and I hope you will work together with me through this step by step! It's been a few months now... | First Hint: Copy your parent theme (without modifications) and start a new child theme that only contains the style.css file with the comment and a plain functions.php file. You can move stuff later, but this way you can make sure that nothing interrupts. Solve one task after each other in this plain vanilla setup. Sec... | wp_enqueue doesn't work | wordpress |
In Appearance/Editor, the Stylesheet for my theme has in it the following code: <code> #content img { margin: 0; max-width: 640px; } #content .attachment img { max-width: 900px; </code> Does this mean that if I use the 'Add an image' button in WordPress, and then pick 'From url' to post an image in a blog post, that if... | No, the size of the source image still matters. The rule only means that the image will not display wider then that. It is there mainly to prevent the large images from breaking the layout. This will have no effect on the download time (browser is loading the original image anyway) and you are actually making browser d... | Will the following code make my css deal with images in the optimum way? | wordpress |
I've set up a menu on one of my sites. The menu has ~30 items. Everything is fine, but at some point the menu crops itself and displays only the first 12 item. Does anyone have an idea why this is happening and how to tackle this issue? | Not sure it will help, but here is sort of what you are talking about: http://core.trac.wordpress.org/ticket/14134 Try adding: <code> suhosin.post.max_vars = 5000 suhosin.request.max_vars = 5000 </code> to your php.ini | Custom menu deletes itself | wordpress |
Firstly, I am new at using video with wordpress. I have installed the jwplayer plugin and using this bit of code to show the video player on the page. <code> $video_array = explode("\r\n", stripslashes(extra_option('video_links')) ); foreach($video_array as $vid){ if (!empty($vid)) echo jwplayer_tag_callback("[jwplayer... | When you work with jwplayer you need to make sure you- Check the supporting file documentation http://www.longtailvideo.com/support/jw-player/jw-player-for-flash-v5/12539/supported-video-and-audio-formats If you are using anything other than mp4 its fine. If you are tying to play mp4 files and you are having problem wi... | Problem with JWplayer. Video is missing? | wordpress |
What I want here is simple, but I'm not really sure how to approach it. I have a tournament website based on WordPress, where users sign up for a tournament by commenting on a post. The problem is, that then I need to send all those guys an email, which means I have to look up 50+ emails for users every single time. I'... | <code> global $wpdb, $post; $query = sprintf("SELECT comment_author_email FROM {$wpdb->comments} JOIN {$wpdb->posts} ON {$wpdb->posts}.ID = {$wpdb->comments}.comment_post_ID WHERE comment_post_ID = %d AND comment_approved = '1'", $post->ID); $emails = $wpdb->get_col($query); $emails = array_unique($em... | How can I get list of emails of users who commented on a post? | wordpress |
I am building a blog where the posts of a certain category make up image galleries (using the standard WP functionality and a modified single.php to display the gallery.) Now, I would like to add links to some of those galleries inside other blog posts. The ideal way would be a shortcode like <code> [thumbnails gallery... | I don't think so, but you could use get_children and get the attachment(s) of those posts: <code> $attachments = get_children(array( 'post_parent' => $post->ID, // <- source post 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'post_date', 'orderby' ... | Plug-in that shows x number thumbnails from another post | wordpress |
I want to have my Index page show posts from a certain Category ('news'). I have that functionality, but is there a way I can make a 'News' Page, where the slug just points to the index? | I would take the current code you have and drop it into a page template called tpl-news.php or whatever you choose. Add the following to the header before your index.php code: <code> <?php /* Template Name: News */ //Add your index.php code here //You can also use wp_redirect(home_url()) here as well if I misunderst... | Make 'Page' slug the 'index' | wordpress |
Just wondering how to fetch a page by using 'title contains'. I can retrieve a page by using the following <code> <?php $page = get_page_by_title('Restaurants and Pubs'); ?> </code> but how could I do 'page title contains "Pubs"'? Thanks | You should build a query using the Wordpress database class. Place this in your functions.php file <code> function get_page_by_title_search($string){ global $wpdb; $title = esc_sql($string); if(!$title) return; $page = $wpdb->get_results(" SELECT * FROM $wpdb->posts WHERE post_title LIKE '%$title%' AND post_type ... | $page = get_page_by_title CONTAINS | wordpress |
Looking to replace static string text in this function with dynamic text from a var. Current model: comments_number( 'no responses', '1 response', '% responses' ); Ideal Outcome (code guess): comments_number( '$no_responce_text', '1'.$responce_text, '%'.$responce_text ); I am sure this is an easy php question but stump... | This should do it: <code> comments_number( $no_responce_text, sprintf('1 %s', $responce_text), sprintf('%% %s', $responce_text) );` </code> Use get_comments_number if you want it properly localized. | Pass var into wp function instead of direct string text | wordpress |
I want to write a WordPress-Blog about some quite different topics. I will write most of it in English, but some topics are only interesting for Germans. The posts in the German-category will be in german. I guess it's not interesting for most readers who read the English categories whats in the German category. So I w... | I just saw that WordPress (or any plugin I've installed) makes this by default. Just go into your category and take a look at the feeds. | How can I offer different RSS-Feeds by category? | wordpress |
Some of the terms on my site appear with the same exact slug, in multiple taxonomies. For example: 'education' appears in both the 'department' taxonomy and the 'topic' taxonomy. Now, I can't seem to modify or delete a term from one taxonomy without affecting the term in the other taxonomy. If I change 'education' to '... | As it turns out, though terms could not be edited without affecting all instances, they could be deleted without deleting all instances. So, it looks as though the answer is this: you cannot separately edit a term that's in multiple taxonomies, but you can remove that term from a taxonomy without removing it from the o... | How to edit/remove a term that's in multiple taxonomies? | wordpress |
So I got a fairly simple setup, one CPT with the default <code> category </code> and <code> post_tag </code> as taxonomies. Say I have 1 post and 1 CPT entry assigned to the same category. I need this to be reflected inside the category widget as well. I've managed to display both of them on the category page via the <... | I have an 'actor' cpt and it seems to automatically get added to the query: <code> SELECT object_id, term_taxonomy_id FROM wp_term_relationships INNER JOIN wp_posts ON object_id = ID WHERE term_taxonomy_id IN (38,40,30,11,32,34,29,39,35,9,31,19,33,37,42,41,27,25,36,1,26) AND post_type IN ('post', 'actor') AND post_stat... | Include custom post types in categories widget | wordpress |
what would be the best way to exclude the current post I am viewing from this recent posts query. Thank You! <code> <?php global $post; if (in_category('top-lists')) { $myposts2 = get_posts('numberposts=5&offset=0&category=7'); } else if (in_category('playlists') || in_category('playlistall')) { $myposts2 = ... | This the <code> post__not_in </code> arg should work dandy for you: <code> $args = array( 'numberposts' => 5, 'offset' => 0, 'category' => 7, 'post__not_in' => array( $post->ID ) ); $myposts2 = get_posts($args); </code> | Exclude Current Post from Recent Posts Loop | wordpress |
Does anybody know where wordpress gets their banner images? Perhaps we could find the original photo? I'm curious just what exactly this pine cone is sitting on top of. | Header images come from Matt Mullenweg's photos http://core.trac.wordpress.org/changeset/17729 It's unreal to find if it was posted anywhere with proper description (man snaps gigabytes of pics), go ask him. | What is the Wordpress Pinecone sitting on top of? | wordpress |
What I'm looking to do is completely hide the UI for a custom post type from specific user roles...Ive previously found many resources on how to disable access to using those CPTs but nothing that really allows you to completely hide the CPT UI all together based on what user is logged into the dashboard. This is impor... | To hide a post type menu item from non-admin users: <code> function wpse28782_remove_menu_items() { if( !current_user_can( 'administrator' ) ): remove_menu_page( 'edit.php?post_type=your_post_type' ); endif; } add_action( 'admin_menu', 'wpse28782_remove_menu_items' ); </code> <code> your_post_type </code> should be the... | Possible to hide Custom Post Type UI/Menu from specific User Roles? | wordpress |
I am trying to solve this issue for days.. I consumed all options and therefore need some fresh ideas.. I have a page template for posting/editing 2 different custom post types from front end of wordpress. For the sake of simplicity, I will name these custom post types as post_type_x and post_type_y here. Names of the ... | I had given a rest to this problem and returned it back today with a fresh mind.. I noticed that the problem is about file upload function.. I revised the code as below: <code> $attach_id = media_handle_upload( $file_form_handler, $post_id ); if ($attach_id != false){ // if the attachment is loaded, register them as po... | No error in debug mode, wordpress template can not be loaded | wordpress |
I'm going to post an image in a blog post, first uploading the image to my server, and using its url. If the image is bigger than the maximum width of my blog-post, will it take longer to download, or will WordPress squish the image for the space it has to fit? If I need to make the image the right size to fit, what si... | You should use the built-in WordPress media manager to attach/insert images in posts. That way, if you define <code> $content_width </code> appropriately, WordPress will auto-resize <code> large </code> sized images to fit accordingly. Otherwise, you'll have to rely on using CSS to set the <code> max-width </code> prop... | Do I need to resize an image to fit the post? | wordpress |
Basically what I want is to have all comments posted by admins with different background color than the rest, so they're easily distinguishable. I wasn't able to find any plugin that would do this though, and hacking it into the theme doesn't look very clean. Any suggestions? | By default WordPress already adds user/admin/post author specific CSS to comments with the following three elements. <code> #byuser </code> <code> #comment-author-admin </code> <code> .bypostauthor </code> So you can just add something like <code> #comment-author-admin {background-color;blue;} </code> to your styleshee... | How can I highlight admin comments? | wordpress |
I've created sidebar tabs that display the most recent, popular and random posts. In other words I'm creating several loops in my sidebar. This seems to cause some problems, though. Do I have to reset something or just use a complete different code overall? The code for the sidebar tabs looks like this: <code> <div ... | Have you tried calling <code> <?php wp_reset_postdata(); ?> </code> after the <code> ehdwhile; </code> for each custom loop? EDIT Next step is to try calling <code> <?php wp_reset_query(); ?> </code> instead of <code> <?php wp_reset_postdata(); ?> </code> after the <code> ehdwhile; </code> for each cu... | Several loops in sidebar issues | wordpress |
I'm pretty sure that this can be solved quite easy, but for some reason I just can't get it to work. My current code looks like this: <code> <?php $comments = get_comments('status=approve&number=5'); ?> <ul id="recent_comments"> <?php foreach ($comments as $comment) { ?> <li><p><str... | Instead of <code> $comment->post_ID </code> use <code> $comment->comment_post_ID </code> . Your code will look like following: <code> <?php $comments = get_comments('status=approve&number=5'); ?> <ul id="recent_comments"> <?php foreach ($comments as $comment) { ?> <li><p><stro... | Get Comments: Direct link to specific comment + post title | wordpress |
I'm looking for a way to keep development instances of Wordpress up to date and under version control with Git. Has anyone managed to the following? set up git to track a repo containing the Wordpress core files add the Wordpress repo to a project via a submodule or similar get the latest version of WP from within the ... | Mark Jaquith maintains a git repo of WordPress, synced with the SVN every half hour. https://github.com/markjaquith/WordPress He also describes how to work with WP in git here: http://markjaquith.wordpress.com/2011/05/26/developing-on-wordpress-using-git/ | Painless way to track remote Git repo for Wordpress updates | wordpress |
I was working on this site this morning and I ran into a bit of an issue with my static page. I have a "featured" post section and I use: <code> <div id="featured"> <img src="<?php echo get_bloginfo('template_directory'); ?>/images/house.jpg" alt"Buy Me" /> <div class="info"> <?php query_post... | You're using <code> query_posts() </code> for your featured-post custom loop . As the Codex says: don't do that . The <code> query_posts() </code> function is intended to modify the Primary Loop . If you need a custom loop, use e.g. <code> $my_custom_query = new WP_Query( $args ) </code> . See here for a good break-dow... | Wordpress: Loop Help | wordpress |
I have a function set up to place some standard text in each post for a Custom Post Type. However, within that standard text I want to pull some unique text from a few custom fields. Not sure what is wrong with my code: <code> function default_content($content) { global $post; if ($post->post_type == 'my-custom-post... | You are trying to echo within a variable. You also have encapsulated PHP tags in the string as well. You need to concatenate just the functions themselves like this: <code> function default_content($content) { global $post; if ($post->post_type == 'my-custom-post-type') { $content .= '<p style="text-align: center... | Including inline Custom Fields info with add_filter in functions.php | wordpress |
LINK: http://themeforward.com/demo2 Checkout my menu. Hover over Features > Shortcodes > Typography. Notice how when you put your mouse over typography the background of Shortcodes turns to the darker red? How do I get the background to turn to the darker gray (#EEE) instead while on the third level of the menu without... | This should be on stackoverflow. If I understand correctly what you want, you need to change: <code> .sf-menu li:hover, .sf-menu li.sfHover, .sf-menu li a:focus, .sf-menu li a:hover, .sf-menu li a:active { outline: 0; background: #AF1D21 } </code> with: <code> .sf-menu > li:hover, .sf-menu > li.sfHover, .sf-menu ... | Current Post/Page Ancestor, CSS | wordpress |
I want to do almost exactly this: http://codex.wordpress.org/Pages#A_Page_of_Posts But Im confused by the last line: Save this to pageofposts.php and then assign PageofPosts as the Template when creating the action Page: How do I tell Wordpress to go to index.php, (or anything else) when, for example, it receives an 'e... | Read more on how to use page templates | Page display certain Category Posts | wordpress |
In my posts custom fields, I have a meta_key named ending. The value of it is a date in the form of 30-11-2011 (dd-mm-yyyy). I tried this below but with no luck. <code> query_posts("paged=$paged&meta_key=ending&order_by=meta_value&order=DESC") </code> I also tried to do it like below, again with no correct ... | ad1. meta_values are strings, so they are ordered like strings, not dates. In SQL you should use some casting as a DATE before ordering ad2. better date format would be yyyy-mm-dd, because sorting this meta field like strings gives the same results as date-type column.. compare order of dates in yyyy-mm-dd <code> 2010-... | Problem with writting correctly a query posts args in Wordpress | wordpress |
I am busy dabbling with writing a WP plugin and hitting a bit of a problem. I believe its best practice to store wp options to an array rather than individually which is great no probs. I have two pages. Page one which updates for example: <code> $xyz_options['api_user']; $xyz_options['api_key']; </code> Page two which... | If you are using the Settings API then you don't have to save the options, that's done for you. So when using an array to store the options your validation function should get an array of all existing options, update only the changed and return that array. Something like this: <code> function my_settings_option_validat... | Wordpress Plugin Dev: Using array for WP options | wordpress |
I am working on custom app for a client that requires some extra fields in the user's profile. I have successfully created a registration page that saves the custom fields and now I need to do the same for the "Edit Profile" page. The function that I used to save the custom fields on registration is generic enough that... | After trudging through the BP source code today, I believe that I have finally figured this out. The hook used to update Profile Fields in BuddyPress is "xprofile_data_before_save". If anyone know of something better, please let me know! | BuddyPress - Hook to Update Custom Profile Fields | wordpress |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.