question stringlengths 0 34.8k | answer stringlengths 0 28.3k | title stringlengths 7 150 | forum_tag stringclasses 12
values |
|---|---|---|---|
The problem can be found here: http://themeforward.com/demo2/ Use my menu and navigate to Features > Shortcodes > Typography. Notice how the border ( <code> ul .sub-menu { border:1px solid #000 } </code> ) moves the third level menu item (typography) down one pixel. How do I get rid of that one pixel gap so that the th... | Though this isn't a WP question, you can use the following CSS to get that third level menu to align properly. <code> .sf-menu li li li{ top:-1px; } </code> Hope this helps. | WordPress Custom Superfish CSS Problem | wordpress |
I have created the file latest.php in the public_html so that when I go to www.domain.com/latest.php it will show me the latest articles. Sadly, nothing of the posts came up. Later, I will sort them with other ways (mostly based on custom fields). This is my latest.php file (I removed any styling for better understandi... | This worked for me: <code> include ('wp-blog-header.php'); </code> and before: <code> while (have_posts()) : the_post(); </code> you have to create wp_query, so do this for example: <code> query_posts('cat=1'); // or any other query args you wish </code> | Not displaying any articles on a custom made file | wordpress |
I am building a community based WP site at the mo and have blocked anyone bar admins from using the admin section on the site with: <code> add_action( 'init', 'sw_block_users' ); function sw_block_users() { if ( is_admin() && ! current_user_can( 'administrator' ) ) { wp_redirect( home_url() ); exit; } } </code>... | The following action hook should help: <code> add_action('admin_init', 'wpse28702_restrictAdminAccess', 1); function wpse28702_restrictAdminAccess() { $isAjax = (defined('DOING_AJAX') && true === DOING_AJAX) ? true : false; if(!$isAjax) { if(!current_user_can('administrator')) { wp_die(__('You are not allowed t... | blocking the admin section (but still using admin-ajax.php) | wordpress |
I have had a wordpress site handed off to me halfway through completion. It's been at least a year since I last used wordpress and there are a lot of things I'm finding different. The way I am used to displaying different content on different pages is to create page templates for each page that needs unique content. I ... | I think what you might need is simply to run <code> register_sidebar() </code> in an <code> 'widgets_init' </code> hook. The TwentyTen theme has examples for <code> register_sidebar() </code> in its <code> functions.php </code> file, but here's what it might look like: <code> add_action( 'widgets_init', 'twentyten_widg... | Display a specific dynamic sidebar widgets on a specific page | wordpress |
How can I change arguments for the main query only, and not affect other queries? <code> add_filter('pre_get_posts', 'custom_post_count'); function custom_post_count($query){ $query->set('posts_per_page', 5); return $query; }; </code> Because this action is called inside the get_posts method of WP_Query, this code w... | Basically what you are looking for is the <code> global $wp_the_query </code> variable which is set to the value of the main query. It may not be a perfect fit for 100% of cases but will probably work fine in 99% of cases: <code> add_action( 'pre_get_posts', 'custom_post_count' ); function custom_post_count( $query ){ ... | "pre_get_posts" firing on every query | wordpress |
What I'm trying to do is edit the output of <code> image_send_to_editor </code> so that i can make the anchor that wraps around the image have a specific class & rel . I plan to basically make each image that gets inserted into a post become fancybox capable without having to be in a gallery or using a plugin. Here... | Your best bet here would be to use jQuery to grab any link that links to an image and tell it to use fanceybox. <code> jQuery(document).ready(function($){ $('a[href$="jpg"], a[href$="png"], a[href$="jpeg"]').fancybox(); }); </code> If you want this to work just for your post content areas use this: <code> $('.post-cont... | Need help building a filter to edit the output of "image_send_to_editor" | wordpress |
Sometimes when I upload a picture (either with flash or browser uploader), I get a message like (this was with a 1.46MB jpg): <code> Fatal error: Out of memory (allocated 69206016) (tried to allocate 4000 bytes) in /home/ab64489/public_html/wp-includes/media.php on line 254 </code> I am on a shared host, but the max up... | This isn't a Wordpress problem. There's no telling on a shared environment what the culprit might be. You probably don't have access to your php.ini config, nor do we know how many websites your hosting company has jammed on your server. The very nature of a shared server is that each client shares the resources of tha... | Out of Memory when Uploading an Image | wordpress |
I'm creating a multisite network and I am looking for a way to have it so new blogs that are created have a couple of standard pages set up automatically. The purpose of these pages will be to display universal membership options and other info that I want each site to display. So, for example, I want each new site to ... | Hook into <code> wpmu_new_blog </code> and create your pages: <code> add_action('wpmu_new_blog', 'create_my_pages', 10, 2); function create_my_pages($blog_id, $user_id){ switch_to_blog($blog_id); // not really need, new blogs shouldn't have any content if(get_page_by_title('About this Network')) return; // create each ... | Hard Code Pages into a Theme for a Network (multisite) Installation | wordpress |
Is there a hook available that lets you append or prepend text to the <code> <title> </code> tag in the head? I've seen lots of posts about customizing the <code> <title> </code> tag, but they all involve manually adding a function inside the <code> <title> </code> tag. I'm looking to modify it with a... | The content is modified with filters, not hooks. To modify the <title>, use wp_title filter Example: <code> add_filter('wp_title', 'set_page_title'); function set_page_title($orig_title) { return 'Modified ' . $orig_title; } </code> | Insert content into head tag with function | wordpress |
Okay, I've been working on this all day and can't find the solution anywhere. I've created a custom field within the image upload screen (info first found here ). The field stores the name of a photographer to give him/her credit. Everything's fine there. What I can't figure out is how to get this information into ever... | You can create a filter using the "wp_get_attachment_image_attributes" hook. Place this in your functions.php file. <code> function filter_image_title($attr, $attachment = null){ //Find your $photographer with $attachment->ID $attr['title'] .= ' (' . __('Photographed by', 'foobar') . ' ' . $photographer . ')'; retur... | Display info from custom fields in all images' HTML | wordpress |
How can i use multiple meta_key and meta_value to search users? For example, i want to search & find user name is "David" & location in "London". I'm using this query, But nothings in result! <code> $query = "SELECT user_id FROM $wpdb->usermeta WHERE (meta_value LIKE '%%david%%') AND (meta_key = 'first_name'... | Your query is wrong that's way noting is returned because there is no row in the database that holds more then one meta_key. What you can do instead is create a Sub Query to get all user id's of users who live in London as a Sub Query and the use that to filter users id's of users who are named David, something like th... | Search Users base on meta_value & meta_key | wordpress |
I previously created a new user role called "Owner" which worked fine, however I decided to delete it afterwards from my functions.php since I found it to not be as useful for my project after all...Odd thing is though, the new custom user role is still showing up in wordpress' dropdown menu where you assign a role to ... | You could try running this once in your <code> functions.php </code> <code> $wp_roles = new WP_Roles(); $wp_roles->remove_role("your_role"); </code> | Custom user role still showing up after deletion, ideas? | wordpress |
I have a blockquote and I can float it left or right if I want by going into the html editor and adding class="alignleft" etc. Is there any way I can make that available to a non tech individual with a button or plugin / function or something. I think i'm looking at a tinymce plugin but i've never done anything with th... | This tutorial gives you a short plugin you can modify to create a "styles" drop down with the "alignleft" and "alignright" classes in it. As a note, just to stay out of WordPress's way, I might choose a different class or at least something prefixed like me-alignleft. | Apply styles to blockquote element with the WYSIWYG editor | wordpress |
I have created a network consisting of 3 sites (site1.com, site2.com, site3.com). Everything works fine, and I can access all three sites fine. What I need is to be able to share themes, plugins and post to all sites. I have tried multipost-mu, and ThreeWP Broadcast. When I create a post I can now choose the other two ... | Marja, By default any plugins in the wp-content/plugins directory will be shared across the site. You can Network Activate a plugin so it's activated on all sites. For themes, you will need to Network Enable the themes in the network admin panel. I'm not sure about the posts. That would be a support question for the pl... | Share plugins, themes, and multi post in a multidomain network | wordpress |
I need to integrate Magento and Wordpress for a corporate website. There will be other functionalities in the website that will require a login (ie forum, helpdesk and maybe others...) which I would like to develop with Wordpress since I'm totally ignorant at the moment on Magento and looks a very complicated system fo... | There is a plugin Mage Enabler http://wordpress.org/extend/plugins/mage-enabler/ which makes Magento session available to WordPress, it's probably a good place to start. The author has written a couple of good posts on his blog detailing integrating the two. | Wordpress and Magento: let Wordpress manage user registration and logins? | wordpress |
I'm having a problem with wordpress rewriting my URLs, basically I have a regular search form with method set as <code> GET </code> , when I submit it the URL looks like this at first: <code> http://mysite.com/news/?type=My+Variable </code> Wordpress adds the <code> + </code> symbol to separate the string and the resul... | I don't think this will solve your problem, but take a look at <code> url_encode() </code> . <code> $pagination['add_args'] = array('s'=>urlencode(get_query_var('s'))); </code> | Wordpress removes spaces in URL on pagination | wordpress |
I have a few custom post types which i don't want any contribute to view or touch. However, the default settings allows contributes to see these in their admin. How do i disallow contributes access to certain post types? | When you register your post type you can show/hide the UI in the arguments. I would approach it this way: <code> $allowed = current_user_can('administrator') ? true : false; $args = array( //other args 'show_ui' => $allowed ); //register_post_type() function; </code> This will maintain the custom post type architect... | Limit 'contributers' abilities in WordPress | wordpress |
I've created a custom post type which now has around 100 posts in it. I simply want to display these in alphabetical order by the post title rather than the default which seems to be most recent first. I've tried various plugins and other solutions, but most only allow manual sorting (too many posts for that to work), ... | try this: <code> <?php $args = array( 'post_type' => 'tenant', 'posts_per_page'=>5, 'orderby'=>'title','order'=>'ASC'); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); ?> </code> You will find more info o custom queries here: http://codex.wordpress.org/Class_Ref... | Displaying a custom post type alphabetically | wordpress |
IN the past I thought there was a chackbox to enable/disable comments when making a new posts? I do not have that option when I make new post's, please help | Click on <code> Screen options </code> in the top right corner of the screen. And select <code> Discussion </code> . Than you'll see that checkbox to enable/disable comments. | Add option to disable comments on a per posts basis? | wordpress |
I currently created a custom field for a custom post type that stores a date in the format dd/mm/yyyy is there a way to query the posts by the month? I "kind of" got the functionality I need using the following query: <code> query_posts('post_type=attraction&meta_key=attraction_date&meta_value=10&meta_compa... | It is not clear what you're using as a comparison, but <code> WP Query </code> supports meta query comparisons and even has a DATE type. For example: <code> $query = new WP_Query( array( 'post_type' => 'attraction', 'meta_key' => 'attraction_date', 'meta_value' => '10', 'meta_compare' => 'LIKE', 'type' =>... | How to query posts by month based on date custom field? | wordpress |
I'd like to use the $atts variable from the lax_google_map_maker() function in lax_google_map_init(). How do I access it? I tried to 'globalize' it, but for some reason it didn't work. <code> function lax_google_map_init() { wp_enqueue_script('google-maps', 'http://maps.googleapis.com/maps/api/js?sensor=false'); wp_enq... | G'day mate ;) I've done this by outputting the variables within a script tag right within the body. I played around with your code and came up with this solution: <code> function lax_google_map_init() { // Don't bother loading the scripts if we're in the admin area if ( is_admin() ) { return; } wp_enqueue_script( 'goog... | How Can I Access a PHP Variable in Another PHP Function | wordpress |
Okay, this is what I'm thinking about (and it's not a coding problem right now, but my fundamental thoughts): How to receive / input images in posts for special uses, let's say a customized portfolio post. The post content should not really contain the Work images. These images should be styled specifically in an own i... | Wordpress already does the heavy lifting for you on this. All you need to do is use post thumbnails. If you don't see the featured image meta box on your pages/posts, place the following in your functions.php file. <code> add_theme_support('post-thumbnails'); </code> From there you will need to define a new image size ... | Best way to receive special images in posts | wordpress |
I have a specific category who's page I'd like to look like the home page of my site, with all the nice sliding featured stories, etc. If I create a file <code> category-slug.php </code> , can I do some sort of include of the index template? If it helps, I'm using wootheme's FlashNews theme. | A somewhat ghetto but fast way to do this is to just use <code> get_template_part </code> , for example, <code> get_template_part('index'); </code> A better use for it is to grab "parts" of your template and not a whole index, but it still works. http://codex.wordpress.org/Function_Reference/get_template_part | Include home page template in specific category template | wordpress |
I discovered the 'More Fields' plugin which allows an editor to control which fields appear on which types of items in WordPress. Problem is, I would like to control which pages appear on just ONE page. Example of this: - About page has WYSIWYG editor & Image - Contact page has multiple text fields From the looks o... | Take a look at the Custom Field Template plugin. It supports adding specific custom fields based on various conditions, which range from broad to fine-grained. You can, for example, limit the display of a particular set of custom fields to a particular page id. | Add a field to just ONE page | wordpress |
I was trying to find the contextual help section for all the admin pages so I could add some additional text. The main pages I need to hit are the "Pages" page and the "Widgets" page but I'm not sure where to find the files for these. Anybody know file names where I can find the contextual help? | Do NOT edit core files! You can add to or override the default text by using a filter. Try taking a look at http://justintadlock.com/archives/2011/06/02/adding-contextual-help-to-plugin-and-theme-admin-pages | Editing Help Section | wordpress |
im working on a website where the users can connect with iphone to some functions of it by using a sha1 encrypted password. In other words the plain password of wordpress encrypted in sha1. In the past i did the silly thing of editing the core files of wordpress to get the password when the user register and save that ... | Have a look at Pluggable Functions in <code> /wp-includes/pluggable.php </code> . You can safely replace the password generating/checking functions with your own. | Get password when user registers and save it sha1 into database | wordpress |
I'm trying to add a custom option panel to a new template following a tutorial found on NetTuts. I saved all the code for the option panel inside a file called optionpanel.php (LoL) and everything is working but now I would like to add an Upload/Image button so I'll be able to change images inside a slideshow straight ... | You can either use the Wordrpess Settings API or you can use an options framework. My team built a pretty awesome options framework that's easy to drop into your theme. It's called the UpThemes Framework. You can grab a copy of it at github. https://github.com/chriswallace/UpThemes-Framework To install simply drop the ... | How to save Uploaded image in custom option panel? | wordpress |
In chrome and firefox (and maybe others) the audio link does not render a media controller. E.g. <code> [audio http://example.com/wp/wp-content/uploads/2011/09/file.mp3] </code> In Chrome, view page source show this code in place: <code> <div id="mep_0" class="mejs-container" style="width: 400px; height: 30px; ">... | Your shortcode: <code> [audio http://example.com/wp/wp-content/uploads/2011/09/file.mp3] </code> should be: <code> [audio src="http://example.com/wp/wp-content/uploads/2011/09/file.mp3"] </code> Note the <code> src="" </code> around the filename. | audio link produces black box | wordpress |
I just can't find a way to make it possible to show only current parent items down to current page item in a vertical menu the "wordpress way". What I want to achieve is the following dynamic structure, if I visit Page 3.2.2.2: Page 1 Page 2 Page 3 Page 4 Page 3.1 Page 3.2 Page 3.2.1 Page 3.2.2 Page 3.2.2.1 Page 3.2.2.... | Finally, I solved it myself. Here is the solution: In functions.php : <code> function show_all_children($parent_id, $post_id, $current_level) { $top_parents = array(); $top_parents = get_post_ancestors($post_id); $top_parents[] = $post_id; $children = get_posts( array( 'post_type' => 'page' , 'posts_per_page' => ... | How to show only parents subpages of current page item in vertical menu? | wordpress |
I have this hook created to retrieve user password when he register or update his pass. I dont want my client to touch wordpress core so i was planning to use a hook in wp-includes/user.php All this come from stackexchange-url ("this other post") as i cant find any other better solution MY problem is that the hook is b... | Ok i can pass variables to hook but i was doing it wrong. Code should be: <code> function encrypt_password_function($pass, $id){ global $wpdb; $encrypted=sha1($pass); $wpdb->query($wpdb->prepare("UPDATE wp_users SET iphone_pass = %s WHERE ID = %d",array($encrypted, '10'))); } function encrypt_password($var1, $var... | Pass variable to hook. Its possible? | wordpress |
I've played around with WordPress here and there for a few years and am wondering about problems with CSS validation with WordPress themes. This may seems like a stupid question, but: Is there a reason, relating to WordPress, why it appears no themes I've run across come up error-free in WC3 CSS Validation? I thought o... | There's no reason a WordPress site can't pass validation, it's entirely up to the theme designer. | WordPress & W3C CSS Validation | wordpress |
I've just been trying windows live writer with my WordPress blog. When I upload my posts from WLW to WordPress and then check them in the WordPress editor, they are a hideous mess of tags etc that describe the formatting (e.g. <code> <P> </code> and no line spacing etc), but aren't visible when I create and edit ... | In this post , the poster had a problem of HTML tags being stripped of their opening and closing brackets when posting in WP from WLW'. He explains the source of the problem, and his solution: The issue with the partially stripped HTML tags is a bug in libxml2. Specifically using anything less than PHP 5.2.9+ with libx... | Wordpress and Windows Live Writer | wordpress |
I have a multisite setup and I am adding some additional information fields in the profile edit screen in my theme's dashboard. I am primarily using text fields however I have a drop down selection menu for the author's country <code> <select name="country" class="mid2" id="country" value="<?php echo $userdata-&g... | Wordpress has a great little function built in for handling selections. <code> <option <?php selected('value1', 'value2');?> value='foo'>Bar</option> </code> You can also check out these form handling functions: checked() http://codex.wordpress.org/Function_Reference/checked disabled() http://codex.wo... | Show selected value in a drop down menu | wordpress |
I really like the drop down menu solution of twenty eleven theme: http://twentyelevendemo.wordpress.com/ and would like to create a similar one but I cannot figure how it works, or is it based on some existing code for dropdown menus? Is there any source code that can be used, or can someone explain the principle behin... | I was just doing exactly this recently. Not sure how advanced you are so you may know some of this stuff already. I found this video to be very good (+ it's second part) I think one of the original pieces of research done was this I think Twenty Eleven also uses the superfish jquery plugin As the other poster mentioned... | How to create a drop down menu like in twenty eleven theme? | wordpress |
I would REALLY appreciate some help with this, I have been working on it for a while and am so close to done I can taste it. I need each post format excerpt to have the same excerpt code as the default excerpt (used without post formats) which is provided as "Code 1". This MUST contain the excerpt_wrap and exerpt_insid... | You can utilize the Wordpress function get_template_part(); Create several template files in your theme directory called content-POST_FORMAT_TYPE.php - Example: content-gallery.php and content-chat.php <code> if(has_post_format('gallery')) get_template_part('content', 'gallery'); elseif(has_post_format('chat') get_temp... | Almost Done... Post Format Code | wordpress |
I'm learning how to build a google maps plugin. (I know that there are plugins that add Google Maps, but I'd like to be able to adapt the code to my needs. And it's fun to learn). Unfortunately, I'm not getting a map after inserting my short code. This is the main php file of the plugin: <code> <?php /* Plugin Name:... | Wierd, just re-read your comment and looks like your shortcode is working when you call it that early - if the map-canvas div is showing up. here's the code I tested, also added jquery as a dependency for your custom script & changed some css on you div... <code> function lax_google_map_init() { wp_enqueue_script('... | Problem Building a Simple Google Maps Plugin | wordpress |
At the start of a typical plugin which uses jquery I have something like the following <code> wp_deregister_script('jquery'); wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js', false, '1.3.2'); wp_enqueue_script('jquery'); </code> Which as I understand it deregisters and re-... | Enqueues are not piling up if done multiple times (that is kinda the point of having a queue). As for registration - frankly it shouldn't be done by most (public) plugins. WordPress comes with jQuery to use and when that copy is re-registered to something else - it affects all plugin and theme code that depends on it. ... | should i be checking for jquery before enqueing it in a plugin | wordpress |
I admin a Wordpress blog with a few dozens of users. Since we upgraded to version 3.1+ my users can't insert the YouTube embed tags into a post ( wordpress or TinyMCE removes them ). When I'm logged in as administrator, I can insert the , and tags. But my users cannot. What about the auto-embed ( oEmbed )? Well, my use... | Youtube now supports oEmbed by default as the first option and even automatically highlights the url. Go to the youtube video you want, click share , the url is auto highlighted for you, copy + paste into wordpress, it does not get any easier. | How to allow YouTube object embed in Wordpress 3+? | wordpress |
I'm trying to get all custom post types to appear in my archive sections on a site, including monthly, tagged, author archives. At the moment, I've thought of something like: <code> add_filter('pre_get_posts', 'sw_custom_post_type_includes'); function sw_custom_post_type_includes($query) { $post_type = array('post','cu... | Try this: <code> function sw_custom_post_type_includes($query) { $post_types = array('post','custom1','custom2','custom3'); if ( ! is_archive() && ! in_array( get_post_type(), $post_types ) ) return $query; $query->set( 'post_type', $post_types ); return $query; } add_filter('pre_get_posts', 'sw_custom_post_... | Multiple post types in archives (filter?) | wordpress |
I am writing a plugin that fetches some extended user info from a remote service and I need it to execute its function each time a user logs in. Is there a hook that gets fired after login that I can add an action to? | The action hook wp_login runs when the user logs in - it can run a simple function. <code> function do_anything() { //do stuff } add_action('wp_login', 'do_anything'); </code> The real breadwinner here is wp_authenticate which has a bit of documentation. It passes an array with the given username and password, which gi... | Is there a hook that runs after a user logs in? | wordpress |
I believe this is completely different than the question asked stackexchange-url ("here"). I'm adding pagination to my theme using a filter hook. The output appears at the beginning and end of my content, rather than just the end. My function, in the template's functions.php file: <code> add_filter('the_content','pagin... | you need to set the 'echo' parameter of <code> wp_link_pages() </code> to 'echo=0'; example: <code> $content .= '<div class="pagination">' . wp_link_pages('before=&after=&next_or_number=next&nextpagelink=Next&previouspagelink=Previous&echo=0') . '</div>'; </code> | wp_link_pages output appears twice | wordpress |
I'm trying to add some Jquery scripts to my Wordpress site, and unfortunately I cannot link you to the site as I'm working locally. It seems that the Jquery file is being loaded, as well as the fancyboxStyle I created, but all of the other js scripts aren't loading. functions.php <code> function my_init() { if (!is_adm... | You have multiple errors here. You're including CSS and JS on the same and wrong hook For JS you could use <code> wp_enqueue_scripts </code> For CSS you could use <code> wp_print_styles </code> <code> wp_register_script </code> / <code> wp_enqueue_script </code> only accepts 4 parameters. You should only register your ... | Having problems loading Jquery in functions.php | wordpress |
I am trying to add custom columns to edit-tags.php for a custom taxonomy that I have created. This custom taxonomy is called equipment-types and it only applies to one custom post type called equipment. I am trying to use the same filters and actions that I would use to add custom columns on the edit.php page. I was ab... | You can do this by hooking into the 'taxonomy'_edit_form and edited_'taxonomy' actions. <code> add_action('taxonomy_edit_form', 'foo_render_extra_fields'); function foo_render_extra_fields(){ $term_id = $_GET['tag_ID']; $term = get_term_by('id', $term_id, 'taxonomy'); $meta = get_option("taxonomy_{$term_id}"); //Insert... | Custom columns on edit-tags.php main page | wordpress |
I've found tons of code and plugins to do various things; from show posts for specific cats, subcats of a cat, etc.. BUT, I cannot for the life of me find, nor do I know the WP API well enough to do what I need with it.. Here is what I'm trying to accomplish: Display a UL of all subcats within Cat31, and the posts for ... | Question was answered on another site.. thank you! BTW, the code that accomplished what I needed was: <code> $categories = get_categories('child_of=31'); foreach ($categories as $category) { //Display the sub category information using $category values like $category->cat_name echo '<h2>'.$category->name.'&... | Display list of Sub-Categories and the posts they contain, within one main Category | wordpress |
The wp_posts table seems to retain all revisions of the same, ok very similar but presumably different, posts/pages/whatever. I'm somewhat conversant with SQL but not WordPress. I need to extract just those records which would appear on the public facing site; so just the most recent revision, and not all the supercede... | Rather than constructing query from scratch, it is easier to see what exactly is WordPress querying when API function is used: <code> get_posts(array( 'numberposts' => -1, )); var_dump( $wpdb->last_query ); </code> Gives following SQL: <code> SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.post_type = 'pos... | SQL query to extract only the "current" wp_posts? | wordpress |
Im trying to figure out how Wordpress sites become defaced/hacked. I know development very well. I know how to secure code, etc. But I am finding recently, that tons of Wordpress sites are becoming defaced. Both sites I developed, and others. Is it simply outdated Wordpress installs? Even when Wordpress is running vers... | Even when Wordpress is running version 3.1, sites are still being defaced. Even ? There had been one major and five security releases since that version. If you are implying that 3.1 should be reasonably secure - it is not. but the only answer seems to be outdated Wordpress sites What had you done to exclude themes, pl... | Wordpress Hacks/Defacing | wordpress |
I'm looking for a good plugin for premium blog content. My client wants to offer 30 trial that's free as well as a paid monthly/6 months/yearly plan. It should display an except of the post for everyone even when they're on the site as a guest without any membership, trial or premium. It also needs to receive payments ... | There's plenty out there, http://winkpress.com/membership-plugin/ has a good write up on most of them and stays pretty unbiased. I can't tell you a good one but if you come across Magic Members stay well clear of it. It's buggy as hell and their support staff only help if its an easy fix. When you point out something t... | Membership Plugin | wordpress |
Right now my excerpts are doubling when I use post formats. I would like to have a default excerpt when no post format is selected. Checkout an example: http://themeforward.com/demo2/ For my excerpts, to call post formats I am using this code: <code> <?php if ( has_post_format( 'aside' )) { ?> <span class="ico... | I believe you just need to add some "elses" into your php, like so: <code> if ( has_post_format( 'aside' )) { // do some stuff } elseif ( has_post_format( 'chat' )) { // do some other stuff } elseif ( has_post_format( 'gallery' )) { // do some other stuff } else { // this isn't a post format, so do your final stuff } <... | WordPress Post Format If Statement? | wordpress |
I'm going to move my blog from http://blog.wordfruit.com to http://wordfruit.com/blog the main Wordfruit site is in PHP and the blog is WordPress. I know I can make the change at wp-admin/options-general.php ...I want to make sure I don't create problems when I make that change... Do I not need to create any folders et... | First you should read the Codex entry on domain moving http://codex.wordpress.org/Moving_WordPress But in a nutshell: aside from moving your contents phisically to the /blog location, all you have to do is search and replace every SQL entry for the previous domain (instead of just changing the domain in Wordpress optio... | Moving a blog from a subdomain to a folder | wordpress |
I am running Wordpress (3.1.4) with Slickr Flickr (1.3.2). I built a theme on top of thematic (0.9.7.7). Everything seems to work fine on my local machine and I can render Slickr Flickr galleries in the them templates without issue. However, when I enable the plug in on our server I get this error: <code> Parse error: ... | I am pretty sure this is down to your site running PHP4. I suspect that your server has both PHP5 and PHP4 installed and happens to running PHP4 on this site. You can verify this by uploading a file version.php to your web root folder containing the following PHP command <code> <?php echo phpversion(); ?> </code>... | Plug-in (Slickr Flickr) works on local machine, but not server | wordpress |
I'm trying to add pagination support for some longer posts on my site. I've added the <code> wp_link_pages() </code> function to my single.php file, after <code> the_content </code> , but this causes the pagination links to display under some end-of-post plugins I have (YARPP and Better Author Bio, if that matters). I'... | That's because you have directly edited the single.php file, try to make a function and in it return <code> wp_link_pages() </code> and in add_action set a priority. Try this function <code> function pagination_after_post() { return wp_link_pages(); } add_action('the_content','pagination_after_post',1); </code> My WP P... | Insert pagination links - wp_link_pages() - before filters on posts | wordpress |
Wordpress sites this as an example of how to get the thumbnail: <code> <?php echo get_the_post_thumbnail( $post_id, $size, $attr ); ?> </code> I want to know how can I use the same basic function but just have it automatically get the latest media upload's ID number instead of having to specify the post_id. | I don't think that you can use <code> get_the_post_thumbnail </code> function to get last uploaded media, but you can use <code> get_post </code> to get latest attachment and then wp_get_attachment_image to display images. <code> $attachments = get_posts( array( 'post_type' => 'attachment', 'posts_per_page' => 1,... | Get most recent media upload | wordpress |
i want the plugin to show header image slider with pagination and the images are capable to change threw the admin panel .* integrating via theme *(template part) is very important. I tried wp-nivo and nivo jquery slider but it doesn't support to change the images threw admin panel. am diggingmy head for past 2 days.an... | Have a look at Wordpress Skitter Slideshow . It allows setup of the slideshow images via the WP admin. You can only control one slideshow on your website. | Need Header slider plugin recommendation | wordpress |
I am building a theme and wondering whether or not to include a home.php file or not. The theme (which will not be available to the public) will be mainly used with a static home page and separate blog posts page. My understanding is that including a front-page.php file means that the static home page would be served b... | If you look here [ is_home vs is_front_page ] you'll see that <code> is_front_page() </code> is true regardless of what the homepage is set to in the WordPress settings. This means that if you don't plan on releasing this publicly (i.e. short-run usage) then just having a <code> front-page.php </code> should suffice. <... | What is the advantage of using home.php over index.php for the front page | wordpress |
EDIT 2 : Rather than figuring out the real solution I've decided to use a workaround, and am simply setting the default value for book_in_series to '0'. Thanks to stackexchange-url ("@eddiemoya") for all his the time he spent looking at this with me! EDIT : I had a different question with required posting the full code... | Rather than figuring out the real solution I decided to use a workaround, and am simply setting the default value for book_in_series to '0'. | Way to include posts both with & without certain meta_key in args for wp_query? | wordpress |
I have a form that users fill out. When they finish, they are redirected to a 3rd party site to set up payment options. After completing the payment process, they are sent back to my site with a variety of $_POST variables. My plugin needs to create a thank you page based on those POST variables. It's a simple little p... | Something like this should work, though I'm not sure how meta, title, etc.. will behave, you'll want to test everything thoroughly! <code> function my_template_redirect() { global $wp; $qvs = $wp->query_vars; if (array_key_exists( 'laundry', $qvs && $qvs['laundry'] == 'thank-you' ) { global $wp_query; $wp_qu... | How to create a dynamic page based on form data with a plugin? | wordpress |
Based upon the code found here: stackexchange-url ("How To Add Custom Form Fields To The User Profile Page?") How Could I alter this so that users could check one of several boxes based upon categories I have setup in the blog. E.g. If I have categories: Apples Oranges Bananas Id like these to appear in the User Profil... | here is an example <code> //create the user category fields add_action( 'show_user_profile', 'add_user_categories' ); add_action( 'edit_user_profile', 'add_user_categories' ); function add_user_categories($user ){ ?> <table class="form-table"> <tr> <th><label for="user_categories"><?php _e... | Adding Custom User Profile data based upon Categories | wordpress |
Problem: I couldn't overload the update() method of an existing widget. The widget method and the form method work fine but I can't update the value of the new options defined in the form method. Bellow is how I made that: I want to use the default WP widgets from my custom theme and I need to give them the look and fe... | My colleague ran into a similar issue a while back. He never did manage to track down the WordPress bug but doing <code> unregister_widget( 'Widget_Class_Being_Extended' ) </code> did the trick. | How to overload the update() of existings widgets? | wordpress |
I have a post in two categories, 1 and 2. I want to get the previous post in the two categories, 1 and 2. <code> get_previous_post(true); </code> With that code I'm getting the previous post in category 1 or 2. Any idea? | <code> get_previous_post </code> uses <code> get_adjacent_post() </code> which has a bunch of filter hooks you can use but a much simpler approach would be to create your own function, something like this: <code> // Create a new filtering function that will add our where clause to the query function date_filter_where( ... | get_previous_post in same categories | wordpress |
I am working on a real estate theme. I am using some custom taxonomies such as Listing Purpose and Property type etc. In my add Listing form I am displaying each taxonomy in a dropdown, for which to work accordingly, I need to manually select all the taxonomy values in a post first then I can see the dropdown being fil... | Ok, I figured out how to do it and it was quite simple and I was unable to figure out till now. Thanks to @NetConstructor.com in his reply to the post stackexchange-url ("Saving Taxonomy Terms") made me realize that using get_terms function (which I was already using), there is an argument 'hide_empty' helps to do the ... | getting all values of a custom taxonomy if there is no post | wordpress |
I'm using <code> next_post_link </code> and <code> previous_post_link </code> on my single post templates, to navigate from post to post, so far so good. But if I do a search and click on a result post, then the <code> next_post_link </code> doesn't bring me to the next result post, but to the next post in the default ... | Building on Bainternet's answer above, but making it more generic, I wrote this quick plugin. You can probably modify the link building function at the bottom to do what you want more exactly. <code> <?php /* Plugin Name: Search Context Description: Use search context on single post pages when they're reached from a... | How to use next_post_link and previous_post_link on single posts in search results | wordpress |
I have a widget that works with my theme that expects images named in a certain way, slide1.png, slide2.png, etc... However, when the user uploads their own images, named slide1.png, slide2.png, etc to the media library, rather than updating the images with the new ones, WordPress changes the names of the replacement i... | Here is something i cooked up which was taken mainly from the plugin <code> Overwrite Uploads </code> but without the extra stuff <code> add_filter('wp_handle_upload_overrides','noneUniqueFilename'); function noneUniqueFilename($overrides){ $overrides['test_form'] = false; $overrides['unique_filename_callback'] = 'nonU... | How to force Media manager to overwrite files of same name? | wordpress |
I need a way to restrict authors from uploading a images bellow a specific dimensions. Say I only want to allow uploading images that are at least 400px x 400px. If the image size is smaller, the author should get an error notice that the image is too small. Is there a plugin or code that can accomplish this? | Add this code to your theme's functions.php file, and it will limit minimum image dimentions <code> add_filter('wp_handle_upload_prefilter','tc_handle_upload_prefilter'); function tc_handle_upload_prefilter($file) { $img=getimagesize($file['tmp_name']); $minimum = array('width' => '640', 'height' => '480'); $widt... | How to Require a Minimum Image Dimension for Uploading? | wordpress |
This is a really neat idea but I'd like to expand upon it. In his post, David Kennedy writes out some code to allow a basic <code> wp_list_pages </code> type feature for Custom Post Types to use as a sitemap . His code is as follows: <code> <h2 id="posts">My Post Type</h2> <ul> <?php $terms = get_t... | Here is a quick crack at it, which should work in two level depth: <code> <h2 id="posts">My Post Type</h2> <ul> <?php $not_in = array(); //to avoid naming the same post over and over //get top level terms $Parent_terms = get_terms( 'my_taxonomy', array('orderby' => 'name','parent' => 0)); for... | WordPress sitemap with Custom Post Types | wordpress |
am Having Custom Field named as thumb.i want to show the images using these custom fields.i want to be fix the image size. My code is <code> <img class="thumb" src="<?php echo get_post_meta($post->ID, 'thumb', true) ?>" alt="<?php the_title(); ?>" /> </code> i tried timthumb also like this <code> &... | You'd be better off using the inbuilt Post Thumbnails , which were introduced in WordPress 2.9 - these are easier to use than custom fields and have things like sizing built in. Once you've enabled Post Thumbnails, you can set their default size using set_post_thumbnail_size and then use them in your theme with the_pos... | How to Resize the Custom Post Images? | wordpress |
I want to give the Editor Role access to editing the sidebar and it's contents. I have a text widget in there and in order to edit this text widget the user needs to be an admin - this sucks. How do I grant permission to the Editor Role that will give him access to edit the sidebar? | The <code> edit_theme_options </code> capability should allow the user to edit the sidebar as described on this page : http://codex.wordpress.org/Appearance_Widgets_SubPanel Code to add to <code> functions.php </code> <code> $role = get_role('editor'); $role->add_cap('edit_theme_options'); </code> Edit: This should ... | Give Editor Access To Sidebar | wordpress |
I need to edit the "Help" section of the "Page" page in the Admin panel. Since wordpress doesn't allow multiple line breaks I need to make sure the user knows that if they add the " " tag in the HTML section they will achieve the line break so I figure what better place to add this than the help section. I can't seem t... | You can add the custom help by adding a hook to the page load e.g. <code> page-new.php </code> would become <code> load-page-new.php </code> <code> function custom_help_page() { add_filter('contextual_help','custom_page_help'); } function custom_page_help($help) { $custom = "<h5>Custom Help</h5> <p>Cu... | Where can I edit Admin Panel Page file | wordpress |
I've created the following custom post type (lugares means places) with a custom taxonomy of tacos and it works fine form the backend: <code> /** * Custom post-type lugares **/ add_action('init', 'lugares_register'); function lugares_register() { $labels = array( 'name' => _x('Lugares', 'post type general name'), 's... | It turned out that there was a difference between the custom post type's name and the type I added in the form. One was "lugares" and the other one was "Lugares". From this, I asume capabilities were broken. Rebuilt the register post type like so: <code> add_action('init', 'lugar_register'); </code> function lugar_regi... | Trying to save custom post type from frontend partially working | wordpress |
I am confused about the exact purpose attachment.php ( and image.php) . I notice many themes dont have them. If single.php displays the image the way I want then is it OK to leave it out. On the other hand could i just make a copy of single.php for attachment.php and leave out the sidebar. The other thing that confuses... | This is part of the WordPress template system, it allows you to drill down and further customize output based in the template hierarchy, for instance if you want the attachments to have separate functionality/style then your <code> single.php </code> , you simply create <code> attachment.php </code> or go even further ... | attachment.php code or tutorial | wordpress |
My WordPress site uses a theme that is a child of a parent theme. As required, both themes have style.css files. However, as far as I can tell WordPress only provides the mechanism to load the child theme style.css file. How do the parent theme styles get loaded? Is it necessary to manually import the parent theme's st... | At the top of your child themes style.css add: <code> @import url("../twentyeleven/style.css"); </code> Obviously replace <code> twentyeleven </code> with your parent themes folder. | How to load parent theme style.css? | wordpress |
hey i got a slightly weird problem.. i got a form enabling login in certain single's according to the cateory and user level.. it works great but the server which is windows (where the website is hosted on returns the wrong "current page" value Meaning.. this: <code> 'redirect' => site_url( $_SERVER['REQUEST_URI'] )... | based on the changes seen in the diff on this trac ticket: http://core.trac.wordpress.org/ticket/17243 i've adjusted my redirect to the following <code> 'redirect' => ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] </code> and this seems to work for WP when it is in a subfolde... | Login redirect problem | wordpress |
I have the following ALMOST working perfectly, but have run into a couple of issues. Right now this displays a Books archive page, ordered like this: Genre Name -- Series Name --- Books within series, sorted by book-in-series (aka reading order) Which is fantastic - I can't tell you how long it's taken me to get to thi... | I've solved this with a custom select query; here's the full code for posterity. :) <code> <?php // QUERY THAT PULLS ALL SERIES SORTED BY GENRE, THEN MENU ORDER $querystr = " SELECT $wpdb->posts.* FROM $wpdb->posts, $wpdb->postmeta WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id AND $wpdb->postmeta... | Sorting within nested queries / multiple meta keys | wordpress |
I have a wp_query that gets all custom post types in ascending order from today, to list some events on a site of mine. While this works fine: <code> $args = array( 'post_type' => 'events', 'posts_per_page' => 5, 'orderby' => 'meta_value', 'order' => 'ASC', 'meta_key' => 'my_special_date', 'meta_value' =... | Simple solution: orderby => meta_key still needs to be set as meta_query does not handle ordering. Also, I was comparing char data as numeric. | meta_query, number comparison, not quite working as it should | wordpress |
Everyone! I am new to WP and trying to build a plugin. I have the following codes working properly: <code> add_filter('the_content', 'say_hello'); function say_hello($content){ if(is_single() || is_page()){ print $content." Thank you for reading!"; } else { print $content; } } </code> But the following codes don't seem... | <code> init </code> is too early for conditional tags , use <code> template_redirect </code> instead. have a look at the action reference to see the order they're executed. | Same Conditionals Not Working on Two Different Hooks | wordpress |
bear with me here as I explain my problem. Generated menu via wp_nav_menu, so I have use of the .current_page_item class. The thing is, I've used jQuery to replace the generated link text with some custom images that I have made and I have to use jQuery now to swap out the image so that the button looks "underlined". N... | There's a site option for <code> page_for_posts </code> , so you might try <code> if ( is_page( get_option('page_for_posts') ) ) </code> . Edit: According to the Codex, <code> is_home() </code> will tell you if you're on the blog page when you have a static front page: http://codex.wordpress.org/Conditional_Tags#The_Ma... | How to test if blog page is active | wordpress |
I have a custom post type running fine, but some of the text in the page is the same for every post, so I want to add it in using a function. I have this set up: <code> function new_default_content($content) { global $post; if ($post->post_type == 'custom-post-type') { $content = 'Test text here'; } return $content;... | You're completely overwriting the content instead of appending it. You need to do something like <code> $content .= 'Test text here'; </code> instead. | How to appending to the_content using add_filter with custom post type? | wordpress |
In edition to this post below: stackexchange-url ("wordpress json custom taxonomy problem") How to write a method for getting categories withing a custom taxonomy, similar to Method: get_category_index in core json api controller? Scenario: I have a taxonomy called - books which has four categories and i need those cat... | To list terms of custom taxonomy in your case <code> books </code> we will need to create a custom controller for JSON API. Step 1: Following 2 classes should be paste in a php file stored in your theme directory (you can store the file whereever you like but then you will have to make sure you return the correct path ... | Wordpress json api taxonomy index method | wordpress |
I've recently created a custom post type, however each time an update is saved the contents of the meta field disappears after a few minutes. Is this a bug? <code> <?php // CUSTOM POST TYPE 1 add_action('init', 'ootb_tenant_register'); function ootb_tenant_register() { $args = array( 'label' => __('Tenant'), 'sin... | try this: <code> // CUSTOM POST TYPE 1 add_action('init', 'ootb_tenant_register'); function ootb_tenant_register() { $labels = array( 'name' => _x('Tenants', 'post type general name'), 'singular_name' => _x('Tenant', 'post type singular name'), 'add_new' => _x('Add Tenant', 'tenant'), 'add_new_item' => __('... | Custom post type not saving | wordpress |
I have a Wordpress site and a web application that can be used only by the registered (Wordpress) users. Now I'm loading <code> wp-blog-header.php </code> to check if the user is logged in. Everything is working fine but because on every request (including AJAX) I have to load the Wordpress core also, it slows down my ... | If I had to do this, I'd use my own cookie to determine login and only load WordPress to check when necessary. The wordpress_logged_in_{some-hash} cookie can be used to determine the user, and WordPress uses it to determine same. You can't easily reimplement that, but you can use it without loading WordPress on multipl... | Is there a way to use the Wordpress users but without loading the entire Wordpress core? | wordpress |
I'm getting this error every time I add an item (page, post or category) to my menu system: Warning: Invalid argument supplied for foreach() in /home/rootname/public_html/wp-admin/includes/plugin.php line 1261 I also can't insert links to internal pages from within the WYSIWYG editor (no pagesappear in the list). I gue... | i also had this problem. the problem is that you are adding action to *admin_init* ... try something like this: <code> add_action( 'admin_menu', 'remove_unused_menus' ); function remove_unused_menus() { remove_menu_page('link-manager.php'); remove_menu_page('edit-comments.php'); } </code> notice the use of *admin_menu*... | Can't insert internal links and menu errors appearing | wordpress |
The wordpress tag is used to display code on a page (refer to: http://themeforward.com/demo2/2011/09/12/code-tags-in-post/ ) but I am having a hard time finding a function that will number the lines of code, as seen on http://themeshaper.com/2009/07/02/wordpress-theme-search-page-template-tutorial/ Does anybody know wh... | To get syntax highlighting with line numbering, you'll need to use a plugin like SyntaxHighlighter Evolved . In fact, looking at the source of that second link, it appears that they are using SyntaxHighlighter Evolved themselves. | Numbering lines of code with the <code> tag? | wordpress |
I have moved my website to a VPS server. It is a Wordpress + Buddypress installation, latest versions. I don't understand why I can't see anything when I visit my site with Lynx - a text browser. I can see other sites using wordpress on the same server, but this one doesn't work. Also blogs created on the platform also... | I have found the problem, there was a plugin activated for mobile browsers support - Smooci (WordPress on Mobiles). The plugin was enabled, and no theme chosen for it. So instead showing the default theme, the plugin, broke out my website - showing nothing/blank page on mobiles. Unfortunately the same plugin could not ... | Weird google bot crawl problem | wordpress |
I’ve created a custom post type (called Sponsors) with an additional taxonomy connected to it, called “Type”. Everything is essentially working perfectly but I would very much like to have my taxonomy “Type” to be a dropdown menu instead of the usual “type and search or create a new”. The reason is, that I’ve created s... | This suppose you have a custom post type "sponsors" and a custom taxonomy "types"... <code> function custom_meta_box() { remove_meta_box( 'tagsdiv-types', 'sponsors', 'side' ); add_meta_box( 'tagsdiv-types', 'Types', 'types_meta_box', 'sponsors', 'side' ); } add_action('add_meta_boxes', 'custom_meta_box'); /* Prints th... | Custom Taxonomy as Dropdown in admin | wordpress |
I need to add star ratings to one of my custom post types. At first I coded them myself but when the rating challenge came along i thought about using a plugin instead, so I used easy post types. I've tried a couple star rating plugins and none of them seem to work. For example, with WP-PostRatings, I used the next cod... | For any rating functionality I always turn to GD Star Rating by Milan Petrovic. This plugin can do SO many things, including thumb rating, rating of comments, multiple ratings, etc. It can also handle Rich Snippets (for getting your star ratings shown in Google SERPs), caching mechanisms, etc.. In short, it can do a lo... | Star rating for custom post types | wordpress |
I have the following: <code> <?php $num_cols = 2; // set the number of columns here $args = array( 'post_type' => 'testimonials', 'posts_per_page' => 4, 'orderby' => 'ID', 'include' => '883, 563, 568, 106', 'order' => '' ); query_posts($args); if (have_posts()) : for ( $i=1 ; $i <= $num_cols; $i++ ... | use <code> post__in </code> : <code> $args = array( 'post_type' => 'testimonials', 'posts_per_page' => 4, 'orderby' => 'ID', 'post__in' => array(883, 563, 568, 106); ); </code> | Order by & include array by specific post ids | wordpress |
I'm attempting something more complex than I've ever done before with WordPress, so please forgive me if this question doesn't make sense. I have a Books archive page and want it to display excerpts from my custom post type "Books", sorted first by Genre, then by Series, then by Reading Order. So it would look like thi... | When you need to retrieve and present a lot of information there is bound to be complexity. Mostly it is finding right balance between complex querying and complex sorting in PHP (which is often overlooked option). Your logic looks mostly fine, what could use tweaking as for me: <code> Genre </code> seems more like a t... | Too many nested wp_query loops in this hypothetical query? | wordpress |
I´m using several similar loops to loop in content from different categories into different containers. If there are no posts in category X then it shouldnt open any container at all. Same with all loops. I´ve done this before, I open the container after "have posts" and put the divs belonging to each posts after "the ... | Let's throw everything, but loop out: <code> if ($my_query->have_posts()) { // open container around all posts while ($my_query->have_posts()) : $my_query->the_post(); // output for every post endwhile; // close containers around all posts } </code> As you see: output of posts goes inside <code> while </code> ... | How to end this loop properly? | wordpress |
I'm using <code> <marquee> </code> in my homepage , I want to use jquery marquee instead , I've added script in my header , in usage it says i have to use "$('marquee').marquee(optionalClass);" , how and where i have to use it ? | WordPress comes with copy of jQuery bundled. See <code> wp_enqueue_script() </code> documentation for how to: Register you script properly and make it load jQuery as dependency Use required noConflict wrapper so you can use jQUery functions (simply <code> $ </code> won't work in WP). | How to use JQuery Marquee in Wordpress? | wordpress |
I moved one of my wordpress site to an AWS instance. But once I got it working, noticed that none of the notifications or contact emails were being sent through. On researching the issue, I found that if I set the SMTP server to be an external SMTP (my AWS instance doesn't have one), it should work. I don't need member... | The plugin WP-Mail-SMTP has always worked for me. This is with the Contact Form 7 and many others as it replaces the WP Mail functions directly. http://wordpress.org/extend/plugins/wp-mail-smtp/ | Using SMTP for outgoing mails (PHPMailer) on AWS instance? | wordpress |
My query is on Wordpress and related to categories. I have a set of categories for my posts: All, Cat-a, Cat-b and Cat-c. a. When I click on the link to my posts page, I want to show an archive for 'All'. How do I generate a link to 'All' explicitly? Something of this kind? <code> <a href="<?php bloginfo('url'); ... | On the Codex page for <code> wp_list_categories() </code> , you can see the two following arguments that might help you: <code> hide_empty </code> : Toggles the display of categories with no posts. The default is <code> true </code> (hide empty categories). <code> current_category </code> : Allows you to force the <cod... | Categories Listing and Highlighting current category item | wordpress |
When I click on the album it takes me to the gallery page and it displays the image in a lightbox. Is it possible to show to the images at the same page instead of it taking me to the gallery page? | Go to: Admin panel -> Gallery -> Options -> Gallery and set the checkbox: "Deactivate gallery page link" "The album will not link to a gallery subpage. The gallery is shown on the same page." | Open NextGen gallery in same page? | wordpress |
I'm using WPML to translate a website. The only major issue I have with WPML is that you cannot have a page in different languages with the same slug. Therefore www.example.com/contact/ and www.example.com/fr/contact/ is not possible. To get around this I was thinking of saving the french version as www.example.com/fr/... | i'm not familiair with WPML, but i do know that qTranslate has the feature your describing. | Manipulate Permalink | wordpress |
From my reading it seems there is a good case for loading scripts like jquery and dependencies into the footer as a preference if possible; however 2 things confuse me which. Firstly the default for wp_enqueue_script() is to put the script in the footer and second (and possibly related) there is a line from the codex N... | There is a lot of leftovers in script-related articles in Codex that are not entirely correct (putting it mildly). The enqueue should not be done before <code> wp_head() </code> , it should be done on <code> wp_enqueue_scripts </code> . Which is technically early inside <code> wp_head() </code> . It doesn't harm perfor... | jQuery in header or footer | wordpress |
i'm looking for a way to show an exit page or message when a user leaves my site. we have a uk version of our site, and some of the nav links lead back to our us site. i want to let users know that they are leaving the uk site and "are now being redirected to this page at our us site. you will be redirected in 10 secon... | In case it helps anyone else, i worked out how to do this using the Better Wordpress External Links plugin and creating a page in root called exit.php in the plugin settings under "Prefix external links with" i chose "a custom url" and entered - http://mysite.com/exit.php?redirect= I also checked the box next to "Proce... | how to create site exit messages with destination url displayed | wordpress |
I'm a WPAlchemy enthusiast, this class really enhance my productivity, but there is some things I don't understand. I started to create a custom post type for products , with description, price and available stock. Then I added some columns to this custom post type listing like the price and stock. And then, I tried to... | Your meta values are being stored as an array under a single field. You have to store them as individual fields to use them in queries. See this explanation on WPAlchemy data storage modes. | Custom sortable column with WPAlchemy | wordpress |
I used <code> // Delete Post Link function wp_delete_post_link($link = 'Delete This', $before = '', $after = '', $title="Move this item to the Trash", $cssClass="") { global $post; if ( $post->post_type == 'page' ) { if ( !current_user_can( 'edit_page' ) ) return; } else { if ( !current_user_can( 'edit_post' ) ) ret... | Try using these delete links instead. Yours don't seem to be formatted right. For delete: <code> $delLink = wp_nonce_url( admin_url() . "post.php", "post=" . $post->ID . "&action=delete"); </code> For trash: <code> $delLink = wp_nonce_url( admin_url() . "post.php", "post=" . $post->ID . "&action=trash"); ... | Delete Post Link to delete post, its meta and attachments | wordpress |
I've long been impressed by TechCrunch's Facebook comments, is there a plugin for WordPress self-hosted websites which achieves the same effect? | This is the official Facebook plugin: http://wordpress.org/extend/plugins/facebook/ supported both by Facebook and Automattic. Give it a spin. | Is there a plugin that can replace WP comments with Facebook comments as used by TechCrunch? | wordpress |
I'm trying to track registered user activity, specifically, when they click a link to a file for download. The filesystem plugin is WP-Filebase. I found that when I added a click() handler through jQuery, it wasn't happening, so I switched to a mousedown() handler for my Ajax-based tracking. What appears to be occurrin... | It's a good idea to prevent mixing your click/mouse handling. In the past when faced with the same problem, I've used one of two approaches (depending on my mood at the time): Mouseup Rather than use <code> mousedown </code> , use jQuery's <code> mouseup </code> event . <code> Mousedown </code> is typically stepped on ... | Ajax mousedown call getting "cancelled" when clicking link | wordpress |
How can I extract the width of an image as defined in <code> add_image_size </code> for use as a template variable? For example if my theme defines the size small as <code> add_image_size( 'small', 195, 146, true ); </code> 195 would be the variable. I am trying to build a dynamic mshots url. | Generally speaking, there's no need to do this. However, if it's one added using <code> add_image_size </code> , it will be in the $_wp_additional_image_sizes global. <code> global $_wp_additional_image_sizes; echo $_wp_additional_image_sizes['small']['width']; </code> | How to extract image width from add_image_size? | wordpress |
I downloaded the WP-syntax plugin and want to customize it to show a black terminal-style background. I edited the file <code> wp-syntax/wp-syntax.css </code> to <code> .wp_syntax { color: #100; background-color: black !important; border: 1px solid silver; margin: 0 0 1.5em 0; overflow: auto; } /* IE FIX */ .wp_syntax ... | Plugin documentation instructs to copy style file to theme's directory , rather than edit it in place (which would make it incompatbile with updates and such). Other than that this seems like CSS issue and has little to do with WordPress. Some time with Firebug+Firefox or other debug tool usually solves such. | Customizing WP-syntax to get custom colors | wordpress |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.