question stringlengths 0 34.8k | answer stringlengths 0 28.3k | title stringlengths 7 150 | forum_tag stringclasses 12
values |
|---|---|---|---|
I have two post types that I've associated in one direction by assigning Post A as a custom meta field of Post B. I need to search based on the titles of Post A and return the associated Post B results. This feels a little tricky. Normally I can display titles from Post A like so: <code> $post = get_post($post_id); $au... | Try setting <code> $title_search = get_the_title($post_object); </code> and then using it in your query as <code> 'value' => $title_search </code> : <code> $args = array( 'post_type' => 'journal_entry', 'meta_query' => array( array( 'key' => 'custom_author', 'compare' => 'LIKE', 'value' => $title_sear... | Use meta_query to get title of associated post | wordpress |
I'm working on my site ontwik.com , just created a new design and uploaded it and when I activate, it works fine for the homepage and otherpages. but the problem is when i lo gout from wordpress admin or open ontwik in a different browser the homepage looks great but the other pages using the old theme. I tried to acti... | You're using WP Super Cache; reset the cache for the problem page(s) and it should display the new design. The reason it looks different when you're logged in is because the static pages are served to Users who are not logged in. Users who have not left a comment on your blog. Or users who have not viewed a password pr... | My site looks different when activating new theme | wordpress |
I've recently heard someone say that WordPress sends data about your blog to home (where ever that is). Is that true? and if so what is sent away or where in the code can I see what's exchanged? | This is true to a degree. They probably do this for a few reasons but most likely to help monitor bugs and things like that in regards to future improvements and updates. Nothing malicious to worry about! They need to keep track of versioning especially so that you can be notified of updates to WordPress itself as well... | Does WordPress send data about your blog back to Automattic or somewhere else? | wordpress |
Is it fired after a post has been published? Say I have a CPT and want to perform some automated actions based on the post that gets saved, can I do: <code> add_action('publish_myt_cpt', 'myfunction'); </code> | It is fired in <code> wp-includes/post.php </code> on line 3026 in the following function: wp-includes/post.php: line 3014-3027 <code> function wp_transition_post_status($new_status, $old_status, $post) { do_action('transition_post_status', $new_status, $old_status, $post); do_action("{$old_status}_to_{$new_status}", $... | When is the {$new_status}_{$post-> post_type} transition hook fired? | wordpress |
Any ideas? It seems my feed is only showing one post, although I made several today. http://www.alpinezone.com/category/news-and-featured-articles/feed/ | The first time I went to it I got this error "XML parsing failed: syntax error (Line: 77, Character: 8)" Check the feed validator for more help http://validator.w3.org/appc/ | Feed only showing 1 result? | wordpress |
I have added HTML code into my TAG description box, but for some reason the output doesn't display the required results. I have even tried to add HREF tag manually into this box, but no hyperlinks are visible. The code contains tag_description(); | You can't put HTML in taxonomy descriptions, but you can use a plugin such as http://wordpress.org/extend/plugins/allow-html-in-category-descriptions/ to enable that functionality. | Tag description doesn't show hyperlink | wordpress |
I hope there is an easy answer for this, as it doesn't seem like it should be difficult and could make my backend much easier for other's to use. I'm trying to add links to custom post types - that is, a shortcut in the sidebar , not a typical wordpress link that you would put in the link category. Let's say my sidebar... | This should do it. <code> function register_additional_page(){ add_submenu_page('edit.php?post_type=tree', 'Bulk Process', 'Bulk Process', 'activate_plugins', 'tree_bulk_process', 'render_bulk_tree_process'); } add_action('admin_menu', 'register_additional_page'); </code> And the function that renders the page. <code> ... | Adding link to dashboard sidebar, nested under custom post type | wordpress |
Having just grasped Custom Post Types I ventured into an article on how to Build a custom image slider using a Custom Post Type wherein I understand everything in the code (i.e. the creation of the CPT and the Meta Boxes). But there is a segment of code which I simply do not get... <code> add_filter("manage_feature_edi... | That particular bit of code actually appears to be incorrect, the format of the filter tag is slightly off. But in general, some tags in WordPress are variable. Since WordPress gives you the ability to create your own post types and taxonomies, some filters and actions will contain a variable which refers to your custo... | Custom Post Type uses Custom Tags in add_filter? | wordpress |
I'm wondering how I would go about implementing some kind of image voting system to wordpress. I've had a brief look at plugins but none are particularly great. I would also like users to be able to upload photos? I'm not great with wordpress so any advice would be great. I'm literally open to anything here. I was also... | Perhaps WordPress database schema is not so good for an implementation like this one, there's a couple of ways of how to do it. You could set a <code> rating </code> post type that is actually a reference with attachmed images and some information for people to rate. So, every time a <code> is_user_logged_in </code> us... | Make a wordpress site similar to Hot Or Not - Image rating system | wordpress |
I'm using the Taxonomy Images plugin and am trying to sort the taxonomy but Taxonomy Images isn't playing nice. This works: <code> $terms = get_terms( 'work_cat', $args ); </code> but this doesn't: <code> $terms = apply_filters( 'taxonomy-images-get-terms', '', $args ); </code> Any ideas? Here's the full query: <code> ... | Try this: within $args, leave 'taxonomy' where it is and put the remaining three arguments in a 'term_args' sub-array. Based on the documentation, it appears that the filter passes arguments to get_terms() through a 'term_args' sub-array. Your $args array is mixing filter arguments and get_terms() arguments at the same... | How can I get Taxonomy Images to work with 'orderby' argument? | wordpress |
Do these hooks listed on the following site work for custom post types? http://www.wphub.com/custom-post-type-publish-action-hook/ <code> // function to be executed when a custom post type is published function run_when_post_published() { // your function code here } // replace {custom_post_type_name} with the name of ... | I think you're using wrong hooks. Please take a look at wp_transition_post_status function, you'll see the correct hooks: <code> function wp_transition_post_status($new_status, $old_status, $post) { do_action('transition_post_status', $new_status, $old_status, $post); do_action("{$old_status}_to_{$new_status}", $post);... | Do New_to_publish hooks work for custom post types | wordpress |
Is there a plugin init hook that runs whenever the plugin is being loaded? I'd like to link the functions for requiring files and defining constants to such a hook if it exists. | There's the <code> plugins_loaded </code> hook for normal Plugins and <code> muplugins_loaded </code> , which runs earlier. My best advice for hooks is making cross file searches for <code> do_action </code> or dump the content of the <code> all </code> hook with <code> $GLOBALS['wp_filter'][ current_filter() ]; </code... | Plugin init hook | wordpress |
I want to display a shortcode through jquery after the DOM is loaded: This is how I call the shortcode: <code> <?php echo do_shortcode('[plugin]'); ?> </code> Now, my question is how can I call that shortcode inside a jquery function, because my website is based on jquery/ ajax calls? Thanks! | Javascript code is running in the user's browser and not on your server (where your wordpress content resides). You could use ajax to call the function which the shortcode is pointing to. Here is how I handle AJAX calls with Wordpress: 1) I use a jQuery ajax function to call the wp-admin/ajax.php <code> jQuery.ajax({ u... | call shortcode in javascript | wordpress |
The following query stopped working all of a sudden and I can't figure out why. <code> <?php $today = date("Y/m/j"); query_posts(array( 'post_type' => array('events'), 'meta_key' => 'event_date', 'post_status' => 'publish', 'orderby' => 'meta_value', 'order' => 'ASC', 'meta_query' => array( array( ... | should <code> 'type' => 'CHAR' </code> actually be <code> 'type' => 'DATE' </code> the Codex might help on the possible parameters you need here | Meta query stopped working | wordpress |
I heard that many people had issues with W3 Total Cache on a WordPress MultiSite install. And then I see this on the plugin page: Compatible up to: 3.2.1 Last Updated: 2011-8-26 Seeing that I'm running on WordPress MultiSite Version 3.4.1 and that it's been over a year since the last plugin update, I'm really wondering... | W3 Total Cache is a GREAT option! One thing to keep in mind is that you need to individually work with each site for the settings - there is not a global settings area (yet). The next version is said to have this built-in. If you need this "right now", then WP Super cache does this and is a great option, if you can hol... | Is the W3 Total Cache plugin a good choice for WordPress MultiSite? | wordpress |
We can post_gallery </code> filter to modify/replace the default WordPress gallery template (AKA output code) to suit our needs. But this doesn't seem to affect the markup in RSS feeds. No matter what I do, the markup for gallery images in my RSS feed is simply like this: <code> <a href="#1"> <img src="#2" /&g... | Without knowing what your post_gallery filter function does, there's no way to give a proper answer. However, if you are using the post_gallery filter, and returning new markup, then yes, it will be used in feeds too. The code you mention commenting out happens after the post_gallery filter, and won't get executed at a... | WordPress gallery 'post_gallery' filter doesn't work with feeds? | wordpress |
I'm designing a custom login template and I need a way to access the <code> <input> </code> html so I can add a label inside the input. I understand the use of <code> wp_login_form() </code> but that only lets me set the default lables outside the input to blank. I need to add the <code> onfocus </code> and <code... | There's this basic trick: Close brackets, open again, insert what you need, close again. Real life example: <code> $args = array( // some args for the login form 'value_username' => 'User Name" onBlur="whatever" onFocus="anotherfoo'; ); wp_login_form( $args ); </code> So we closed the brackets after the Username, th... | How to access the actual input html of the login form | wordpress |
I have a custom post type 'events', to which I have associated a custom taxonomy 'calendar'. The calendar has 12 fixed terms, for each month of the year ( 'august', 'october', 'november, etc.). I'm in the process to make the archive page for the 'events' post type. I was thinking to display 12 different lists of max 10... | Don't use <code> query_posts() </code> . Don't modify the main loop query from within the template. You may be able to get a single query to provide what you need (e.g. by filtering <code> pre_get_posts </code> and <code> groupby </code> ), but more than likely, you will need to iterate 12 custom loops using <code> WP_... | Splitting the main query in multiple loops with query_posts and/or pre_get_posts? | wordpress |
I'm using the Skeleton theme and the header image is on all pages. I only want it on the home page. Anyone got a solution? | The following one-liner removes regular header images: <code> ! is_admin() && is_front_page() && add_filter( 'theme_mod_header_image', '__return_false' ); </code> Usually, header images are saved and retrieved per Theme Modification API , which offers the same filter scheme <code> "theme_mod_$name" </co... | How to remove header images from all pages except the home page? skeleton theme | wordpress |
I have a question about adding multiple post meta values to a post meta key. Here is a link to the WordPress <code> add_post_meta(); </code> function in question. The <code> $unique </code> parameter is a little on the fuzzy side of clarity for me. Whether or not you want the key to be unique. When set to true, this wi... | For anyone who might have had the same question... <code> add_post_meta($post_id, $meta_key, $meta_value, $unique); </code> The <code> $unique </code> parameter means that there must not already be an existing post meta key for the key / value you are about to add to the post object as post meta. You can store a single... | Adding Multiple Values to a Post Meta Key | wordpress |
I'm working on a front-end uploader using WP's own media-uploading functions. All is well, except that I just want to simplify some UI things, like removing tabs and unnecessary information for my users. Most importantly, I'd like to magically close the Upload Thickbox once the uploads are done and the files are crunch... | This was solved as simply as: Hooking a custom .js script to the media-upload thickbox, so that it runs inside the iFrame: <code> function admin_styles_scripts_media_upload() { wp_register_script('mediajs', get_template_directory_uri().'/js/button.js', array('jquery'), true); wp_enqueue_script('mediajs'); } add_action(... | Close the media-upload thickbox right after upload is finished? | wordpress |
An example file: http://twentyeleven.korkmaz.biz/files/2012/09/example.docx and here is same file but direct url without ms-files.php: http://twentyeleven.korkmaz.biz/wp-content/blogs.dir/3/files/2012/09/example.docx Its same file. Just first one is getting call with ms-files.php. Problem is first file is not working i... | Only fix for 3.4.2 involves hacking a core file. The issue is already corrected in the upcoming version 3.5. Edit wp-includes/functions.php. Around line 1810, you'll find this: <code> 'doc|docx' => 'application/msword', </code> Change that to this: <code> 'doc' => 'application/msword', </code> The docx file exten... | Google Docs Viewer have problem in MultiSite sub-blogs | wordpress |
Okay I've googled this for hours...I installed wordpress to a subdirectory as a content management system, but I want my main index.php along with other files to remain in the root. What .htaccess code do I need to so that the main url http://foo.com/index.php doesn't look for the wordpress/index.php (which of course c... | WordPress core in a subdirectory, but accessed via the root folder If you're trying to move WP to a subdirectory, but access it from the root, use the following approach. Keep your index file in the root, but point it to the proper path: <code> ./SUBDIRECTORY/wp-blog-header.php </code> instead of <code> ./wp-blog-heade... | Index in root, wordpress in subdirectory | wordpress |
Ok, so I'm working on a plugin and just ran into a problem. Here's what I'm doing: 1. Using a metabox with Plupload to upload an image to an upload dir in the plugin folder. 2. Upon upload success a script is called and the image is initialized in jCrop. 3. The cropped image is processed and saved to another dir in the... | Instead of cooking up your own PHP file and trying to bring in WordPress functionality, put the functionality inside of WordPress using the AJAX hooks that are designed to do that sort of thing. More info here: http://codex.wordpress.org/AJAX_in_Plugins | Use ajax response in PHP function | wordpress |
im working on default wordpress theme twenty eleven, i just wanted to know how can i wrap this previous and next anchor with an image or next/previous button? <code> <span class="nav-previous"><?php previous_image_link( false, __( '&larr; Previous' , 'twentyeleven' ) ); ?></span> <span class="n... | Try passing in the image into the functions themselves: <code> <?php $previous_image = "<img src='http://domain.com/path/to/image/' alt='Previous Posts'>"; $next_image = "<img src='http://domain.com/path/to/image/' alt='Newer Posts'>"; ?> <span class="nav-previous"><?php previous_image_link( ... | How to wrap this Link with an Image? | wordpress |
I'm trying to add a custom field to the built in Page content type. I've found lots of tutorials on how to do this for a single page, but I want to do this for all pages in my theme. Please point me in the right direction. | If you want to do that yourself, take a look at function <code> add_meta_box </code> (don't forget the examples). That page has almost everything you need to create a custom meta box for a certain post type. If you want to simplify your work, you might want to use an utility like Meta Box plugin . This plugin can help ... | Add Field To All Pages | wordpress |
Recently I had someone customize a WP blog for me. This person didn't do a very will job so I decided to do it myself. I customized my own blog page and it all works, except for when I click on the posts I get a "Not Found Error" page. I looked through the old blog that some person made and I can't tell where that pers... | The file you included in your question is a custom page template , and would never be used by WordPress to render the single-post view of a blog post. If you don't have a <code> single.php </code> , then the template hierarchy will fall back to <code> index.php </code> to render the single-post view for blog posts. Edi... | Where are my posts linked to? I keep getting a Not Found Error, and I have no single.php page | wordpress |
I'm building an ajax archive tool. Among the functionalities it can list categories. For each entry i'm displaying the category name (with an anchor that links to the category page) and the number of entries for the category. I would also like to show the date when a post was last added to the category. Is there a way ... | Unfortunately no; the categories are stored separately in the database and would each require their own query. I like to stick to built in wordpress functions as much as possible, but you could make a custom query to find the latest post from each category using the wp_term_relationships table. It stores the post id (o... | get latest post in category date | wordpress |
I would like to build a wordpress theme with a custom menu (no dropdowns, nothing fancy). I am trying to get <code> wp_nav_menu </code> do what I want, but I can't quite see how to achieve the following. I would like to give the menu items different names, i.e. if I have a page called <code> Classes </code> , I would l... | You can add other classes to individual menu items manually. Within the Appearance-> Menus page, click Screen Options in the top right corner. You will see a menu that looks like this: Check off <code> CSS Classes </code> and it will give you an extra form field per page item. Adding a custom class will allow you to ta... | Custom menu: Link names | wordpress |
I have a custom post type 'event', a custom meta field 'event_date' and a custom taxonomy 'locations'. I want to query $wpdb to retrieve posts in this way posts must be of the 'event' post type 'events' must be associated with a certain $location term within the 'locations' taxonomy results have to be ordered by the 'e... | You have a typo in <code> orderby </code> , and <code> meta_value_num </code> is only used as an <code> orderby </code> value, try this: <code> $args = array( 'post_type' => 'event', 'tax_query' => array( array( 'taxonomy' => 'locations', 'field' => 'id', 'terms' => $location // location term id ) ), 'me... | $wpdb query a post type within a specific taxonomy term while ordering posts by custom meta value? | wordpress |
I am working on a small WordPress widget and I am trying to set it up where the user can upload an image. So far, the necessary scripts are loading but when I click the "Media Library Image" button the image uploader doesn't pop up. Here is my javascript file: <code> jQuery(document).ready(function($) { var formfield =... | I also noticed a typo in the url <code> media-upload.php?type=image&amp&TB_iframe=1 </code> . Maybe this is the problem. Also a working example: <code> jQuery( 'input[id^=my_field]' ).live( 'click', function($) { formfield = $( 'input[id^=my_image]', $(this).closest('.widget') ).attr( 'name' ); tb_show( '', 'me... | Help adding image upload functionality to widget | wordpress |
I have created some custom post forms that I'm now using in place of a plugin called WP User Frontend which allows you to post and edit from front end. These post forms we're working great but when I deactivated the plugin I now I get a warning when the post completes its' upload saying.. Warning: Cannot modify header ... | You can't do this: <code> wp_redirect( get_permalink($pid)); </code> after you've already sent content to the browser. Headers were already sent, and <code> wp_redirect </code> is attempting to send a header again. The first three lines of the template you pasted above are all sending content to the browser, when you c... | Form Submission Warning: Cannot modify header error only when plugin is deactivated | wordpress |
I have a plugin which uses this shortcode: <code> [daisy] </code> And the html output of this shortcode is : <code> <a class="clickable">Click Here</a> </code> Plugin is working perfect if I use the shortcode to trigger the plugin. It works with this also: <code> <?php echo do_shortcode('[daisy]'); ?>... | If you open the plugin file and find where the function add_shortcode('daisy','someotherfunction'); is, then you could simply call that function that the shortcode is pointing too. This code could be placed as follows in a plugin or the functions.php file of your theme: <code> add_action( 'admin_init', 'daisy_fun' ); f... | plugin shortcode output | wordpress |
<code> /*Breadcrumb*/ if ( ! function_exists( 'seobreadcrumbs' ) ) : function seobreadcrumbs() { $separator = '&rsaquo;'; $home = 'Home'; echo '<div xmlns:v="http://rdf.data-vocabulary.org/#" class="seobreadcrumbs">'; global $post; echo ' <span typeof="v:Breadcrumb"> You are Here :- <a rel="v:url" pr... | My initial thought is that the issue is here: <code> $category = get_the_category(); </code> If <code> get_the_category() </code> is returning categories in reverse-hierarchical order, then you can do this to put them back in order: <code> $category = get_the_category(); $category = array_reverse( $category ); </code> ... | Breadcrumb ordered wrongly | wordpress |
I am working on a theme which has options for suit & shirt designing. Basically, I am stuck in creating taxonomies for suits & shirts. Reference Link Problem I am facing is to plan how the taxonomies should go: e.g. type: suit jacket style & measurement options trouser style & measurement options shirt ... | Taxonomies in WordPress don’t work like in biology or similar fields. They are not mutually exclusive. There are some ways to simulate such a behavior (see post formats for an example), but in general you have to expect cases where on post object belongs to more than one taxon (term). And there is no really useful sort... | help needed for suit designing tool | wordpress |
I was looking for a post rating system for a while, then I stumbled across a great tutorial: http://wp.tutsplus.com/tutorials/how-to-create-a-simple-post-rating-system-with-wordpress-and-jquery/ I have it working (well, its recording clicks ok), but I cannot seem to get a "most liked" page. The tutorial said to use the... | Thats code just querying the posts by sorting it by meta value, but you have no loop for the posts to display. Add the loop after the query for something like this: <code> echo '<ul>'; if ( have_posts() ) : while ( have_posts() ) : the_post(); echo '<li>'; the_title(); echo '</li>'; endwhile; endif; e... | Most liked page not displaying posts | wordpress |
I've never transferred a website before let alone a database. I believe I backed up the database to an .sql file and I haven't deactivated the old host yet in case I need to do it again. My main question is now that I'm on a host with cPanel should I use the automatic "WP Install" and then upload the database somehow o... | After fumbling a bit with the database I came across http://codex.wordpress.org/Importing_Content Switched the nameserver back, got into the old wordpress, did an export from in there so it would be in the xml format it wanted instead of sql. Switched the nameserver again to the new host, did a fresh WP install and imp... | Switched hosts to one with cPanel. To transfer my blog should I do the WP install or just be uploading my old WP directory & database? | wordpress |
i'm having a problem. I have my WP with custom roles, capabilities and so on.. But i'm having a problem in displaying the context help (in top right corner). If i log in as admin-it's all right - it's there, if i login with account which doesn't have admin rights -it's not there. But i want to display help for lower le... | The contextual help code doesn't make any discrimination on user-level by default. If you can see the page, the contextual help is there too. Are you using some custom code, and hiding the help stuff behind a level check, by chance? More information than what you have provided is needed. | Contextual help in wp-admin for non admins | wordpress |
I'm using this in my search.php template … <code> <div class="pagination"> <?php echo get_pagination_links(); ?> </div> </code> And this is the function … <code> function get_pagination_links() { global $wp_query; $big = 999999999; return paginate_links( array( 'base' => str_replace( $big, '%#%', e... | I'm fairly certain this is answered elsewhere, but I'll add it here again. I believe your issue lies here: <code> 'current' => max( 1, get_query_var('paged') ), </code> Try this instead: <code> global $wp_query; $wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : $current = 1; <... | paginate_links() don't properly work in search.php? | wordpress |
I own a self-hosted Wordpress blog and I am experiencing a lot of issues: Jetpack stopped working and it won't connect: <code> verify_secrets_missing : The Jetpack server encountered the following client error: Verification took too long </code> ; can't post any entry, the Publish button has been replaced with Send for... | The DB space run out, I had to wait for the hosting to make space and extend the DB size to the amount I requested. | Can't publish posts, Jetpack won't connect, empty notification emails to my inbox | wordpress |
As our users regularly upload ~6MB images to use on the website (and aren't too familiar with how to resize them first), WordPress stores the originals as well as resizing them to several different sizes. I'd like a function or plugin that takes the uploaded image, resizes it down to something more manageable and then ... | Add this to the functions.php file in the theme folder. It replaces the original image with the large image set in settings. You might want to setup a new image format and use that as the new original size though. <code> function replace_uploaded_image($image_data) { // if there is no large image : return if (!isset($i... | Automatically replace original uploaded image with large image size | wordpress |
I am running a WordPress website. I want to assign other users roles like Admin, Editor, etc. I want them to be able to install plugins, themes, delete them, etc. The only thing I don't want them to do is access the "Editor" page. I don't want them to edit any core files directly , even if it is as small task as adding... | The Admin and Super Admin roles are the only ones with access to edit themes. If you're wanting to give other people all other "Admin" capabilities but not access to edit themes, it'd probably be easiest to add the User Role Editor plugin, duplicate the Admin user with a new title and then just un-check the "edit_theme... | Restrict other Admins from using Editor in Admin Panel | wordpress |
I am having two sites viz. www.a.com and www.a.com/b . Now, these are two seperate wp installations, in the same /root where 'b' is kind of an extended vertical site of 'a'. I want to achieve the technique where I'd be able to show recent (or all that I publish) posts of B on A's front page. The post should look like a... | Method 1 (tested): The easiest way that wont even involve any special code is to use wordpress rss feed... i dont know if this is the solution you are after but it looks to be the simplest one i can think of... You can use: feed2js (to build an rss "recent posts" display) There you can enter the rss feed of the www.a.c... | fetching posts and showing on frontpage | wordpress |
I am using a WordPress plugin for including PHP code within posts and pages , and it's working great - however, I need to insert some styles and scripts, and in order to do that, I need to add a hook to wp_head. I tried it, creating a function and using <code> add_action('wp_head','my_func'); </code> but it didn't work... | To enqueue styles and scripts properly, use the <code> wp_enqueue_scripts </code> action like so: <code> function wpa_63708_enqueue_scripts() { wp_register_script( 'my-script','/path/to/script' ); wp_enqueue_script( 'my-script' ); } add_action( 'wp_enqueue_scripts', 'wpa_63708_enqueue_scripts' ); </code> | Adding a wp_head hook from an included PHP file | wordpress |
There are dozens of other WP installs on the same server, subject to the same ModSec rules, and none of them has a problem. This is the only WP install that has jetpack installed and it only occurs when JetPack is active. The problem is as follows: Some actions on the post/page edit screen (so far it seems to be the on... | Jetpack support kindly replied: This could be an issue with the After the Deadline module. When you update a post, WordPress makes a call to the service (service.afterthedeadline.com) to spellcheck your content, and it seems an error occurs during the connection. Could you try deactivating the Spelling and Grammar modu... | I'm think I've found a bug with JetPack 1.7 | wordpress |
I want to add a class to the 'Read more' link. Actually I have this: <code> <?php the_content( 'Read more...' ); ?> </code> Which outputs: <code> <a href="...?p=14#more-14" class="more-link">Read more…</a> </code> How can I add a class (using PHP) to the link, so it outputs: <code> <a href="...?p=1... | What (exactly) happens When calling <code> the_content() </code> inside your template, you are able to call it without any parameters. This means, that the function already has the defaults of <code> null </code> for both arguments: The "more" link text and the boolean switch that allows you to strip teaser content bef... | Modify 'Read more' link adding a new class | wordpress |
I'm using s2member and I added a new registration field to my registration form. s2member stores all custom registration fields in an array under the meta key <code> wp_s2member_custom_fields </code> . An example array (private data is x'd out) looks like this: <code> a:15:{s:14:"street_address";s:19:"xx xxxxxxxx xxxxx... | This code is your problem: <code> $s2_custom=get_user_meta($u->ID, 'wp_s2member_custom_fields'); $real = $s2_custom[0]; $real['loomsong_del']='email'; update_user_meta($u->ID, 'wp_s2member_custom_fields',$real); </code> get_user_meta returns an array of the meta values. Since in this case there's only a single va... | editing usermeta when field is an array | wordpress |
I have this working for the most part, but some of the syntax is wrong someplace because when the post DOESNT have a thumbnail, it still prints that last echo and closes a div outside of the conditional. Can someone help me get this syntax on this code right? Basically I want: Check for venue image, if it's there, disp... | I believe this should do what you want: <code> <?php if ( has_post_thumbnail() ) { echo '<div id="venue-single-img">'; the_post_thumbnail(); if ( get_post_meta($post->ID, 'Venue Image Notation', true) ) { echo '<span>' . get_post_meta($post->ID, 'Venue Image Notation', true) . '</span>'; } ec... | nested conditional to check for feature image and custom field? | wordpress |
I found this snippet online … <code> function search_url_rewrite_rule() { if ( is_search() && !empty($_GET['s'])) { wp_redirect(home_url("/search/") . urlencode(get_query_var('s'))); exit(); } } add_action('template_redirect', 'search_url_rewrite_rule'); </code> This transforms my <code> ?/s=term </code> into <... | The reason it isn't working is because you haven't told WordPress how to handle that page. You can do so by applying a rewrite rule in the following manner. <code> add_action( 'init', 'wpse_63716_search_rule' ); function wpse_63716_search_rule(){ add_rewrite_rule('^suche/([^/]*)?', 'index.php?s=$matches[1]', 'top'); } ... | custom naming of search permalink /search/ | wordpress |
For testing mobile themes and other reasons, I am trying to use an existing server with wordpress setup as multisite. The root site is not in inetpub/wwwroot but rather on another partition and that seems to work. I want to the site to be conventionally http://somesite.com and http://somesite.com/mobile I can see that ... | The solution was not that there was a permissions issue. Since iis6 doesn't use .htaccess it required installing Ionics Isapi Rewriter Enabled on the webserver you then insert essentially the same content as a the .htaccess file into an iirf.ini file in the root of the site you want and the content becomes available. M... | iis6 multisite and permissions | wordpress |
I've a filter attached, that allows modifying an array: <code> $data = apply_filters( 'wpse_example_filter', $data ); </code> The problem is, that the data can be a single or multidimensional array: <code> // single: 'SINGLE' => array( // some data ) // multidimensional: 'MULTI' => array( 0 => array( // some d... | While your answer is very interesting and I like it, I still want to post another proposal, just let you have another choice :) IMHO, if the data contains only simple fields, like: <code> array( 'name' => 'my name', 'address' => 'my address', 'phone' => '01234', ); </code> then you can use the code below: <cod... | Filter an array with a callback - for single & multidimensional arrays | wordpress |
Why is there an author.php file when the same information is in the single.php? I looked at the template hierarchy and one would think that if author.php wasn't present, the single.php would come into play but it doesn't. I would also think that if you styled the author.php then that would affect the author bio on the ... | From the Codex : ...when a viewer clicks on a link to a post author, by default he or she is taken to a page listing the posts from that particular author in chronological order, from newest posts at the top to oldest at the bottom. In other words, the author template is used to show posts made by one person as well as... | why is there an author.php | wordpress |
I was just wondering if it's possible at all to move the position of a tab inside the admin panel. Here's what I mean: http://i.stack.imgur.com/XDz8X.png As you can see I have plenty of custom post types, and each one except for the Slider type has position = 5 ( above media ). Unfortunately some of them are sliding be... | Just in case anyone might stumble upon this and have the same problem, it can be done by manipulating the admin menu itself, and there's a great tutorial for this http://wp.tutsplus.com/tutorials/creative-coding/customizing-your-wordpress-admin/ | Modify admin panel tab position | wordpress |
Im attempting to use twitter UL styles on a custom menu widget. For example, in BootStrap they have a Nav List Style for UL's <code> <ul class="nav nav-list"> <li class="nav-header">List header</li> <li class="active"><a href="#">Home</a></li> <li><a href="#">Librar... | you would have to do something like this <code> <?php wp_nav_menu( array( 'sort_column' => 'menu_order', 'container_class' => 'menu-header' ) ); ?> </code> The container class you can change your class add more class | How to Modify a Widgets UL and/or LI Classes | wordpress |
stackexchange-url ("The wonderful answer here") helped me create a custom RSS feed, and that's one major part done. I know that there's the <code> is_feed </code> conditional tag to show content only if it's a feed. But is there a conditional tag to show content only in my custom feed? If not, is there any other way to... | Okay, that was quite easy. So, if your custom feed URL (non-pretty) is <code> http://example.com/?feed=wpse63760_custom_feed </code> , then the conditional tag would be used as such: <code> if ( is_feed( $feeds = 'wpse63760_custom_feed' ) ) { // So what's the conditional content? } else { // This is shown everywhere el... | Conditional tag to show content in custom rss feed? | wordpress |
I've spent hours trying to understand the custom taxonomies functionality, but still can't figure out how to use it for my situation. I have Restaurants. They can be a certain type of restaurant, and can be in a certain city. A restaurant can be more than one type but will not be in more than one city. I need to be abl... | It can be daunting to wrap your head around these things sometimes. I sure had a hard time with it :) You were right making the Restaurant a custom post type which you can then assign terms from your the custom taxonomies . First of all, it would be best if you change the names of your taxonomies to something more read... | Way to organize content - custom taxonomies or other way? | wordpress |
when typing "a" into my search field (/?s=a) I my <code> search.php </code> template is loaded and all results that match that letter are shown. If I add this to my .htacess … <code> RewriteCond %{REQUEST_URI} ^/$ RewriteCond %{QUERY_STRING} ^s=(.+)$ RewriteRule .* /searchmyblog/%1/? [R,L] </code> and then type "a" int... | WordPress doesn’t know that you want the path <code> /searchmyblog/ </code> as search result base. So when it sees the <code> a </code> it tries to find the best match – in your case a post starting with this letter. To fix that you could modify stackexchange-url ("my code for the pagination base") to change the search... | rewriting search-permalink with htaccess - search results are are "opened" automatically? | wordpress |
I feel like I'm extremely close on this one but the query keeps on showing up empty. Basically, I'm trying to query the custom values between two dates. Records should be returned if the start date is less than the current date and the end date is greater than or equal to the current date: <code> $args = array( 'taxono... | Update - it may be supported in a meta_query. I need more information - see below. You can't do it using a meta_query, it's not supported. Do you have data in meta_data fields? - WordPress queries will exclude posts where any of the orderby (or meta_query) fields is missing. WordPress adds a join condition to the SQL q... | Query between two meta keys | wordpress |
The same old problem and not sure if its even possible. Pagination on a single.php custom post type, is it possible? This works fine until i turn permalinks to /%postname%/ then it just reloads the same page when click on the previous/next links, <code> <?php $temp = $wp_query; $wp_query = null; $wp_query = new WP_Q... | The problem is you're using <code> next_posts_link() </code> etc... note the plural form 'posts'. To link to previous and next single posts you need to use <code> next_post_link() </code> and <code> previous_post_link() </code> . Basically change 'posts' to 'post' in the function names. | Custom Post Type Pagination on Single.php? | wordpress |
Can anyone help? I'm trying to show a default placeholder image on my posts when the user hasn't uploaded an image. I have the below code BUT i need to rewrite it so that the link isn't applied to the placeholder image - only the uploaded image. Unfortunately my PHP isn't great at all so would appreciate some help.. <c... | <code> <div class="imageContainer"> <?php if ( has_post_thumbnail() ) : ?> <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('size-2'); ?></a> <?php else : ?> <img src="<?php echo get_bloginfo( 'stylesheet_directory' ); ?>/images/shared/placeholder.jpg" />... | Setting a default placeholder image WITHOUT link | wordpress |
Firstly, I am new to Wordpress so thank you for your patience. I have a list of posts (with excerpts) being displayed in the page using Short Tags. The output is fine , However, I wish to add and change some tags which is coming as a content from the_content as I see under page.php file of my theme files. Any direction... | sorry to mark this as an answer for some reason I can't comment on this question. Can you explain more what you mean by "I have a list of posts (with excerpts) being displayed in the page using Short Tags."? Do you have a list of posts excerpts displayed on the front and some number of short tags in the backend that ut... | How to place HTML tags in content from the_content()? | wordpress |
I do have a custom post type with the following setup: <code> $supports = array( 'title' , 'editor' , 'thumbnail' , 'revisions' , 'page-attributes' ); $args = array( 'hierarchical' => true , 'supports' => $supports [...] ); register_post_type('myType', $args); </code> I would like to show all posts and have them ... | As far as I can tell, there is no work-around to this at the database level. This is a problem I run into somewhat often, which is the case you need to turn an list with structure references into an an ordered array with children elements appearing immediately after their parents. This can be accomplished in PHP, but w... | Custom Post Type, WP_Query and 'orderby' | wordpress |
I developed a widget that offer a full blown archive search tool, where the user can select various options that are joined into an objects to be passed to WP_Query in an ajax action that returns the results data via JSON. 10 results are sent back to the page so pagination is needed. A new request is sent every time th... | Attempting to answer this question directly: if the data you are returning is exactly the same each time, you can send cache control / expires headers with your AJAX response so that the browser knows not to request again for a while. <code> // ask the browser to cache this response, to reduce requests $expires = 60 * ... | store/cache ajax sent data to avoid repeated request | wordpress |
Where does WordPress default SimplePie save cache data? I could only find relevant info about cache durations but not the location. SimplePie has a method called <code> set_cache_location() </code> but I cannot find it being used in WordPress. I'm writing a plugin and if a cache folder is available already by default, ... | In WordPress, the <code> WP_Feed_Cache </code> class uses the <code> WP_Feed_Cache_Transient </code> class to store the results into a transient. So, short answer, either in the database or in the Object Cache if you have a persistent object cache stored. If you need to cache something for a period of time, use a trans... | Where does WordPress default SimplePie save cache data? | wordpress |
I'm trying to include a WP_Query in a save_post function for a custom post type. The query is used to check all the other posts for a custom field <code> bh_shortcode </code> to make sure the content of the field is not duplicated. However, when I create and loop through the wp_query, the value of <code> $post </code> ... | Since <code> wp_reset_query() </code> and <code> wp_reset_post() </code> didn't appear to do anything in this situation, here's something that seems to work. I'm not entirely sure if this is the accepted approach, but I got it working by temporarily storing the $post value before the WP_Query, then setting it back to t... | using new WP_Query in save_post function alters $post | wordpress |
I have a local development server with WordPress installed (my desktop Linux Mint 12 box). I'd like to use multi-site WordPress to manage my different client projects through one install, but I have a couple of important questions before I commit to this set-up. 1) Is it possible to import a database backup (created fr... | I imported/exported between a single wordpress blog and a multisite wordpress without problems, many times. Personally on a multi-site wordpress I have a parent generic theme and each website has it's own child theme with as few files as possible, mostly only html/css for custom post types. Security issues or big compl... | Is it possible to import a wordpress backup from a single site in to a multi-site configuration? | wordpress |
I'm almost there on this one. On functions.php i have this: <code> function base_home_product_post_type( $query ) { if($query->is_search() && $_POST['box'] == 'sku') { $query->query_vars['post_type'] = 'product'; $query->query_vars['meta_key'] = 'sku'; $query->query_vars['meta_value'] = $query->q... | You could do two things: A) replace the search with a SQL query that only searches the postmeta table (faster as there's no <code> JOIN </code> involved - you can get the post via it's ID later on, when displaying the results). B) Split the string right after <code> WHERE 1=1 </code> and drop the later part. You can us... | Search ONLY by meta key / meta values | wordpress |
I am using a plugin to send emails to a relatively large email list. Because we have a low per-hour email threshold from our host we have to use a setting in the plugin to throttle the emails down to only a certain number every hour. I am assuming that the plugin uses wp-cron to accomplish this. I have tried finding do... | Yes. No, because the scheduled job hasn't reached the time yet. Yes, but not until 7:03pm. Basically, any hit to the site after the scheduled time will cause the queued job to run. The WP_Cron is a "best effort" system, not an exact timer. This is generally good enough though, since if nobody's visiting the site, then ... | How to make sure a wp-cron job runs | wordpress |
I have a front end post form where users can upload a file with their post that I save as an attachment using <code> media_handle_sideload() </code> . I need a way to add a term to that attachment so I can show a loop of all specific attachments by a user with that term. | <code> media handle sideload </code> returns an attachment ID, and attachments are normal posts with the post type 'attachment'. All the same things apply, featured images parents taxonomies post meta etc albeit with a few attachment oriented functions like <code> wp_get_attachment_image </code> So use <code> wp_set_ob... | Add a term to an attachment submitted from front end | wordpress |
I have this in my <code> functions.php </code> <code> add_theme_support( 'post-thumbnails' ); </code> This means all my post-types (normal posts and custom-post-types) have post-thumbnails enabled. Is it possible to just enable them inside a custom-post-type and not on normal posts? | Use <code> remove_post_type_support </code> to disable features for specific post types. <code> add_action( 'init', 'wpa63635_init' ); function wpa63635_init() { remove_post_type_support( 'post', 'thumbnail' ); } </code> | Post-thumbnail only for specific post-types? | wordpress |
I had urls like <code> example.com/?area=new-york </code> . <code> area </code> is a custom taxonomy. I had to change the urls to <code> example.com/new-york </code> . I want to do a 301 to new urls if previous urls are accessed. and I want Google to update its index. I have been trying to define a rewrite rule that ca... | You can use the Redirection plugin . This plugin supports full regular expressions and another interesting redirection functions. | Redirect old query string urls to new SEO urls | wordpress |
I have this include … <code> event-list.php </code> <code> <?php /** * The loop that displays upcoming events */ ?> <ul class="event-items"> <?php $yesterday = time() - 24*60*60; $args = array( 'post_type' => 'wr_event', 'posts_per_page' => -1, // show all posts 'meta_key' => 'event_date', 'orde... | Why don't you use a simple function with an argument to achieve that, the code is something like this: <code> function wpse63585_event_list( $fresh = true ) { echo '<ul class="event-items">'; $yesterday = time() - 24*60*60; $compare = $fresh ? '>' : '<'; $args = array( 'post_type' => 'wr_event', 'posts_p... | passing argument to get_template_part() or a better way to code | wordpress |
Has anyone used autoloading and/or PHP namespaces within a plugin or theme? Thoughts on using them? Any harm? Pitfalls? Note: namespaces are PHP 5.3+ only. Assume, for this question, that you know you'll be dealing with servers that you know have PHP 5.3 or greater. | Okay, I've had two big projects where I've been in control of the server enough to namespace and rely on autoloading. First up. Autoloading is awesome. Not worrying about requires is a relatively good thing. Here's a loader I've been using on a few projects. Checks to make sure the class is in the current namespace fir... | Autoloading & Namespaces in WordPress Plugins & Themes: Can it Work? | wordpress |
I am creating a facebook app via wordpress but some how need to pull the comments off my homepage and insert them onto another page, essentially what I am trying to do is duplicate the homepage with a different url/page name. I have mananged to do so easily but I need the comments as well. Thanks a tonne to anyone who ... | If that's the case you are going about it the wrong way. You should use WP_Ajax_Response to send the comment, or just redirect the the same page. Duplicate content is not what WP is intended for. | Pull comments from one page/post into another page/post? | wordpress |
I have created a custom post type with custom taxonomies. Now I need help with the permalinks. Now is like that: custom post type archive: <code> example.com/custom-post-type/ </code> taxonomy archive: <code> example.com/taxonomy/ </code> single custom post type: <code> example.com/custom-post-type/single/ </code> It s... | Plugin Recommendation I've had some great experience with the plugin Custom Post Type Permalinks . Here's the settings panel that it provides which allows you to define your structure per custom post type. Adding More Permalink Tags If you want to further extend the permalink structure tags for your needs you can take ... | Semantic URL Custom Post Type and Taxonomies permalinks | wordpress |
I am trying to display custom fields on my template values of which i am pulling from postmeta table doing something wrong with a loop or not writing the foreach args correctly not sure whats the problem pastebin link for the code http://pastebin.com/eyPD6Qws basically i want to display 15 div's with 3 cols so to say (... | Answer to my problem, finally sorted it (happy-face) { <code> global $wpdb; $broker_names = $wpdb->get_results("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key = 'B_name' ORDER BY meta_id DESC ", ARRAY_A); $b_region = $wpdb->get_results("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key = 'Region'... | pull custom fields values from wp-database in a nested foreach loop | wordpress |
I don't understand why this happens I created a new image size in functions.php called blog. Code looks like this <code> add_theme_support( 'post-thumbnails' ); add_image_size('blog', 134, 134, false); </code> Yet for some reason when the featured image comes out as 134 by 58 when called like this <code> <?php the_p... | When you set that final argument of <code> add_image_size() </code> to <code> false </code> , it scales the image down until the height or width matches one of the set values, then it maintains the proportions. For example: A 600px by 400px image using your settings is 134px wide (the long dimension) and then 89px tall... | trouble with featured image | wordpress |
Is there an easy way to change the WP default template hierarchy? For instance; Say I want to change my theme directory structure so that it completely changes from the Template Hierarchy suggested here based upon conditionals: http://codex.wordpress.org/Template_Hierarchy If I wanted to make sure that for all page typ... | Try this filter <code> function wpse_63614_restructure_template_hierarchy( $template ){ return get_template_directory().'/filename.php'; } add_filter( 'template_include', 'wpse_63614_restructure_template_hierarchy' ); </code> The filename would be the file you would want to call in your theme folder. For child themes y... | Changing the template hierarchy | wordpress |
I really need your help with a feature I have never worked with so far. I have a custom-post-type named <code> wr_event </code> . And I created this custom <code> WP_Query </code> to retrieve all posts for this post-type that are "younger" than yesterday. Fairly simple and this works like a charm. <code> function event... | This is entirely based on Event Organiser (a plug-in I've developed). The code is lifted almost straight from the source but with alterations. As such I've not tested the code as given. Step 1: Create a feed This is simple: <code> add_action('init','wpse63611_add_events_feed'); function wpse63611_add_events_feed(){ add... | Loop through posts of a custom-post-type (event) and create .ics (iCal) file? | wordpress |
I struggled with this all day, and now am here... I have a contact form generated by including a php. Presently, I have this code in my theme's index.php to include it: <code> if ( is_page('contact') ) { include("../contact.php"); } </code> which renders and functions as expected: http://www.derekbeck.com/1775/contact/... | The answer to this was not, probably (not tested) the formatting of the code, but the complicated form in that include. I've worked with the code designer to derive the solution, but it is too complicated for here. If you want to know how the WP plugin of my contact form works, it is now available for all here: http://... | Including a PHP file via a function that is part of a plugin? | wordpress |
Someone help me understand why the following do not output anything: <code> wp_list_pages( 'post_type=post' ) wp_list_pages( 'post_type=event' ) </code> Yet the following work as expected: <code> wp_list_pages( 'post_type=page' ) WP_Query( 'post_type=post' ) WP_Query( 'post_type=event' ) </code> I'm stumped. | <code> wp_list_pages </code> will only output hierarchical post types. If we look at the function in source, we'll see that it calls <code> get_pages </code> to load pages for output. If we look at <code> get_pages </code> function in source, we'll see: <code> // Make sure the post type is hierarchical $hierarchical_po... | wp_list_pages() refuses to output posts | wordpress |
I have template-clientlist.php now I search on wordpress doc but can find a function on how to check if page used template-clientlist.php <code> template-clientlist.php <?php /* Template Name: Page Of Posts */ ?> </code> Is there function that exist or custom function to check if page used the custom template? | You can give this a try. <code> $template_name = get_post_meta( get_the_ID(), '_wp_page_template', true ); </code> | Function to check if custom page is used by page? | wordpress |
I am using Yoast SEO and a custom header. this obv means that any code that yoast uses to input all the seo stuff such as title tag and meta description wont be there. I solved the title tag by using this code: <code> <title><?php /* * Print the <title> tag based on what is being viewed. */ global $page,... | Yoast uses <code> wp_head </code> hook to output the meta description tag. Make sure you have this line in your <code> <head> </code> : <code> <?php wp_head(); ?> </code> For title tag, you can simplify the code by using one function call: <code> <?php wp_title( '|', true, 'right' ); ?> </code> The <c... | SEO meta description and title tag Yoast SEO | wordpress |
I am using WooCommerce and have 3000+ products. With WooCommerce, there is an option to enable/disable reviews for each product. The box looks like this on my edit product page: Unfortunately, the checkbox (highlighted in red) doesn't come checked by default. I have contacted WooCommerce about this and they told me tha... | If you have database access, and are familiar/comfortable with MySQL, you could write a simple update script on the product table, replacing all 'review_status' to be 'yes'. I am not familiar with WooCommerce back end, but you will just need to find the proper table, column, and value, and it would be a 5-10 second lon... | Mass check a certain box in an option panel for 3000+ WooCommerce products? | wordpress |
I edited my loop in archives.php in order to work with pagination and with the Category Post List Widget. I basically pieced it all together from random code and ideas and am now so far from the default post query that I'm having trouble getting back to square one. The reason I need to get back to square one is that I ... | First, for layout and CSS styling, I would recommend creating template files for the contexts you want to customize; i.e. create a <code> category.php </code> and a <code> tag.php </code> for the category and tag index archive pages, respectively. In either case, copy <code> archive.php </code> (or, if it doesn't exist... | How To Modify The Loop in archives.php To Have 11 Posts Per Page and CSS Styling | wordpress |
I'm looking for a way to force all video content on my site to scale to 100% width and I'm hoping to avoid using any additional javascript. Is there a filter or function that I can use to accomplish this? If so how is it used? And I do not want a plugin! | Without knowing more information - you can use CSS to set a max width to any element. <code> iframe, object, embed { max-width:100%; } </code> Rachel Baker mentioned Fitvids.JS in her WordCamp Chicago presentation last weekend. It is a Javascript plugin that writes specific code for the various video providers online. ... | Force resize for all video content | wordpress |
I'm very familiar creating page templates in WP and for this project I really just have one page template with an option to switch the sidebar from the right side to the left side. The problem is that I would hate to have all of that duplicate code in both templates especially since I'll just be swapping css classes on... | Don't use custom page templates for structural layout changes. Use custom post metadata instead, and then output conditional CSS rules (or even custom HTML markup, though that's probably not necessary here) based on the value of the custom post metadata. | Can You Build Page Templates Without Extra Files | wordpress |
I'm current removing some user fields with the following code in the functions.php file: <code> function adjust_contact_methods( $contactmethods ) { unset($contactmethods['aim']); unset($contactmethods['jabber']); unset($contactmethods['yim']); unset($contactmethods['twitter']); return $contactmethods; } add_filter('us... | <code> unset($contactmethods['googleplus']); </code> Is what I needed to add to my above code. | Removing user fields | wordpress |
I found out this code and works ok for hide pages in admin page listing, but I need someway to do this to thousand pages: <code> add_action( 'pre_get_posts' ,'hide_pages_87ff65f5f' ); function hide_pages_87ff65f5f( $query ) { if( !is_admin() ) return $query; global $currentpage; $pages = array('2389','2605','2640','297... | The code you posted doesn't work because there is no <code> global $currentpage </code> . There are <code> $current_screen </code> and $pagenow </code> . <code> add_action( 'pre_get_posts', 'wpse_63414_hide_pages' ); function wpse_63414_hide_pages( $query ) { if( !is_admin() ) return $query; global $pagenow; $pages = a... | Hiding posts and pages in panel | wordpress |
I have this template I purchased and I'm trying to customize. I added a new taxonomy category called location and I'm trying to replace the default categories being loaded in the theme with my new taxonomy categories. here's the current code and where it loads the categories: <code> $cats_array = get_categories('hide_e... | I wasn't able to fix the issue in the end, but instead of using the theme options file to dynamically select the category I want, I used an override code to directly (statically) select the category I wanted | Trying to add taxonomy to get_categories() but it's not working. How to fix this? | wordpress |
Sorry for posting such a noob question but I am totally stuck and don't know what I am looking for. So basically I have a buddypress website with a static homepage. On the homepage I need to add a dynamic area where the admins can add a news story, this story will change maybe once a month. I just need to know what I a... | You need to open up your custom child theme and add a loop to the index.php. Or if you want it in the sidebar then you add it to sidebar.php with a conditional check if you only want it to appear on the homepage. If you only want to show one post you add something like this. <code> <?php global $wp_query; $args = ar... | Noob Question - Buddypress Dynamic content on static page | wordpress |
By default in the category chooser at the edit post screen wordpress displays the selected categories on top of the others, i find that extremely annoying and i would like to disable the feature even if i need a hack for this. | If I got this right, you need this plugin: Category Checklist Tree . On the post editing screen, after saving a post, you will notice that the checked categories are displayed on top, breaking the category hierarchy. This plugin removes that "feature". Additionally, it automatically scrolls to the first checked categor... | How to stop wordpress from showing the selected category on top of others in the category selection? | wordpress |
I like to create Web site mockups for clients using Wordpress. Typically I will only create the landing page and a believable navigation menu. To keep from creating extraneous pages I will create a Custom Link using "#" and then enter whatever menu name. The problem I run into is when I mouse-over the menu link I get a... | CSS. .menu li { cursor:pointer; } | Wordpress Menu - creating a fake link | wordpress |
I'm using Wordpress version 2.6.2 and now it shows in the page that <code> Deprecated: Assigning the return value of new by reference is deprecated in /home/np14388/domains/<sitename>/public_html/wp-settings.php on line 472 </code> etc. Is it safe to update from this version to the newest one, or should I update ... | Probably. Just do the following before updating: Do a direct SQL backup of the database Export your site content Disable all Plugins Switch to the default Theme Then update to the latest version. If anything goes wrong, just restore from your backups, and try an iterative update. | Is it safe to update from 2.6.2 to the newest version? | wordpress |
I'm using this plugin: http://wordpress.org/extend/plugins/event-organiser/ I notice a field in the widget called "Template (leave blank for default)". How would I use this field to show the standard list of events, but with only the date (not the time), and only display the year if it's not this year? | The template field allows you to enter what will appear on the event list widget. It accepts various place holders (you can see the documentation here - the template can be used for the <code> [eo_events] </code> shortcode too). One of the place-holders is <code> %start{date-format}{time-format}% </code> which outputs ... | How to use template field in the Event Organiser plugin widget | wordpress |
What I'm after is creating a secondary (or default) <code> orderby </code> option for a custom query. Here is what I have: <code> $post_args = array( 'post_type' => $taxfunc_post_type, 'meta_key' => '_mouldings_dimensions_height', 'orderby' => 'meta_value_num', 'order' => 'ASC', 'paged' => get_query_var(... | It's a quite simple revision to your current code. You can add multiple "orderby" values separated by a space. <code> 'orderby' => 'meta_value_num title', </code> This should keep the priority of sorting by your meta value, with a secondary sort of title. | Secondary Sort (fallback) for WP_Query | wordpress |
I have a front end post form where I take a file upload of an image. That image gets stored as a custom field which is easy enough to do. What I need to do though is store each unique image url for each user into an array in their usermeta. I want to do this so I can show them a list of those images they've already upl... | Instead of saving the URL of the sideloaded file, save its ID. You can then attach post meta or a tax term to the new attachment indicating its album art. That way your meta stores the ID of the current cover, and if you want a selection, just show attachments that are images with the associated postmeta indicating the... | Adding data to an array in usermeta and displaying it in a loop | wordpress |
I would like to be able to hide a widget in the front-end if the user is logged in and only display the widget when the user is not logged in. I have found a plugin that does this called Widget Logic however i don't want to install too many plugins especially for something as small as this. Your help will be much appre... | If you're comfortable changing the code where the widget is outputted you could use the is_user_logged_in() function. Something like this: <code> <div id="widget_area"> <?php if ( is_user_logged_in() ) { // show nothing } else { dynamic_sidebar('widget_name'); } ?> </div> </code> The downside being th... | Hide widget if user is logged in without plugin | wordpress |
Sometimes in my error log i have this error: <code> You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 SELECT * FROM c_posts WHERE id = , do_action('wp_ajax_inline-save'), call_user_func_array, wp_ajax_inline_save, edit_post... | The error in the SQL statement is at the very end, <code> SELECT * FROM c_posts WHERE id = , </code> There is no value being supplied to check against the <code> id </code> column. This is most likely because you didn't check for a blank value in the ID field before forming and executing the query. Check the code in th... | Sql syntax error | wordpress |
I am dividing my plugin code into multiple files and functions. When I have a function and straight after it an action hook, or for example add_shortcode, should that line go straight after the function or in a plugin init function? As an example, should I have something like this: <code> // Shortcodes.php file functio... | You do it like in your first example <code> // Shortcodes.php file function myplugin_shortcode( $atts ) { if ( !empty ($atts) ) { foreach ( $atts as $key => &$val ) { $val = html_entity_decode($val); } } myplugin_display_items( $atts ); } // Register shortcodes add_shortcode( 'output-items', 'myplugin_shortcode'... | Developing plugin, where to place action hooks etc? | wordpress |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.