question stringlengths 0 34.8k | answer stringlengths 0 28.3k | title stringlengths 7 150 | forum_tag stringclasses 12
values |
|---|---|---|---|
Edit: Found that the theme options panel set up (using a class) was causing the problem. Still not sure why - would still love know how to find out what the problem is - e.g. is it a JS or PHP issue. Going to try a different method of creating the theme options panel to see if it fixes the problem. I am able to add ext... | You should read this: http://codex.wordpress.org/TinyMCE_Custom_Buttons It's pretty straightforward if you already know how to program a TinyMCE plugin (which it sounds like you do). | How can I troubleshoot why TinyMCE won't load custom plugins in the visual editor? | wordpress |
I have been working on using featured image to create a list of items on the right column here: http://www.julianamaeberger.com/soma/news/ The current featured image is now being given a class of "highlighted" so that you can tell which image is related to the post. I now need to move that li class="highlighted" to the... | Can't you do this in HTML? So instead of printing everything in your loop, append it to a string that you print in the end. That way you can keep special stuff apart. I assume this is a follow-up question to your previous question about featured images, so I will use stackexchange-url ("the code from my answer there") ... | How to move featured image to the top of the list? | wordpress |
I am registering sidebars automatically for each category (a separate widget space per category). The technique I'm using is here . In the admin side I have an options page where I need to display a dropdown of all registered sidebars... Is there are way to dynamically get this list of registered sidebars? since they'r... | Hmm... I'm not sure if this is the best way to do it but it's simple: I looked in register_sidebar() and found that new sidebars are simply tacked onto an array: $wp_registered_sidebars And I guess that's that. If they ever change the name of the variable, I guess I'd be screwed. | Get list of all registered sidebars | wordpress |
So I have a custom type called "vendors" and two custom taxonomies for it. One is "state" and the other is "type". I am trying to list all the vendors from a certain state on one page. I'm using the file called "taxonomy-state.php" which works perfectly. It displays all the vendors in the state. Now what I want to do i... | Hopefully someone else will flesh out this answer, I don't have the time to write out a full solution right now... If you're using WordPress 3.1, look at the <code> tax_query </code> parameter that you can pass to <code> query_posts </code> . It can handle multiple taxonomies and relationships between them. Otto's post... | Query posts with double taxonomy | wordpress |
Is there a way to use regular categories with custom post types? It seems like there is better functionality and options with regular categories (such as permalink options, etc.). | No problem, the categories and tags are also registered as taxonomies that you can pass to the <code> taxonomies </code> argument when you call <code> register_post_type() </code> . Categories are <code> category </code> and tags are <code> post_tag </code> . You can also do this later with <code> register_taxonomy_for... | Is there a way to use regular categories with custom post types? | wordpress |
If I'm using a custom post type for a Movie or a TV show episode, I may use a taxonomy for "actors" and assign all the actors related to the work to it, but I'm not sure how, besides of that, I can also add the character the actor is playing in said work . The characters themselves may or may be not a taxonomy, as some... | You could simply use the "pods"-plugin (for WordPress) from Matt Gibs and Scott Kingsley Clark. It's exactly what you searching for. Take a look at the doku and look specificaly at "pick columns". Aside from that it has a nice and ajax driven interface and builds it's database tables next to wordpress and doesn't make ... | Add additional data to a specific taxonomy term when used in a post | wordpress |
<code> <?php $recent = new WP_Query(); ?> <?php $recent->query('cat=1&showposts=2'); ?> </code> With what can i replace cat=1 to show posts from all the categories? | You should be able to remove that category from the query so you would have <code> <?php $recent->query('showposts=2'); ?> </code> you can also take a look at completely custom queries here . ` | How can i show all categories using wp query? | wordpress |
For a project I'm working on, I want to change the labels of the 'Nickname' and 'Biographical Info' fields on edit profile (user-edit.php) page in the dashboard. I still want to use those fields as they are, I only want to change the labels. Anyone know of a function that can do this? | Every string goes through <code> translate() </code> , which uses the <code> gettext </code> filter. This mean you can try something like this: <code> add_filter( 'gettext', 'wpse6096_gettext', 10, 2 ); function wpse6096_gettext( $translation, $original ) { if ( 'Nickname' == $original ) { return 'Funny name'; } if ( '... | Change labels on 'Nickname' and 'Biographical Info' in user-edit.php | wordpress |
Basically, I'd like to create a category permalink like example.com/books/adventure without having to make adventure a child-category because it will apply to other categories as well. So the end result is: example.com/books/adventure example.com/movies/adventure example.com/toys/adventure The order is based on the two... | David, welcome to wordpress answers. The answer is: Switch to some other platform. Wordpress can not with what's currently in core produce such a result easily. Technically spoken it's possible, but folks hate me here to say how (well Apache + PHP) in concrete, so I don't tell it because I fear the negative karma this ... | How can I create a permalink with two categories, with the order based on the parent category? | wordpress |
is it possible to bring custom taxonomies to permalink? currently my permalink is looking something like this <code> /%postname%/%category% </code> but i also want to add custom taxonomies to my permalink so it should look something like this <code> /%postname%/%category%/%location%/%mba_courses% </code> is this possib... | What you're looking for is a 301 redirect. I use two plugins to catch do this. One notify's me of 404 errors ( http://wordpress.org/extend/plugins/404-notifier/ ) and the other makes writing the 301 redirects easy ( http://wordpress.org/extend/plugins/simple-301-redirects/ ). You could also write the 301 redirects in y... | custom taxonomies on permalink | wordpress |
I am new to WordPress, and I need to make some quick changes. How can I find the Page that is referenced by a permalink: e.g. for www.example.com/mypermalink how can I locate the actual WP Page so I can find it either in the file system or in the WP Pages list? | Addressing both your original question and the question implied by your comment ... Finding the page ID Every post and page within WordPress is given an ID. By default, WordPress uses the ID in the link structure: http://www.example.com/?page=ID or http://www.example.com/?p=ID (for posts). You can change this to a more... | How can I reverse engineer a Permalink to Find the Page? | wordpress |
I'm having a bit of a brain fart on this one. I'm working on some code that resembles a custom search form. The custom search form, is a mixture of checkboxes as well as some drop downs. All of the fields which are being searched for are also custom fields. The custom fields were entered through a custom write panel. S... | This doesn't seem especially complex, but does seem bulky and prone to errors. As I answered couple of times on similar issues - if this isn't time critical then wait for WP 3.1 because it will have major improvements for querying by custom fields. See Advanced Metadata Queries for brief writeup on upcoming improvement... | Custom Search, MySql Query Gone Wrong? | wordpress |
I'm currently working on a website that has a static frontpage and couple of pages that is going to contain portfolio and things alike on the other pages. The thing I want to do is to hardcode content on the frontpage in css and xhtml. Is this possible and where do I do this? I thought it should be done in index.php in... | I would set up a new page template (see http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates ), create a new page (Pages > New) and set it to use that template, and then set WordPress to use that page as the homepage (Settings > Reading). Then you can fill the custom page template with whatever content you... | how to setup content on a static frontpage with css and xhtml | wordpress |
I made a custom post type and a custom taxonomy, but I have a problem. When I access the url <code> http://www.ithemes.co.kr/?shopcat=galaxy-s </code> , it works well. But when I access the url <code> http://www.ithemes.co.kr/?shopcat=5 </code> , it returns a 404 page. <code> galaxy-s </code> is the taxonomy term slug,... | This is not supported by default, but you can convert the numeric terms back to slugs with the <code> pre_get_posts </code> hook. I tested this with WP 3.0.1, but in 3.1 the taxonomy query handling changed, so I don't know whether this will work by default or if there is a better way to do it. <code> add_action( 'pre_g... | Query custom taxonomy by term id? | wordpress |
I'll try to make this as clear as possible. I'm am trying to figure out a few things to clean up the permalinks on a large website project. We're using custom post types and ~200+ custom categories (we chose this because you can really add a lot of custom field spaces and data easily with the new custom post types). We... | There is no such thing as a "dual category permalink" in wordpress, so you might be looking for custom rewrite rules (Wordpress.org Forums) and let deal your own code with the URL design as you need it then. | Remove slug from Custom Category Permalink + dual-category permalinks | wordpress |
I am starting a new wordpress blog, and no longer updating an old one. The old one still gets 400-500 hits a day, so I would like to keep it up for archival purposes, as people still link to its posts. Obviously there is the problem that wordpress and plugins will be updated, and I have no desire to maintain it. How ca... | With a dynamic CMS like WordPress, there is no real way to "lock it down." As the web evolves, formerly unknown security holes are discovered and patched in new versions. In reality, unless you're always running the latest version of WordPress (currently 3.0.4), your site is in some way vulnerable. If you don't intend ... | How can I lock down an old wordpress install I don't intend to update? | wordpress |
I want to write a simple plugin. For every time a page is viewed, it will write to the MySQL database. Then, if the current hour is odd, it will set a PHP variable of $is_odd to true; <code> <?php require_once('library-of-functions-to-support-this-plugin.php'); function_to_write_to_mysql_db(); $is_odd = false; if(cu... | You could attach the to wp_head action http://codex.wordpress.org/Plugin_API/Action_Reference/wp_head | What filters to call to modify the output of the entire page? | wordpress |
I think there used to be an out-dated plugin to do this. Is there any way to do this easily with just a little code? We prefer not to rely on a plugin since that makes us dependent on the developer to keep it up-to-date. We only have two parent categories we would like to remove for all of their child-category permalin... | This code pretty much does the job for this question and another one about removing the /category/ base from the permalinks. Got it from a plugin that does this, and decided to just use the raw code. So the permalinks only have the lowest child-category listed. First, we had: example.com/category/items/books/ and now..... | Remove parent category from permalink? Basically only have the child category? | wordpress |
We've seen plugins to do this, and a lot of people with different code modifications. We really would like to achieve this the cleanest and simplest way possible, without worrying about out-dated plugins or causing problems with too many mods. | Not sure how clean or easy this is, but it seems to work. This code pretty much does the job for this question and another one about removing the parent category from the permalinks. Got it from a plugin that does this, and decided to just use the raw code. So the permalinks only have the lowest child-category listed. ... | Best and Cleanest way to remove /category/ from category permalinks? | wordpress |
I have a few custom thumbnail sizes and obviously one of them is used in the set_post_thumbnail_size, what directly affects the interface in the admin area. What I'm looking to do is to intercept which admin page (for post-type) I'm in and set a different size in the above function, so basically I'd like to have that: ... | Simpler way to figure out the post type of the item (which you are editing) and uploading media to: <code> $type = get_post_type($_REQUEST['post_id']); </code> As has been noted, the media upload iframe that is shown in the lightbox overlay when you try to upload something doesn't indicate the parent post that new uplo... | change set_post_thumbnail_size according to post type admin page | wordpress |
I am using a WordPress plugin called MyReview but I want some changes to it. That plugin has feature to review posts, where users will come and give star ratings to the post according to categories, but in that plugin a user can give star rating to a post to as many times as the user wants, which I dont want, what I wa... | Hi @ntechi: I think this is what you are looking for: <code> $sql =<<< SQL SELECT id FROM myrp_ratings AS rat, INNER JOIN wp_comments AS com ON com.comment_ID = rat.comment_id WHERE 1=1 AND com.comment_author_email = '%s' AND rat.value != '0' AND rat.value != '1' LIMIT 1 SQL; $sql = $wpdb->prepare($sql,'wha... | MySql database help for a plugin | wordpress |
Say I link to http://www.glumbo.com on one of my posts. I want wordpress to automatically change the anchor text of the link to glumbo.com's title. How can I do this? | Decided to entertain the idea. Adapted from my snippet that changes anchors to collapsed domain names. Little too verbose, but seems to work. <code> add_filter( 'the_content', 'anchors_to_page_titles' ); function anchors_to_page_titles( $content ) { preg_match_all( '/<a.*?href="(.*?)".*?>(.*?)<\/a>/', $cont... | Plugin to automatically change anchor text of urls to the destinations title? | wordpress |
I only want a post to be viewable by the administrator and one user. (So I would have a post for each user) I am thinking of using the Members plugin and meta-data/custom fields to restrict the content. This would effectively make the post private to only those with access and any one else would not even see the post a... | I am not expert on users, simplest way as for me would be to store ID (or IDs) of user in custom field and check for it if user is not admin. Some example code (not tested): <code> if(current_user_can('administrator') || in_array(get_current_user_id(), get_post_meta(get_the_id(), 'allowed_users', true))) { the_content(... | Restrict post to user_id | wordpress |
Somehow the WordPress editor doesn't have a button to insert a horizontal line ( <code> <hr /> </code> in html). Is there a plugin that adds this button? Or an easy way to add such a button myself? | There's an easy way. Open functions.php and add this code. It works for many html entities <code> // got this form http://www.sycha.com/wordpress-add-hr-button-tinymce-visual-editor function enable_more_buttons($buttons) { $buttons[] = 'hr'; /* Repeat with any other buttons you want to add, e.g. $buttons[] = 'fontselec... | Get a button for in the Editor | wordpress |
From what I can tell the widget API is pretty straight forward and simple, yet for some reason my update code isn't taking effect properly. When I press [save] from the backend all fields are blanked, and nothing is actually saved. When I drag my widget onto the sidebar region, an entry is created in the database for t... | You're using <code> get_field_id() </code> for the name attribute of the form elements, but you should use <code> get_field_name() </code> . The field names are of the form <code> widget-{$id_base}[{$number}][{$field_name}] </code> , but id's can't use <code> [] </code> , so they are like <code> widget-{$id_base}-{$num... | Widget Update Code Not Working | wordpress |
As a proof of concept, I'd like to create a simple plugin that loads some content, say "hello world" just after the_content on the home page only. How can I do this from a plugin? | You mean a filter and a check for <code> is_home() </code> ? <code> add_filter( 'the_content', 'wpse6034_the_content' ); function wpse6034_the_content( $content ) { if ( is_home() ) { $content .= '<p>Hello World!</p>'; } return $content; } </code> | How can I add/append content to the_content on the home page via a plugin? | wordpress |
The code below creates a plugin that appends the contents of $content to "the_content" on the hompage. It works fine when I set $content to a static value. However, I'm trying to set it to draw out the site's active categories as a list. However, nothing happens when I set $content to wp_list_categories() Ultimately, I... | Hi @Scott B: Your example doesn't work for me when I use <code> if (is_home()) </code> but does when I use <code> if (is_front_page()) </code> . Is there any chance that is the problem? Other than that it seems to work fine on my WordPress v3.0.3 install. Do you have other plugins that might be disabling the output of ... | List categories with descriptions via plugin | wordpress |
i recently found that a login url filter is available but i can't find a solution for the forgot password as well, for the login url i use this: <code> function custom_login_url($login_url) { return ''.get_option('siteurl'). '/login'; } add_filter('login_url','custom_login_url'); </code> is it possible to do the same f... | Yes it's also possible for the password, by running a filter on <code> lostpassword_url </code> , which is basically the password equivalent of the login url.. Example Basically the same as before, just changed the function and hook names. <code> add_filter( 'lostpassword_url', 'custom_lostpass_url' ); function custom_... | Is it possible to use a forgot password url filter? | wordpress |
I am trying to add a form where users can submit post from front-end. I am Following this tutorial: http:// wpshout.com/wordpress-submit-posts-from-frontend/ What I am doing is adding this code to one of my page-template. The form shows up alright but when I click on the submit button it gives me " Page not found error... | <code> <?php $postTitle = $_POST['post_title']; $post = $_POST['post']; $submit = $_POST['submit']; if(isset($submit)){ global $user_ID; $new_post = array( 'post_title' => $postTitle, 'post_content' => $post, 'post_status' => 'publish', 'post_date' => date('Y-m-d H:i:s'), 'post_author' => $user_ID, 'p... | Front-End Post Submission | wordpress |
I'm trying to create sub-posts like this: /post/info/ /post2/info/ Using wp_insert_post() and I have almost succeeded. I'm setting post_parent to the parent post ID and the post_type needs to be "attachment". But! The problem is that the post_name needs to be unique so the sub page needs to be info, info2 etc and that'... | Hi @jonasl: I asked a clarifying question but I'm going to go ahead and at least start to answer. The function in WordPress core that controls post slugs and adds numbers to them in order to force them to be unique is <code> wp_unique_post_slug() </code> . In WordPress 3.0.3 you can find it on line 2530 in <code> /wp-i... | Sub posts and non unique post_name | wordpress |
wp_list_pages seems to print out menus ok, but is there a way to alter the functionality so that i can display the menu in two colors..? So, if the titles of 3 actual pages are: <code> Big Cinema * Monaco Theatre * San Franciso Sport * Berlin </code> (each page really has two titles, the asterisk used to separate them.... | Hi @cannyboy: Unless I misunderstand, I think what you need is to use <code> 'the_title' </code> filter. If you simplly enter "Title 1 * Title2" into your title field, this code I've written for this hook should wrap your Title2 in a <code> <span class="title2"> </code> which will allow you to style it with CSS. ... | Two-tone menu items | wordpress |
I have my wordpress blog in the root of my website (example.org) and would like to store uploaded files in a subdomain depending on type of file, for example I currently have static.example.org/images, static.example.org/video and static.example.org/audio and was trying to find a way to put uploaded files in the subdom... | Try changing the upload path by referring to following tutorial, then use the plugin again. http://7php.com/how-to-change-the-path-of-uploading-file-in-wordpress-2-8-x-2-9-x-without-touching-the-code-configurations/ | inserting uploads into subdomain | wordpress |
I've been going round and round with this so I hope someone can help! I've setup about 10 websites, all on Wordpress, for friends. At the moment, each of these sites are on separate wordpress installs. What i'd like to do is get to the stage where I have 1 install that can accomodate the 10 sites, but each site can't s... | Option 2 should work, I just wrote http://wp.leau.co/2010/12/24/moving-a-weblog-to-a-wp3-multisite-weblog-system-on-mediatemple/ themes: you should NOT network activate all themes, only activate them on a specific site via the site settings for a blog plugins: disable the setting in the network admin to display plugin ... | Multiple sites with independent users | wordpress |
I'm using the manage_users_columns to display a custom field I create in the usermeta database called company. My code is as follows: <code> function mysite_column_company( $defaults ) { $defaults['mysite-usercolumn-company'] = __('Company', 'user-column'); return $defaults; } function mysite_custom_column_company($val... | hummm... do you mean something like this : <code> function mysite_column_company( $defaults ) { $defaults['mysite-usercolumn-company'] = __('Company', 'user-column'); $defaults['mysite-usercolumn-otherfield1'] = __('Other field 1', 'user-column'); $defaults['mysite-usercolumn-otherfield2'] = __('Other field 2', 'user-c... | How to display multiple custom columns in the wp-admin users.php? | wordpress |
I am building a mobile friendly plugin and put the theme directory inside the plugin directory. If it's a mobile browser, how can I redirect to the theme in the plugin directory? <code> /wp-content/plugins/mobview/theme/ </code> I've managed to use the following redirection: <code> wp_redirect( plugins_url('/mobview/th... | Hi @Hamza: I think what you are looking to do is for your plugin to hook <code> 'template_include' </code> to tell it to load a file from your plugin directory. Here's starter code for your plugin: <code> <?php /* Plugin Name: Mobile View Plugin */ if (is_mobile_user()) // YOU NEED TO DEFINE THIS FUNCTION class Mobi... | Using a Theme inside a Plugin directory | wordpress |
I'm building a Wordpress Plugin and it has two tables and some data. Right now, for displaying and changing the data, I'm using the wpdb function and manually creating the user interface (mimicking the Default one). However, I see that other plugins have a more consistent style with their tables and the same features (... | check this out, I believe this might be what you're looking for. it helped me a lot. | Creating a custom Admin panel | wordpress |
I've just moved to another theme, and it uses the custom field <code> bigimage </code> for associating an image with a post, instead of using WordPress's post thumbnails. How do I copy the URLs of all existing post-thumnails to their corresponding post's <code> bigimage </code> custom field? Could we possibly write a b... | I wouldn't bother doing that. I'd just find the places in your theme files that call the custom field (probably something like "echo get_post_meta('bigimage')" or something) and replace those with a the_post_thumbnail() tag. This saves you the trouble of messing with the data, and it makes administration much, much sim... | Copying post thumbnail to custom field | wordpress |
I really need a comprehensive solution to this, so I'm offering up almost a quarter of my rep in bounty :) I would like to have a plugin that creates a custom category listing on my home page. To do this, I'd like the "Category Edit" screen to be augmented with some additional functions as described below... Adds "Uplo... | Here's how to add fields and save the values on the category edit screen as well as a method of adding an image upload field. Adding fields to category edit screen To start we need to get some code showing up on the category edit screen. <code> add_action( 'edit_category_form_fields', 'my_category_custom_fields' ); add... | Category listing with thumbnail and description on home page | wordpress |
I am currently a CS student and an aspiring programmer/web developer. I am wondering whether it is worth taking the time to master html and css to make websites when CMS services/wysiwyg like wordpress and various others seem to be becoming more and more functional. Does anyone think these publishing services might eve... | I think your question conflates design and development , though they're not even close to the same thing. Sites are rarely "designed from code"...they're designed in Photoshop by designers and translated into code by developers (of course, there are exceptions to this, but it's usually the case). But I'll assume you're... | raw code vs wordpress | wordpress |
I know that there is a way to crosspost from WP to Blogger but I am curious if there is a way to essentially mirror WP blog on Blogger completely, in other words crosspost both posts and comments? | Hi @Alex: Your client wants to mirror on Blogger this "In case WordPress fails?!?" OMG!!!! Do they not understand how WordPress works? Set him up a second WordPress site on a different web host or on WordPress.com! Don't put up with Blogger. A simple solution would be to use Windows Live Writer or Qumana to write the p... | Crossposting from WP to Blogger with comments | wordpress |
I'm planing to create a plugin called Goodbye Dolly. Once installed, it will take care for the installation to remove the auto-installing Hello Dolly (Wordpress Plugin) shipping with wordpress. This is due to popular request. Some folks have asked for it. I like the idea. I never cared so far because I removed it manua... | While I appreciate the idea, isn't this just replacing one plugin with another? Rarst's link already has the answer -- it just needs to be reworked a bit to check for the plugin periodically, like so: <code> function goodbye_dolly() { if (file_exists(WP_PLUGIN_DIR.'/hello.php')) { require_once(ABSPATH.'wp-admin/include... | How to delete the Hello Dolly plugin automatically? | wordpress |
i asked this on SO but got no where. i will try asking here. this works fine in category.php <code> <?php echo category_description(the_category_id()); ?> </code> but it does not work in single.php, just the category id shows up not the description. any ideas, how to get this done? thanks in advance Edit: in cate... | Hi @andrewk - Try the code that follows the screenshot: <code> <?php $categories = get_the_category(); foreach($categories as $key => $category) { $url = get_term_link((int)$category->term_id,'category'); $categories[$key] = "<dt><a href=\"{$url}\">{$category->name}</a></dt>" . "<... | echo category description in single.php | wordpress |
I'd like to add a page that does not appear anywhere on the site (especially not in the header or wherever your pages are listed) unless the URL is typed in directly. Additionally, the page/post should be password-protected. I know how to add a password, but I found no way to remove the page from being listed. | Hi @mafutrct: There are a lot of ways to do this; picking one is actually the challenge! I'm going to suggest a few options and let you explore (the ones at the top look most promising) : Page Protection Plugin Password Protect enhancement Plugin Better Protected Pages Simply Exclude Plugin ( Article ) Hide Pages Plugi... | Is there a way to create invisible pages? | wordpress |
I've been trying to figure out why we have the constants <code> BLOG_ID_CURRENT_SITE </code> and <code> SITE_ID_CURRENT_SITE </code> (vs. hardcoding them to be equal to <code> 1 </code> ) , what exactly the differences are, and when either of them will not equal 1? Any insight will be appreciated. Thanks in advance. | I addressed a similar question on StackOverflow stackexchange-url ("last month"). In MultiSite, "blog" is a reference to an individual website. "Site" is a reference to a network of "blogs." In the future, there's the likelihood that WordPress will be able to power multiple networks ("site"s) in addition to its current... | BLOG_ID_CURRENT_SITE vs. SITE_ID_CURRENT_SITE in WordPress Multisite? | wordpress |
I'm following this to make my plugin auto-create a table when the plugin is activated, but what happens is that while all the tables (the whole db) are utf8_general_ci, the newly created table is latin1_swedish_ci... Why isn't it also utf8? I thought it would also be utf8 by default since I have: <code> define('DB_COLL... | You're missing the point that there is collation not only for the DB but as well for tables and even fields. Therefore from your point of view, I assume that your CREATE TABLE statement is "not complete". Before using SQL statements, please learn the language first. See <code> CREATE TABLE </code> Syntax (MySQL Manual)... | Default table collation on plugin activation? | wordpress |
how are you ? I have in my site (post_type called = books).. I need to make some users for example (Library) to create a books (post_type = books) .. this is the code to add rols (called = library) .. <code> $library = add_role('library', 'library', array( 'read' => true, 'edit_posts' => true, 'delete_posts' =>... | You can add your own capabilities for custom post types. The default behvaiour for a post type is to inherit capabilities from the default post post-type. See the capabilities parameter in register_post_type (Wordpress Codex) , that has more information about how that can be done. | using add_role function to make some users to create a selected type post | wordpress |
For example, I want to use add_menu_page() function to add a menu item to the dashboard. To control which users will be able to access it, I'm supposed to use capabilities... <code> <?php add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position ); ?> </code> So, if I want ... | In case someone needs a sollution - I just put <code> 'publish_posts' </code> as $capability parameter and it works as I thought it would - it gives you all the capabilitis that are below the one used (below publish_posts in my case)... | How to determine which capability to use? | wordpress |
Say a theme "foo" is used on across a network of sites. In each site, all the theme resources ( <code> .css </code> , <code> .js </code> , etc.) will have distinct URLs: http://network/siteA/wp-content/themes/foo/style.css http://network/siteB/wp-content/themes/foo/style.css http://network/siteC/wp-content/themes/foo/s... | Hi @mrclay: Good questions. WordPress Multisite is Many Independant Sites, not Many Dependant Sites To answer your aside, WordPress multisite was designed to be a collections of independent WordPress installs collected into one where each site is likely to be very different, unlike your use-case. So each site has it's ... | Outputting Canonical Resource URLs Across a Multisite Network? | wordpress |
I am trying to insert html into the HTML view.What i have done is to have tinymce advanced(a wordpress plugin) button that throws a popup and in it is all the necessary things to insert the html.The tinymce buttons are however only visible on the visual view. Question 1: Is it a plugin or hack that can allow one to par... | Question 1: Is it a plugin or hack that can allow one to parse html inside the visual view Neither of both. The visual view is the visual view and not the HTML view. If you want to paste HTML, use the HTML view. Question 2: Is it possible to insert html code to the html view from a popup initiated from the visual view ... | Inserting code to HTML view from a pop up initiated from visual view | wordpress |
I have two domains www.domain1.com and www.domain2.com, both pointing to the same host. What I want to do is redirect www.domain2.com to www.domain1.com/domain2. I got this code for a .htaccess from the hosting provider but is giving me a error "500 Internal Server Error" when I install it. What is the problem? <code> ... | <code> What I want to do is redirect www.domain2.com to www.domain1.com/domain2. </code> Then you don't want to do it via <code> htaccess </code> . You need to use the WordPress MU Domain Mapping plugin. Map any blog/site on a WordPressMU or WordPress 3.X network to an external domain. Also see: WordPress 3.0: Multisit... | Domain redirect in Wordpress multisite | wordpress |
I have Twitter's own widget set to load on my website, which works just fine. However, on my WP-powered blog the script is included but not rendered. I call it inside an empty <code> div </code> like this: <code> <?php include $_SERVER['DOCUMENT_ROOT'].'/twtr-widget.html' ?> </code> But it appears in the page sou... | It is hard to say for sure with those floating sidebars, CSS is huge pain to work through. On the outer layer whole <code> div </code> that holds your widget has <code> display: none; </code> property applied and there are couple more places with same property applied to parts of twitter widget. Overall this seems like... | Why isn't my Twitter widget working in my theme? | wordpress |
I have two Custom Post Types, "event", and "opportunity". They share a custom hierarchal taxonomy, "location". My client had added a handful of terms (United States (parent), then a few States (children)). I decided to save them time by adding the rest of the States via wp_insert_term. This worked great! Or, so it seem... | There are some bugs related to hierarchical term caching, indeed: http://core.trac.wordpress.org/ticket/14704 http://core.trac.wordpress.org/ticket/14485 | Custom Taxonomy Term Caching? | wordpress |
how can i use multiple meta_key and meta_value in query_posts? For example, I want to find multiple content with two different meta_key and meta_value. How do I do this? i using this code but not effective: <code> query_posts('meta_key=test2&meta_value=hello&meta_key=test2&meta_value=bye'); </code> please h... | This is not currently possible with query arguments alone (realm of filtering raw SQL query and such). If your task is not time-critical then I suggest to wait for upcoming WP 3.1 release. It will feature much more flexible querying capabilities for custom fields. See Advanced Metadata Queries for post on upcoming impr... | using multiple meta_key and meta_value in query_posts | wordpress |
I want to add different class (css) in widgets in site sidebar . For example: First widget in Sidebar -> class=sidebar-top1 Second widget in Sidebar -> class=sidebar-top2 third widget in Sidebar -> class=sidebar-top3 <code> i want to add class in <div> tag. </code> how i can to do? | Check out this post I wrote on the wordpress.org board... it has some functioning code you can work from: http://wordpress.org/support/topic/how-to-first-and-last-css-classes-for-sidebar-widgets | different class (css) for sidebar widgets | wordpress |
I have a few function. For both of them need javascript code. I need to add javascript code in header only when function is active. At this time I have all my javascript code in header for all my function and newermind which one of them is active. I tried to make this code but nothing is changed: All I have in scripts.... | Hi @Denis Belousov: Okay, based on your responses I'm going to ask why tie it to the function existing, why not just test the return value of <code> get_option('src_switcher') </code> like this? <code> function my_scripts() { if (!is_admin()) { wp_enqueue_script('jquery'); wp_enqueue_script( 'custom', get_bloginfo('tem... | How to Add Javascript Only When a Function Exists? | wordpress |
I'm thinking of blocking all IP adresses indicated by Akismet as containing spam. Something like cronning <code> select distinct wp_comments.comment_author_IP FROM `wp_commentmeta` JOIN `wp_comments` WHERE wp_commentmeta.comment_id = wp_comments.comment_id AND wp_commentmeta.meta_value='true' ORDER BY wp_comments.comme... | Personally I highly recommend to not use IP blocks at .htaccess level. There are simply too many false positives possibilities for that to work reliably. I had encountered WP blogs (luckily wave of those seem to have faded) that just shut me out, accusing my IP of belonging to evil spamer... Static IP that belonged to ... | Auto block ALL IP's indicated by Akismet? | wordpress |
My theme has a "function_exists" wrapper around the is_multisite() call as seen below... <code> if(function_exists(is_multisite())) { //do something } </code> However, I'm still getting this error on theme install... <code> Fatal error: Call to undefined function is_multisite() </code> What am I missing? | the quotes: <code> if(function_exists('is_multisite')) </code> | Fatal error: Call to undefined function is_multisite() | wordpress |
My Wordpress blog suddenly seems to have started giving me 404 errors when accessing category pages. For example, http://blog.rtwilson.com/category/tok-related/ . Interestingly, this doesn't happen for child categories (such as GIS and Remote Sensing, shown in the sidebar on the above link) but does happen for parent c... | Apparently this is a common problem with WordPress 3.1+ (just had to fix it on a site I built too). You can get a plugin or a code snippet for your functions.php to fix the problem here: http://wpcodesnippets.info/blog/how-to-fix-the-wp-3-1-custom-permalinks-bug.html | Category links suddenly started giving 404 errors | wordpress |
Hey guys, I have been spending the longest time trying to figure out this issue. I would like to know what the file permissions should look like in WordPress in order to use the autoupdate feature . As of now, my wordpress installation keeps asking me for my FTP information and I do not want to use that method of upgra... | In my question, I stated confusion at the fact that everything worked seamlessly on my shared-hosted despite all of the files being owned by my user, whereas on my VPS, the auto upgrade would not work unless all files were owned by the webserver. I am fairly certain that this is a result of my shared host using suexec ... | Recommended File Permissions | wordpress |
I am using Wordpress 3.0 and would like to organize the directory where uploads are made. Is there any way to change where the files get uploaded or is the only real organization the Media tag plugin? What would be ideal is when a user uploads a file, they can specify a sub directory where to dump the file (or default ... | Please see if Custom Upload Dir (Wordpress Plugin) does the job for you. With that plugin you can configure the upload path based on numerous settings. | Wordpress 3.0 Media Upload Directory | wordpress |
In my site i have a navbar which is created by using the new feature of wordpress 3 - "the menus ".In my site this navbar conatins both categories and pages. When I'm in a single post / sub-page , the navbar doesn't give the parent category /page the class of "current-menu-item" and therefore that item in the navbar is... | The filter you need is nav_menu_css_classes . You should be able to test for *in_category* on single post and archive pages, and add the appropriate class there. | How to highlight the right item in the navbar | wordpress |
I have a WordPress multisite installation. I need to create a sitewide tagcloud on the main blog. How can I do that ? | Use this plugin http://wordpress.org/extend/plugins/wordpress-mu-sitewide-tags/ and this tutorial http://wpmututorials.com/how-to/make-a-tags-page-like-wordpress-dot-com/ It says wpmu, but it is exactly the same. | How can I create a multisite global tag cloud? | wordpress |
This is for a personal-use plugin I'm trying to make. I want to submit a comment from site A to my blog (sort of like sending trackbacks/pingbacks but a full comment). For instance, on site A I have a form with a name, url, and comment field. The data I enter in site A, I want to submit to site B (my blog) via URL para... | Hi @wpStudent:: In WordPress, almost anything is possible. It all depends at times how hard you want to work for it. :) The Comment Post form of course uses HTTP POST to submit to <code> /wp-comments-post.php </code> so you could use that except for the NONCEs if you want to post unfiltered HTML. You'd have to write a ... | Are there action hooks for comments? | wordpress |
I am planning on building a plugin and i need to know if the data stored in the options table i will create for the plugin will be serialized or it will be in the ordinary sql format. | It totally depends on what data is being stored in the option, <code> maybe_serialize </code> will determine in the option is holding a singular static value, such as <code> true/false </code> , <code> 0/1 </code> , <code> empty string </code> , whatever(it's called when an option is created or updated).. it will seria... | Plugin options table,is the data serialized | wordpress |
A client of mine runs a Buddypress-based site (BP 1.2.6 on WP 3.0.2). We'd like to give users the ability to publish blogs of their own, but we don't want them to be able to execute PHP code (we make extensive use of the Exec-PHP plugin on the site), activate/deactivate plugins, or basically anything but use the site a... | Kit, I'd say that if you make extensive use of Exec-PHP what you really need is a developer that can make stuff happen without it. In reality, that plugin is a crutch that is easily replaced with proper widgets, plugins and template code. So, the best advice I can give you about securing that plugin is to remove it. | Best practices for securing a Buddypress installation? | wordpress |
I've got two custom post types: CD and Track. Each of them has got some metadata associated with them. What I'm trying to do is to add Track posts to a CD post when the CD post is being edited. On the CD edit page I have "Add Track" link. When clicking on it, I would like a "New Track Form" to appear under the link tha... | For your my_ajax_admin_add_track() function, grab the form field data from the $_POST array, populate the required data in an array to call wp_insert_post(), then call wp_insert_post() passing it the post data. It should return the new post ID number if successful. | How to add a custom-post-type post within another custom-post-type post edit screen using AJAX? | wordpress |
So i'm trying to create a WordPress plugin and I've created some menu pages using this provided function: <code> add_submenu_page('my_plugin_menu', 'Edit record page', 'Edit record page', 'manage_options', 'edit_record_page', array(&$this, 'display_edit_record_page'); </code> and when I go to the page I notice on t... | <code> admin_url() </code> gets you the correct administration page URL (and <code> network_admin_url() </code> to get a network administration page URL) Optionally, you can use <code> add_query_arg() </code> to append arguments to an URL, using an associative array: <code> $page = 'edit_record_page'; $rec_id = 1; $rec... | On the WordPress Admin section how do I link to submenu pages created for a plugin? | wordpress |
( Moderator's Note: The original title was "using archive by date with a custom date") I'm adding an additional date to posts as a custom field. Now I want the archive to show posts by the custom date and not by the published date. For example I've got a post published today (22nd December) but the custom date is set t... | Hi @Dalen: As with many things in WordPress there are several ways to do what you want. I'm going to explain one of them. Remove the <code> 'year' </code> , <code> 'monthnum' </code> and <code> 'day' </code> Query Variables You can modify the parameters to the query WordPress uses on the archive URLs inside the <code> ... | Archive Listings Filtered by Date Values in a Custom Field/Post Meta? | wordpress |
I am trying to display different things to new users that have not created a post versus users who have created a post. I tried this, but it did not work for custom post types (only normal posts) and it does not account for drafts or pending posts: <code> <?php if (count_user_posts(1)>=1) { blah blah blah } else ... | Hi @Carson: A simple function to address what you are asking for might be the function <code> yoursite_user_has_posts() </code> which leverages the built in <code> WP_Query </code> class: <code> function yoursite_user_has_posts($user_id) { $result = new WP_Query(array( 'author'=>$user_id, 'post_type'=>'any', 'pos... | Display text if current user has written 1 or more posts in a custom post type | wordpress |
after successful import of ~4000 users and their blogs & posts from Liftype I have a rights problem: all users only are subscribers in their own blog. How can I mass change it to blog (not sitewide!) administrator privileges? All known functions I found in Codex gives Admin rights for the main blog, that's not what... | From your question, I'm assuming these are users on a specific blog within a MultiSite installation, correct? In that case, do the following: Go to the blog for which you want to make these users administrators. Click on the "Users" button in the left-side admin sidebar This will present you with a display of about 20 ... | Change user role after bulk-import | wordpress |
Right now, my login page shows the Wordpress logo. How do I change it to my logo? | Here is a pretty simple approach to changing the logo. Mark Jaquith of WordPress released a plugin that allows you to upload an image which will be shown on the login page instead of the WP logo. Customize the WordPress Login Screen Logo | How do I change the logo on the login page? | wordpress |
I'm having a custom sidebar called Footer. I'm displaying this sidebar using this code: <code> <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Footer') ) : ?> (maybe I should do something in this line?) :) <?php endif; ?> </code> This works smoothly, but almost every theme nowadays allow... | Use three sidebars an let them float. Anything else will break depending on the widgets your users insert. | Dividing widgets in sidebar? | wordpress |
I have a site with FORCE_SSL_ADMIN turned on. When I'm editing a post with an embedded image, or when I'm viewing images through the media library, they are loaded using the http:// protocol rather than https. This causes a mixed-content warning in IE, which clients kind of freak out about. Does anyone have a recommend... | You can't right now. This needs to be fixed in wordpress core. Probably this can be temporarily circumvented for a fraction of the problems with a plugin, but it's much more valuable to invest the time developing something in an actual fix of wordpress. | How to get the post editor and media library to respect HTTPS administration mode? | wordpress |
The search form at the top of the users listing in the Admin area (wp-admin/users.php) is limited and does not search all of the user meta fields, such as bio, instant messenger handles, etc. I've not been able to find a plugin that can add this. Is anyone aware of a plugin or a function I could create that could expan... | Hi @user2041: Clearly as you know you need to modify the search that's performed which you can do by modifying the values in the instance of the <code> WP_User_Search </code> class used for the search (you can find the source code at <code> /wp-admin/includes/user.php </code> if you'd like to study it.) The <code> WP_U... | How to search all user meta from users.php in the admin | wordpress |
I would like to know why my page navigation within a particular category doesn't work. The code seems correct but I never see the pagination links. <code> <?php $my_query = new WP_Query('cat=18&showposts=8'); while ($my_query->have_posts()) : $my_query->the_post(); ?> <article id="post-<?php the_I... | For this particular problem you need to change this.. <code> <?php if ( $wp_query->max_num_pages > 1 ) : ?> </code> For.. <code> <?php if ( $my_query->max_num_pages > 1 ) : ?> </code> However, like Rarst said, if you're looking to change the "main" query, then <code> query_posts </code> is reall... | Page navigation within a category | wordpress |
(My first WP question ever asked! Be gentle!) I'm building a site that is mostly pages (i.e., static), using WP as CMS. At the bottom of several of the pages, there will appear 1, 2, or 3 "promo boxes" -- basically button-images that link to other parts of the site. Though only up to 3 promo boxes will appear on any gi... | As the author of WPAlchemy, I'm a bit bias, but you essentially have a good working model outlined to follow depending on what ever route you choose. However, if using WPAlchemy, you would basically do something like the following (step #2): <code> // functions.php include_once 'WPAlchemy/MetaBox.php'; if (is_admin()) ... | Custom field/meta populated by dropdown of existing posts? | wordpress |
Does anyone know how the navigation on this site was made? http://www.thinkingforaliving.org | That sliding navigation is a feature built-in to the theme used by the Thinking for a Living website. If you view the source code, you can see that each panel in the slider is defined by similar code starting with: <code> <div id="covers" scope="Covers"> <div class="cover-index grid4 column page"> <div c... | How is this sliding/scrolling navigation made? | wordpress |
What is the best way to pass arguments to another page in wordpress. I did it this way : <code> <a href="get_permalinka(id_of_page).'/&i=2&j=3&k=4'">Link/a> </code> I get this arguments with $_GET['i'],$_GET['j'],$_GET['k'],problem is : this works just with default permalinks,but when I change it t... | Use add_query_arg() to do this. Here's a useful function if you need to get the current page URL (when get_permalink is inaccesible, like on Archives): <code> function get_current_page_url() { $request = esc_url($_SERVER["REQUEST_URI"]); $pageURL = (is_ssl() ? 'https' : 'http').'://'; if ($_SERVER["SERVER_PORT"] != "80... | Best way to pass arguments to another page in Wordpress | wordpress |
I see a lot of plugins making use of object-oriented coding when there isn't really necessary. But what's even worse is that theme developers are starting to do the same thing. Commercial themes and free popular themes like Suffusion, even my favorite theme - Hybrid, stuff all their functions inside a class, instantiat... | I can understand your confusion based on the example you provided. That's really a poor way to use a class ... and just because a class is used, doesn't make a system OOP. In the case of Hybrid, they're just using a class to namespace their functions. Considering Hybrid is a theme framework , this is done so that child... | Using OOP in themes | wordpress |
I have a WordPress multisite installation. The client wants an email update form on the sidebar of every blog. I want to use a widget there so I need to assign it to the sidebar. Is there any way to do that on the theme install ? | yes. preset widgets: stackexchange-url ("Possible to preset a widget's contents via a plugin script?") post your widget code here if you need specific instructions | How can i initialize a widgetized sidebar (with widgets) | wordpress |
To put it like this: I have created a WordPress theme for myself which consists of the following: PHP code - GPL v2 licensed like WordPress CSS files - All rights reserved JS files - All rights reserved image files required for the theme - All rights reserved As far as I understand I can copyright all non PHP files in ... | Does this licensing scheme (for file groups) violates the WordPress license? No, only the PHP code needs to be GPL'd. A popular example is Thesis: http://mashable.com/2010/07/22/thesis-relents/ http://markjaquith.wordpress.com/2010/07/17/why-wordpress-themes-are-derivative-of-wordpress/ Do I have to publish the PHP cod... | What does exactly GPL license mean for my WordPress theme? | wordpress |
I have a Wordpress database which was installed in a development environment... thus, all references to the site itself have a fixed IP address (say 192.168.16.2). Now, I have to migrate that database to a new Wordpress installation on a hosting. The problem is that the SQL dump contains a lot of references to the IP a... | The data you're looking at is not JSON formatted. JSON doesn't (normally) store value types and lengths like that. What you're looking at is SERIALIZED data. A google search for "mysql replace serialized" yields this page, which might help: http://davidcoveney.com/mysql-database-search-replace-with-serialized-php/ | How to replace the domain name in a Wordpress database? | wordpress |
I don't like the grey one and i'd rather not change each user. Thanks. | I don't see easy way to change default so far, <code> fresh </code> color scheme seems to be hardcoded in plenty of places. If you just need to force some specific scheme for all users it can be done with this: <code> add_filter('get_user_option_admin_color','change_admin_color'); function change_admin_color($result) {... | Default admin color scheme as "blue" | wordpress |
I would like to query posts from a taxonomy created by a plugin (WP Business Directory Manager). How would I do this? I want the query to create html listing of the posts and allow me to list a certain amount, show the associated image to the posts, and a small excerpt. Some examples on wp stack exchange seem like they... | To query by taxonomy you need to know its <code> query_var </code> that is used in its <code> register_taxonomy() </code> call. It defaults to taxonomy name so usually equal to that. Then you use that info in query argument: <code> query_posts( array( 'query_var' => 'term' ) ); </code> See Querying by taxonomy in Co... | How to list posts from a plugin taxonomy? | wordpress |
How to filter WP_Query for posts having a certain meta-value, without using a Custom Select Query? I have a custom posttype with meta-key: "open", and meta-value options: "yes" or "no". I would like to show posts only with meta_value = yes, for meta_key = "open". <code> function filter_where($where = '') { $open = "yes... | I am not sure from your wording if you hadn't tried it with query argument or it didn't work? <code> $the_query = new WP_Query(array( 'meta_key' => 'open', 'meta_value' => 'yes' )); </code> Custom Field Parameters in Codex. | Filter WP_Query for posts having a certain meta-value | wordpress |
I have a custom plugin which queries users and usermeta, but I now need to filter admins out of the results. A very simplified version of my sql query is: <code> SELECT * FROM usermeta LEFT JOIN users ON users.ID = user_id WHERE meta_key = 'last_name' AND user_role != 'admin' ORDER BY meta_value ASC LIMIT 0, 25 </code>... | You can use this function: <code> // get users with specified roles function getUsersWithRole( $roles ) { global $wpdb; if ( ! is_array( $roles ) ) $roles = array_walk( explode( ",", $roles ), 'trim' ); $sql = ' SELECT ID, display_name FROM ' . $wpdb->users . ' INNER JOIN ' . $wpdb->usermeta . ' ON ' . $wpdb->... | query users by role | wordpress |
What (if any) is the hook or method for including named categories into the wp_list_pages function? The end result would be that the categories are added onto the end of the list of pages (along with any child categories that exist, with proper ul/li nesting for drop down css to act on)... Home | About | Contact | Cate... | Wouldn't it be even easier to call <code> wp_nav_menu() </code> and customize your menu as you please from the admin menu? | How to add categories to wp_list_pages() | wordpress |
I've got a great Comment Form and Threaded Comments setup by using the native WordPress functions: <code> comment_form </code> and <code> wp_list_comments </code> . However, I'm trying to also create a custom Contest Comment template for certain posts. I call <code> comments_template('/contest-comments.php', true); </c... | Short answer: It doesn't, but you can get around this: <code> add_filter('comment_form_field_comment', 'my_comment_form_field_comment'); function my_comment_form_field_comment($default){ return false; } add_action('pre_comment_on_post', 'my_pre_comment_on_post'); function my_pre_comment_on_post($post_id){ $some_random_... | Does WordPress Allow Blank/Empty Comment Submissions In WordPress? | wordpress |
I just noticed 55.000 entries(!) in my wp_options table. I had not been there for a while. So I ran: <code> delete from `wp_options` where `option_name` like '_transient_timeout_rss%' delete from `wp_options` where `option_name` like '_transient_rss_%' </code> And... it is now back to 645 entries... How can I have thes... | Yep, this does seem like a cron issue. Core Control plugin is good to diagnose cron tasks (among other things). I am still unsure what is the reason of you getting overrun with feed transients. However I had written some stackexchange-url ("code that might help with automatic cleanup"). | Transient RSS feeds in wp_options not removed automatically? | wordpress |
When I deal with Multisite installation.Some themes like mystique and aparatus provide the widget areas with in the theme-settings page to enter Advertising codes in the form of HTML or java script .But I want the 'Ad code Boxes' to access only by super admin(Me on my Multisite) and not by Normal admins .Can I make tha... | If that is custom functionality in theme options page then it is highly specific to that theme. Likely you will need to edit theme files and/or create child theme. Plus option pages can be simply in WordPress API but just as well can be built with help of theme framework or other kind of third party code. I think your ... | Editing theme files and access to the Code pages only to super-admin? | wordpress |
Hi to the community, is it possible to change the default username slug to nickname if is available? By default the url is something like: http://domain.tld/author/(admin ) , is it possible to rewrite and change to http://domain.tld/author/(nickname ) so if a user change his nickname from the profile page the slug it w... | I see two ways to solve this problem: changing the data that forms the author URL, or changing the author URL. You probably should handle redirects too, so old URLs to user archives keep working when a user changes their nickname. Changing the author URL There are two parts to this question: handle incoming links with ... | Change the Author Slug from Username to Nickname | wordpress |
I'm using the WP Business Directory Manager plugin and I'm having some problems. The developer hasn't been supporting the plugin lately, so here I am. I need to change the field order. Currently the option is there, but it doesn't work. I need to target the field for CSS purposes, with custom classes/ids And I need to ... | To change the field order, you can delete all the fields and then add them again in the order of your choosing. Sucks to have to do it that way, but whatever. It's a free program. | Help with WP Business Directory Manager Plugin? | wordpress |
I have a widget-less WordPress theme to which I want to add Subscribe by Email functionality. Unfortunatly the plugin only comes in the form of a widget. How can I use the widget functionality without widget support. | It is a little bulky for complex widgets, but you can call any widget in any place (no sidebar required) with <code> the_widget() </code> function. | How to use widget in a widget-less WordPress theme? | wordpress |
I'd like this code to only run inside the admin area as it is resorting the items on the public side admin bar too. <code> /* Reorder Admin Menu to put "Pages" at the top */ function menu_order_filter($menu) { $content_menu = array('edit.php?post_type=page'); array_splice($menu, 2, 0, $content_menu); return array_uniqu... | There is very little overhead to assigning couple of filters on hooks that simply won't fire on front end. In general it would be something like this: <code> add_action('init', 'admin_only'); function admin_only() { if( !is_admin() ) return; // filter assignemnts and such go here } </code> Also <code> create_function()... | Run functions only in the admin area? | wordpress |
i am having a wordpress function to display the latest 5 tweets of the user, this tweets can be displayed by two ways one is through direct entering the user ID in admin menu which i created, and second is through custom fields, here i want to avoid custom fields and want to start with shortcode, i know i am weak in sh... | Here you go: <code> add_shortcode('latest_tweets', 'latest_tweets'); function latest_tweets($atts){ extract(shortcode_atts(array( 'max' => 5 ), $atts)); $twitter_id = esc_attr(strip_tags($atts[0])); // try to get data from cache to avoid slow page loading or twitter blocking if (false === ($output = get_transient("l... | shortcode help require | wordpress |
For a WP Theme with multiple admin screen (got its own main menu and some submenus), I want to add a common Js script to load on (only) all these pages. I know how to acheive this using the pagehooks of the individual (sub)pages lioke this: <code> add_action('admin_print_scripts-' . $page, 'my_plugin_admin_script'); </... | It would be easiest to run some conditional logic on <code> $parent_file </code> inside a callback hooked onto <code> admin_print_scripts </code> , and would go a little something like this.. <code> add_action( 'admin_print_scripts', 'possibly_enqueue_script' ); function possibly_enqueue_script() { global $parent_file;... | add JS to multiple plugin admin pages | wordpress |
WP loops are widely used to print lists of posts in Wordpress: <code> <?php $loop = new WP_Query( array( 'post_type' => 'ff', 'ff' => 'show_ff', 'orderby' => 'menu_order', 'order' => 'ASC' )); while ( $loop->have_posts() ) : $loop->the_post(); ?> <!-- here we're going to have all posts from s... | I don't think i've fully grasped how you want this to work, but if i assume for a moment that as long as the loop has at least 6 posts, you want to insert extra markup after the third result in the loop.. Example Insert extra markup after the third post, when the current iteration has at least 6 posts <code> <?php i... | Breaking the loop? | wordpress |
What is the difference between feeds served by my WordPress install vs feeds served by FeedBurner? How to disable hosted Wiordpress feed completely and use feedburner? | Here are some reasons I think FB does well: feed statistics: subscribers, item view and clicks email subscription: control email template, subscribers sharing posts on social networks with FeedFlare monitize with Google Adsense reduces CPU usage on your host. Some of above features you can do with plugins, but it costs... | What is the difference between feeds served by my WordPress install vs feeds served by FeedBurner? | wordpress |
I am using wordpress Multisite installation . 1)I want to run my website faster .Especially the main site.There are near about 50 plugins .I want to exclude many of these plugins on Main site and activate to other sub-sites.Could any body tell me how to do it? I have other three questions related to plugins on multisit... | I only recently started to poke multisite, as far as I understand you activate plugins per-site by activating theme in that site's admin area. You can switch between backend of different sites in <code> Super Admin > Sites > (hover cursor on site) > Backend </code> . Server load is not about quantity of plugin... | Exclude plugins on Main site on Multisite installation? | wordpress |
To simplify the Media Library layout to users when uploading an image, sometimes i hide the following fields: <code> function myAttachmentFields($form_fields, $post) { if ( substr($post->post_mime_type, 0, 5) == 'image' ) { $form_fields['image_alt']['value'] = ''; $form_fields['image_alt']['input'] = 'hidden'; $form... | Jose, give this a shot and see if that's the kind of thing you had in mind.. EDIT: Done a little bit of testing and copying of core code to archieve this, but i think the new example i've added below should do what you've described, remove the buttons, "Insert into Post", etc..., but keep a delete link. I've left the o... | Trying to hide buttons from Attachment window | wordpress |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.