question stringlengths 0 34.8k | answer stringlengths 0 28.3k | title stringlengths 7 150 | forum_tag stringclasses 12
values |
|---|---|---|---|
I know how to hardcode that... but i like to have a plugin with shortcode that will make it for me... do you know any... If not, i will have to make it myself Have a page (blank) and build it base on post category. So in page xyz display all the post with category=abc. So the build page will display all the abc post ba... | I dont quite understand how it's less easier to manage a category... So you have <code> Category -> Post </code> but instead you want <code> Page -> Category -> Post </code> It doesn't make sense in what you are trying to do. And and if your trying to link categories into pages just so you can include them in ... | Build page base on category | wordpress |
Is it possible to retreive media image directly into the library... Something like get_media ('all') and it return a array with image url, caption, description etc etc.. | Here you go: <code> function get_media_all_wpa14177(){ $args = array( 'post_type' => 'attachment', 'post_mime_type' =>'image', 'post_status' => 'inherit', 'posts_per_page' => -1, ); $query_images = new WP_Query( $args ); $images = array(); foreach ( $query_images->posts as $image) { $images[]= $image->... | Function to get image from media library | wordpress |
Is there a browser plugin or method to find which php template an item is coming from? | The Debug Bar together with the Debug-Bar-Extender will show you what template file is being used. | Is there a browser plugin or method to find which php template an item is coming from? | wordpress |
I'd like to be able to show sticky posts at the top of category pages. I'm using archive.php for my category page. I'm using the code below to display sticky posts at the top of my category archive page followed by the rest of the posts within that category. This works fine, until there are no sticky posts to display w... | try to use a conditional statement to wrap the first loop, such as: <code> if( get_option('sticky_posts') ) : //only do the next part if sticky posts </code> add the corresponding <code> endif; </code> after the <code> endif; </code> of the first loop. | Show Sticky Posts in Category Archive | wordpress |
I am trying to save my meta box, I have something like <code> function xxx_meta_box_callback() { add_meta_box('xxx-meta', 'xxx Details', 'xxx_meta_box', 'xxx-post-type', 'side', 'default'); add_action('save_post', 'xxx_save_meta_box'); error_log('meta box cb'); } function xxx_save_meta_box($post_id, $post) { error_log(... | Hi @JM at Work: Try this in your theme's <code> functions.php </code> file, or a <code> .php </code> file of a plugin that you may be writing: <code> add_action('init', 'xxx_init'); function xxx_init() { add_action('save_post', 'xxx_save_meta_box'); } function xxx_meta_box_callback() { add_meta_box('xxx-meta','xxx Deta... | Why is save_post hook not running? | wordpress |
Conditionally Including scripts whether js or css in xhtml document head...has been a generally tricky affair, especially if you want to enqueue something, based on a shortcode or custom meta field or a widget. If you know that you need your script for sure,you would just do what the Wordpress Codex suggest by using wp... | To circumvent this, you can use <code> strpos() </code> with <code> the_posts </code> hook, which gets fired before wp_head. But one of the drawbacks is that its an extra pass at the data. You're essentially doing the same inside the callback you're hooking onto <code> wp_head </code> , i don't see the difference.. (pl... | Is this a bad implementation of wp_enqueue_script for conditional usage? | wordpress |
I'm trying to test the comments template on a theme that is based on TwentyTen, using the the WP Theme Unit Test XML file, and there is one post that does not display comments properly. The post is called "Comment Test", and it contains 20 comments, including 2 pingbacks. The only thing that displays are the pingbacks.... | Twenty Ten has been tested by the theme review team and it passes all the unit tests. You can see how it looks on one of the demo test installs or another install I found . Try doing a fresh install of WordPress with a new database with no plugins. | WordPress TwentyTen Theme Incompatible with Theme Unit Test | wordpress |
The script below creates a nav menu and assigns a page to it. Everything's working perfectly except that the nav menu is not being automatically assigned to my theme's "Header-menu" location. Any ideas why? <code> //Register menu locations for the theme add_action( 'init', 'register_my_menus' ); function register_my_me... | <code> wp_create_nav_menu() </code> function accepts the menu name and not the menu location. and as for <code> wp_update_menu_item() </code> well its for items and not the menu itself. After digging in the code i found out that "assignment" of 'theme location' to a menu is not done using of the nav_menu API in WordPre... | Custom nav menu is created with default pages, but not hooked to theme's custom menu location | wordpress |
hey guys, <code> <?php urlencode(the_title()); ?> </code> doesn't take effect. this is my entrie line of code: <code> <li><a href="mailto:?subject=<?php urlencode(the_title()); ?>&amp;body=<?php the_permalink(); ?>">e-mail</a></li> </code> I don't want to have spaces in the... | The <code> the_title() </code> echo the title. You must use <code> get_the_title() </code> instead. get_the_title() returns the title as string. Use <code> <? echo urlencode(get_the_title()) ?> </code> | urlencoding of the_title() doesn't work? | wordpress |
When doing an automatic upgrade, I get this: Downloading update from http://wordpress.org/wordpress-3.1.1.zip … Unpacking the update… Could not create directory.: /public_html Installation Failed All my wp files are in /public_html and the directory already exists. The FTP user I am logging in as owns all the Wordpress... | I had this problem and the answer was found (a) in enabling ftp to write and (b) at least temporarily setting the directories to 777 although I think the latter permissions can be improved. I run vsftp with chroot'd users. After finding no mention in apache logs, setting the permissions to 777, changing ftp group to ww... | Upgrade to 3.1.1 Fails | wordpress |
I've got a registered sidebar called "my-header" that affects the absolute positioning of elements below it in the markup. So I need to execute a query in header.php to determine if the sidebar is present for the current post, and write out a class identifier to my theme's body tag. I'll use this css class to adjust ab... | <code> <?php $bodyclass = ""; // are we on a 'single' page? e.g. a post or page or some other custom post type? if(is_single()){ // is this a post of type 'page'? or is it a blogpost? global $post; if($post->post_type == 'page'){ // good now to check if we have a sidebar with active content if( is_active_sidebar(... | How to determine if post has widget content? | wordpress |
OK, I have an issue with Sidebar Generator Plugin . This plugin creates subpage called "Sidebars" in WP-Admin. The point is, it is created as a child of "Appearance" page. And I don't want it here, I want "Sidebars" to be a subpage of my own Page named "my-page". I have found this line in the plugin's code: <code> func... | you can do something like: <code> // create your own page add_menu_page('my-page', 'My Page', 'My Page', 'parent-slug', 'my_plugin_options', '', '10'); // create the subpage under my-page add_submenu_page('parent-slug', 'Sidebars', 'Sidebars', 'manage_options', __FILE__, array('sidebar_generator','admin_page')); </code... | Add menu page issues (permissions & position) | wordpress |
I'm executing a query inside of header.php which is apparently resetting the $post object so that all pages are getting the $post-> ID of the last element in this loop. <code> $mypostsheader = get_posts(array('cat' => "$cat,-$catHidden",'numberposts' => $cb2_current_count)); $current_page = get_post( $current_pag... | I found that one solution for this was to place a call to wp_reset_query() just before the close of the function call. I was trying to use rewind_posts() but it would not work. wp_reset_query() did the trick. After doing that, thanks to @goldenapples excellent observation that I was already setting a pointer to the cur... | All post ids are the same after this query but rewind_posts() does not seem to work here? | wordpress |
I have a website where I let people subscribe. I would like to only show the author page for actual authors who have written a post. I wrote this code that checks for post the problem is I can't use a <code> wp_redirect </code> or include a template that uses it because then I get everyones favorite "cannot redifine he... | You can do this at an earlier moment by hooking into the right action, like <code> template_redirect </code> , which fires right before the template will be displayed. <code> add_action( 'template_redirect', 'wpse14047_template_redirect' ); function wpse14047_template_redirect() { if ( is_author() ) { $id = get_query_v... | How to hide/redirect the author page | wordpress |
I just upgraded to WordPress 3.1.1 and suddenly I'm getting the following error: <code> Fatal error: Call to undefined function wp_get_current_user() in /home/arisehub/arisehub.org/wp-includes/capabilities.php on line 1028 </code> I've narrowed it down to my usage of "current_user_can" Example: <code> if ( !current_use... | You are calling the function too early. The <code> functions.php </code> is included before <code> current_user_can() </code> is defined. Never do anything before the hook <code> 'after_setup_theme' </code> : Example for the functions.php <code> add_action( 'after_setup_theme', array( 'WPSE_14041_Base', 'setup' ) ); cl... | current_user_can on WordPress 3.1.1 | wordpress |
I need to add a widget to the sidebar that shows post titles sorted by year ie: 2011 POST TITLE 1 POST TITLE 2 POST TITLE 3 2010 POST TITLE 1 POST TITLE 2 POST TITLE 3 I was thinking of using the Archive widget to do this, but I dont know how to add the display post title bit and then have the YEAR display as a type of... | Have a look at http://wordpress.org/extend/plugins/simple-yearly-archive/ Or if you want to code it yourself have a look at wp_get_archives http://codex.wordpress.org/Function_Reference/wp_get_archives | Archive Widget - Show selected Category Post title. Sorted by Year | wordpress |
Just like the title states. I've added around 20+ custom fields into my wordpress site and only around 10 are showing in the drop down. The custom fields are all functioning fine on the site side, but they just aren't showing up in the drop down. | There's a limit set inside the function that lists the meta data. http://core.trac.wordpress.org/browser/tags/3.1/wp-admin/includes/template.php#L512 Run a filter on <code> postmeta_form_limit </code> to increase to your desired value, eg. <code> add_filter( 'postmeta_form_limit', 'meta_limit_increase' ); function meta... | Added 20 Custom Fields. Only 10 showing in drop down | wordpress |
The website I run www.detroitdungeon.com loads perfectly fine in every browser but in IE it crashes after loading. Any help would be appreciated! | When you want to debug any issue, follow these steps: Check Firefox or another browser to make sure it's not a system issue but is, in fact, a browser issue. Use the build-in debugger in IE to diagnose your problems. You've already done step 1. You've pointed out that the site works well everywhere but IE. I did step 2... | Website fully loads then immediately crashes in Internet Explorer | wordpress |
I tried the following: <code> <?php function my_wp_admin_css() { echo '<link rel="stylesheet" href="/wp-content/plugins/custom-admin-style/wp-admin.css" type="text/css" />'; } add_action('wp_admin_css','my_wp_admin_css'); </code> but nothing is being displayed in the Wordpress admin. What I'm doing wrong? | You need to use <code> wp_enqueue_style </code> and hook it into <code> admin_print_styles </code> <code> add_action( 'admin_print_styles' , 'my_wp_admin_css' ); function my_wp_admin_css() { wp_enqueue_style('my_admin_style' , WP_PLUGIN_URL . '/myPlugin/stylesheet.css' ); } </code> If you just want the stylesheet on yo... | Can't call external stylesheet for Wordpress admin (using wp_admin_css)? | wordpress |
I already use WordPress to create an online catalog and web presence. Now, a little box tells people to enter their email, and they will receive an email when a new product is added to the site (which is useful). Now, having entered the emails manually or asking people to enter it, I would like to have a little CRM for... | Check out Bill Erickson's Twentyten CRM Theme . It's a great theme for using WordPress as a CRM. | CRM and newsletter integration? | wordpress |
I'm using a custom post type with custom meta fields, but autosave and the "unsaved changes" dialog don't seem to be triggered for these custom meta fields. Autosave isn't as important to me as the unsaved changes dialog - is there a way to trigger it? <code> function add_meta_boxes() { add_meta_box('places_location', ... | The code indeed only looks at the TinyMCE editor or the title and content field if the editor is hidden: <code> window.onbeforeunload = function(){ var mce = typeof(tinyMCE) != 'undefined' ? tinyMCE.activeEditor : false, title, content; if ( mce && !mce.isHidden() ) { if ( mce.isDirty() ) return autosaveL10n.sa... | Trigger "unsaved changes" dialog for custom post meta changes | wordpress |
I have a widget that shows all the post names. All the post names are "Chapter ## - Title" I would like the php in the widget to remove the "Chapter 1 -" or "Chapter 12 -" for example so that just the part after the Chapter is left.... | This is a new query loop that I use that shows the latest ten post titles/permalinks in the category mycategoryname and strips the first 15 characters from all of the titles. <code> <?php $my_query = new WP_Query('category_name=mycategoryname&showposts=10'); ?> <?php while ($my_query->have_posts()) : $m... | Removing the first 8-10 letters from a post? | wordpress |
My theme uses some custom options fields, like post excerpt, that were removed from the editor screen with WP 3.1 I understand and support the intent to clean up the content workspaces. However, as a result of the 3.1 upgrade, I have had several support requests related to the fields that suddenly disappeared with 3.1 ... | http://wordpress.org/support/topic/troubleshooting-wordpress-31-master-list?replies=14 a few posts down has instructions for default 'ON' options <code> // Change what's hidden by default add_filter('default_hidden_meta_boxes', 'be_hidden_meta_boxes', 10, 2); function be_hidden_meta_boxes($hidden, $screen) { if ( 'post... | How to programmatically bring back "excerpts" field in post editor in WP 3.1+ | wordpress |
I'm using the following code to display the term for a specified taxonomy: <code> $terms = get_terms( "book_review" ); $category = $terms[0]->name; </code> However I want to display the term for whatever the currently displayed taxonomy is, rather than specifying a particular taxonomy. Basically what I'm wanting is ... | You can use <code> get_queried_object </code> to get the term name. <code> <?php if( is_tax() ) { global $wp_query; $term = $wp_query->get_queried_object(); $title= $term->name; } ?> </code> To display: <code> <?php echo $title; ?> </code> If your on a taxonomy archive page you can use: <code> <?ph... | How to get the first term for the current taxonomy? | wordpress |
So basically i got this custom field value which is stored in $postrating - and under the database field customfield1. I want to grab the value of that field for all posts that have the tag currently being browsed. Then i want to calculate the average value of those numbers and display on the archive.php page when brow... | If its a regular custom field you can add this to your archive.php: <code> //before the loop $rating_count = 0; $total_rating = 0; //in the loop $total_rating = $total_rating + get_post_meta($post->ID,'your_custom_field_name',true); $rating_count = $rating_count + 1; //after the loop: $average = $total_rating / $rat... | Getting and calculating averge value of custom fields of the same tag | wordpress |
I've created a site using wordpress and i moved that from localhost to new server. The steps i've followed is just got backup of old db from localhost and uploaded them to the new server. Changed the WordPress address (URL) & Site address (URL) manually from phpmyadmin. Moved all the files from localhost to the ser... | I solved it myself.. It was issue in the windows server with wordpress 3.1 so i installed the Permalink fix pack @ wordpress.org/extend/plugins/… . Now its working fine.. I've no issues linux server.. I've to dive into the thing to know why that is happening in windows server... | Wordpress redirection problem after moving to a new server? | wordpress |
Is there any information about WordPress becoming completely OOP in future versions? | Hi @Eugene: I can say with about 99.9999% certainty that WordPress will never become completely OOP in future version, not the least of which is that the topic has come up time and again on the wp-hackers list and the core team members has expressed no interest in doing so. As I look at my personal experience with prog... | Will WordPress become completely OOP? | wordpress |
Basically, I would like to activate a CSS class only if the current page is a certain custom post type (e.g. <code> ?bbp_forum=technology </code> ) or if the current page is a child of that custom post type. EDIT: The first custom post type is called ' <code> bbp_forum </code> .' Each ' <code> bbp_forum </code> ' can h... | I accidentally got the answer: <code> <?php global $post; $the_post_parent = $post->post_parent; $the_post_ID = $post->ID; $cat_posts = get_posts('post_type=bbp_forum&posts_per_page=-1'); print_r($post_parent); ?> <?php foreach ( $cat_posts as $post ) : ?> <li <?php if ( $post->ID == $the... | How to write an if statement which reads: 'if is this custom post type or a child of it do the following'? | wordpress |
I want to have different sidebars on different pages. So firstly I registered a few basic sidebars in functions.php. So they will be always there no matter where I move my theme. Let's name them Standard Sidebar, Special Sidebar, Tiny Sidebar. The next step was creating sidebars metabox below posts and pages. It lists ... | You can call registered sidebars with the dynamic_sidebar() function. Just put the ID of the sidebar in to the call. In the case below the id would be homepage-sidebar. <code> <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('homepage-sidebar') ) : ?><?php endif; ?> </code> | Custom sidebars - get_sidebar() problems | wordpress |
When I do <code> $gallerypage = new WP_Query(array( 'post_type' => 'post', 'pagename' => 'gallery' )); $gallerypage->the_post(); </code> the last line <code> $gallerypage->the_post(); </code> is giving me errors. Why is that? It seems correct? <code> Notice: Undefined offset: 0 in /site/url/wp-includes/quer... | Hi @JM at Work: Try wrapping <code> $gallerypage->the_post(); </code> with <code> if ($gallerypage->have_posts()): ... endif; </code> It should look like this: <code> if ($gallerypage->have_posts()): $gallerypage->the_post(); endif; </code> See: http://codex.wordpress.org/The_Loop | WP_Query $gallerypage-> the_post() giving Undefined offset: 0 | wordpress |
i need to change the posts in taxonomy.php page. I have a meta_key which i want to compare to meta value. But currently my code is not returning anything. I am sure i am missing something. Please let me know what i am doing wrong! <code> add_action('pre_get_posts', 'add_event_date_criteria'); function add_event_date_cr... | Try using meta_query parameter : <code> add_action('pre_get_posts', 'add_event_date_criteria'); function add_event_date_criteria(&$query) { // We only want to filter on "public" pages // You can add other selections, like here: // - Only on a term page for our custom taxonomy if (!is_admin() && is_tax('even... | pre get posts changing the query | wordpress |
I'm looking for themes or examples of sites that use the post format feature in an interesting way. I suppose adding special styling for each post format would be a good start. But if anyone knows of it being used in a cool or creative ways by a premium or free theme feel free to chime in. | Check out this post on WordCast: WordPress Post Format Eye-Candy: Tumblr Style Theme Inspiration Showcase Also Digging into WordPress uses them and just wrote a post about it: Tumblr Links with Post Formats | Suggestions for creative use of post format feature, or themes that use them well | wordpress |
I'm going to be using add_role() and $role-> add_cap() to set up a new custom role and attach a new capability to existing roles. I'm wondering where the best place to do this is? Obviously I can do it straight inside functions.php and be done with it. But is this the best practice? Do I only need to do this on admin_i... | When adding a role and capabilities you only need to run the code once since the roles and capabilities are saved to the database when using <code> add_role </code> or <code> ->add_cap </code> functions so just like Andy said you can use <code> after_setup_theme </code> for this kind of action but add some kind of c... | What action should I hook into when adding roles and capabilities? | wordpress |
I am a programmer, and love jQuery. Visual jQuery and other resources is THE best place to get all the code/function et get your hand dirty... But when it come to WordPress.. the code is too thin or too abstract... i nee more like a dictionary of term, function, and possibility What i need is like the ULTIMATE cheat sh... | Hi @menardmam: Let's try with what I wrote in the question : <code> $cat->cat_name </code> . How can I know that <code> cat_name </code> is a method that return something from <code> $cat </code> from <code> get_the_category() </code> function? Frankly the best way to know an answer like that is to use a debugging I... | Need resource on available functions and objects | wordpress |
for a small project i need to assign the The Events Calendar Plugin to an subpage but i've found no solution in the documentation. Does anyone know if this is possible or has an idea to get it done? Regards | Here's a basic page template for displaying an events calendar in grid form based on the grid template bundled with the plugin. Edit as necessary to match the styling and layout of your theme: <code> <?php /** * Template Name: Event Gridview **/ global $spEvents; $spEvents->loadDomainStylesScripts(); get_header()... | Assign "The Events Calendar" to Subpage | wordpress |
First a teeny bit of background... I have a custom post type where I'd like to use custom post statuses. Since custom post statuses (stati/status/whatever) , have not been fully implemented within the core, I've decided to use the gettetext filters to change the names of certain things. For example, I've changed the te... | First, you have nasty typo in <code> __contsruct </code> . :) Second, your hook timing is wrong. Related WP JavaScript is localized via <code> postL10n </code> object (you can see it echoed in page's source), that gets put together on <code> init </code> hook - way earlier then <code> admin_head </code> and your filter... | How to prevent text modified using gettext filter being stomped (presumably) by updateText() js function within a CPT's edit screen | wordpress |
I have the following code: <code> <?php /* Template Name: blog */ ?> <?php get_header(); ?> <div id="blog"> <div class="content"> <?php query_posts('cat=-4,-11');?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="post"> <h2><a href="<?php... | You would need to account for pagination in your query.... something like: <code> <?php query_posts( array( 'cat' => '-4,-11', 'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1 ), )); ?> </code> http://www.rvoodoo.com/projects/wordpress/wordpress-tip-fixing-pagination-on-custom-queries-with-q... | Post Navigation Not Working In Blog Template - Redirecting to same page with correct URI | wordpress |
How might I query for a tag given the slug? | Hi @JM at Work: Like this: <code> $term_slug = 'foo'; $term_object = get_term_by( 'slug', $term_slug, 'post_tag' ); print_r( $term_object ); </code> | Query for tag given slug | wordpress |
Normal Wordpress Menu looks like: Home | Blog | About us | Contact But I've seen many pages with descriptions under these links: Home Page | Our Blogs | About us | Contact ....meet us...| read more| basic info| contact form How to achieve this? (I want it to be core function for all my themes, so no plugins please, I j... | You need a custom walker for the nav menu. See this article for the details. Basically, you add a parameter <code> 'walker' </code> to the <code> wp_nav_menu() </code> options and call an instance of an enhanced class: <code> wp_nav_menu( array ( 'menu' => 'main-menu', 'container' => FALSE, 'container_id' => F... | Menu items description? Custom Walker for wp_nav_menu() | wordpress |
I've been building wordpress sites for a few years now and have noticed a few things that bother me. 1. It's fairly slow (awful blanket statement, I apologize) My initial desire to create a custom front-end came from an observation. The Wordpress sites I was building weren’t quite as fast as I wanted them to be (3-5 se... | You do cite experience with WP going back farther than that of mine... Yet I do not see these issues as that major. What scale of sites are we talking about? It's fairly slow I feel this is bit too much of generalization. Slow can be put in context of specific hardware, tasks and level of traffic. It's blanket statemen... | What are the pros and cons of using a custom front-end to retrieve content from a Wordpress back-end | wordpress |
I have a restricted area on a website that can only be accessed by logged in users. For that I created a page template with a 'current_user_can()' condition. My problem is that the documents attached to the restricted pages are still accessible to anyone if you put the complete path into the browsers address bar. Is th... | This isn't really a WordPress question - but you can add a rewrite rule to prevent access unless the referrer is your own domain. [Update] You'll need to do 2 things Add a rewrite rule (either directly with .htaccess or by using WP_rewrite (Codex reference) . The aim here is to deny requests to your documents that don'... | How to restrict access to uploaded files? | wordpress |
I am using the following code to remove the admin bar (client request). <code> add_filter( 'show_admin_bar', '__return_false' ); </code> Trouble is, it leaves some autogenerating CSS, which places a massive white line at the top of my page in its place (via a 28px top margin rule). How can I turn this off as well? | To completely remove the Admin bar deregister the js and css using wp_degregister_script and remove the action. <code> if (!is_admin() && !current_user_can('add_users')){ wp_deregister_script( 'admin-bar' ); wp_deregister_style( 'admin-bar' ); remove_action('wp_footer','wp_admin_bar_render',1000); } </code> | Admin Bar CSS left over after removal | wordpress |
Hey guys, last days i have been trying to figure out how to do that. As read on http://net.tutsplus.com/tutorials/javascript-ajax/create-a-twitter-like-load-more-widget/ but inside wordpress. And i have finally come with a solution, may not be the best one but i hope you guys can improve my code and post it here just l... | For starters see AJAX in Plugins . WordPress has own mechanism for processing Ajax request and that is what you should use over includging <code> wp-load.php </code> . | How to create a load more post entries like Twitter? | wordpress |
i'm trying to get the author name using the " <code> the_author_meta </code> " function. After doing that I need to pass the value inside an array and return that with "json_encode". Let me show: <code> $autor_id = $post->post_author; $autor_name = the_author_meta('user_nicename', $autor_id); echo $autor_name; </cod... | The echoing is already done by the_author_meta(). <code> echo $autor_name </code> does nothing. Correct would be to use get_the_author_meta(). | How to get post author name by its ID inside a function? | wordpress |
i have a self hosted wordpress install on a server in a virtbox at home. i was trying out plugins from the wordpress.org site, and after enabling some securtiy plugins, i found i couldnt access the wp-login.php page anymore. i get a function of one of the plugins telling me the site is forbidden and doesnt exist. the p... | Assuming you have shell access to the server (which is sounds like you do), rename the <code> wp-content/plugins </code> directory to something else (I often just stick an <code> x </code> in front) and see if you can get into your site. Then create a new plugins directory and move the plugins one at a time from <code>... | How do i login when i cant access wp-login.php? | wordpress |
Does anyone know how much do the localization functions from WordPress affect the speed of a website? Do you think it's worth replacing all strings with gettext inside a theme, even if it will only be used on a single, english website? | If you know that you or the client will NEVER need to be translated there is no need to replace all the strings within your theme with gettext. Regarding the performance issue I found a benchmark comparing the 3 gettex methods. It also compared using the default local vs a different local and the differences were negli... | Should we localize custom-made themes / plugins? | wordpress |
I know there are plugins out there for integrating the user base & sign-up, but are there any for using PHPlist to automatically send out newsletters of new posts? I'm really trying to avoid a from-scratch solution here, though if nothing is 'ready made' I'd appreciate any pointers or head starts ;) | Don't know of a plugin that does that but if you take a look at WP PHPList plugin or more specifically the way it Interacts with phplist using PHP CURL, it logs in to phplist as admin and save cookie using <code> CURLOPT_COOKIEFILE </code> and then simulates a post to subscriber form. So maybe going in that route you c... | PHPlist & new posts notification? | wordpress |
I construction of a administrative back office inside the wordpress theme for running our travel company, monitoring users, bookings and payments, it has come to my attention that it might be better served and more secure if such an area were in face a desktop application or offline webpage that connected to the intern... | I'm curious how/where you got the impression that desktop apps are more secure than the WP admin. For better security, you can enable SSL for the normal WP admin web interface, by adding this line to wp-config.php: <code> define('FORCE_SSL_ADMIN', true); </code> More info here: http://codex.wordpress.org/Administration... | Building a Wordpress App | wordpress |
I have customized my login screen with a logo using html{background:#E2DEAF url(.../images/login_logo.jpg) center top no-repeat;} because it is so wide. Usually would not tie something to the HTML element. works great BUT... it also shows up in the admin area. Anyway to prevent this? I only want it on the login. | Try selecting login body class instead of adding background to html tag. <code> body.login { background:#E2DEAF url(.../images/login_logo.jpg); } </code> You could also play with .page (pages only), .logged-in (logged users) and so forth :) Hope it helps. | Background image in login showing in admin area | wordpress |
hey guys, I couldn't find anything on the web. Is it possible to have custom template for the image attachement page. I wonder if it is possible to add a navigation to the image attachement page so people can easily navigate through a gallery. Maybe it's even possible to add comments to each image? edit: Moreover is it... | WordPress supports several types of attachment templates. The function <code> get_attachment_template </code> in <code> wp-includes/theme.php </code> provides this support; it is called in <code> wp-includes/template-redirect.php </code> . If your theme includes <code> attachment.php </code> all of your attachments wil... | page template for attachement page? | wordpress |
Why isit that WordPress sometimes add a number to my slug even if I explicitly set it. Like if I set slug to be 'about' I get 'about-2'. I want the slug to be correct so I can style using CSS easily. Or is there a better way? | WordPress appends a number to your slug when the database already contains a duplicate slug. It will append the number even if the duplicate post or page has been moved to the trash. The URL Routing system is one of the weaknesses of WordPress. stackexchange-url ("Mike Schinkel") made a very good proposal to evolve the... | Why does WordPress append numbers to page slugs sometimes? How to reliably style based on page | wordpress |
How might I have custom markup for my menus, like I want to give menu items something like <code> id="menuitem-postname" </code> how might I do that? | The only way that I could think to do this would be to add a filter to <code> wp_nav_menu_items </code> . Here is the code that I got to work (just add it to your themes functions.php file): <code> add_filter('wp_nav_menu_items', 'my_id_name_nav', 10, 2); function my_id_name_nav($items,$args) { if( $args->theme_loca... | Custom markup with wp_nav_menu based on pages | wordpress |
I have a new question, how can I limit the amount of posts coming out of this query? I only need 7 <code> <?php $newsposts = new WP_Query('cat=restaurant'); if ( is_front_page()) { echo '<h3 class="member-review">Latest Restaurants</h3> <div id="extra">'; if ($newsposts->have_posts()) : while ($... | It should be: <code> $newsposts = new WP_Query('cat=restaurant&posts_per_page=7'); </code> Another way to write it (helps readability with larger queries) would be: <code> $newsposts = new WP_Query(array( 'cat' => 'restaurant', 'posts_per_page' => 7, )); </code> See <code> WP_Query </code> in Codex for descri... | How to limit the posts | wordpress |
I'm creating common "Single Tag Page" for different Post Types. I'm using next code: <code> $loop = new WP_Query( array( 'post_type' => 'any', 'tag' => single_term_title( '', false ), 'posts_per_page' => 10 ) ); while ( $loop->have_posts() ) : $loop->the_post(); ?> <div class="entry-content"> &l... | Thank you guys for such quick response. Much appreciated! Here is code for "global" Tags page (displaying terms of default 'post_tag' taxonomy): <code> <?php $term_slug = get_queried_object()->slug; if ( !$term_slug ) return; else $loop = new WP_Query( array( 'post_type' => 'any', 'tag' => $term_slug, 'post... | Retrieve single term slug | wordpress |
Ok, maybe it a far fetch question, and a question about depersonalisation of something into something else, but let try. One on my client want a easy file bin for his client to go get the public HR file for publicity. The main company have the HR pdf and some newspaper or local advertising need it. Instead of sending t... | Perhaps WP-Filebase would be a suitable plugin for you. | FTP file manager AS wordpress site | wordpress |
I've asked a similar question before: stackexchange-url ("How to create thumbnails with a fixed width, so all of them will have the same width?") But... this one is related, but different. Please bear with me. Right now: if you insert an image in a post as a thumbnail by the media-library, you can choose between 4 diff... | You can set a maximum width for all image sizes and WordPress will crop portrait and landscape oriented images to that same width. In your media settings set the width field and leave the height field blank. When you upload a landscape oriented image the size will never go past the max width of 300px and the height wil... | media-library: how to insert thumbnails with a fixed width, regardless of landscape/portrait orientation | wordpress |
I need to display images and other content in the sidebar depending on a page. Pages are added dynamically and information that need to appear in the sidebar is different for each page. So I can't predict what will go where. So the idea was is to have a page's content as usual (with all the neccessary shortcodes) and t... | A shortcode handler doesn't have to return anything, it can just modify a global variable that you later read in your sidebar widget. If your sidebar is displayed after your post content (most likely if it's a right sidebar), you can do this without any problem. If your sidebar is displayed before the post content it i... | Display post shortcode content in the sidebar? | wordpress |
Is there a plugin or some php code to do this: I want to disable some categories from the category box on the add/edit message page. I don't want to delete the categories and I want to leave the disabled categories to the previously assigned posts. | I have solved the problem myself, but it is not a pretty one. With the function attached to the <code> add_meta_boxes </code> action hook, I change the callback function that builds the category box. It replaces this function with the customized function <code> post_categories_meta_box_custom </code> . <code> post_cate... | How to disable category without deleting? | wordpress |
I am working on a function that displays all authors but it appears I am doing something wrong the HTML within does not display until the bottom of the page separate from the output. <code> /* Add shortcode to display authors */ function all_authors() { global $wpdb; $authors = $wpdb->get_results("SELECT ID, user_ni... | <code> the_author_meta() </code> is display function, it echoes the result to screen right where it's called. To concatenate with string you need to use function that returns result - <code> get_the_author_meta() </code> . | Shortcode not displaying HTML within the function | wordpress |
This should be easy. I need to query to display one page in a tab. Just pull one page by one query, but I'm doing something (maybe lots) wrong here: Edit: Hah. I forgot <code> the_content </code> It works now. <code> <?php $the_query = new WP_Query; $the_query->query ('pagename=about' ); while ($the_query->hav... | Hah. I forgot <code> <?php the_content(); ?> </code> | Why doesn't this page query work? | wordpress |
How does one go about locking down transient API requests for multiple threading? Has anything done some benchmarking, just how much can the transient API handle for multiple concurrent requests? It seems like it might cause some severe bottlenecks if not managed properly. Also how would one go about forcing the transi... | How does one go about locking down transient API requests for multiple threading? Has anything done some benchmarking, just how much can the transient API handle for multiple concurrent requests? Under normal circumstances Transients API is essentially thin wrapper on top of Options API. The difference is that (unlike ... | Any insights into Transient API locking, cron and threading? | wordpress |
<code> <?php echo do_shortcode('[mingleforum]'); ?> </code> inserts the mingle forum into my content! is it possible to use add_filter() on that? | You can change your code to this: <code> <?php $shortcode = do_shortcode('[mingleforum]'); echo apply_filters('my_new_filter',$shortcode); ?> </code> and then you can interact with that filter <code> add_filter('my_new_filter','my_new_filter_callback'); function my_new_filter_callback($shortcode){ //to stuff here... | adding a filter to a shortcode? | wordpress |
I've got a default main menu: <code> wp_nav_menu(); </code> But it gives a list of links in a form: <code> (...) <a href="link" title="PageName">PageName</a> (...) </code> The very important question is, how to force WP to display it like: <code> (...) <a href="link">PageName</a> (...) </code> I... | The title is an accessibility attribute that helps users with screen readers. It is part of the recommended WC3 standard for navigation items. Just think about that before you decide to eliminate it because you find it annoying. Rather than modifying the PHP code, you could think about removing it after it's loaded. It... | Main menu - get rid of titles? | wordpress |
I'm looking for a plugin that will allow the user to upload files, maybe 4-10 that can be used on the homepage as part of a slideshow. I can code the slideshow part myself, if necessary, but the thing I'm interested in is a way for the user to select / upload the photos. It would be excellent if they were integrated wi... | jQuery Cycle and Cycle Lite are very flexible and very easy to use. Most WordPress slideshow plugins either don't do exactly what you need or they try to do everything and are overly complicated with options and features. The solution Build the slideshow feature into your theme template or code your own plugin. To make... | What plugin can I use to create a list / slideshow of featured images? | wordpress |
The question is pretty simple, but it's complex in fact. I have implemented custom sidebars for each post/page function in my blog. It looks like: <code> <div id="<?php echo get_option('sidebar-layout');" ?> <div id="content"> Some content [myshortcode] </div> <div id="sidebar"> Sidebar </... | Use this code to echo your div's ID <code> <?php $sidebar_layout = get_post_meta($post->ID, 'sidebar-layout', $single = true); ?> <div id="<?php echo $sidebar_layout ?>"> <div class="content"> ... </div> <div class="sidebar"> ... </div> </div> </code> If you want to ap... | Hide/disable sidebar using shortcode? | wordpress |
I've got several custom image sizes for my blog. One of these is setup as <code> add_image_size( 'slide', 640, 290, true ); </code> . These are used in a header slideshow. My problem is I've upped the dimensions of this size after many of them were originally created, and many of the attached post images are too small ... | Not from personal experience (I don't use WP image management much), but I believe Regenerate Thumbnails plugin is usually recommended for rebuilding thumbnails. | How to delete outdated, wrongly sized images in _wp_attachment_metadata? | wordpress |
I've used Justin Tadlock's great function for category specific custom post templates many times, where you can use single-cat-id.php for single posts belonging to a specific category. I just ran into a problem though working on a new site that needs to use the single-{posttype} template for a custom post type. The fun... | You can check for your post type single-{post-type}.php first try this: <code> /* Define a constant path to our single template folder */ define(SINGLE_PATH, TEMPLATEPATH . '/single'); /* Filter the single_template with our custom function*/ add_filter('single_template', 'my_single_template'); /* Single template functi... | Conflict in function to allow single post template based on category | wordpress |
I always find myself creating posts every time to test layout or design. For example, I create stuff like: Content 1 Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation u... | I use Demo Data Creator plugin with it you can create and set: Number of users to create Number of blogs per user (for WPMU/MultiSite) Whether users must have a blog Number of categories in each blog Number of posts in each blog Number of paragraphs in each blog post Number of pages in each blog Number of top-level pag... | Is there any way of copy/pasting, duplicating, or auto-generating posts for fast testing? | wordpress |
I've written a plugin that allows users to add information in the database. It runs well but I can't translate the information using WPML. This is a simple example of the problem: $message = 'test'; // here I get the information of the DB __($message, 'my-plugin'); Is there a way to workaround this problem? I don't kno... | If you want to have variables in your text to be translated the usual way would be with string formatting like so: <code> <?php printf(__("text %s text2."), $message); ?> </code> with integers: <code> <?php printf(__("text %d text2."), $count); ?> </code> with more then one placeholders: <code> <?php pri... | Translate database content using __($message) function | wordpress |
Hiya Guys! so I need some help with this: <code> <?php $newsposts = new WP_Query('cat=restaurant'); if ( is_front_page()) { echo '<h3 class="member-review">Latest Restaurants</h3> <div id="extra">if ($newsposts->have_posts()) : while ($newsposts->have_posts()) : $newsposts->the_post(); <... | you can't run code inside quote since php treats it as string, try this: <code> <?php $newsposts = new WP_Query('cat=restaurant'); if ( is_front_page()) { echo '<h3 class="member-review">Latest Restaurants</h3> <div id="extra">'; if ($newsposts->have_posts()) : while ($newsposts->have_posts()... | PHP nested If statement syntax | wordpress |
I have custom post type and I want to have a menu where I combine category or categories from default Wordpress post type and from my custom post type. Let's say I have these categories sport, books, movies, any in default post type sport, books, school, any in my custom post type can I have a menu link where I would d... | What I would suggest in this situation is that you create a "CUSTOM QUERY" to query the posts. Set this custom query into a page, then use Appearance > Menu's to add the page into your menu structure. I hope this helps. | can I 'combine' categories as a menu item? | wordpress |
I'm student web developer and I'd like to know the things I should know before venturing into WordPress. Where do I start? | Glad your taking the jump into wordpress, wordpress is an amazing platform for developers and non-developers alike, if you have knowledge of PHP, HTML, CSS (and jQuery in some instances) you will enjoy working with wordpress. A great place to start understanding wordpress would of-course be the wordpress website itself... | Where do I start from | wordpress |
I just found the magnificent wp_insert_post function and have a few basic question about it. *For reference I used this on a multisite install for a number of blogs running theme_x. I simply wanted to add a page to each blog (without having to do it through WP Admin). This seems to have mostly-worked though I'm not sur... | Wordpress just adds a new entry, the title is not unique, but there is a field guid which is. Permalinks do get an incremental number. Yes, you should remove it from your theme, you'd better write your own plugin for this kind of stuff. I don't totally understand what you mean, is there no menu entry in the admin? That... | Proper procedure for wp_insert_post? | wordpress |
I try to save an option from the frontend but i can't find yet how to do it. So, the idea is to give the blog owner a simple form with a dropdown that can select a different stylesheet.css. I have build it for the wp-admin area and it works fine, but i want to do the same in the frontend, i have tried to include the wp... | You Do Not want to post /wp-admin/options.php from the front end , thats a bad idea and can cause problems. To updated Options from the frontend simply use update_option() and make sure you verify correctly. here is an example using your code with minor fixes: <code> <?php if (isset($_POST['stylesheet']) && ... | Save Theme Options (options.php) From The Frontend | wordpress |
Hey guys, I simply want to prevent the creation of empty paragraphs in my wordpress post. That happens quite often when trying to manually space content. I don't know why this doesn't take effect? <code> /*Remove empty paragraph tags from the_content*/ function removeEmptyParagraphs($content) { /*$pattern = "/<p[^&g... | WordPress will automatically insert <code> <p> </code> and <code> </p> </code> tags which separate content breaks within a post or page. If, for some reason, you want or need to remove these, you can use either of the following code snippets. To completely disable the wpautop filter, you can use: <code> rem... | remove empty paragraphs from the_content? | wordpress |
I think my audience is more capable of answers each others' questions than I am. I need a system for them to do that and I'd like it to integrate with WP so I could use their existing usernames and accounts. Do you know of a good solution? | Have you heard of WP Answers ? It is a plugin that appears to do exactly what you need. There are also some themes out there that do what you're after; after a quick comparison, the Answers theme by Templatic appears to be one of the nicer ones. | Is there a good Q&A platform to integrate into WordPress? | wordpress |
I have several virtual hosts setup, three of them pull files via SVN when needed(though only the trunk folder actually needs this), using SVN for other versions make for easy patch creation, or easy file replacement if i hack a core file. My question is whether i can checkin a plugin from directly inside the plugins di... | I run a WordPress checkout of trunk, a branch, or a tag. This way I can switch WordPress versions easily: <code> svn sw http://svn.automattic.com/wordpress/trunk svn sw http://svn.automattic.com/wordpress/tags/3.1 </code> In <code> wp-content/plugins </code> I have a trunk checkout for each of my plugins: <code> cd wp-... | Can i do plugin commits directly from a plugin folder inside an installation using the Trunk SVN | wordpress |
I use paged and threaded comments with: 10 comments per page the last comment page first the newest comments first If there are 21 comments total, the first page only contain 1 comment - the newest. How do i get the newest 10 comments always showing on the first page? I'm using WordPress 3.0.3. Edit: Upgraded to 3.1, t... | This is indeed the default behavior of WordPress. The comments always stay on the same comment page, so if you show the last comment page first, that last comment page will not always have the "full" number of comments. The advantage of keeping a comment always on the same comment page is that the URL always stays the ... | Last comment page first with full number of comments? | wordpress |
This has me stumped for a while already. Either I am missing something very obvious or something very not obvious. I am also not entirely sure if this has something to do with WP or purely PHP mechanics at work. <code> function test() { global $wp_query; var_dump($wp_query == $GLOBALS['wp_query']); } function test2() {... | Update with a better example <code> header( 'Content-Type: text/plain;charset=utf-8' ); error_reporting( E_ALL | E_STRICT ); function failed_unset() { // Copy the variable to the local namespace. global $foo; // Change the value. $foo = 2; // Remove the variable. unset ( $foo ); } function successful_unset() { // Remov... | query_posts() in function makes global $wp_query out of sync? | wordpress |
I got social bookmarks in jQuery, but how can I get post titles and permalinks in this snippet? If I put <code> <?php echo get_permalink(); ?> </code> in there, the whole site gets blank. <code> $('a[rel=shareit-twitter]').attr('href', 'http://twitter.com/home?status=' + title + '%20-%20' + title); </code> UPDATE... | You must output the propper HTML to make it working. Specifically, the href-attribute needs to contain the URL and the title separated with the | sign, like <code> <a href="http://example.com/post-url|post-title" rel="shareit" ... </code> . That will enable the script you've posted above use a concrete URL and title... | jquery bookmark links | wordpress |
For example, at /wp-admin/upload.php are displayed the following filters by: All (6) | Images (6) | Unattached (6) How can I remove the "Unattached (6)" filter by? Thanks in advance. | As it turns out, with the introduction of the <code> WP_List_Table </code> class, view filter are now hookable and specifically you can filter out that detached link like so.. <code> add_filter( 'views_upload', 'upload_views_filterable' ); function upload_views_filterable( $views ) { unset( $views['detached']); return ... | How to remove the Unattached filter on Media Library List? | wordpress |
I am creating a WordPress theme for a record label. One aspect is the video gallery. I created the gallery using a custom post type called 'videos'. The code below is what I placed in my functions.php file to set up the post type: <code> add_action( 'init', 'create_my_post_types' ); function create_my_post_types() { re... | Check the documentation here: http://codex.wordpress.org/Function_Reference/WP_Query#Taxonomy_Parameters You'll want to add this to your wp_query: <code> 'smash-palace' => 'smash-palace' </code> In other words, your new query would look something like: <code> $loop = new WP_Query( array( 'post_type' => 'videos', ... | looping though custom post types and only return results in a given taxonomy | wordpress |
I had recently moved my wp site from a domain to other, but when I type in the new domain's address it gets redirected to the old domain/some_page. Is this any common problem? Is there any known solution to this? I had checked my code and it has no redirects to this page. Can someone give me a hand on this? | This is because the URL settings inside WordPress are still pointing to the old WordPress site. In other words, you didn't read the Moving WordPress article in the documentation. If your WordPress admin pages are still working, you can go to Settings → General, and change the WordPress URL and the Site Address to the c... | My wordpress site gets redirected automatically to the old site any known solution for this? | wordpress |
how can I tell WordPress, that if a user registers, it shall execute my function? | You can use <code> user_register </code> action hook which fires after a user has registered and passes <code> $user_id </code> as a variable: <code> add_action('user_register','my_function'); function my_function($user_id){ //do your stuff } </code> | WordPress Hook for user register | wordpress |
I've followed a tutorial on Nettuts on how to add a custom button to TinyMCE (http://net.tutsplus.com/tutorials/wordpress/wordpress-shortcodes-the-right-way/) It works great and all, but i want to add many buttons and i wonder if there's a smart way to do this without having to duplicate all the code over and over. Her... | First add your additional buttons inside the buttons callback.. <code> function register_button($buttons) { array_push($buttons, "quote","wpse-rules"); return $buttons; } </code> Then add additional buttons function inside the plugin javascript.. <code> init : function(ed, url) { ed.addButton('quote', { title : 'Add a ... | How to add multiple buttons to TinyMCE? | wordpress |
I just created a custom post type named Catalog. Where authors can create as many entries they need. But I need to restrict/deny access to all admin parts: Posts, Profile, Media or other admin parts except their Catalog entries. Do I need to compare against $_SERVER['REQUEST_URI'] or theres a better way? Thanks in adva... | This is more difficult than it needs to be it seems. To code it without using a plugin I would suggest using <code> global $menu </code> and <code> global $submenu </code> as an array and unset them based on user role or user name. It might get more difficult if you want to define user role permissions outside default ... | Disable all admin UI access to authors (except to custom post type add, edit and modify) | wordpress |
Based on solved question from: stackexchange-url ("How to add a checkbox element to attachments editor with example") Theres an example of multiple Checkboxes, for example: Colors, patterns, etc... A grouped list but using checkboxes? Tips to save and remember checked options on edit? Thanks in advance. | Like @Bainternet said, it is the same thing. Taking the code from the question you linked to, you can do it like this: <code> function filter_attachment_fields_to_edit( $form_fields, $post ) { $foo = (bool)get_post_meta( $post->ID, 'foo', true ); $bar = (bool)get_post_meta( $post->ID, 'bar', true ); $form_fields[... | How to add multiple checkbox elements to media attachments? | wordpress |
I don't even know where to start with this one. I'm using a theme that requires me to override server php.ini settings in my own php.ini with <code> allow_url_include = on </code> That setting at very least seems to be a security risk, according to many (and my webhost) at most it requires some other users on some othe... | Okay, first off, that's an incredibly badly made theme. Your item number 2 there indicates to me that he making AJAX calls in entirely the wrong way. Secondly, look for anything in the theme that is using http but not in a link. allow_url_include basically lets you include some PHP from a remote site, which is indeed b... | Theme requires allow_url_include = on in php.ini | wordpress |
How would I add the capability in Simple Twitter Connect (in the stc-publish.php file) to not tweet pages, either newly published or edited? I don't need it to be an admin option, just a change for a few of my sites. It looks like this function would be a good place to add the "don't tweet pages" capabilty (while retai... | Even better answer that doesn't involve changing the plugin: <code> remove_action('transition_post_status','stc_publish_auto_check',10,3); add_action('transition_post_status','my_custom_publish_rules',10,3); function my_custom_publish_rules($new, $old, $post) { if ($post->post_type == 'page') return; else stc_publis... | Add function to Simple Twitter Connect to not Tweet pages | wordpress |
The tinyMCE "kitchen sink" toggle button shows/hides a row of buttons. I have successfully added my row of shortcode buttons to the tinyMCE editor, but I was wondering if there was a way to make my row only display when the kitchen sink button is clicked. I don't want to add the buttons directly to the kitchen sink row... | Yes! Use the <code> mce_buttons_2 </code> filter to add buttons to the second row. Use the <code> mce_buttons_3 </code> filter to add buttons to the third row. Here's an example of what I use: <code> function mytheme_mce_buttons_row_3($buttons) { $buttons[] = 'fontselect'; $buttons[] = 'fontsizeselect'; $buttons[] = 'c... | Is there a way to add another row to the tinyMCE kitchen sink toggle? | wordpress |
I have made a multiple category. Each item belong to one or more category. So when display one item, i like to retreive the category of this item, and display all post that have belong to that category. Example. Chair : cat = sit, leather, one person So when display the chair, i like below to display all item that have... | <code> # according to your example: $categories = array ( 'sit', 'leather', 'one person' ); # get all id's by the category names foreach ($categories as $category_name) { $category = get_term_by( 'name', $category_name , 'category' ); $ids[] = $category->term_id; } # get all posts for the categories query_posts( 'ca... | Category "same post" retreive and display | wordpress |
Is there a way to remove 'category' from the slug when viewing posts in a particular category in WordPress 3.1 without it breaking? My client is asking me to remove it, but it seems necessary - I get a Page Not Found error when using this plugin: http://fortes.com/projects/wordpress/top-level-cats/ He also doesn't want... | I didn't test it myself, but maybe this tip could solve your problem: If you would like yoursite.com/category/projects/projectname/ to appear as yoursite.com/projects/projectname/ Simply enter /. as the value for Category base in the permalink settings page. | WordPress 3.1 removing 'category' from the slug | wordpress |
First plugin, basic question... I am trying to print the variable <code> $xavi </code> from a plugin into a theme like this: <code> add_action('init', '_load_options'); function _load_options() { global $xavi; } </code> So that I can use it in a theme file like this: <code> <?=$xavi;?> </code> It doesn't look lik... | Your webhost has disabled <code> register_globals </code> in the php.ini , so you have to "register" your variables manually everytime you want to use it. For example: <code> <?php global $xavi; echo $xavi; ?> </code> Another approach is using the <code> $GLOBALS </code> array: <code> <?php echo $GLOBALS['xavi... | Variable from a plugin into a theme | wordpress |
i hope you are well today, My question is just breif i am trying to query from a custom post type by a certain taxonomy only; to keep it streamline lets use the below as an example; Custom Post Type: 'Products'; Taxonomy: 'Categories'; Categories within 'Categories'; (1) Category 1 (2) Category 2 (3) Category 3 So i wo... | There are 3 ways of doing that: a) <code> ... 'category_name' => 'category-1' ... </code> b) <code> ... 'taxonomy' => 'category', 'term' => 'category-1', ... </code> c) <code> ... 'tax_query' => array( array( 'taxonomy' => 'category', 'terms' => array( 'category-1' ) ) ) ... </code> More info: http://... | Query Custom Post by Taxonomy Category | wordpress |
Hi im looking at hardcoding a wp plugin into a theme, the plugin is Calendar . This is what i have done as of yet: 1) Moved files from wp-content/plugins into a folder within theme folder and made the changes so that paths are followed correctly. 2) Set to populate database via an SQL query rather than via plugin activ... | My first recommendation: Don't do it! If the plug-in author releases an update, you can and will run into conflicts. Particularly if someone installs both the new plugin and your theme at the same time. A much safer route is to build plugin support into your theme. Make things degrade gracefully in case the plugin does... | Hardcode a Plugin into theme | wordpress |
I use my own svn repositories for all my development. I am looking for an easy way to keep the svn repository wordpress provides for my plugin synced up with my own internal repository. The desired end result being that when I commit a change to my own internal repository it gets duplicated automatically to my reposito... | Maybe the svn switch -- relocate repository option can help you here: svn switch --relocate oldURL newURL . ( http://svnbook.red-bean.com/en/1.1/re27.html ) But... a lot more options here: stackexchange-url ("stackexchange-url | Sync my svn repositories | wordpress |
You probably noticed the trend of making custom designed plugin/theme options UIs, especially in the commercial ones (on CodeCanyon for example - custom boxes, tabs, accordions etc). I personally believe that UI should be unified in the first place and that is really easy in WP to achieve using some core's default HTML... | Custom UI is great where it improves the experience and makes the task easier. After all, a plugin extends WordPress and therefore a lot of the time is extending the user interface. This might mean a screen that is arranged completely differently to any other screen, but if it is logical and understandable then there's... | What do you think about custom designed plugin/theme options UIs? | wordpress |
hey guys, any idea how I could filter all inline javascripts from the content()? thank you | Not tested, but I imagine <code> add_filter('the_content', 'wp_kses_post'); </code> will scrub it good. Might need playing with priority. | remove inline scripts from the_content() produced by plugins? | wordpress |
How would I go about adding a column to the Page Admin area that would show the last revision date of all pages? Alongside the Author and Published Date columns? I need to keep an eye on the page edits that other users do, and right now, the Page Admin area will only show the published date for a published page and the... | Would need some prettifying, but basic code is following: <code> add_filter('manage_pages_columns', 'add_revised_column'); add_action('manage_pages_custom_column', 'echo_revised_column', 10, 2); function add_revised_column($columns) { $columns['revised'] = 'Revised'; return $columns; } function echo_revised_column($col... | Add "Page Revised" column to Admin | wordpress |
My future posts are going missed. They are not getting published on the time they should, and it says "Missed Schedule". I read somewhere that it could be a server issue, so how can I fix it? | Added the following to my functions.php: <code> define('WPMS_DELAY',5); define('WPMS_OPTION','wp_missed_schedule'); function wpms_replacements_deactivate(){delete_option(WPMS_OPTION);}register_deactivation_hook(__FILE__,'wpms_replacements_deactivate'); function wpms_init(){ remove_action('publish_future_post','check_an... | Missed schedule | wordpress |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.