question stringlengths 0 34.8k | answer stringlengths 0 28.3k | title stringlengths 7 150 | forum_tag stringclasses 12
values |
|---|---|---|---|
I just installed Automatic Wordpress Backup on a fresh install of wordpress, with no other plugins installed, nothing else has changed from the default install. The plugin is saying zip is not found, I verified with my host that it is, and updated the path for it in automatic-wordpress-backup.php. I also have debug tur... | The plugin's description in repository says following: Important caveat: this plugin currently has to be run on a linux server. Also, the wp-content/uploads folder has to be server-writable or it won't be able to create the zips for backup. ...which makes me think that developer was not too interested in making plugin ... | Automatic Wordpress Backup Plugin works, but says it's not | wordpress |
I'm trying to schedule a pseudo cron job to send an email after a set amount of time utilizing a WordPress plugin. So far, I've been able to make this code run when I hard code the email address and message into the 'email_about_coupon' function; however, when I try to send the arguments to the function, the email is n... | I think you have mismatch in how you pass arguments and how you expect it to work. You pass array of arguments to schedule and expect your hooked function to receive identical array of arguments. This is not the case. Cron events are processed by <code> do_action_ref_array() </code> , which in turn passes arguments via... | Using wp_schedule_single_event with arguments to send email | wordpress |
I have a template that pulls three posts query_posts() loop. Two of the posts and are truncated to 10 words like I have it set in a filter. The third decided to ignore the filter and is spitting out 33 words. I can't see a difference between the posts. Does anybody know why this would happen? <code> while (have_posts()... | Does that post have an excerpt manually entered? the filter only works on excerpts when they're pulled from the post content. | Using the_excerpt() some posts are truncated and some are not | wordpress |
I tried to install a premium theme called Superb. I'm new to WordPress and I'm having a bit of a problem. I think that it has to do with permission settings, but I'm not sure. This is my situation: I'm on a Mac running MAMP Pro. I've setup WP on my local machine. When I open my site in a browser, I see the default Word... | Laxmidi: You wouldn't FTP to your local installation of WordPress, which is under some directory that you have assigned with MAMP. Wherever that directory lives, you must unpack your theme.zip folder on your desktop, then move the theme into /wordpress/wp-content/themes Once you add move your downloaded theme directory... | Problem Installing a Premium Theme-- File Permission Issue on a Mac, Local Machine? | wordpress |
I know this is very avant-garde, but bear with me. I've read that one is able to query a page by the page/post name or slug. I'm trying to do this because I need information from a page with a similar title/slug and will not have the ability to get the page id (unless there's a way to convert a title to an ID). I've tr... | Hi @Zach Shallbetter: If I understand your question, then you are looking to solve your problem using theming functions when you really need to use more of WordPress' API. The following code can be copied to a <code> test.php </code> file and run using <code> http://yoursite.com/test.php </code> for you to see how it w... | Get post by page name or slug | wordpress |
Hey guys, I've added a TinyMCE to some textareas that are displayed in a custom meta box. All of the formatting works perfectly fine, except that the editor will not save <code> <p> </code> or <code> <br/> </code> tags. It doesn't preserve the line breaks. The TinyMCE is setup like this: <code> wp_tiny_mce(... | I recently got this working. You should search and replace <code> metaname </code> with your meta box name. The key to maintaining formatting was using <code> wpautop(); </code> when saving the data. <code> add_action( 'add_meta_boxes', 'add_metaname_box'); add_action( 'save_post', 'metaname_save'); function add_metana... | Extra TinyMCE editor strips and tags? | wordpress |
I want to start giving back to the community, but writing a plugin from scratch is currently slightly beyond my skill level and creativity level (meaning, I don't know what kind of problem I can solve with a plugin! every time I think of something, I find a plugin or 6 that have already been written!). However, I have ... | there are several guides in the Codex that can help, Set up your plugin for submission Submit your plugin Keep it up to date I also think it's a great idea to "fix" older useful plugins :) Steps : http://wordpress.org/extend/plugins/about/ Submit : http://wordpress.org/extend/plugins/add/ How to Use Subversion : http:/... | How to fork a plugin? | wordpress |
I'd love to be able to hide meta boxes using screen options, instead of removing them or restricting them to user roles, the goal is to just "uncheck" the meta box for the user. I see how this would be tricky since any code that would make a DB change for a user wouldn't be allowed to run every time they hit the page b... | You are referring to the metaboxes on the admin post screen right? For that you don't need a plugin, just drop the following into your functions.php file. <code> // add_action('user_register', 'set_user_metaboxes'); add_action('admin_init', 'set_user_metaboxes'); function set_user_metaboxes($user_id=NULL) { // These ar... | How to set default screen options? | wordpress |
I'm trying to create two queries. In the first query, I will, for example, display 6 posts, in a given order. In the second query, I want to display the same 6 posts, but "offset" the first 3 and then have those same 3 appear at the end. For example, Query #1 would return: 1 2 3 4 5 6 Then, Query #2 would return: 4 5 6... | No need to have two queries, you can just reuse the same post data by resetting the current post position and running the loop again: <code> $wp_query->current_post = 2; </code> you'd have to do this twice to achieve what you're asking, and stop it the second time at the third post. | WP_Query - Adding "offset" posts to the end of the loop | wordpress |
Will adding code similar to what I've pasted below to the functions.php theme file slow down a Wordpress site or effect CPU? (Thank You) <code> function remove_menu_items() { global $menu; $restricted = array(__('Links'), __('Comments'), __('Media'), __('Plugins'), __('Tools'), __('Users')); end ($menu); while (prev($m... | Nope or Not really or Not noticeably. | Functions file mods and CPU | wordpress |
I'd like to know how I can rewrite a search URL that also contains an extra query var into a pretty permalink using <code> wp_redirect </code> and the <code> template_redirect </code> hook. I have taken the code from the Nice Search plugin which works fine to change <code> http://example.com?s=africa </code> into <code... | To modify the search rewrite rules you can hook into the <code> search_rewrite_rules </code> filter. You can either add the extra rewrite rules that match post types yourself, or you can change the default "search rewrite structure" to also include the post type and then re-generate the rules (there are four rules: one... | Pretty permalinks for search results with extra query var | wordpress |
fellow coders! I an having a hard time JOIN(ing) tables. I have a a lot of users on my site and many of them have the same last names. I am trying to get their emails by their last name. WP stores emails in the users table and user names in the usermeta and I have been trying to use JOIN to get what I want, but I don't... | Hi @Holidaymaine : Not sure where you are doing wrong, but try the following instead which is a self contained <code> test.php </code> file you can drop into the root of your website and load in your browser with <code> http://yoursite.com/test.php </code> (assuming you replace <code> yoursite.com </code> with your sit... | LEFT JOIN, INNER OUTER JOIN, LEFT OUTER JOIN is driving me crazy. Please help? | wordpress |
<code> sanitize_title_with_dashes </code> (see code below for reference) is the function Wordpress uses to format "pretty" urls. However, contrary to the function's comment header, it allows much more than alphanumeric characters, underscore (_) and dash (-). It also allows signs like °, etc. How would I go about reall... | Consider this function as a rough placeholder. It has more flaws than you might imagine … :) There are many plugins to improve the conversion for different languages and needs. You may take a look at my plugin Germanix to see how this could be done. | Is sanitize_title_with_dashes formatting function too liberal (in terms of accepted characters)? | wordpress |
I have a Custom template with a custom query. I want to use additional information about the current taxonomy > description and name (and use it in the HEAD, desc, keywords, etc...) <code> <?php $productvariable = $_GET['product']; $term = get_term_by('slug', $productvariable, 'mytaxonomy'); $mytitle = $term->nam... | you can look at line 874 in /wp-includes/taxonomy.php for the function itself. the value has <code> stripslashes </code> applied and then it's used in a prepared statement, so I'd say it's safe. but there's nothing stopping you from checking the value yourself first if you know what parameters it will always fall withi... | get_term_by with a variable | wordpress |
I added a Merchant to the Wordpress E-commerce plugin. I want on the submit, after doing my curl() call, to clear the cart How do I do that? ( link to plugin page ) | according to their docs: <code> $wpsc_cart->empty_cart(); </code> | Clear Cart with Wordpress E-commerce plugin | wordpress |
I was thinking of removing/hiding admin-bar from my wordpress (3.1.1) installation. I visited following link: http://codex.wordpress.org/Plugin_API/Filter_Reference/show_admin_bar I was surprised to see only a single line to remove/hide admin-bar <code> add_filter( 'show_admin_bar', '__return_false' ); </code> My quest... | WordPress contains built in functions for quickly returning values. They are intended to be used as a quick built in function that returns a common value to a filter hook such as true, false, or an empty array. <code> __return_false </code> — Returns the Boolean value of false. <code> __return_true </code> — Returns th... | what is __return_false in filters | wordpress |
I'm currently wanting to have it so that writers on my site have to have an admin approve their content before it's published, but still be allowed to do other tasks such as uploading images, adding tags, etc, and the wordpress static permission levels are either too restrictive, or let writers publish themselves. I kn... | heres a brilliant resource for the info you required. wp roles and capabilities | Create custom permissions for user type | wordpress |
I have an Expand/ Collapse plugin which, via a shortcode, can expand/ collapse content. My expandable content is a shortcode of a gallery. See here: http://shop.dearearth.net/collections INTERMITTENTLY, the gallery shows up in at least the first to be expanded section, but never in the second... * these are the plugins... | Even after listening to the podcast this morning where Joel and Jeff talk about how "Fix my Code" questions are too localized to stackexchange-url ("benefit the community") and serve no purpose to anyone but the op, I'm going to try and answer this in a way that will be useful and beneficial to other weary WordPressors... | Nested Gallery Shortcode INTERMITTENTLY working | wordpress |
I added descriptions to my menus using this post, stackexchange-url ("Menu items description?"). However I need to be able to use html tags and WordPress is stripping them out. Can anyone help? | You can remove the filter by adding this to your functions.php file: <code> remove_filter('nav_menu_description', 'strip_tags'); </code> | Allow html tags in WordPress Custom Menus Description Field | wordpress |
How do I do that? Any custom post type I register shows up as a meta box on the menu page... | It's really simple, when registering the Custom Post Type use: <code> register_post_type( 'post_type_name', array ( ... 'show_in_nav_menus' => FALSE ... ) ); </code> | Prevent custom post type from showing up in custom menus | wordpress |
I'm using the mingle plugin and the mingle-forum plugin. I want to show a certain part on my site only if those two plugins are active. How can I solve this? <code> <?php if ( is_plugin_active('mingle-forum') ) { ?> <div id="login"><?php include (TEMPLATEPATH . '/inc/userlogin.php' ); ?></div> &... | This function exists in wp-admin/includes/plugin.php so I'm assuming it doesn't get included by the theme. You can either <code> require </code> it, or just create your own version of it - see here: http://wordpress.org/support/topic/is_plugin_active | if plugin is active? check wheter plugin is enabled or not? | wordpress |
I've got a custom post type (CPT) called <code> event </code> . Every event has got an associated <code> meta_key </code> called <code> event_date </code> . I want to make sure that events with empty <code> event_date </code> won't appear in my list of all events and in the prev/next event navigation when viewing a sin... | I ended up using the Ambrosite Next/Previous Post Link Plus plugin . As to an empty <code> event_date </code> meta key - I have added some code to prevent a post from being saved if meta key value isn't correct. Have a look at this posts: stackexchange-url ("Modifying Wordpress post status on Publish") stackexchange-ur... | specify meta_key / meta_value condition for prev_post_link and next_post_link | wordpress |
Note: This is more of a tutorial/wiki than a real question and should be a reference for later Questions. If you got something to add, please feel free to add an answer. Working answers get upvoted. :) Szenario You want to modify the output of some wp core function and instead of modifying the core directly (which is a... | Example Nav menu walker - allows adding eg. css classes to (all) menu items. <code> // copyied from /wp-core/wp-includes/nav-menu-template.php > line 76 (wp 3.1.1) - start_el() function $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) ); </code> Now let's check ... | How-to inspect filter-able $vars? | wordpress |
Does a method exist that can return a simple array of the pages in the site that are published? I only want the name and the slug returned, not the full content or other default values. I've tried WP_query(), get_posts(), get_pages() and query_posts() but they all return the post/page content. I'm only looking to get t... | Like a commented the only way to do it is with a custom sql query so: <code> global $wpdb; $mypages = $wpdb->get_results( "SELECT post_title, post_name FROM $wpdb->posts WHERE post_type = 'page' AND post_status = 'publish' AND parent = '0'"); if (count($mypages) > 0){ foreach ($mypages as $page){ //do you stuf... | How to exclude content (and other returned values) from WP_query()? | wordpress |
I'm trying to learn HOW to learn about WordPress by following its source code etc. I'm really stumped at the_excerpt(). Documentation states that the_excerpt uses get_the_excerpt(), and will return either the (manual) excerpt, or will use the first 55 characters of the_content. I'm interested in the logic that looks fi... | From what I understand in the default-filters.php file a filter is applied to the 'get_the_filter' filter. The callback is for a method called 'wp_trim_execrpt'. This is found in formatting.php. From there you can see the logic. Hope that helps. | Where is the logic that defines the excerpt? | wordpress |
I need to extend the cookies of a subdomain.domain.com to all of the domain.com's subdomains (.domain.com in cookie terms). I am trying to minimize the impact of this transition. It seems that flipping the switch with <code> define('COOKIE_DOMAIN', '.domain.com'); </code> in wp-config leaves the user in a state of limb... | stackexchange-url ("This answer") may help. To quote: The basic code you need here is this in the wp-config file: <code> define('LOGGED_IN_COOKIE', 'login_cookie_name'); define('AUTH_COOKIE','auth_cookie_name'); define('COOKIE_DOMAIN', '.example.com'); define('COOKIEHASH', 'random_hash_here'); </code> Put that in the c... | How to transition cookies from .subdomain.domain.com to .domain.com with minimal impact on users? | wordpress |
Im using the following code to get an array of children taxonomies and write them out with links in an unordered list. <code> <?php $termID = 10; $taxonomyName = "products"; $termchildren = get_term_children( $termID, $taxonomyName ); echo '<ul>'; foreach ($termchildren as $child) { $term = get_term_by( 'id', ... | Here is a function I use to list subterms: <code> /** * Lists all subentries of a taxonomy. * * @return void */ function ttt_get_subterms( $args = array () ) { if ( ! isset ( get_queried_object()->taxonomy ) ) { return; } $options = array ( 'child_of' => get_queried_object_id() , 'echo' => 0 , 'taxonomy' =>... | Get current term's ID | wordpress |
i am trying to learn and create some deeper things with Wordpress. My goal is to create a code/script/plugin that will allow me to post from the frontend. I have seen many plugins, like templatic classifieds theme that submit, handle and edit posts from the frontend but are very complex with useless code for my purpose... | To post from the front-end you can use wp_insert_post() function. So its simply a matter of a form and processing it the form: <code> <!-- New Post Form --> <div id="postbox"> <form id="new_post" name="new_post" method="post" action=""> <p><label for="title">Title</label><br />... | I am trying to create a simple frontend form for posting | wordpress |
I'm currently working on importing an MovableType blog into WordPress. The blog has several thousand posts, and each post has an image associated with it. The export file contains references to each image as follows (and as expected): <code> <img src="http://domain/path/to/image"> </code> I've got all the images,... | Answers: Is post_guid the image location reference? Or is the path to the image stored somewhere else? $post-> guid is the record in a post which holds the URL for your attachment. Where is featured image set? featured image is saved as post meta so use <code> update_post_meta() </code> once you have the attachment id:... | Programatically creating image attachments from local URLs and setting featured image | wordpress |
I have a custom post type that I'm just using just to keep data in but I sometimes share it with others, and I don't want any confusion when the "view" link appears in the admin column. Is there a way of removing that? | <code> add_filter( 'post_row_actions', 'remove_row_actions', 10, 1 ); function remove_row_actions( $actions ) { if( get_post_type() === 'my_cpt' ) unset( $actions['view'] ); return $actions; } </code> Should see you through :) The $actions array consists of the following: <code> $actions['edit'] $actions['inline hide-i... | Remove the "View" Link in Post Admin | wordpress |
Im working on a little plugin that when activated creates a theme page and then a function sets this page to published this is the code i have for published: <code> // function that creates the new ads page on plugin install // function mjj_create_page () { // Create new page object $ads_page = get_option('mjj_smart_ad... | I'm posting this as another solution for you and its based on the page id <code> /* $post_id - The ID of the post you'd like to change. $status - The post status publish|pending|draft|private|static|object|attachment|inherit|future|trash. */ function change_post_status($post_id,$status){ $current_post = get_post( $post... | Set page to draft on plugin deactivation | wordpress |
I have a simple meta box that updates the post custom fields (using <code> update_post_meta() </code> ). How can I send a error or warning message to the next page after the user publishes/updates the post and doesn't fill one of the meta box fields (or fills them with invalid data) ? | You can do this by hand, but WP natively does it like this for settings errors: <code> add_settings_error() </code> to create message. Then <code> set_transient('settings_errors', get_settings_errors(), 30); </code> <code> settings_errors() </code> in <code> admin_notices </code> hook to display (will need to hook for ... | Passing error/warning messages from a meta box to "admin_notices" | wordpress |
I'm using the code below to create custom menu items on the fly. Its working great, except all menus are created as "Custom". In the code below, setting the menu-item-type to 'page' appears to have no effect. <code> foreach($thePages as $page){ wp_update_nav_menu_item($menu->term_id, 0, array( 'menu-item-title' =>... | There's a filter: <code> function wpse15368_update_menu_item_type( $args ) { return $args['menu-item-type'] = 'page'; } add_action( 'wp_update_nav_menu_item', 'wpse15368_update_menu_item_type' ); </code> | Custom Nav Menu items default to 'menu-item-type' => 'custom'. How to make a "page" menu item? | wordpress |
I have a wordpress multisite installtion with 5 sites within, the multisite is called Lifestyle Homes Cars Architecture Holidays Communities I am trying to get the blog name, for each blog when viewing in my theme, every function I use returns 'Lifestyle'. I have tried; <code> get_bloginfo('name'); get_bloginfo(); glob... | This is what you need: <code> global $blog_id; $current_blog_details = get_blog_details( array( 'blog_id' => $blog_id ) ); echo $current_blog_details->blogname; </code> Have a nice multisite! :) | How to get blog name, when using Wordpress Multisite | wordpress |
After a new user registration, WP sends out an email with the login / password, and a link to the login page. Is there a way to change this defaut email template? I'd also like to change the subject and sender. Edit : For anyone interested, here is a plugin solution. | the new user email is sent using <code> wp_new_user_notification() </code> function which is pluggable meaning that you can overwrite it: <code> // Redefine user notification function if ( !function_exists('wp_new_user_notification') ) { function wp_new_user_notification( $user_id, $plaintext_pass = '' ) { $user = new ... | How to change the default registration email ? (plugin and/or non-plugin) | wordpress |
Does Wordpress MU not allow domain mapping to subdirectories, such as example.com/blog? Wordpress.com doesn't allow this. I couldn't find an option to do this in WordPress MU Domain Mapping plugin. | Domain mapping works for both subdomains and subfolders (AKA subdirectories). It used to not be available for subfolder installs via the WordPress MU Domain Mapping plugin, but that's no longer the case for a long time. With that being said, it's for a self-hosted blog (WordPress.org install) and not for WordPress.com. | How to do Domain Mapping to Subdirectories? | wordpress |
I've just set up a new multisite installation. Everything works as I'd except that images don't show up on any of the sub-sites. Any idea why the images don't show up? I'm running Wordpress 3.1.1 on IIS6 in a shared Windows server (hosted by Arvixe.com). The secondary sites are in sub-directories rather than sub-domain... | Finally, I've got it! Sniffing the HTTP resonses indicated that a few extra bytes were being inserted between the headers and body of the http response, resulting in bad image data. Further investigation revealed that these characters represent a Unicode Byte Order Mark (BOM). These, in turn, were caused by a Windows e... | Images don't show up | wordpress |
Does anyone know of a theme that completely removes all uses and aspects of the frontend. So the sole use of the site will be in the admin section. to use as a portal for something like a school or internal government uses. | There are three things (if i understood your needs correctly): Adjust the admin menu items @MikeSchinkel Gist The Backpress project ...or simply <code> wp_redirect(); </code> on login and offer only a login screen in your index.php template . | wordpress theme backend admin only | wordpress |
I am trying to get scripts via <code> wp_enqueue_script(); </code> . I have tried this in header but WordPress is not importing any script. I am using like this <code> wp_enqueue_script('jquery'); </code> http://codex.wordpress.org/Function_Reference/wp_enqueue_script Is any other step needed for importing script via W... | In simple case you need to enqueue script before header scripts are printed, which happens in <code> wp_head </code> hook. Basic approach would be this in <code> functions.php </code> of your theme: <code> add_action('wp_enqueue_scripts', 'my_enqueue_scripts'); function my_enqueue_scripts() { wp_enqueue_script('jquery'... | How wp_enqueue_script works? | wordpress |
I'm trying to figure out a permalink structure for my pages (not posts) in Wordpress. Right now, I can add a "Category Base" for posts... so, something like www.mysite.com/categorybase/post1/ or www.mysite.com/categorybase/post2/ But, if I wanted to do something similar for pages, how would I do that? For example, www.... | For the example you're using (ie www.mysite.com/pagebase/page1) you can: create a page called pagebase create a page called page1 and make pagebase the parent page - the url for this page will be www.mysite.com/pagepage/page1 This does mean that www.mysite.com/pagebase also exists as a browsable page, but I generally u... | Default Permalink Structure for Pages | wordpress |
I'm seeking advice on the best way to construct a PDF repository. Basically, there will be an uploader in the administrator section and in the front end. The user should be allowed to add tags to the files. So I guess I need: Front-end uploader Backend-uploader Custom-post type? Security to check the PDF files and not ... | Right now, the support for tagging media is pretty disappointing. You can add tags or categories to the attachment post type, but you'll find the UI is unacceptably bad (it's a text box where you enter terms separated by commas). There's a plugin Media Tags that is decent though, so you might look into that. GravityFor... | How to build a PDF repository in WordPress | wordpress |
I am pretty new to web design, so this is a perplexing problem to me. I am creating a floating social media share button to the left of my content that scrolls with the blog content. Here is the code I am using: <code> <div id="floating-menu-blog" style="opacity:0.3;filter:alpha(opacity=30)" onmouseover="this.style.... | A plugin conflicted witt eh last 30 lines or so of my css file. No idea what exactly it did to cause this, but disabled the plugin and everything is solved. | CSS not being applied | wordpress |
About 60% of plugins that I install don't show up in my plugins section. When I install them it says they're installed, and when I click "activate plugin" it says theres no valid header for the plugin. Navigating to the main plugin section in the dashboard the plugin doesn't show up at all, so I can't activate it from ... | Download the plugin as a zip, extract and manually upload the folder that immediately parents all the .php files (i.e not a folder that has another folder as its child) into you plugin folder. Sometimes dev's can zip things within an extra folder, which confuses wordpress. | Plugins not showing in dashboard-> plugins section | wordpress |
When a user selects a specific category from a drop-down a list of multiple post types is displayed. I'd like to display the data in groups with the post-type title above in a heading. I'm unsure how to segment into post-type groups. I spent a bit of time looking but didn't find exactly what I need. I also tried to add... | Yep, I don't think this is something you can easily do natively. Two ways that I see: Use <code> posts_orderby </code> to modify SQL request and order posts by post type, then just need to check so headings don't repeat. Instead of looping through posts in order returned, take array of those and sort by post type befor... | Grouping post-types in loop | wordpress |
I have seen a number of solutions of how to manually attach links to the new WP admin bar, but I need to make this much easier for my site admins. It occurred to me that the easiest solution would be to create a custom navigation menu, and then have that menu 'attached' to the admin bar. This way the site admin could v... | It turns out to be very easy! No need for a special walker, <code> wp_get_nav_menu_items() </code> returns everything you need. This example adds an single root menu item and then the menu, you can do this differently if you want. It maps all extra menu features I could find in the code, I don't know whether you can se... | Attaching a navigation menu to the admin bar? | wordpress |
Is there a ready plugin or solution for implementing Featured Image function to Categories and Links? At Pages and Posts I use the feature image as a background image, using the full size original image, and I'd like to achieve the same, meaning I'd like to have featured full size image for categories. With Links, I'd ... | Finally, I managed to use two plugins: Link Image Gallery and Category Meta plugin although I had to tweak one of them. They both use the media gallery to select picture, but if both very active, Link Image Gallery disabled the return function of Category Meta plugin, so I added a check in Link Image Gallery's main fun... | Featured image for links and categories | wordpress |
I have this query that shows the categories that a user had posted in. For example if I have 3 cats, name NEWS, MEDIA, PUBLICATIONS and the author had only posted in the first two, it will show NEWS MEDIA Is there any better code than this or an improvement because my db is really huge and it gives me throttling? Thank... | Your SQL isn't limiting the term matching to categories only. You're also getting back tags and any other taxonomy. So the data coming back may be more than expected. Taxonomy is a key in the term_taxonomy table, so it should be fast to eliminate the ones you don't need. <code> SELECT DISTINCT(terms.term_id) as ID, ter... | Is there any better/faster code than this ? It shows the categories that an author had ever posted in | wordpress |
So the reason why I am don't want to include <code> get_header() </code> or <code> get_footer() </code> tags is because this page will be loaded as an iframe using the thickbox modal plugin and its content will be a form and I don't want the aforementioned tags to render all the menus and banner images and menus as wel... | Completely skipping <code> wp_head </code> and <code> wp_footer </code> doesn't seem like a good idea, many core components and plugins depend on these hooks. Instead, you could create a light header and footer, and load them via an extra argument to <code> get_header() </code> and <code> get_footer() </code> . <code> ... | What action hook can I use to add a JavaScript to a page post using a theme template that is not including get_header() nor get_footer()? | wordpress |
I have a custom post type ("News"), and a custum user role ("Friends"). How can I get the last "News" written by "Friends" ? | I would try the following (not tested) <code> <?php $friends = get_users( array( 'role' => 'friends' ) ); $friend_ids = array(); foreach( $friends as $friend ) $friend_ids[] = $friend->ID; $news = new WP_Query( array( 'author' => implode( ',', $friend_ids ), 'post_type' => 'news', 'paged' => get_query... | How can I get the last posts by user role? | wordpress |
Question is simple. Can i get the title and main url of the site from where the posts are loading? Actually i want to linked to the main site. The url can be found by wordpress function esc_url(); function but what about site title? The page is here: http://citystir.com/author/designdons/ Thanks! | <code> $feed = fetch_feed($feedurl); $channel = $feed->channel; $blog_title = $channel["title"]; </code> Note - I haven't tested this, am relying on my (faulty) memory. | Showing RSS feed via fetch_feed. How to show the site title of the feed? | wordpress |
I have migrated my blog from blogspot to WordPress. Then I have noticed many of the posts contain duplicate custom fields. Like blogger_author, blogger_permalink, blogger_blog are duplicated upto 5 times. How can I remove the duplicate Custom Fields? | You can delete directly from the database, using an SQL statement like: <code> delete from wp_postmeta where meta_id in ( select * from ( select meta_id from wp_postmeta a where a.meta_key = 'blogger_blog' and meta_id not in ( select min(meta_id) from wp_postmeta b where b.post_id = a.post_id and b.meta_key = 'blogger_... | How to remove duplicate Custom Fields? | wordpress |
It is possible to restrict the upload process to choose only one file. Now a person can select various files from pc, Im trying to find a way to restrict this feature just to one file. Thanks in advance. | WordPress contains 2 media up-loaders. The Flash uploader allows the selection of multiple files while the browser uploader only allows 1 file at a time. To disable the Flash uploader add the following filter to functions.php <code> add_filter('flash_uploader', create_function('$flash', 'return false;')); </code> EDIT ... | Media upload - choose only one file | wordpress |
I'm getting ready to submit a theme to the .Org repo and wanted to make sure that everything is in ordnung. One of the biggest holes left in my design is the comments template. I've taken a look at comments.php in a few themes, Twenty Ten chief among them and have come away more confused than when I started. It seems a... | You really don’t need much. A headline with id=comments <code> <h2 id="comments"><?php comments_number(); ?></h2> </code> This will be the target for <code> comments_link() </code> in the article loop. Links for paginated comments. Usually, I put these links into a function and call the function above... | What are the current recommended best-practices for comments.php? | wordpress |
Is there a native function to check if a theme a template file. For instance, if a theme is not using the 'home.php' file, then execute some code... | So I would add to the Answer the following: <code> function foo_function() { $located = locate_template( 'home.php' ); if ( !empty( $located ) ) { // 'home.php' found in Theme, do something } } add_action('init', 'foo_function'); // remember to change both of the parameters above, first one for where you want the // ac... | How do you check if a WordPress template file exist? | wordpress |
I'm using site_url() for my href for anchors. I want to control what when I send the user to a secure page or non secure page. I thought I could do that with site_url('/foo', 'http') and site_url('/bar', 'https') but the scheme is not changing. If I'm on a secure page and site_url('/foo', 'http') is set, the clicked pa... | What is original link? <code> var_dump( get_option('siteurl') ); </code> If I am interpreting code right then for <code> http </code> protocol argument action is to not change the link. So if you have set up URL to be secure by default then function doesn't override that. | site_url is not honoring scheme | wordpress |
I want to move all my content, posts and pics from Tumblr to Wordpress ..! What would be the best way to do this??? | Try the Tumblr Importer. :) http://wordpress.org/extend/plugins/tumblr-importer/ Let me know if you have any problems with it, we're actively trying to improve it. | Moving a blog from Tumblr to Wordpress | wordpress |
I want to know all the classes and functions(individual .php files) in a wordpress installation that handle serialization and unserialization. | WordPress uses <code> maybe_serialize() </code> and <code> maybe_unserialize() </code> . Both of them use PHP's native <code> serialize() </code> and <code> unserialize() </code> functions. See: http://phpxref.ftwr.co.uk/wordpress/wp-includes/functions.php.source.html#l1028 http://phpxref.ftwr.co.uk/wordpress/wp-includ... | Classes and functions involved in serialization and unserialization | wordpress |
I'm having trouble reading RSS feeds created by WP3 on the same domain. When I do a print_r($rss); at the part of my plugin where it does the RSS parsing, I get the following output: <code> WP_Error Object ( [errors] => Array ( [simplepie-error] => Array ( [0] => WP HTTP Error: couldn't connect to host ) ) [er... | Anyone with a similar issue: First off, try the following after connecting to your webhost via SSH: <code> ping <yourwebsite> </code> If you get a "cannot connect to host" issue, there's a firewall or NAT problem blocking traffic for RSS. Contact your server admin. | WP HTTP Error: couldn't connect to host for RSS feeds on same domain | wordpress |
I have a third party events plugin that uses custom tables in the database. I have created a theme file (event.php) that pulls the data in based on a slug that is ideally given in the URL. I want to create a custom URL rewrite rule for this template, so a URL like this: /event/my-slug Will call the event.php file, grab... | Just remove pagename=event& and reset your rewrite rules... <code> $newRule = array('event/(.+)' => 'index.php?eventid='.$wp_rewrite->preg_index(1)); </code> *template_include* is a filter NOT an action! <code> add_filter('template_include', array($EventpageCode, 'template_redirect_intercept')); </code> You c... | Adding Theme File for Non-Wordpress Content | wordpress |
I am going to have two WordPress websites running off the same database, so that they both have the same products set (each post is a product) but they have different homepages, about us pages, etc. thanks to the themes of each site. (Note: NOT using MU). But there is once concern: <code> <title> </code> and <cod... | Hm... In more pure sense of the question I suppose you could filter <code> active_plugins </code> option on retrieval via <code> option_active_plugins </code> filter and throw plugin out for one of the sites. But I won't try to predict what this can cause to active/inactive state in your situation. :) I think more prac... | More than one WordPress site using the same database - how to disable plugin for one site? | wordpress |
First things firs.... up until now (before I experimented with some plugins - many) my blog was behaving properly.... 1. I write the post 2. Import the media from my computer 3. Insert the media into my post 4. When I click on media link ... it fires up the pdf file (for example) Now when I do everything same from 1 to... | In the Add Media window, click the "File URL" button, not "Post URL" before inserting it into the post. | Links to my uploads went crazy | wordpress |
I'm using - this tutorial - to add simple meta boxes to a custom post type. But the textarea meta boxes are spitting out content all as one big paragraph, with no <code> <p> </code> formatting applied. What code would add the - wpautop filter - to the meta box textarea? Thanks for any help. | Add a function that grabs your meta data, applies wpautop and echoes it out, or otherwise run it through when you output it in your template. <code> $my_meta = get_post_meta($post->ID,'_my_meta',TRUE); echo $my_meta['name']; echo wpautop( $my_meta['description'], 1 ); </code> | Add filter 'wpautop' to meta box textarea | wordpress |
I'm trying to prevent people from adding terms to some, but not all of my taxonomies. There are four taxonomies in a certain post type. I need to prevent people from adding to two of those. I used jQuery to prevent people from adding them on the taxonomy page, but I'm having trouble with the new post/edit post page. I ... | For these situations build your own metabox for the tax terms and use radio or select. My fork of Jared Atchison's Custom Meta Box class supports custom taxonomy metaboxes. After you get the metabox directory uploaded use this to create your meta box. <code> $prefix = 'xxx_'; //Add your own unique prefix. $meta_boxes =... | Prevent users from adding taxonomy terms | wordpress |
Hi to all I'm running a Wordpress MS installation and I would like to move a couple of heavy "sub" blogs on a different DB, will it encrease my performances? Actually I'm on a dedicated server with quadcore 2.5 Ghz, 6GB ram and a few nice stuff like Lightspeed eaccelerator and so on. I'm a "self made webmaster" so I ne... | WPMUdev has a Multi-DB plugin but you won't see any performance gains from splitting your database up unless you have a very high volume of sites with thousands of tables. From the plugin instructions: Step 1: Decide how many databases you want (16, 256, 4096) So, how do you know that this plugin is necessary for your ... | Split a database will improve performance? | wordpress |
I have been playing around with media queries quite a bit lately and I love the concept. It is so easy to display images or change div floats depending upon what the users screen max-width is. I'm trying to find a way of displaying a custom sidebar on my template Only if the users screen size is large enough to permit ... | On my website I load the recent comments per AJAX for window sizes above 480px: <code> if ( 480 < jQuery(window).width() ) { jQuery(document).ready( function() { jQuery.get('http://toscho.de/?rc', function(data) { jQuery(data).insertBefore('#inner'); } ); } ); jQuery('#posts').after('<div class=clear>&#160... | Best approach for loading a sidebar Only if the screen max-width is > 900px? | wordpress |
I have a gallery attached to a page. On that page, I'm running the following query: <code> $events_gallery = new WP_Query( // Start a new query for our videos array( 'post_parent' => $post->ID, // Get data from the current post 'post_type' => 'attachment', // Only bring back attachments 'post_mime_type' => ... | These are the query parameters i use...works for me when i loop through the results <code> array( 'post_parent' => $post->ID, 'post_status' => 'inherit', 'post_type'=> 'attachment', 'post_mime_type' => 'image/jpeg,image/gif,image/jpg,image/png' ); </code> | Broken? WP_Query and "attachment" as a post type | wordpress |
I have massive number of files in my uploads folder. Is there a way of identifying those which are not linked to any post? Note: some of those files are manually copied to uploads folder not via "media library" | The easiest way would probably be: 1) perform a WordPress XML export ( Dashboard -> Tools -> Export ) 2) import into a clean WordPress install ( Dashboard -> Tools -> Import ) At this point, everything in the <code> /uploads </code> directory of the clean install is attached. You can now: 3) backup/delete your original... | Garbage in uploads folder | wordpress |
I have serious trouble displaying code blocks in my theme. I want to display something like: <code> <something> <something-else> Content </something-else> </something> </code> And it works fine everywhere, but doing that inside code tag: <code> <code> <something> <something-else&g... | You either need to add such code via the HTML editor (and not switch back to the Visual editor), or else you will need to pass a custom configuration to the Visual editor. I have similar needs, and here's what I use (in <code> functions.php </code> ): <code> // http://tinymce.moxiecode.com/wiki.php/Configuration functi... | Formatting <code> ? | wordpress |
Does anyone have a function I can place in my <code> functions.php </code> that will remove this? I want to avoid altering the core files. It currently says "Both comments and trackbacks are currently closed." | for thematic, it's inside the 'content-extensions.php' just do a search with ctrl-f and just leave the field empty | function to remove 'comments and trackbacks are closed' | wordpress |
I'm interested in the theory of a user being able to register/upload a gravatar directly in their user account within a hosted WP system. Is this feasible? | If you are looking to connect your sites sign-up with Gravatar then you simply can't, since Gravatar don't have a sing-up api you can use. But if you are just looking to let your users upload there own photos the either Simple Local Avatars Plugin that Chip suggested or one I've used a lot before is User Photo will do ... | Upload gravatar in WP profile? | wordpress |
I have a custom post type that doesn't use the default title bar to define the post's title. Instead it is a series of taxonomies: artist, album and year. Right now my xml feed is displaying <code> <title>Auto Draft</title> </code> for each post type. What filter can I use to have these three taxonomies be ... | You can use <code> wp_insert_post_data </code> filter hook which is called by the wp_insert_post function prior to inserting into or updating the database. for example this will take the first term of each taxonomy and set them as the title: <code> function custom_post_type_title_filter( $data , $postarr ) { //check fo... | How to make custom post type feed title = taxonomies? | wordpress |
Looking at the code in feed-rss2.php and feeds-rss2-comments.php, after the header preamble, we have a Loop - eg in feeds-rss2-comments.php: <code> if ( have_comments() ) : while ( have_comments() ) : the_comment(); $comment_post = get_post($comment->comment_post_ID); get_post_custom($comment_post->ID); </code> W... | These files are not loaded directly, but similar to regular template files, only after the <code> WP </code> class is initialized. This class does the main query, which already can include the comments if the correct query variables are set. The execution flow is a follows, starting in the main <code> index.php </code>... | How / where is the wp_query object created for RSS feeds? | wordpress |
I created some posts using a custom post type, then I decided to delete this custom post type but of course the old posts remained orphan inside the database. How can I remove these orphan posts and all related attachment (post meta, etc.) safely from DB? | <code> DELETE a,b,c FROM wp_posts a LEFT JOIN wp_term_relationships b ON (a.ID=b.object_id) LEFT JOIN wp_postmeta c ON (a.ID=c.post_id) WHERE a.post_type='customposttype' </code> | How does one delete orphan custom post type? | wordpress |
I need an easy way to create a set of users who cannot interact with the other users, all they can do is administrate a group (they can upload documents to the group-documents plugin and maybe change the name and description and avatar). Apart from that they're not allowed to have a profile, they're not allowed to inte... | If you want them to be able to choose the type You'll need to write your own registration logic After that check via get_user_meta() to see if they have a certain permission if they can do xyz and allow accordingly. I've done custom user types before for a plugin i wrote. There's no build in roles in BP AFAIK but a lot... | Buddypress - New user type with no profile and can't interact but can be admin of a group | wordpress |
I really like the way Vanilla Forums is integrating with WordPress however I am wondering if it is possible to take it one step further? What i'd like to be able to do is to replace WordPress comments with a Vanilla Forum thread. That way, the conversation can continue and work more in the fashion of a forum thread, as... | Vanilla recently released an update to their WordPress plugin that enables the comments to be replaced with a Vanilla thread discussion. See here: http://vanillaforums.com/blog/news/introducing-vanilla-comments/ | Vanilla Forums as a replacement for WordPress comments? | wordpress |
Consolidating several blogs into a single multisite instance - we have 2 sets of blogs - active and archived. What's the best way of adding <code> /archive/ </code> to the URLs of the archived blogs? So, as an example: An active blog would be accessed via <code> www.domain.com/blogname </code> An archived blog would be... | In order to do partition your blogs like this you're going to need to write a custom plugin similar to the WordPress MU Domain Mapping plugin. Here's how your plugin needs to work. Create a <code> sunrise.php </code> file for your plugin, and properly <code> define('SUNRISE',true); </code> in your wp-config.php file. C... | Multisite - sub-subfolders for certain blogs | wordpress |
Should a breadcrumbs navigation have links set to rel="nofollow"? | I think it depends what your goal is and what the breadcrumbs represent. I would say that for most wordpress sites nofollow on breadcrumbs is probably a nonissue. Let's start with nofollow. Nofollow says you don't want a search engine to pass on page rank to this link. So if you had comment links and people can post th... | breadcrumbs & rel="nofollow" | wordpress |
My plugin code is below. In the myPlugin_cleanup() function, I'm creating some categories and assigning term id 1 as the parent. Due to the known bug with creating categories via script (the category_children array does not get created and results in a fatal error when pages containing category listings are accessed), ... | After creating about 40 test WP installs today on localhost, here's what I can report: It appears that the correct function call to rebuild the category_children options is: <code> _get_term_hierarchy('category') </code> Previously, I was trying to call: <code> clean_term_cache('','category') </code> And I was calling ... | Calling clean_term_cache() fails when called in the same plugin that creates terms, succeeds when called separately? | wordpress |
I have a structured Custom Menu: parent 1 children1_1 children1_2 parent 2 children2_1 children2_2 parent 3 parent 4 children4_1 etc. I want the following: on every page, the parent level items will be shown as main menu. If a parent level item is active, I want to show the child menu items as a separate list somewhere... | This plugin do exactly what you want! http://wordpress.org/extend/plugins/rv-submenus/ | List WordPress Custom Menu's active parent level's children as separate menu | wordpress |
Can one plugin activate another plugin via script? I know its possible to stackexchange-url ("deactivate known plugins via script"), but can't find any examples of how to activate them. | Take a look at <code> function activate_plugin( $plugin, $redirect = '', $network_wide = false, $silent = false ); </code> in wp-admin/includes/plugin.php | Can one plugin activate another plugin via script? | wordpress |
I have a site where pages will often move from draft to published and then to legacy. I would like to create another status type similar to draft or published titled "legacy". Wherein the page exists but is indicated as no longer active on the site. Is anyone aware of a Plugin or way to hack this feature? | take a look at Edit Flow plugin which offers a suite of functionality to redefine your editorial workflow within WordPress. Features include Custom Statuses | Additional page and post status types | wordpress |
Im trying to display user login instead of user full name below each post avatar. Im using the following hook: <code> function my_member_username_link() { global $post; if (isset($post->post_author)) { $user_info = get_userdata($post->post_author); return '<a href="/' . $user_info->user_login . '/" title="'... | The reason it's not working in the sidebar is likely because the sidebar content is outside the Loop, and <code> $post </code> data, and thus, <code> $post->post_author </code> , are only available inside the Loop. You could try setting a variable equal to <code> $post->post_author </code> while still inside the ... | BuddyPress - User Login instead of Full Name | wordpress |
If I want to apply a style to only an item in a menu that has a submenu, how can I select that with CSS? | You could use jQuery, if you're open to a jQuery solution? <code> <script type="text/javascript"> jQuery(document).ready( function($) { $('#your_menu_id li').has('ul').addClass('has_children'); }); </script> </code> Slight modification of what i posted stackexchange-url ("here") basically. Any menu item wit... | Custom CSS class or ID on menu items that have a Submenu | wordpress |
I need to create a feed (RSS or Atom) of posts and comments that have been deleted (ie moved to Trash). What's the best way of doing this? Right now I'm thinking about creating 2 pages templates containing a SQL / $wpdb query that returns posts and comments with trashed status (and then creating new pages eg deletedpos... | Well if you want a feed it would be logical to create a feed, rather than emulate it with page. <code> add_feed() </code> ( source ) and your queries+output in callback. | RSS feed for deleted posts and comments | wordpress |
I'm using Get Posts plugin to list posts with post type "project". I want to filter the list by two custom fields: year (ex. 2006) and state (ex. Completed). I added <code> meta_query </code> to the plugin's <code> get_post </code> args and tried the shortcode: <code> [get_posts post_type="project" meta_query="array(ar... | Besides the plugin not being updated, this will not work because the meta_query arg is evaluated as a string: <code> array(3) { ["post_type"] => string(7) "project" ["meta_query"] => string(96) "array(array('key' => 'state', 'value' => 'Completed'),array('key' => 'year','value' => '2006'))" ["suppress... | Get Posts shortcode plugin and meta_query? | wordpress |
Whats the difference between <code> current_page_item </code> and <code> current-menu-item </code> when using Custom Menus <code> .current_page_item{} // Class for Current Page .current-cat{} // Class for Current Category .current-menu-item{} // Class for any other current Menu Item .menu-item-type-taxonomy{} // Class ... | current_menu_item is the active element in the menu, independent from the type (page, archives, post, etc.) of the current menu element, while current_page_item only available, if the current item is a page and is current. For more details: http://codex.wordpress.org/Dynamic_Menu_Highlighting | Whats the difference between current_page_item and current-menu-item | wordpress |
I added a custom button to the TinyMCE editor, and I want to open WP's Thickbox when I click on it. How can I make it so that the <code> tb_show() </code> function loads the content I want with ajax? <code> // the ajax add_action('wp_ajax_getTheContent', 'getTheContent'); function getTheContent(){ echo 'weqwtegeqgr'; /... | The second parameter for <code> tb_show </code> is the URL, so you'll want to use something like.. <code> <?php $ajax_url = add_query_arg( array( 'action' => 'getTheContent', 'query_var1' => 'value1', 'query_var2' => 'value2' ), admin_url( 'admin-ajax.php' ) ); ?> tb_show(tag, <?php echo $ajax_url; ?&... | Open a Thickbox with content trough AJAX | wordpress |
I'm working on a plugin, which converts a site into a feedback sort of portal. I made a new object page, 'Feedbacks', which displays all the feedbacks is a tabular format, and I'm using <code> register_column_headers($array_of_column_headers) </code> to make my table. I wanted to know if it is possible to add my own pa... | When using custom post type you use the <code> post_row_actions </code> filter hook and check the post type to modify it only: <code> add_filter('post_row_actions','my_action_row', 10, 2); function my_action_row($actions, $post){ //check for your post type if ($post->post_type =="feedbacks"){ /*do you stuff here you... | Row actions for custom post types? | wordpress |
How do I show 10 posts on the first page of the archive, and 20 on others (> 1)? My custom post type name is "apartments". Cheers! | You can change the <code> posts_per_page </code> variable depending on the page you are on, so make it 10 on the first page and 20 on the other pages. However, you will have to offset </code> query variable too , otherwise you will skip posts 11-20 on the second page, because this page thinks they are already displayed... | Number of posts in the archive | wordpress |
Is it possible to use the "Insert/edit link" dialog box outside of TinyMCE? For example, if I wanted to add that dialog box to a generic button within a plugin settings form, is it possible to include just the portion of the TinyMCE that is required to make it work? | this was asked before, but sadly the "Insert/edit link" (with interlinking) was developed as a tinymce plugin so using it outside of tinymce is not really possible unless your write the whole thing from scratch. | Utilize TinyMCE hyperlink chooser outside of TinyMCE | wordpress |
My site requires the use of https for all img src HTML. This is the WordPress function I'm using to display images: <code> <img src="'.get_bloginfo("template_url").'/images/thumb-default.gif" /> </code> This outputs an http img src - how can I convert that to https? | WordPress checks the return value of <code> is_ssl() </code> before creating URLs using <code> get_bloginfo() </code> . If the function returns true, it creates https URLs. If it returns false, it creates http URLs. From the WordPress source ... <code> function is_ssl() { if ( isset($_SERVER['HTTPS']) ) { if ( 'on' == ... | Use https for img src | wordpress |
I've isolated the source of a fatal error that's been occurring when a brand new site is previewed just after installing and activating the plugin I'm working on. The problem appears to be that the "category_children" item in the options table is not being created. Interestingly, it appears that two actions trigger WP ... | This is a known (and nasty) bug in the taxonomy hierarchy caching code: http://core.trac.wordpress.org/ticket/14485 Basically, you have to force a refresh by deleting the option. | Missing "category_children" option when dynamically creating categories via a plugin | wordpress |
My issue is prety much what the title indicates. Whenever I publish a new post, everything works fine - the post is listed in my WP dashboard and all looks good. However, if I try to 'view post' to view it live on my website, I've searched for this issue throughout the net, and all point into editing the .htaccess file... | I just ran into something similar to this. It had to do with refreshing permalinks. If you go to Settings -> Permalink and just click save see if it fixes your problem. It did for me. In the end I added the following to my functions.php file which updated the permalinks for me. I was using custom post types. Maybe you ... | 404 error after publishing a post | wordpress |
I have a page "Portfolio", it contains a loop that outputs the list of portfolio (Custom Post Type, is this the problem? ) items using <code> page-portfolio.php </code> . Problem is somehow WordPress used the <code> archive.php </code> to render my portfolio page, why is that? | An archive of a custom post type is displayed using <code> archive-[posttype].php </code> or <code> archive.php </code> if the first does not exist (see the Template Hierarchy for the full details). <code> page-[posttype].php </code> is only used if you create a "dummy" page to show a custom post type archive (before W... | Why is archive.php used for my page | wordpress |
What i'm trying to achieve is bringing a loop from one WP site into another WP Site. I used this method to get the loop into an external php file (which all works fine, the results show) <code> <?php define('WP_USE_THEMES', false); require('path_on_server/wp-blog-header.php'); query_posts('showposts=5'); ?> <?... | If you want to grab info right off the page you should use one of these options if you don't want a plugin, the content can be returned and parsed as xml, rss, json or just html/text. This is the proper way to do this. WordPress HTTP API: http://codex.wordpress.org/HTTP_API or <code> fetch_feed() </code> ( for rss only... | Loop from another WP site onto mine | wordpress |
I am trying to reload the fresh posts using jQuery. As far as I know, I can't reload the contents of a div inside the page so I reload a file into that div. The problem is that my loaded file gives me a Fatal error: Call to undefined function wp_query() How can I implement functions to a newly created file inside the t... | The reason for this error is that your loading the file without loading in the WordPress system and so wp_query() doesnt exist. Quick fix is to: <code> include("../../../wp-load.php"); </code> <-- guessing at the location of the wordpress file. at the top of the php file. | Can't access WordPress functions in file called via Ajax? | wordpress |
I'm trying to create a custom RSS feed template for a site my company manages, and I've encountered a very confusing bug I'd like some input on. First off, as background context, after a lot of Googling, this is the method I've chosen to create the RSS template. (If there's a better approach, I'm all ears): Copy /wp-in... | First off, as background context, after a lot of Googling, this is the method I've chosen to create the RSS template. (If there's a better approach, I'm all ears): Second time this comes up today. :) You should use <code> add_feed() </code> ( source ) rather emulate this stuff with page. As for issue you describe I am ... | Bizarre issue with custom RSS template | wordpress |
I have a plugin filter that isn't working for me: <code> add_filter( 'gform_notification_email_3', 'route_notification', 10, 2 ); function route_notification($email_to, $entry) { global $post; $email_to = get_the_author_email(); return $email_to; } </code> I think the $email_to variable isn't being set properly, but ho... | Like usual. :) Works most of the time unless it ends up in some place that is not echoed to the screen by browser. <code> echo $email_to; </code> And for debug it is more informational to use <code> var_dump() </code> . Personally I usually use this to quickly add/remove dump to filter: <code> add_filter('filter','dump... | What's the best way to echo out a filter variable? | wordpress |
I've bee experimenting with a site I'm working on. My client wants the header with its nav and logo intact, so visitors always have the ability to access the navbar while scrolling to read the page content. I have added <code> fixed </code> to my wrapper <code> div </code> and that keeps the background static, but in t... | Alright, what you'll need to do here is separate the header into it's own wrapper. What I did to get this to work is to close the #wrapper div right after you close the #header div and start a new div with the same class hfeed and a new ID other than wrapper. Should look like this: <code> <div class="hfeed" id="wrap... | How to create a fixed header and scrolling content area | wordpress |
I find that if I use <code> class widget_name extends WP_Widget { function __construct() { ... } } </code> instead of <code> class widget_name extends WP_Widget { function widget_name() { ... } } </code> I get an error like <code> Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 523800 b... | Because <code> widget_name::__construct() </code> calls <code> WP_Widget::WP_Widget() </code> , which in turn calls <code> widget_name::__construct() </code> etc. A simple solution would be to make <code> widget_name::__construct() </code> call <code> WP_Widget::__construct() </code> directly. Also see http://core.trac... | Why will using __construct instead of widget_class_name when creating widget trigger out of memory error | wordpress |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.