question stringlengths 0 34.8k | answer stringlengths 0 28.3k | title stringlengths 7 150 | forum_tag stringclasses 12
values |
|---|---|---|---|
I've been trying to utilize the PHP excerpt function to call from her recent blog post to post on a main landing page without avail. Any thoughts? <code> <div id="home_news" class="prefix_9 grid_3"> <div id="newsbox" style="display: block;"> <div id="news"> <h2>Welcome</h2> <div id="new... | While this was far from clear in the OP at first, I think this might be a good solution. Just make a shortcode to place the excerpt in the body. (This is a bad idea if you want this on every page . This is a good idea if you want it once in a while on some pages in the body.) Here's code to put in your functions.php: <... | Using the_excerpt() on a page | wordpress |
How can I enable specific themes and plugins for new blogs that have been created with <code> wpmu_create_blog </code> ? I'd like to set the themes and plugins in code rather than having a person manually set them in the network administration section (i.e. not in <code> http://domain/wp-admin/network/site-themes.php?i... | stackexchange-url ("This WPSE answer") led me to the $meta argument for <code> wpmu_create_blog </code> . That led me to this Support thread showing that $meta can include <code> template </code> and <code> stylesheet </code> arguments which seem to contain the folder name for the theme you want (just like the "Templat... | WordPress network: set themes and plugins for new blog | wordpress |
I have a plugin that inserts a tinymce like shown below. Something causes the second toolbar, the <code> theme_advanced_buttons2 </code> to have <code> display:none </code> attached to their style attribute, effectively hiding them. I don't manage to find the code responsible for this. <code> $tinymce = array ( 'theme_... | Show the Kitchen Sink by Default Copying stackexchange-url ("@nus'") answer as an answer to help newcomers. If you would like to show that second row of options by default, there’s an easy way. Simply put the following into your theme’s <code> functions.php </code> file: <code> function unhide_kitchensink( $args ) { $a... | Second toolbar in tinymce has "display:none" set? | wordpress |
Is there any way to add class to edited posts in order to style them differently? If there is a way to do that without adding a class, this option would be much better. EDITED - IGNORE THE ABOVE QUESTION - SEE BELOW Is there a way to add a check box (meta box) in the area that a user writes an article/post so when this... | This is very similar to @mrwweb's answer, but a little bit more fleshed out. We're also not going to overload taxonomies in order to get our post class, but do what you wanted initially: use a custom meta box. There is a built in template tag called <code> post_class </code> . Like almost every other function in WordPr... | Style Differently Edited Posts | wordpress |
I am looking to overwrite the existing upload functionality to save the file on a remote storage service. The remote storage has an HTTP interface that allow me to post file and return an addressable URL back. The reason for doing this is that the remote storage service has large amount of space and is automatically re... | Two options: Hook into <code> 'wp_handle_upload' </code> , a filter provided by the function <code> wp_handle_upload() </code> in <code> wp-admin/includes/file.php </code> : <code> apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ), 'upload' ) </code> Replace the ne... | Upload file to remote storage | wordpress |
The code below is from Wordpress SEO plugin by Yoast. I am trying to add the page number to the Meta description on paginated posts (to avoid duplication issues with Google). <code> function metadesc( $echo = true ) { if ( get_query_var('paged') && get_query_var('paged') > 1 ) return; global $post, $wp_query... | To add a page number regardless to any plugin … use filters. Do not change the plugin file. You cannot run updates other wise. Example: <code> <?php # -*- coding: utf-8 -*- /** * Plugin Name: T5 Add page number to title * Description: Adds <code> | Page $number</code> to the page title. * License: MIT * ... | Add Page number to Meta Description in Wordpress SEO by Yoast | wordpress |
I try to assign custom taxonomies to a page when newly added by the "publish" button. This is the function: <code> function set_default_object_terms( $id, $post ) { if ( 'publish' === $post->post_status ) { log_me ('From inside function: '.__FUNCTION__.', while I pressed the "publish" button. Post-ID: '.$id); $taxon... | You are using <code> wp_set_object_terms </code> wrong, the second parameter should be the term slug or id and the 3 parameter should be the taxonomy name, so try: <code> function set_default_object_terms( $id, $post ) { if ( 'publish' === $post->post_status ) { log_me ('be in function while "publish" i pressed with... | How to assign default taxonomy to pages on 'save_post'? | wordpress |
Currently I'm trying to get the post type labels plural. In detail: <code> $GLOBALS['wp_post_types'][ get_current_screen()->post_type ]->labels->name </code> This is how I'm trying to retrieve it - in the admin UI - using the public wp API functions: <code> $post_type_name = get_current_screen()->post_type;... | Edit: get_post_type_labels was never intended to be a public function. It is only used internally when registering a post type. See these trac tickets: get_taxonomy_labels() and _get_custom_object_labels() fail if $object-> taxonomy is not array Fatal error: Cannot use object of type stdClass as array in /.../wp-includ... | get post type plural | wordpress |
Is there a way I could install some plugin or have syntax highlighting for my wordpress.com blog or do I need to install WP on my own server to be able to install a plugin to do that? | WordPress.com uses Alex Gorbatchev’s SyntaxHighlighter so all you need to do is use the right shortcode ex: <code> [sourcecode language="css"] #button { font-weight: bold; border: 2px solid #fff; } [/sourcecode] </code> which gives you something like this: it has more features and you can see a list of supported langua... | How to have syntax highlighting in wordpress.com blogs? | wordpress |
I am looking for a decent plugin that will display a slide show of images that are hosted on Flickr. I have tried <code> Slickr Flickr </code> and and <code> Flickr+Highslide </code> (but that one seems to be missing from the WP plugins directory right now). The issue I have with those two is they do not display the ga... | fotoramajs.com Switch to English version in the right top corner | Photo Gallery Plugin and Touch Devices | wordpress |
Is there a good plugin for rating blog posts that doesn't depend on PollDaddy or another external service? Ideally I'd like a plugin similar in appearance to Polldaddy Polls & Ratings , but without the PollDaddy dependency (I'd prefer to have the rating data in the WP database). EDIT: just to make things clear: I'm... | I eventually used WP-PostRatings . I thought it wasn't working, but actually I just needed to edit the theme to insert the rating where I wanted it. | Good rating plugin that doesn't depend on an external service? | wordpress |
The following function shows a top 10 chart of most voted posts. How would I add acceding numbers to this chart eg 1 - example Post1 2 - example Post2 etc <code> function MostVotedAllTime_Widget() { $a = SortVotes(); //Before ?> <div class="JibbleChart"> <div class="title">Most Recommended Albums</div... | Use this: <code> function MostVotedAllTime_Widget() { $a = SortVotes(); //Before ?> <div class="JibbleChart"> <div class="title">Most Recommended Albums</div> <?php $rows = 0; //Now does not include deleted posts $i = 0; while ($rows < get_option('voteiu_widgetcount')) { if ($a[0][$i][0] != '... | Vote It Up Plugin - Add ascending numbers to MostVotedAllTime Chart Function | wordpress |
I have got following code. <code> $postData = array( 'post_category' => array(get_category_id("website")), 'post_content' => 'My website about cars.', 'post_title' => 'my little cars', 'post_type' => 'post', 'post_status' => 'publish', 'tags_input' => 'cars, hobbies' ); $pID = wp_insert_post($postData... | This should work: <code> $wp_upload_dir = wp_upload_dir(); $fileurl = "http://damianc.pl/th.jpg"; $filename = $upload_dir['path'] . DIRECTORY_SEPARATOR . basename( $fileurl ); if ( file_put_contents( $filename, file_get_contents( $fileurl ) ) ) { require_once(ABSPATH . 'wp-admin/includes/image.php'); $wp_filetype = wp_... | Automatic adding thumbnail to post | wordpress |
I need a way to disable the save process completely using an <code> action/filter </code> . Something that works (for e.g.:) in the <code> query </code> , <code> posts_clauses </code> or <code> wp_insert_post/save_post/update_post </code> hooks. So far I only tried to <code> return ''; </code> , which gives me tons of ... | <code> function disable_save( $maybe_empty, $postarr ) { $maybe_empty = true; return $maybe_empty; } add_filter( 'wp_insert_post_empty_content', 'disable_save', 999999, 2 ); </code> Because <code> wp_insert_post_empty_content </code> is set to true, WordPress thinks there is no title and no content and stops updating t... | Disable the post save process completely | wordpress |
I have created a custom user profile field <code> <?php $basics = get_the_author_meta( 'fbasics', $user->ID ); ?> <ul> <li><input value="lesson1" name="fbasics[]" <?php if (is_array($basics)) { if (in_array("lesson1", $basics)) { ?>checked="checked"<?php } }?> type="checkbox" /> &... | The function is <code> <?php get_user_meta($user_id, $key, $single); ?> </code> The <code> $single </code> is a boolean that returns a single value for true or an array if set to false, in your case you would set it to false. <code> $user_output = get_user_meta($user_id, 'fbasics', false); var_dump($user_output);... | How to get data from an array using get_user_meta() | wordpress |
My scenario: I have a part of a site which retrieves all post_tags terms for a specific category the code: <code> query_posts('category_name='. $category[0]->cat_name); if (have_posts()) : while (have_posts()) : the_post(); $posttags = get_the_tags(); if ($posttags) { foreach($posttags as $tag) { $all_tags_arr[] = $... | i am not sure but try this: <code> query_posts('category_name='. $category[0]->cat_name); if (have_posts()) : while (have_posts()) : the_post(); $posttags = get_the_tags(); if ($posttags) { foreach($posttags as $tag) { $all_tags_arr[] = array($tag->name,wp_basename(get_permalink())); } } endwhile; endif; foreach ... | retrieve post slug by post_tags taxonomy | wordpress |
How do you get the content by id and by specific language? I need to display two specific language content in a page, regardless of the session's language. So far, this is my progress: this works fine for getting the content by id of the active language: <code> <?php $id=47; $post = get_page($id); $content = apply_f... | You must use the qTranslate native functions to do your job. Use <code> qtrans_use </code> , that is the function that do all the job in qTranslate. It's defined in qtranslate_core.php, line 747 <code> function qtrans_use($lang, $text, $show_available=false) </code> Use it on the raw content of the post! Try this code:... | qTranslate get content by language | wordpress |
I'm using wp-postviews to track views for posts by authors on my site. It stores the view count in the post meta field <code> $views </code> . I'd want to show on their profile a total count of views for all their posts combined. How to do that? | A list of posts in the format: Post views by Author: Author Name Post Title (15) Post Title (67) Post Title (4) Total Number of views: 86 <code> $author_id = ''; // do stuff to get user ID $author_posts = get_posts( array( 'author' => $author_id ) ); $counter = 0; // needed to collect the total sum of views echo '&l... | How to show total view count across all posts for an author | wordpress |
I am reading this tutorial from the end of 2008 on how to make widget and so far everything works fine except that I have few questions that I couldn't find answers there. I need to style back end widget form somewhat different and for that purpose I would like to be able to add class to it that will render only in das... | I don't know if the tutorial uses any deprecated function, you can check that enabling WP_DEBUG in your wp-config.php . Anyway, by the time it was written the new Widgets API didn't exist . The Codex is your friend, read the Codex : http://codex.wordpress.org/Widgets_API And for styling the widgets admin area refer to ... | styling back end widget form and enabling multi widget feature | wordpress |
I am having trouble accessing json values return from an ajax call. Here is the call: <code> $.ajax({ type: 'POST', data: 'user_id=' + user.user_id + '&user_login='+ user.user_login, //dataType: 'json', url: 'http://###/user-stats.php', success: function(data){ alert(data); //alert(data.games_won[0]['winner_id']); ... | Looks like you want to use something like <code> result = $.parseJSON(data) </code> . Then you can access the data with <code> result.win_id </code> , for example. As an aside, you should sanitize the input to that database query using <code> prepare </code> with something like: <code> $wpdb->get_results( $wpdb->... | Accessing WPDB Multidimensional JSON Array w/ Javascript | wordpress |
I am running WordPress 3.3.2 self-hosted. I used to see the option "I would like my site to be private, visible only to users I choose" under Privacy Settings but I no longer see this option. Instead, now I only see the options to make the blog visible or not visible to search engines, but no way to make it private. I ... | It sounds like you were on WordPress.com previously, which has options that are not built in to the core of WordPress. There are various plugins out there to accomplish a similar end result, such as Restricted Site Access . | No option "I would like my site to be private, visible only to users I choose" in Privacy Settings | wordpress |
I am starting making some wordpress plugin, so I am a beginer. I just wonder how can I change the post form of the pages. For example for adding some other input (of type file or text)? I am trying to use <code> add_filter('comments_template', 'add_new_fields'); </code> but nothings happens. | If you want to change/add something to post form, you have to deal with meta boxes. I would recommend you to read through these articles: Reusable Custom Meta Boxes Part 1: Intro and Basic Fields Reusable Custom Meta Boxes Part 2: Advanced Fields Reusable Custom Meta Boxes Part 3: Extra Fields Reusable Custom Meta Boxe... | How to change the post form from plugin? | wordpress |
Is there any filter available to set the naming convention of those auto generated thumbnails? Something like this: thumbnail_150x150.jpg -> thumbnail-s.jpg thumbnail_300x300.jpg -> thumbnail-m.jpg thumbnail_600x600.jpg -> thumbnail-l.jpg | Seems that the answer is no ... I've followed the core functions and found a dead-end. And found this post ( stackexchange-url ("How can I make add_image_size() crop from the top?") ) where stackexchange-url ("Rarst") says: Intermediate image generation is extremely rigid. Image_resize() keeps it close to code and comp... | Set custom name for generated thumbnails | wordpress |
I've a page (at /portfolio) & nav item created called Portfolio. What I'd like is for this page to either contain all the portfolio category's post in chronologically order or else all of the portfolio posts organized by portfolio subcategories (and then chronologically within). What's the easiest way to achieve th... | You say you have a page for your portfolio, then go on to say you want posts displayed; confusing. Assume you have a category for posting items into named portfolio. New portfolio items will be posted in the portfolio category. You can take your categories.php page, copy and re-name it categories-portfolio.php, then cu... | Custom Portfolio Page | wordpress |
First and foremost, this is definitely a duplicate of the age old question of "my Wordpress permalinks are generating 404 errors", but in a way it's different because no solutions I've tried have worked. A little back-story to my problem: I developed a Wordpress site locally, all permalinks and everything worked. I ins... | The issue wasn't caused by Wordpress, I found out that my httpd.conf file had a default setting of AllowOverride None which was causing my rewrite rules in my .htaccess file not to work. Probably something I should have checked in the first place, but easy to overlook as well. | Bizarre Permalinks Issue: 404 Errors Everywhere | wordpress |
I am using a postTabs plugin and Comprehensive Google Map Plugin , my problem was when I have my Google map on the second tab, the map is not loading as expected. But if I move it on the 1st tab it works really great.. Is there any way to make the map work on the second tab? Actually, whichever Tab plugin I use the map... | i was tested with Google Maps Embed plugin with PostTabs plugin. You can Insert the map in editor also.This is really works. Please Check the screenshot for both tabs. :) Admin Page: | Google Map is not working on the second tab of Tab Plugins | wordpress |
I have 3 categories, 1.OnGoing projects(cat id='5') 2.Completed Projects(cat id='6') 3.Upcoming Projects(cat id='7') and also i have another 2 categories:( Not a Sub Category ) chennai (cat id='10') Dubai (cat id='11) How to get the post from " OnGoing Projects " with " Chennai " category?(I like to Display -> OnGoing ... | Just guessing here, but I suspect that <code> query_posts() </code> is not appropriate in this situation. <code> query_posts() </code> should only be used to modify the main query, and the emerging best practice is that <code> query_posts() </code> shouldn't be used at all, but, instead, replaced by filtering <code> pr... | Query only Posts from Both of Two Category? | wordpress |
I've never edited admin files before, but I need to edit the table used to list my posts in the admin area (on the All Posts page). Can someone please point me to the right file to edit? I've looked in the wp-admin directory but I haven't found a file with this table in it, so far. | You do not need to and absolutely should not be editing a core WordPress file to achieve this. There are almost certainly hooks for whatever it is you are looking to accomplish. You can take a look at questions regarding custom columns (such as stackexchange-url ("Add column to pages table")) or, if you'll excuse my li... | Which file do I need to edit the All Posts page in the admin area? | wordpress |
I have thumbnail support added with the following in my functions.php <code> // Add Thumbnail Support add_theme_support('post-thumbnails'); set_post_thumbnail_size( 140, 140, true ); </code> And I create the custom post type with <code> // Create Custom Post Type for Work add_action( 'init', 'create_post_type' ); funct... | try the <code> register_post_type </code> <code> supports </code> parameter: <code> 'supports' => array( 'thumbnail' ) </code> | How come Featured Image isn't showing up in my Custom Post Type? | wordpress |
I am using the Vote Me Up plugin http://wordpress.org/extend/plugins/vote-it-up/ on my site. I have the MostVotedAllTime function showing the top 10 posts. Currently this displays the Post Title only. I am wondering if it is possible to display a custom taxonomy associated with the post here. for example it is a chart ... | Use <code> get_the_term_list() </code> to print the assigned terms. Example: <code> echo '<div class="votecount">' . /* stripped */ . '</div>'; echo echo get_the_term_list( $postdat->ID, 'taxonomyname', 'Taxonomy Label: ', ', ', '' ); echo '</div>'; </code> Replace <code> 'taxonomyname' </code> and... | Using Taxonomies with Vote It Up plugin chart | wordpress |
Let's say I'm starting a martial arts website and I want to categorize content into themes: philosophy fitness training techniques diet Etc. I keep going back and forth between using custom loops to display the content or making each a custom post type. Is there advantages to either? And is it worth the trouble of crea... | Try to stay as close as possible to the built-in functions and behavior. I would just use tags or categories in your case. You can make both more special and rename them to type (for tutorials, link lists, rants etc.) and topic : Questions to ask before you decide about implementation: What kind of relationship will I ... | Categories or Custom Post Type to Organize Content | wordpress |
I'm looking to create a site wide feed on my site and have multiple custom post types. I'd like to display say 3 posts from at least 3 different post types. I can get the latest 10 posts across each post type, and I can get the latest 10 overall, but I'd like to specify so that I only get 3 from each so things are even... | This method uses a counter and 1 query. Only 3 posts from each post type can ever be displayed. <code> $args = array( 'post_type' => array( 'type1', 'type2', 'type3' ), 'posts_per_page' => -1 ); $myquery = new WP_Query( $args ); $type1 = 0; $type2 = 0; $type3 = 0; $count = 0; while ( $myquery->have_posts() ) :... | Get latest 3 posts from multiple CPT in one query | wordpress |
So I'm doing a query like this: <code> $the_query = new WP_Query( array( 'meta_key' => 'homepage', 'meta_value' => 'yes', 'post_type' => 'page', 'orderby' => 'modified', 'posts_per_page' => 1 ) ); </code> To get a single page with a specific key value, how do I get the page template from a query like thi... | This should do the trick for you. This shows what template file is stored in <code> post_meta </code> , if one has been selected in the admin panel: <code> $template_name = get_post_meta( $the_query->post->ID, '_wp_page_template', true ); </code> If you want to see if the page is the homepage, use <code> is_home(... | How do I find if a page has a template? | wordpress |
I want to logout user autometically when user is idle for more than 10 minutes.That mean suppose user is logged in to a site and user didn't browse any pages for more than 10 mins.when he browse any page after 10mins, it will logout user and redirect to login page.Any Solution? Advance Thanks. | You just need to add your filter hook like this: <code> function myplugin_cookie_expiration( $expiration, $user_id, $remember ) { return $remember ? $expiration : 600; } add_filter( 'auth_cookie_expiration', 'myplugin_cookie_expiration', 99, 3 ); </code> You can add it to your theme’s functions.php file. | How reduce wordpress login session timeout time? | wordpress |
Sorry for silly question, I'm pretty new in WordPress and Genesis . I want to move Genesis menu above header. How can I do that? | Just add the snippets in Genesis Theme function, in functions.php <code> remove_action('genesis_after_header','genesis_do_nav'); add_action('genesis_before_header','genesis_do_nav'); </code> | Genesis menu position change | wordpress |
I've been playing with custom post types & custom fields, using a combination of the <code> types </code> plugin and the <code> advanced custom fields </code> plugin, also having done the same manually. Occasionally I want to create a CPT where a <code> title </code> would be inappropriate - for example, an FAQ whe... | You can use the <code> enter_title_here </code> filter: <code> add_filter('enter_title_here','wpse51871_alter_title_label',10,2); function wpse51871_alter_title_label($label, $post){ if( 'question' == get_post_type($post) ) $label = __('enter question here', 'my-plugin-text-domain'); return $label; } </code> | How to programatically set the post title of a CPT on wp-admin | wordpress |
Is it possible to list the posts from a custom taxonomy by slug along? This link kind of does it but i want to target the slugs rather than just the whole taxonomy itself http://codex.wordpress.org/Template_Tags/wp_list_categories#Display_Terms_in_a_custom_taxonomy So i have Custom Taxonomy 'Books' within that i have B... | As long as you have registered your custom taxonomy to with <code> 'rewrite' => true </code> , then WordPress should automatically build taxonomy archives for you at yousite.com/{taxonomy base}/{term slug}. There are a lot of caveats and problems that can arise, but for simple setups, this works like a charm. To fin... | Displaying Custom Taxonomy List Posts By Slug? | wordpress |
I´m going to develop a site for a client which requires multiple languages. I have no experience with this from beforehand so I´m researching what might be the best way to do this. The webpage will be in swedish, english and norwegian. I must have the ability to have separate content in each language, like separate new... | There is the plugin Multilingual Press for exact this setup: It helps to synchronize multiple sub sites in a multi-site installation. Running an import and an export each time you publish or update a page is not necessary. | Using WP Multisite for multi language site? A good option? | wordpress |
I would like to remove the edit option for all plugins on a wordpress site. Is there a hook/filter for doing this? It would be preferred to do it from the theme's functions file, rather than try to disable it within each plugin. Ideally, it could be removed for users without admin privileges, but that is a secondary co... | Add the following line to your WordPress installs wp-config.php <code> define('DISALLOW_FILE_EDIT',true); </code> | How do you remove plugin edit option? | wordpress |
I'm using WordPress as an Authoring tool. Hence I do not use the front end. Now I wanna add the functionality making internal comments. As it is now, you are only allowed to read comments from the Edit Post page, not to write them. Got any hints or good ideas on how to make this possible? | This will be possible in the upcoming version WordPress 3.4. Try the Beta or just wait. Here is a screen shot (incomplete translation to German): | Add comments from the admin panel? | wordpress |
Is there a way for the functions <code> wp_count_posts </code> , <code> wp_count_terms </code> and <code> wp_count_comments </code> to return their results only for a specific user, possibly by using a user's <code> ID </code> ? I'm making a custom "Right Now" dashboard widget for a custom post type and I need it to sh... | I ended up writing my own custom code for <code> wp_count_posts() </code> and <code> wp_count_comments() </code> to generate the counts from scratch (through custom wp queries) based on their original code ( <code> wp_count_posts() </code> is in <code> wp-includes/post.php </code> and <code> wp_count_comments() </code>... | wp_count_posts, wp_count_terms and wp_count_comments for specific user? | wordpress |
I have a very serious problem.. I have this dev site done using PhpMyAdmin http://dev.freelanceu.net/mjl/clickzac/ and my client wants me to transfer the site. But their server don't have PhpMyAdmin and had to use Adminer, after transferring the database the website becomes like this http://kjrias.com I really don't kn... | The problem Chrome's console, or Safari's or Firebug for Firefox are essential tools for a developer. Here's a snapshot that shows exactly what's going wrong with your site: you still have urls that point to the old address. Observation Adminer is a wonderful tool, but if your server don't have PhpMyAdmin that's really... | Site is broken after transferring to adminer | wordpress |
I'm looking to create a function which would be called when the blog's <code> /feed/?args... </code> URL is requested. I've been looking at <code> the_content_feed </code> , would that be correct? Also, how would I get the <code> args </code> in the URL into my function as an array? | It depends what you want to do as for when you want to hook into the process. <code> the_content_feed </code> is fired for each item in your feed, so this probably isn't the one you are after. You could use <code> pre_get_posts </code> which fires just before WordPress queries the database: <code> add_action('pre_get_p... | Hook for feed creation? | wordpress |
How to display excerpts in the homepage instead of full post automatically, without the need to insert <code> <!--more--> </code> in every post ? I tried this plugin http://wordpress.org/extend/plugins/advanced-excerpt/ which or doesn't work or I can't use it. Here's how I configure it http://wordpress.org/suppor... | general: locate the template for the home page - often index.php - if not see http://codex.wordpress.org/Template_Hierarchy find <code> the_content() </code> (possibly with some parameters in the brackets) and change that to <code> the_excerpt() </code> - http://codex.wordpress.org/Function_Reference/the_excerpt specif... | Automatic excerpts | wordpress |
Is there any way to change the "Help" tabs label? I speak about the top right tab to toggle the contextual help. I'm looking to change "Help" label by "Documentation". I work on WordPress 3.3 and 3.4 beta Thanks for your advices | Look at the source , there is no filter to alter the 'Help'. But it does translate the text so you can hook onto the <code> gettext </code> filter. Not the nicest of solutions (an alternative would be to use javascript) : <code> add_filter( 'gettext', 'wpse51861_change_help_text', 10, 2 ); function wpse51861_change_hel... | contextual_help, change the "Help" tab label | wordpress |
I want to remove some plugin widget showing from wp-admin/widgets.php but i dont want to use unregister_widget because i am using this widget automatically from php files.. Basically i dont want clients see this widget as option in wp-admin/widgets.php but i want to use this widget from php files. I thought css display... | Check the following answer, adapt the code and it will do what you want. stackexchange-url ("stackexchange-url Use Firebug for Firefox, or Chrome/Safari inspector to discover the widget ID. Note the use of CSS3 attribute selector , that allows targeting an element using a partial ID or Class. For example, this will hid... | Removing widget without using unregister_widget | wordpress |
I'm using Wordpress 3.3.1 and trying to figure out how I can modify my sidebar to include a list of all the galleries. I see wp_get_posts and the like...but nothing for galleries? | Search the stackexchange-url ("posts by content") for the string <code> '[gallery' </code> . You get an array of posts which you can list then in a widget or in plain PHP code. | How to add a list of all galleries to my sidebar? | wordpress |
Which plugin or code I need to make it show me a list with the posts that don't have featured image or is broken(the featured image doesn't exist anymore)? | In form of a shortcode: <code> add_shortcode('nofeatures', 'wpse_51768_shortcode'); function wpse_51768_shortcode() { $posts = get_posts( array('numberposts' => -1) ); foreach ( $posts as $post ) { $featured = get_the_post_thumbnail( $post->ID, 'thumbnail', null ); if ( $featured ) echo 'Has Featured Image: ' . $... | How can we see which posts don't have a featured image or it doesn't exist anymore? | wordpress |
having a huge problem with a site. i updated the theme to use post thumbnails (that's how old it is) and then when trying to upload an image to use as featured thumbnail: the images process/crunch but then the URLs result in 404s. there isn't anything abnormal in the site's .htaccess. there actually wasn't a wp-content... | If I remember it right, this happened to me once. I deleted my <code> /uploads </code> directory (to delete all the images) and went back to posting thinking that WordPress will automatically create an <code> /uploads </code> directory and any necessary sub-directories for me. And yes, that's how it works. But here's t... | uploaded images not going to /uploads folder | wordpress |
Is there a way to compare the_excerpt() to the_content() to know if the_excerpt() is actually showing the entire post content? for instance, if a post were particularly short. ultimately i'd like to have a "Read more" link at the end of excerpts. but i want it to say 1 thing for posts and another for posts of the video... | What you're trying to do with the video is exactly what Post Formats were created to handle. Add this to functions: <code> add_theme_support( 'post-formats', array( 'video' ) ); </code> And then this to handle your Read More link: <code> if( !has_post_format( 'video' ) ) { echo '<a href="' . get_permalink() . '">... | Compare the_excerpt() to the_content() | wordpress |
I am working with a non-profit client that runs several charities under one umbrella. A good metaphor would be to think of the United Way (but it's not the United Way). Can a WordPress multi-site installation do the following: Share content between sites. E.g., if site A has a section called "Advocacy", can that same c... | I believe that ThreeWP Broadcast is the plugin you should use. I've been using this plugin in WPMS to share (and link) content between blogs, and it works well. Basically, this plugin allows you to: duplicate a post from a blog to other blogs in the network options to create a link to those blogs, which means when the ... | How Can I Centralize Content Usage and Approval in a WordPress Multi-Site installation | wordpress |
I need to show a list of custom posts but exclude any that have the custom taxonomy 51, is it possible to do it with the loop below? <code> $pages = get_children(array('orderby' => 'post_date', 'post_type' => 'news', 'numberposts' => "3")); $counter = 1; foreach($pages as $post) { setup_postdata($post); $field... | Make sure to reread the <code> tax_query </code> documentation . If you change it to this, I think it should work: <code> 'tax_query' => array( array( 'taxonomy' => 'news', 'field' => 'id', 'terms' => 51, operator => 'NOT IN' ) ) </code> Depending on your setup, you may also want to specify the <code> in... | Exclude posts with custom taxonomy | wordpress |
I am trying to make things work like where any post attachment image will generate embed code automatically. Example: If I upload and add two images 1. 250x150 2. 600 x 160 and insert into post. Now that image information I want to auto put into embed code like below. <code> <div> <a href="link url" title="tit... | WordPress has a predefined function, <code> wp_get_attachment_image_src </code> that returns the following information as an array: <code> [0] => url [1] => width [2] => height </code> But, the function requires that you know the attachment's ID, not the post's ID. In order to get that, you'll need to use <cod... | Get post attachment images dimension and use in embed code | wordpress |
I'm using custom post types to display properties and have a custom price field assigned to each post. On the property page I want to display a list of four similarly priced properties, two less than or equal to the price of the current property and two greater than the current price. Ordering properties numerically by... | One possibility is a direct SQL query similar to the one stackexchange-url ("given here"). But I'm not convinced that it would be much more efficient than 2 queries, all handled by WordPress: The is untested <code> $price =0; //Price of current property $id=0; //Property (post) ID. $args = array( 'post_type' => 'pro... | Order Posts by Closest Numeric Values | wordpress |
I'm trying to write a kind of "breadcrumb" function in my "functions.php" I'd like to query if I'm on a term-page and if so I want to print the current term I'm in. By "term-page" I mean the following. I list all terms of a custom-taxonomy (associated with a custom-post-type) as kind of categories in my header. I do th... | You'll want <code> get_queried_object() </code> . This is a very generic function - and simply returns the queried object- so a single post, this would be a post object. For instance, the return object may be of the form: <code> Object ( [term_id] => 299 [name] => test [slug] => test [term_group] => 0 [term... | If on term-page -> get the current term? | wordpress |
I have created a custom image uploader for my wordpress admin panel and need to retrieve the data from the wp_options table. I have wrritne the below function: <code> //function to get all slider images function getSliderImages(){ global $wpdb, $theme_shortname; $query = "SELECT * FROM $wpdb->options AS o1 WHERE o1.... | In your header.php <code> $images = getSliderImages(); foreach ( $images as $img ) { echo '<img src="' .$img. '" />'; } </code> | Creating custom function in wordpress to return data from database | wordpress |
I have a taxonomy <code> location </code> . All terms except one are to be treated differently. That's why I have two php files taxonomy-location.php taxonomy-location-national.php Now, I want to make the URLs SEO friendly. If URL = example.com/localdeals/national, I want to redirect it to taxonomy-location-national.ph... | Note that the url-rewriting doesn't directly determine the template used. A pretty url is interpreted as a query and then that query determines what template is used based on the template hierarchy . So only need one rule: <code> example.com/localdeals/myterm => example.com/?location=myterm </code> WordPress will lo... | New rewrite rules for custom taxonomy and reuse default | wordpress |
Is there a way to get the content from another outside the loop? The ID is 302 and I need to display the content of that on another page. | You can use <code> get_page() </code> to return the <code> $post </code> object of a static page: <code> $page_id = 302; $page_object = get_page( $page_id ); echo $page_object->post_content; </code> Edit Similarly, you can use <code> get_post() </code> to return the <code> $post </code> object of a post: <code> $pos... | Get post content from outside the loop | wordpress |
I have a standard HTML form that the visitor will fill out. It consists of mostly checkboxes. What I would like, is after the form is submitted, a page is then presented to the user showing what they checked. For example, if the visitor checked off Checkbox A, B, and D (but not C), then upon submission they would see t... | Gravity Forms is by far the best form plugin available for WordPress and it will allow you to easily do what you are looking for. http://gravityforms.com Here is an example of how to do it: Set the confirmation to show which checkboxes were checked using the merge tags: This form can be placed anywhere in a page and th... | Plugin that will output submitted form data for user? | wordpress |
I'm using the following code to create two custom post types: Pastebin Link The Spotlight custom post type is giving me the edit/permalink to edit the post. However, the cooking video isn't. I've just copied the code from the Spotlights, changed the pertinent info for Cooking Videos so I don't get why it isn't working. | As I told SickHippie in the comment, this was a matter of the naming convention while registering the custom post type in the functions.php file. I used camel-case and the DB didn't like that. Once it was changed to all lower-case, it worked fine. | Can't edit custom post type | wordpress |
The Wordpress codex has an example of the <code> register_taxonomy() </code> function at http://codex.wordpress.org/Taxonomies that shows arguments that are not documented in http://codex.wordpress.org/Function_Reference/register_taxonomy . In particular <code> args['sort'] </code> and <code> args['args'][order_by] </c... | I suspect the Taxonomies Codex entry is simply out of date. Per source , there are no <code> 'sort' </code> or <code> 'orderby' </code> args for <code> register_taxonomy() </code> . Given the purpose of the <code> register_taxonomy() </code> function, it doesn't even really make sense for this function to include sort/... | What are these undocumented arguments for register_taxonomy? | wordpress |
I setup a custom post type <code> employee </code> with an <code> agent </code> role that mimics an <code> author </code> role for this particular post type, and so far everything is working fine, except that when I created a <code> test </code> user and granted it an <code> agent </code> role, the dashboard that <code... | This support forum thread has both an explanation and a code snippet that you might be able to work up into a solution. The "Right Now" widget is tied to the <code> edit_posts </code> capability. I don't know about the incoming links widget or quick post widget, but I'd guess it's the same issue of either requiring <co... | empty dashboard for custom role | wordpress |
I'm fairly new to Wordpress, but I'm encountering a strange issue. I have a menu set up, and I've put links to some of my pages inside of it. But, when I try to click on any of the menu items, nothing happens. I can see the URL in the bottom left of my screen when I hover over the links, but when I click on them, I'm n... | I would guess that some javascript is running on that page (in your theme) and preventing the default action of click event. Disable all plugins you have and then theme to narrow down the cause. If disabling a plugin or reverting the theme fixes it, then you have found your culprit. Also look for javascript errors in c... | Links do not open from click, only in new tab | wordpress |
Back in my naive days of theming, I had to make it so the link inserted by <code> <!--more--> </code> wouldn't dump the viewer at the anchor it produces. I made a dinky plugin that consisted of: <code> function No_More_Link($buffer) { $inHTML[0] = '/#more-\d+/'; $outHTML[0] = ''; return preg_replace($inHTML, $out... | You can filter <code> the_content_more_link </code> hook and remove <code> #more-POST_ID </code> from the link: <code> function wpse_51806_strip_more_link( $more_link ) { global $id; return str_replace( "#more-$id", '', $more_link ); } add_filter( 'the_content_more_link', 'wpse_51806_strip_more_link' ); </code> It has ... | Filtering out the #more anchor link that gets produced by | wordpress |
I have data in the <code> wp_options </code> table currently stored as a multi-dimensional array ( <code> profile_element_order </code> ): <code> a:12:{s:17:"img_base64_enable";s:1:"1";s:25:"moulding_combination_page";s:0:"";s:24:"moulding_collection_page";s:0:"";s:25:"idea_gallery_thumb_height";s:3:"200";s:24:"idea_ga... | As far WordPress is concerned - your multi-dimensional array is one option. To update just part of the multi-dimensional array its necessary to retrieve the entire array, alter it accordingly and then update the entire array. Suppose your multi-dimensional array is as follows: <code> my_options = array( 'option_a'=>... | Update Option Stored in Multi-Dimensional Array | wordpress |
I need a custom registration page from for my site. I want to take some details from my regular visitor and then finally want these details in a csv or excel file. Is there is a plugin which can do this for me just like we have Contact Form 7 for Contact Page??? This question may seems common but please consider me as ... | If I understand you correclty, you are essentially asking two questions. For one, you are looking for a solution for a customized registration- (login- / profile-) page. Also, you want to export data to .csv or .xls As for the first issue, I'd recommend taking a look at Jeff Farthing's excellent Theme-My-Login plugin. ... | Need a Plugin to create a registration form for my website? | wordpress |
I have a theme released into the wild but have not prefixed the post type appropriately. Yes, I know, it's a shame and I regret it :( So, I am currently using <code> acme </code> as the post type name, but I' like to change it to <code> prefix_acme </code> . I'm looking for the most appropriate function/hook to rename ... | This will not be the full answer but i think it will greatly help you if you are able to make templates - you will be able to do this: In theme init (when it installs) make function which will make db query to find all post with your post_type and renames post_type to your new value. (i think this is very easy and can ... | How to change database values on theme update | wordpress |
I want create "Custom Post Type" that will have next structure: Post (hierarhy level)-(some-post-id) Post 1-1 => <code> Post 2-2 Post 2-3 Post 2-4 => Post 3-5 Post 3-6 Post 3-7 Post 2-8 Post 2-9 Post 2-10 </code> I need something like "Page attributes": http://s019.radikal.ru/i638/1205/19/d533f543c5f7.png | You can set a post type to hierarchical when you register it with <code> register_post_type </code> . Simply set the 'hierarchical' argument to true . <code> $args = array( 'public' => true, 'publicly_queryable' => true, 'has_archive' => true, 'rewrite' => true, ... 'hierarchical' => true, ... 'supports'... | Does "Custom Post Type" can have page hierarhy option? | wordpress |
I 'm setting up a site to allow multiple associations to use it. I ask your help to decide whether it's worth to consider switching to the current 'single site with many plugins' approach, whick feels like a bad hack, to a multisite approach. The requirements are: Each association may have multiple users, with differen... | I implemented a MU site similar to this a few years ago and there are some caveats you need to consider before going that direction. It's helpful to think of an MU installation is a convenient way of accessing the administration of multiple, independent WordPress installations . It operates not much differently than if... | Set up collaborative site | wordpress |
This question has changed significantly. I have the latest version of Wordpress and am hosting it on an Apache server. Link to Blog: http://blogs.bzaeds.org/test/2012/05/11/video-test/ Now, here's the thing. When I upload a video to Wordpress it will play on a Mac in Firefox with the Wordpress URL the item is given (ex... | After 6 days of pure sadness, this ended up being the fix: http://www.technowut.com/2012/05/14/how-to-stream-videos-to-ios-devices-with-multisite-wordpress/ Here’s how to get it working on CentOS 6 with the packaged Apache httpd: Nils Maier wrote the module for Apache httpd. Download the source and take some time to re... | Multisites, upload issues, and iOS! | wordpress |
So I just found this great stackexchange-url ("WPSE thread about security for themes/plugins"). It answered most of my questions but it was created before the new <code> wp_editor() </code> function was built. I have two TinyMCE editors on my Theme Options and I'm wondering whether I need to use <code> esc_html() </cod... | <code> esc_html() </code> and <code> esc_textarea() </code> are, appropriate to their names, escaping functions and really meant for display rather than sanitizing or validating. I would use <code> wp_kses() </code> or <code> wp_kses_post() </code> (which is just <code> wp_kses() </code> with the global <code> $allowed... | Secure Validation of wp_editor in Theme Options | wordpress |
My site currently has an outrageous 500k+ transient records in the wp_options table. This causes the table to be crashed frequently and so be my site. I thought transient records will all expired after some time. I'm not sure which plugins are responsible and what went wrong yet. However, I don't want my site to crash ... | This is a fairly definitive set of responses about transients WPSE: stackexchange-url ("Are transients garbage collected?") | Will it break my site if I delete all transient records in wp_options table? | wordpress |
Is it best to hardcode a sidebar menu using functions.php or sidebar.php OR use the custom menu widget? Are there times when each is appropriate? | To some degree, the answer depends on the intended use of the sidebar menu, but in general, it is best to allow the greatest degree of freedom to the end user. If the intended use of the sidebar menu is to be, well, a navigation menu , then I would strongly recommend supporting the core Nav Menus feature. If the intend... | Best practices: Custom theme sidebar menu - hardcode or widget? | wordpress |
How does WordPress convert raw data from the database to a readable format in the_content function? I've noticed that it applies the_content filter, but what does the_content filter do? | the default filters are set in /wp-includes/default-filters.php; for 'the_content' this is from line 135: <code> add_filter( 'the_content', 'wptexturize' ); add_filter( 'the_content', 'convert_smilies' ); add_filter( 'the_content', 'convert_chars' ); add_filter( 'the_content', 'wpautop' ); add_filter( 'the_content', 's... | What filters are applied to the_content function? | wordpress |
Is there a filter for when a Featured Image is set/unset or changed. I need to delete transient data when the above occurs. | The post featured image ID is stored as post metadata, so I would recommend hooking into the <code> update_post_meta </code> or <code> update_post_metadata </code> hooks, and then query the post meta for <code> '_thumbnail_id' </code> being set. stackexchange-url ("See this related answer from Jan Fabry"). | Filter For Featured Image | wordpress |
Yslow reports following issues with Jetpack: 1) Compress http://stats.wordpress.com/e-201219.js using gzip 2) Configure etags for http://stats.wordpress.com/g.gif ?... Modified the format so that it is easier to understand. How can I take action against these items. I am already using latest version of W3 Total cache p... | You can't "optimize" Jetpack. Look at the URL; it's served from wordpress.com. You get what they offer from their servers. | Optimizing Jetpack for Wordpress | wordpress |
I remember to have read about this, but I can't find it anymore. Basically we are not allowed to advertise without the users consent inside plugin, its a good rule I think. I just want to see the official text to quote it. | http://wordpress.org/extend/plugins/about/guidelines/ You are probably thinking about #5 and #10 on that page. There are other possibly relevant ones as well, like #7 about phoning home. Basically, you cannot broadcast your plugin on the front side of the website without the ability to turn it off (user consent). Nor c... | Guidelines / restrictions about advertising /donate begging unside wordpress plugins or themes | wordpress |
I'm using following install function with dbDelta as referring to the codex, articles on SO I watched out for the typical problems with e.g. one space instead of two spaced at the PRIMARY KEY ... <code> function myplugin_install(){ global $wpdb; $table_name = $wpdb->prefix . "vehicles"; $sql = "CREATE TABLE IF NOT E... | Run <code> dbDelta </code> for each SQL statement seperately: <code> function myplugin_install(){ global $wpdb; $table_name = $wpdb->prefix . "vehicles"; require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); $sql = "CREATE TABLE IF NOT EXISTS $table_name ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, description VARC... | dbDelta only creates the last table | wordpress |
I use the <code> post_gallery </code> filter in functions.php to replace the core gallery code, with the gallery code I've modified to suit my needs, like this: <code> function aahan_post_gallery($output, $attr) { global $post; static $instance = 0; $instance++; // We're trusting author input, so let's at least make su... | Instead of using 2 separate functions to grab the attachment you can use the same function, and then add the URL in separately using <code> wp_get_attachment_url </code> , making the logic much clearer, and reducing the amount of work needed: e.g. <code> $image = wp_get_attachment_image( $id, $size, false ); // if it's... | Proper Way to Remove Thumbnail Links In Gallery | wordpress |
I'm using calls to wp_nav_menu() in my header.php file. They're conditional, based on whether a user is logged in. This is in header.php: <code> <?php if ( is_user_logged_in() ) : wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'user' ) ); else : wp_nav_menu( array( 'container_class... | It looks like this behavior is the result of adding custom post types to the query. See http://wordpress.org/support/topic/wp-nav-menu-dissapears-in-category-pages-1 | wp_nav_menu doesn't show on index page | wordpress |
Does any one know of a plugin to allow users to create ads on a format like Google Adsense (title, some text and a link). ? Something that may require some customization may do the job. Thanks in advance. | When you say "Users" do you mean registered users or visitor to yoour site? For the first one I use wordpress-multiple-user-ad-management , with some customized code since there a few options that I don't use. Also the text links options that the plugin have only allow users to create a title and the link for the ads (... | Plugin for users to create their own ads like Google Adsence | wordpress |
I need a way to create a menu page with a list of all users for administrative purposes. The list will be used by users that don't have permission or acceses to the "Users" menu page. The page need to have the User ID, Name, Registration Date, Nickname, User Level and User Role for each user Any idea how to achieve thi... | As a plugin all that I can give to you is this. <code> <?php /* Plugin Name: Users Table Plugin URI: http://www.exe.ie Description: A list of all available users with their ID, Name, Registration Date, Nickname, User Level and User Role Version: 1.0 Author: Daniel Conde Author URI: http://www.exe.ie License: GPL */ ... | Menu page with list of users | wordpress |
I'm using a grayscale filter on all uploaded images in my WordPress installation. However I want both the gray scaled image and the colored image in my website (colored on hover). The way I tried to do this was to create a bunch of add_image_size()'s like so: <code> add_image_size( 'gho-small', 100, 0, true ); // Used ... | Gee, I keep solving my own problems all the time. Here's how I solved it in the end. I discovered that add_image_size does not ignore the identical dimensions of the image size, but instead points the file name towards the same file in the uploads dir. Once I knew that, I could just save the grayscale image under a dif... | How to add multiple image sizes of the same size with add_image_size | wordpress |
I'd like to be able to add tags to my pages just like I can with posts. What would I need to do to enable the tag editor/entry for the page editor? | You can use the <code> register_taxonomy_for_object_type </code> function. The following adds the default 'tag' and 'category' taxonomies to pages: <code> register_taxonomy_for_object_type('post_tag', 'page'); register_taxonomy_for_object_type('category', 'page'); </code> | Add tags to pages | wordpress |
I'm updating my self-built theme to HTML5, and easily made a number of changes already. My theme's sole stylesheet is added to the page head via <code> wp_enqueue_style </code> in the <code> functions.php </code> file, as follows: <code> function gridded_enqueue_styles() { wp_enqueue_style('style', get_template_directo... | For modify this output you can use that filter: <code> function wpse51581_hide_type($src) { return str_replace("type='text/css'", '', $src); } add_filter('style_loader_tag', 'wpse51581_hide_type'); </code> You can see this hook into <code> wp-includes/class.wp-styles.php </code> | When enqueing a stylesheet, is it possible to remove the type attribute? | wordpress |
I've been working with Custom Post Types lately and haven't had any major problems. This time I'm trying something new. I want to create a CPT which basically works like Pages, with page hierarchy. The real thing is in Swedish so I'll use "Books" as an example on how I would like it to work. So first I create my new po... | Alright, after a couple more hours I removed the <code> 'query_var' => '', </code> and re-saved/flushed my permalink settings. Query_var defaults to true, and it works. Coding blindness or something lol. Hope this can help someone else. | Child pages on hierarchical Custom Post Types 404s | wordpress |
I'm very glad that there is such a dedicated website for WP. My problem is data validation upon saving attachment fields. I have added many custom fields to attachment/media library dialog, most of them are marked as mandatory. (Ex. <code> $form_fields["some_custom_field"]["required"] = true; </code> ) But this just ad... | THE ANSWER Well as it happens many times in my life - i found the answer myself. For people who struggles as me here the answer: <code> $post['errors']['field_name']['errors'][] = __('Error text here.'); </code> if you do that - error text will be displayed at the bottom of that field. In my case this doesn't work beca... | Validate data on attachment_fields_to_save | wordpress |
I would like to create an archive page with a list of my custom taxonomies that link to a page that shows posts with that taxonomy relationship. I registered my taxonomy like this: <code> register_taxonomy('my_taxo', array('my_custom_post'), array( 'hierarchical' => true, 'label' => 'my taxo' 'show_ui' => true... | WordPress doesn't generate an 'archive of terms' automatically. However, you're current permalink structure is set up so that: <code> www.example.com/my_taxo/my-term </code> points to the 'my-term' archive page of the 'my_taxo' taxonomy (listing all posts with the 'my-term' tag). So what you can do is create a page wit... | Custom Taxonomy Archive URL rewrite | wordpress |
This might be complicated to explain and I don't know if there is a solution to that!? I have a custom-post-type named "wr_event" and a hierarchical custom-taxonomy named "event_type". The custom-post-type has a meta-box for <code> event_date </code> and all posts associated with this post-type are sorted by this <code... | It sounds like you're looking for <code> wp_get_object_terms() </code> which takes an array of post IDs, a taxonomy, and some optional arguments to determine what to return. So, you'd use <code> get_posts() </code> to query future events, build an array of IDs, and then pass that array to <code> wp_get_object_terms() <... | List Taxonomies: Don't list taxonomy if it has no post - depending on custom post-meta? | wordpress |
Spent two days researching this. I need to be able to add HTML to the Custom Menus Description. Everything I can find (including on this site) is from Feb 2011 and mentions using a strip_tags filter. However, that no longer works. I'm developing on WP 3.4 Beta 4. I've created a custom walker class and found a filter to... | (Untested). But if you want to use HTML in the description, then you shouldn't use: <code> `esc_html( $item->description )` </code> Try removing the <code> esc_html </code> as this escapes the HTML. (Or better still use <code> wp_kses </code> instead to only allow certain tags.). So you want <code> $description = ( ... | Custom Menus Description Stripping HTML Tags | wordpress |
I want to display list of post in category page using AZindex . So I've created a category template. Now I need help to display posts list by category there. For instance, when I'll go to domain.com/category/health, the page should display only post list from health category using azindex. Is it possible? I need your h... | You can create a custom category template and this can help you. All the best | AZindex related help needed | wordpress |
Hi I am writing a plugin and would like to extend a class in the wp-includes folder. I mean that literally like <code> class my_class extends wp_includes_class_x{ ... } </code> However when attempting this I get a <code> class x not found </code> error but I know the class is being used by Wordpress. So I try an <code>... | The Widgets API page on the Codex has a great snippet for extending a class (in this case the WP_Widget class). This should be pretty clear overall. Be sure you're using the standard name of the class and make sure it's an actual class and not just a function. <code> /** * Adds Foo_Widget widget. */ class Foo_Widget ex... | Extending core class in plugin | wordpress |
I have some custom stars that I would like to use for GD Star Ratings.. how do I load my custom star image? | The plugin supports this feature by default. Searching for "gd star ratings custom images" finds lots of information including this guide on the official site. Apparently the GD Stars User Guide contains full instructions on creating new image sets as well as some pre-built ones you can use. | Custom GD Star Ratings Stars | wordpress |
I want to have a related loop of posts on single post pages and to do this I want to search the tags of the post. My first question is can you use the search in query posts for multiple terms and what is correct way to do this. This is what I've been trying that is not working. <code> global $post; $tags = wp_get_post_... | If you are inside the loop, on the single page, than you have all tags and can search for releated posts with the same tags. You find many solutions via google; an example: <code> //for use in the loop, list 5 post titles related to first tag on current post $tags = wp_get_post_tags( get_the_ID() ); if ( $tags ) { echo... | Related posts by searching post tags of single post as terms | wordpress |
I run a website for a company with a careers section, with each vacancy posted as a custom post type. When vacancies are available, ie a post type of "vacancy" is published, we want to display a ribbon in the top corner, directing people to the careers page. To check for published posts obviously I could get_posts for ... | I wouldn't worry about doing a second query (e.g. using <code> get_posts() </code> ). If you want to check if a post type has any published posts - you're going to have to query the database. But reading a database is really quick - any noticable delay in your page load is more likely to come from extra HTTP requests (... | Checking for published posts in a certain post type | wordpress |
I am looking for a way to achieve the following: A group of users 'students' They login to the site Each student can see a 'Custom Dashboard Widget(s)' Each widget will carry a personal message wrote by Admin for that logged-in student. Such as A] Total Days in the course B] Total attendance C] paid & due fees. Is ... | This can be solved using custom meta fields in the user profile (only visible to administrators) and then making an individual dashboard widget containing this meta (only visible if certain criteria is met). Adding fields to the user profile page can be done: 1) manually Following Justin Tadlock's tutorial: Adding and ... | How to Make a Custom Dashboard Widget to Display Custom Notification from Admin? | wordpress |
Let's say I want to give the first paragraph bold text by adding a body class to the first paragraph. Is there a way to filter the output of <code> the_content(); </code> or any other paragraph? First paragraph? Last paragraph? I know I can do this using Javascript or CSS (:firstchild), but is there a native WordPress ... | The following bit of code adds a class to the first paragraph output by <code> the_content </code> : <code> function first_paragraph($content){ return preg_replace('/<p([^>]+)?>/', '<p$1 class="intro">', $content, 1); } add_filter('the_content', 'first_paragraph'); </code> Add the above to your theme's f... | Add Class to Specific Paragraph of the_content() | wordpress |
I need to know if Wordpress can handle multiple sites. And between these sites, it should share some content types while restricting others . If the answer is yes, then I need to know: does it do it out of the box what plugins will i need do i need to build my own plugins do i need to modify the core code (and hence, b... | That's a pretty lengthy question, so I try to be brief and still hit all your points. If nothing else, maybe someone else can improve on what I suggest. Does it do it out of the box? No It does however have the ability to do the things you've asked "out of the box", it's called the WordPress API (if you're going to be ... | Multiple Websites that share some content types and not others | wordpress |
I am creating a post from the front end using (shortened for brevity); <code> if (empty($_POST['my_title'])){ echo 'error: please insert a title'; } else { $title = $_POST['my_title']; } $new_post = array( 'post_title' => $title, 'post_status' => 'publish', 'post_type' => 'post' $pid = wp_insert_post($new_post... | Simply put the <code> wp_insert_post </code> call inside your conditional check so its only called if the post title is not empty, something like this: <code> if (empty($_POST['my_title'])){ echo 'error: please insert a title'; } else { $title = $_POST['my_title']; $new_post = array( 'post_title' => $title, 'post_st... | Prevent empty Post Title on form submit via front end post (wp_insert_post_) | wordpress |
I am new to Wordpress and need some helps here. I am trying to add posts that have written codes for the demonstrated purpose of programming languages. I installed SyntaxHighlighter Evolved plugin. The post looks great when I preview it or view the post under category. However, it seems that Wordpress generated <code> ... | On archive pages like a blog home page the <code> the_excerpt() </code> is used normally. As the name says it shows just a snippet from your post. Most content filters are not applied to the excerpt, they work on <code> the_content() </code> only. Fix: change your template, replace <code> the_excerpt() </code> with <co... | How to remove automatic generated tag in Home page | wordpress |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.