question stringlengths 0 34.8k | answer stringlengths 0 28.3k | title stringlengths 7 150 | forum_tag stringclasses 12
values |
|---|---|---|---|
I'm working on a news website. (wordpress.org) I want to add a quote on the header with an image. Please have a look at this For this I want to add a check box on the post publish section (post.php) like this Please guide me on how to do this, should I use custom field or what? should i try custom metaboxes... or custo... | I think using CPT may not be necessary as we already have post formats . Trun on "Quote" post format and their you can add the quote, the image as featured image. And on the header section just query for the post format and show the latest one or use jquery if you like to have multiple on a slider. You can use a post m... | Post Quote with image on header for news site | wordpress |
I am using <code> All in one Events Calendar </code> plugin to add the events. It works fine in CMS. I would like to display the events data in mobile version. for this i used <code> JSON-API </code> for obtaining web-services in json format. To obtain all events , I dint find any plugin which will full-fill my require... | I had to do the same thing. I used the JSON API plugin and had to create a new controller for JSON API that read the specific data out of the tables that All-in-One created. Unfortunately there really were not the right calls in the calendar plugin to access all the data (or at least on the older version I used this fo... | How to get all events from 'All in one Events calender' plugin in JSON format? | wordpress |
How do i get the list of categories as wp_list_categories does but using get_categories and then displaying the links in a foreach loop. The reason is i want the links to point to the current page with [?search-type=normal&s=cat_name; ] instead on pointing to the category url. This will then filter the results when... | <code> get_categories() </code> is handy function to get list of categories with all information such as id & name of each category etc. This code might work. The <code> $category->term_id </code> will return the unique id for each category and <code> $category->name </code> will return the name to display to... | Category List with custom urls | wordpress |
I know how to disable <code> TinyMCE </code> default buttons with <code> add_filter('tiny_mce_before_init') </code> using <code> theme_advanced_disable </code> parameter, but a button added by a 3rd party plugin seems impossible to hide with <code> tiny_mce_before_init </code> The available array with <code> add_filter... | I've found that you can manual set availability button by this attribute <code> theme_advanced_buttons1 </code> (for button in row 1) Example : <code> function disable_mce_buttons( $opt ) { //set button that will be show in row 1 $opt['theme_advanced_buttons1'] = 'bold,italic,strikethrough,|,bullist,numlist,blockquote,... | How to disable tinyMCE button added by a plugin? | wordpress |
has anyone tried to implement Aviary API and wordpress successfully? I am looking for a tutorial or guide of some sort. | I just Finished a part of my theme framework which Integrates aviary editor to WordPress media library and since i was asked, I released it in a plugin form Aviary Editor | Aviary + Wordpress Media | wordpress |
Searching about options page, I found a lot of themes that uses a options theme page like this one: There is an pre-built option? What framework do you advise? Thanks | Don't forget the Option Framework Theme and Plugin . They are killer solutions IMO. | Options Theme - Wordpress | wordpress |
2 days ago I asked stackexchange-url ("this") then I tried to work on my code to be able to understand how ajax and php work and now I have a new issue that, probably would be easily solved. These are my codes: <code> <?php /* Template Name: Nuovo form */ ?> <html> <head> <script src="http://ajax.g... | That will not work because you are referring to a single php file, instead the the whole WordPress environment. There's a easier way to use ajax in WordPress. Use <code> admin_url('admin-ajax') </code> as the form action, then put the function that will answer the ajax call in the theme's functions.php. More detail her... | Use ajax to update_post_meta | wordpress |
I want to have a link in the wordpress menu pointing to the latest post of a specific category. Because I am not able put a dynamic URL in the wordpress menu, my approach was to put a page with a custom page template in the menu. This page template should behave like the themes <code> single.php </code> but showing tha... | You can filter <code> wp_nav_menu_objects </code> and add a new item. Here is a simple plugin doing that: <code> <?php # -*- coding: utf-8 -*- /** * Plugin Name: Latest Post In Menu * Description: Append a link to the latest post to all nav menus called with the argument <code>'add_latest_post' => TRUE</... | Dynamically link to the latest post or simulate request of specific post in page template | wordpress |
I tried to do it myself but I have really hard time with Regex (regex is hell. I just don"t understand). Anyway, I think this would be usefull to some people. The context is that we use a plugin to display images in post in a lightbox. It works only if we create the link to the file (the image) and NOT the attachment p... | So I have completed a way to replace links to attachments pages for images, and replace them with not only the url to the <code> img </code> tag, but to the large version of the image file. I'm not using regex because it's evil and I don't want to make kitten dies. It working for me, so I share as a starting source for... | Replacing with(out) regex link to attachment by links to files | wordpress |
Suppose I have a shortcode called <code> [item] </code> , which I have used 20 times in a particular post. Is it possible, from within the shortcode handler function, to know what the numerical index of the given <code> [item] </code> is? Like, whether this is the 1st <code> [item] </code> in the post, or the 16th? I k... | If you're using a class, it would be <code> class MyShortcode { static $instance = 0; function __construct($args = array()) { add_action( 'init', array(&$this, 'init') ); } function init() { add_shortcode('myshortcode', array(&$this, 'shortcode')); } static function shortcode($atts) { //this is the code of your... | How to check if this is the nth instance of a given shortcode in a post | wordpress |
Right now I'm submitting a drop-down form to it's own page (action="") to filter posts displayed. I'd like to not have to refresh the page, which resets the forms. Is there a way to query posts/filter them using ajax? | I'd go with @Vinicius' answer with the following changes: Change <code> type: 'GET' </code> to <code> type: 'POST' </code> Change <code> ajax: 1 </code> to <code> action: 'filter_posts' </code> Replace <code> add_action('init', 'check_ajax'); </code> with: add_action('wp_ajax_filter_posts', 'check_ajax'); add_action('w... | Use Ajax To filter posts? | wordpress |
How can I completely remove the custom fields and the collapse button in the Edit Post/Edit Page custom screen, but without removing the capability to add custom fields with a PHP function? | http://codex.wordpress.org/Function_Reference/remove_meta_box <code> function remove_custom_meta_form() { remove_meta_box( 'postcustom', 'post', 'normal' ); remove_meta_box( 'postcustom', 'page', 'normal' ); } add_action( 'admin_menu' , 'remove_custom_meta_form' ); </code> HTH | Force hide custom field metaboxes | wordpress |
I have no idea why this is happening. I've read A LOT about it and there don't seem to be any solutions. I once read that it was expected behaviour because of some plug-ins and that the Hotfix plugin would fix it but that wasn't the case. However, if I go to the actual media gallery through the sidebar, I can see all m... | This is a little known error caused by creating a custom taxonomy called 'type'. To solve just need to change the taxonomy's name. | Media Library not showing images but still acknowledges existence | wordpress |
I'm really new to Wordpress. I just installed it following the instructions here http://codex.wordpress.org/Installing_WordPress_Locally_on_Your_Mac_With_MAMP and I'm wondering what to do next. I already have an account and a website set up, and how do I edit that website now on my computer? any input would be really a... | from your description, its time to visit your localhost/wordpress/wp-admin/ and login | How to edit pages after installing WP | wordpress |
I am using WP_Query to sorting the post by user input. The input contains meta value which is display in select type field. Normally when there is value inserted into the form, the wp_query working fine. But how about when the user want to sorting all the posts regardless what the meta is value is? Here is what I mean:... | check if the $GET['rating'] is set ( isset($_GET['rating']) or has any value. ( !empty($_GET['rating']) if not, build the query fecthing all post without 'meta_query' for example: <code> if ( (isset($_GET['rating']) && !empty($_GET['rating']) ) { // restrict $meta[] = array(( 'key' => 'rating', 'value' =>... | Meta_query with or without value | wordpress |
I created and added a banner to my plugin page http://wordpress.org/extend/plugins/dbc-backup-2/ but there was a spelling mistake so I deleted & committed a new verison. After I added the new image back in the SVN - it's still showing the old one. So I know that the CDN has cached the image for a very long time. I ... | This was discussed on the WP Hackers mailing list . On Tue, Jul 31, 2012 at 7:15 PM, Dion Hulse (dd32) wrote: s-plugins.wordpress.org is a Externally hosted CDN - Edgecast to be specific. Right now, the only way is to wait for it to update, the Edgecast CDN has a long cache expiry time, so WordPress.org needs to be upd... | WordPress.org how to force expire Cached Banner-772x250 from my Plugin page | wordpress |
Upon logging into the dashboard, I am presented with a blank white page, tho the front end of the site works fine. I am pretty sure its due to a white space oposed to a plugin issue, but not sure where the white space could be hiding, I have checked wp-config and functions to no avail, any way to sniff them out? Thanks... | What your seeing is probably a PHP fatal error, however your server will be configured to log them to the error log rather than present it on the frontend. To find out what the error is, check your error log, or alternatively, if you don't have access to the error log or enabling the error log is not an option, you cou... | blank white page in admin, white space hunting? | wordpress |
I would like to remove some items from the quick edit screen on a custom post type. I would like to remove "slug", "date" and "password", as they will never not be used by end users. I'm open to any suggestions! | There's no hooks to modify the Quick Edit, it has to be done with CSS and/or jQuery. The plugin Adminimize is very good to hide administrative elements, CPTs included. But in the Quick Edit box, for lack of CSS classes or ID's to target, it is not possible to hide the slug field, and only possible to partially hide the... | Remove specific items from Quick Edit menu of a Custom Post Type? | wordpress |
Okay so I've spent the last few weeks (on my spare time outside of work) creating a site for a client with a custom built theme. This is my first use of wordpress and the site can be seen here at http://portwashingtonmama.com I have a bunch of different static pages. For example, if you go to the first page in the nav ... | Looks like your "local" "pretty close" and "further away" is only title text on the page and is not actually linking somewhere. You can simply make each venue into a post and under "local" "pretty close" and "further away", add a link to the post after their description/introductions. This way they retain their categor... | Posts vs. Pages | wordpress |
I have Wordpress installed in the root directory, and plan to use the <code> domain.tld </code> as a portfolio and <code> domain.tld/blog </code> as personal blog site. Since the <code> blog </code> keyword is reserved in Wordpress and can't be used for creating any child site, I tried changing the reserved words defin... | the main problem is that you should never alter core files ... the next time WordPress does an update it might overwrite the file you just changed. you should not have needed to use a multisite for your scenario - you can have a portfolio and blog in the same setup using plugins or a great theme (even without using som... | Using "/blog" as a site with Wordpress Multi-Site | wordpress |
I'm looking for a way to only allow users to create new subpages once there are nine pages that are parents/root pages. Once there are nine parent pages when trying to create a new parent the users will get an error message. Edit: Moved from the comments to @brasofilo s answer below: when I press submit it processes as... | Code based in Bainternet's answer to this question: stackexchange-url ("Make Categories and Tags required in admin") See code comments. <code> add_action( 'admin_head-post-new.php', 'wpse_59770_publish_admin_hook' ); add_action( 'admin_head-post.php', 'wpse_59770_publish_admin_hook' ); add_action( 'wp_ajax_wpse_59770_p... | Only allow new subpages to be created | wordpress |
When I enter content in posts/pages' WYSIWYG editor, I do not get <code> <p> </code> when ending paragraphs, just <code> &nbsp </code> s. If I manually place <code> <p></p> </code> in the HTML mode, they are stripped as soon as I switch to 'visual' mode. This is repeated in several sites (I though... | I have done extended research and found the answer - I am now using a hook on 'tiny_mce_before_init'. Based on stackexchange-url ("other answers") (special thanks to answer #2 stackexchange-url ("@Chip Bennett")), I have used the following code in my functions.php to secure the paragraph breaks (in the editor HTML mode... | Stop editor from removing tags and replacing them with nbsp | wordpress |
The function <code> the_tags(); </code> gives output as: <code> Tags: tag1, tag2 </code> . But I want to get the tags only without the text <code> Tags: </code> . How can I use the function so that it does not out the text`? Thanks. | Use something like <code> <?php the_tags('', ', ', '<br />'); ?> </code> From Wordpress codex for the_tags() : <code> <?php the_tags( $before, $sep, $after ); ?> </code> Parameters $before (string) Text to display before the actual tags are displayed. Defaults to Tags: $sep (string) Text or character ... | How to remove Tags: text from the_tags? | wordpress |
I have the wordpress category widget installed on my website that lists all categories/subcategories on my site and their hierachy: <code> Watch Accessories (1) - Straps (1) Watch Glossary (5) Watch Guides (1) - Maintenance (1) Watch News (2) - New Releases (2) Watch Reviews (7) - Christopher Ward (1) - Hamilton (1) - ... | This is a matter of your template. To display the subcategories in a list view as well you would have to customize the template. I do not know what kind of template you use and how the file is named which displays the subcategories, but you could change it so that it displays the articles of the current category. There... | How to display subcategory articles in the category view? | wordpress |
It seems to me that twentyelven opens standard single posts using the file <code> content-single.php </code> yet when I try the same code and files they open for me in <code> content.php </code> here's the code I have in index.php <code> <?php get_template_part( 'content', get_post_format() ); ?> </code> ... then... | There's actually nothing to fix. In Twenty Eleven, this is used in <code> index.php </code> : <code> <?php get_template_part( 'content', get_post_format() ); ?> </code> ...and this is used in <code> single.php </code> : <code> <?php get_template_part( 'content', 'single' ); ?> </code> The design intent here... | How do I get standard posts to open up in their own template when using get_template_part()? | wordpress |
Ok, so I want to embed youtube videos but also remove the annoying annotations. The following code works great from to embed the video <code> [embed width="599" height="360"]youtube.com/watch?v=mNf0v2WkV0U [/embed] </code> But whatever I seem to do, I cannot add the following parameter: <code> iv_load_policy=3 </code> ... | Managed to do it, <code> <iframe frameBorder="0" probably_logged_in="0" width="599" height="360" src="youtube.com/embed/…; frameBorder="0"> </code> (the B in border must be caps) <code> probably_logged_in=0 </code> (removes the watch later button, as long as the user isnt logged in) <code> modestbranding=1 </code... | Youtube parameters within WordPress embed code? | wordpress |
I'm trying to move back to WP for our blog, after struggling with a clunky CMS for a few years, but we'll be sticking with that CMS for the rest of the site. Is there a plugin (or code) that I can use to pull the recent posts in a particular category from my WP blog to the sidebar of my non-WP site? Assume full permiss... | The easy way is to just use a PHP based reader and parse/output the results. Maybe your CMS already has one but if not and it's based on PHP you can use, MagpieRSS SimplePie Simplexml Then you simple point it to your categories /feed, like --> <code> www.example.com/your_category/feed </code> You can easily customize a... | Show recent posts from one category on a non-WP site | wordpress |
I want to block a directory to everyone but WordPress's internal upgrade feature (I am trying to get WordPress to do auto-updates of my premium plugin). I have it updating, but I really would like to block the directory for everyone but WordPress. Anyone know what WP's internal User Agent is? | The WordPress user agent is set in the class <code> WP_Http </code> as <code> 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ) </code> You can set it to a (secret) fixed value per filter: <code> add_filter( 'http_headers_useragent', 'wpse_59788_user_agent' ); function wpse_59788_user_agent() { // to remove thi... | Does WordPress have an Browser Agent? | wordpress |
I've won a sweet managed VPS hosting package with Anchor (VPS D), and I'm looking for recommendations on how to set up the server. Anchor will setup apache or nginx for me - but which should I choose?! My considerations are: I'm concerned that there'll be a big configuration shift between my staging server and the clie... | Anchor will setup apache or nginx for me - but which should I choose?! Based on your concerns, I'd recommend Nginx -> Apache stack. Please let me explain. By default, Nginx can only process static content, such as images, CSS and JS files. Nginx passes PHP requests to PHP-FPM or to other servers such as Apache. Nginx c... | Recommendation for server config for Wordpress Staging servers | wordpress |
OK I'm trying to show my principal menu so I use the following code: <code> <?php $defaults = array( 'theme_location' => '', 'menu' => '', 'container' => false, 'container_id' => '', 'menu_class' => 'menu', 'menu_id' => '', 'echo' => true, 'fallback_cb' => 'wp_page_menu', 'before' => '', '... | your walker class is almost perfect for what you need @Gab. instead of line 21: <code> $output .= '<li>'; </code> move it down just before line 38 <code> $output .= apply_filters( 'walker_nav_menu_start_el' [...] </code> and change it to something like <code> $output .= $indent . '<li id="nav-menu-item-'. $ite... | wp_nav_menu, walker class, categories as classes of li | wordpress |
I am using <code> JSON API </code> for getting web services.. I have 80 records in my <code> wp_posts </code> table . I need to display 10 , 10 records so that my mobile app will be faster. I used the following method in this <code> http://mysite.com/api/?json=get_category_posts&slug=mediapr&count=84 </code> he... | First, there's the debug query arg: <code> ?dev=1 </code> , which you can simply append to the URl. AFAIK, the plugin relies on <code> get_posts() </code> , so you should be save to use <code> &offset=10 </code> . _Disclaimer: Not tested, as I ain't got a setup with the plugin in use.` | Fetching ten ten records from JSON API in word press | wordpress |
I've found several similar question but none of them explains why the below is giving me nothing with ASC order. It works with DESC. Basically it's a query that should list posts where the custom field values are equal or greater to the current date, then arrange it in reversed order, so the first post should be a post... | With some more googling: <code> <?php $today = date("Y/m/j"); query_posts(array( 'post_type' => 'custompost', 'posts_per_page' => 4, 'meta_key' => 'mydate', 'orderby' => 'meta_value', 'order' => 'ASC', 'meta_query' => array( array( 'key' => 'mydate', 'meta-value' => $value, 'value' => $tod... | Order by custom field date with ASC order | wordpress |
Once a page has loaded, how do I create a TinyMCE editor? Putting a <code> wp_editor </code> call in an AJAX request then displaying it gives this: Visual and text tabs are nonfunctional, no toolbar, no active TinyMCE instance, just the html markup. I need to instantiate the JS component of TinyMCE, but how? I've also ... | I've made some progress Load a wp_editor in the initial page load in a hidden div, then do the AJAX call to grab the editor markup. While in PHP, you will need to retrieve the IDs of the editors created via wp_editor calls. Unfortunately, the variables on the _WP_Editors class are private, but wecan get around this by ... | Instantiate TinyMCE via JS ( rather than PHP/wp_editor ) | wordpress |
I am using WordPress 3.4.1 on Ubuntu 12.04 using Apache and PHP 5.3.X When I login to the dashboard and add a new post. Then try uploading an image to set as a featured image, I get a red box with a message "HTTP Error". I have read about people saying to not use the flash uploader and just use the browser uploader, bu... | After troubleshooting with @Wyck in chat, we have narrowed to the underlying issue. The issue was related to my server configuration not having the proper amount of memory allocated to Apache/PHP. If anyone has this same problem, please try verifying that you have enough (64MB+) server memory allocated to Apache/PHP in... | How to Fix HTTP Error When Uploading Images? | wordpress |
I want to create a user account on my multi-site installation of Wordpress with a username less than 4 characters. But since Wordpress has a limit of usernames at least being 4 characters, this error message is shown: Username must be at least 4 characters. I found a solution involving a mu-plugins folder in the wp-con... | You can filter <code> 'wpmu_validate_user_signup' </code> and check if the error code matches the 4 character warning. Then just unset the error code. Sample plugin: <code> <?php # -*- coding: utf-8 -*- /* Plugin Name: Allow short user names for multi site. */ add_filter( 'wpmu_validate_user_signup', 'wpse_59760_sho... | Changing the username character limit from four to less characters | wordpress |
I'm trying to figure out how to accomplish the following: <code> http://www.mydomain/blog/my-blog-post/ </code> I'm using the <code> /%postname%/ </code> for my permalink structure, but this eliminates the "/blog/" from all posts that are technically blog only. Is there a way to ensure that "/blog/" is within the URL s... | I've come to accept that this is just not possible with WordPress. You MUST have a slug for a custom post type. | Permalink for regular posts "/blog/" | wordpress |
On one of my templates I have an action hook 'do_xyz' I want to attach a custom sidebar to the action hook do_xyz Here is what I am trying in my theme functions.php file, does not work: <code> add_action('do_xyz', 'get_sidebar('secondary')' ); </code> What is the proper way of doing this? I know my hooks are setup righ... | Explanation There's the global array <code> $wp_filters </code> . This array stores some sub arrays. One for each <code> priority </code> . Each sub array then contains an array for each callback added. And the keys for those sub-sub arrays are the attached functions. Example If you do the following, somewhere in your ... | How do I hook a sidebar via add_action? | wordpress |
I setup a child theme which works fine. It's importing the main style.css and has custom css styles along with custom header.php and footer.php files When using functions.php in a child theme it's going to append the child themes functions.php to the main theme. Do I need to wrap my functions in opening and closing php... | Opening tags are required, closing tags are only needed if you have other code (HTML, CSS) after them in the same file. See PHP manual . A closing tag with nothing after it may lead to problems with included files if they contain a BOM . That’s one of the reasons why all optional closing tags were removed for WordPress... | Child theme functions.php do I use php open and close tags? | wordpress |
I have added an admin page in wordpress but i needed it to be hidden.I added the page successfully like this <code> function add_admin_page() { $themename = 'Cesaro'; $page_function = 'admin_page'; add_menu_page($themename." Options", $themename, 'edit_themes', $page_function, 'admin_page'); } add_action('admin_menu', ... | WordPress already takes care of that for you. The third argument in your <code> add_menu_page </code> function, which reads <code> edit_themes </code> is the capability required to access the page. If the user doesn't have that capability he can't access the page, so WordPress won't show him that option on the menu. Cl... | Hiding an added admin page menu using css | wordpress |
My website uses typekit to grab custom fonts, which works on the frontend. I'd like to put this in my editor styles in the backend. However, I don't know how I would do this. Typekit uses a js embed snippet rather than a css font-face embed snippet. | Tom Nowell's stackexchange-url ("TinyMCE plugin solution") works brilliantly, just update the JavaScript to use Typekit's new async code . Once you use the new async embed code, the 403 problem disappears and you'll have Typekit-enabled TinyMCE with no fuss! Tom has put all the code together in a blog post. He did all ... | Editor Styles and Typekit | wordpress |
I have created a custom post type called "pdf". I've have a custom metabox where user can upload a pdf file throught wordpress builtin media uploader I need to restrict allowed files (pdf) only in this uploader. I already know how to restrict allowed files: stackexchange-url ("How to set file type in wp_handle_upload?"... | <code> add_filter( 'wp_handle_upload_prefilter', 'wpse_59621_delay_mimes_filter' ); function wpse_59621_delay_mimes_filter( $value ) { if ( isset( $_REQUEST['post_id'] ) && get_post_type( $_REQUEST['post_id'] ) === 'my_post_type' ) add_filter( 'upload_mimes', 'wpse_59621_mimes_filter' ); else remove_filter( 'up... | Limit upload by file type only for certain custom post type | wordpress |
It is possible to use add_image_size in functions.php to get the original uploaded file size. Because when I uploaded the images to my posts I cropped them in order to have 1x1 ratio for all my image sizes and I remember using the All images option. So now when I use full or large I always end up with squared images. B... | You can always get the url for original attachment image. I don't see any code from you so i don't know which one is good for you but there are lots of functions on core which will get you the original image. here are some http://codex.wordpress.org/Function_Reference/wp_get_attachment_url http://codex.wordpress.org/Fu... | Using add_image_size in functions.php to get original uploaded file | wordpress |
I'm looking for solution that will display all the tags that used on a custom post type.. I just want to list them all coz I'm going to add jquery code on each tag. :) | wp_get_object_terms will have your answer. <code> wp_get_object_terms( $post_ids, 'post_tag', $optional_args ); </code> There is also get_the_terms which is simpler but also gets the job done. <code> get_the_terms( $id, 'post_tag'); </code> | List all the tags from a custom post type | wordpress |
I met some trouble. I tried to get user display_name in a custom mysql query foreach, but it failed. I have tried three method. <code> new WP_User </code> , <code> get_user_by </code> and <code> get_userdata </code> . but they only can get back the result <code> $user->display_name </code> which is ID=1 in table <co... | You should use all of the goodness of the wpdb object. <code> #Create a new WPDB object for your custom DB $foo_db = new wpdb('username','password','database','localhost'); $query = ('SELECT * FROM custom_table'); #Use the get_results method - You can return OBJECT(default), OBJECT_K, ARRAY_A, ARRAY_N $results = $foo_d... | query user display_name failed in a custom mysql query foreach | wordpress |
This is my example code placed in functions.php: <code> function my_init_method() { wp_enqueue_script('jquery'); wp_enqueue_script('jquery-ui-core', false, array('jquery'), false, false); wp_enqueue_script('jquery-ui-widget', false, array('jquery'), false, false); wp_enqueue_script('jquery-ui-mouse', false, array('jque... | All of these scripts are already registered to print in the footer. See <code> wp-includes/script-loader.php </code> for details. When you try to register the scripts again WordPress doesn’t change that. The workaround would be to register a new script for <code> wp_head </code> with those scripts as dependencies (the ... | WP_enqueue_script() loads them always in wp_footer()? | wordpress |
I have a situation where I want to redirect the user from single.php to my 404.php How can I do this? I did it like this inside single.php <code> header("HTTP/1.0 404 Not Found"); header("Location: ".bloginfo('template_url')."/404.php"); exit(); </code> But when I check the http responses I get a 302 response instead o... | Try something like this: <code> header("HTTP/1.0 404 Not Found"); $wp_query->set_404(); //This will inform WordPress you have a 404 - not absolutely necessary here, but for reference only. require '/path/to/404.php'; exit; </code> Just do the error handling on the page itself instead of redirecting it to another tem... | Redirect to 404.php from single.php | wordpress |
I recently developed a custom post type for my company's blog, so that we could have a separate press area. In the archive-presse.php page I make a query, thus : <code> $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; //echo '<div style="display:hidden"> paged :'. $paged . "</div>"; $press_ar... | The problem was that one cannot apparently set <code> 'posts_per_page' </code> to anything other than what is set in the admin interface, even for a custom archive page. The same code, minus the <code> 'posts_per_page' => 'x' </code> line, works fine. | Fourth page of custom post type archive page does not exist | wordpress |
In my iphone app i am trying to list out all the users using the wp.getUsers XML-RPC method , but its not returning all the users, in that blog i have around 180 members , but it has returned only 50 users in the list,,how can i get all the users ?? i am passing these following 3 parameters blog_id , username and passw... | I'm unable to find a XML-RPC method called <code> wp.getUsers </code> in <code> wp-includes/class-wp-xmlrpc-server.php </code> . Could it be, that you're using an additional plugin that extends the basic behavior of WordPress? A simple google search for 'wp.getUsers' points me to the the github repo of Max Cutler and t... | wp.getUsers XML-RPC method is returning only 50 users, how can i get all the users | wordpress |
When using the Advanced Custom Fields plugin for Wordpress, Suppose I have a radio button field with possible choices: o Apples o Bananas o Cranberries How can I return each one of these options regardless of which one is selected? Thanks everyone | Check out this page in order to discover your field key for your radio button: http://www.advancedcustomfields.com/docs/functions/get_field_object/ Next, insert this code where you are grabbing your field values: <code> <?php $key = 'your_fieldkey_here'; $field = get_field_object($key); if ($field) { foreach ($field... | Returning all radio button options when using Advanced Custom Fields | wordpress |
In my plugin I have a custom post type with a slug of 'ready-to-wear' and I have a custom taxonomy called 'seasons' associated with it. The odd thing is that this url with query works: <code> http://dev.catwalkyourself.com/ready-to-wear/?seasons=autumn-winter-2012-2013-en </code> but the same one with custom permalink ... | I solved this issue by making sure that the calls to register my taxonomies were placed before the calls to registering my custom post types. Weird but it works! | custom taxonomy archive permalink shows 404 error | wordpress |
I'm writing a plugin which adds a class that creates an endpoint for third party software to make API calls to and check if the current user is logged in. Here's a stripped down version of what I'm doing. <code> class API_Endpoint{ public function __construct(){ add_filter('query_vars', array($this, 'add_query_vars'), ... | One question : is the 3rd party that's sending the request passing a user cookie? If not, then WP will treat the request like any other guest! If it is, have you inspected <code> $_COOKIE </code> when <code> send_response() </code> runs? Update: Thought I'd try and wrap up the discussion below, once and for all :) You'... | Get user logged in status from within a plugin. $current_user not defined | wordpress |
I have a custom post type called <code> transaction </code> , and on the post type's edit/publish screen I have removed the post title field. The post title is now being generated by the function below, which labels each post <code> Transaction </code> followed by a unique string, thanks to the <code> uniqid </code> PH... | <code> function transaction_title( $title ) { if ( 'transaction' == get_current_screen()->post_type && '' == $title ) { return 'Transaction '.uniqid(); } // else return the normal title else { return $title; } } add_filter( 'title_save_pre', 'transaction_title' ); </code> | How can I run this code once so that my generated post title doesn't keep changing on publish/update? | wordpress |
I am using a child theme, and wish to change one of the meta boxes defined in the parent theme. The meta box is for 'pages' only. I tried using the remove_meta_box in my functions.php, but it has no effect: <code> function remove_parents_box() { remove_meta_box( 'id-of-meta-box' , 'page' , 'normal' ); } add_action( 'ad... | Note: This is the merged version between my and @toscho answers. Explanation (by @toscho) Use <code> add_meta_boxes_page </code> as action hook. You can find the hook in <code> wp-admin/edit-form-advanced.php </code> and it displays as: <code> do_action('add_meta_boxes_' . $post_type, $post); </code> Solution(s) Try th... | Removing custom meta box added in parent theme | wordpress |
Discussion Groups sort on activity. Is it possible to make them sticky to always appear on top of the list? Thanks. | To summarize: OP wanted to make an entire BuddyPress Group sticky, which is not possible currently in core BP. You can add this functionality using the Group Meta custom fields and then hooking into the BP Group Loop . | How to make a Discussion Group ”Sticky” in BuddyPress | wordpress |
I'd like to prevent the "Featured" category from appearing for certain user roles. To be specific, I want only the admins and editors to be able to see and thus select or unselect that category. Everybody else can see the whole tree but the Featured cat. Which hooks and WP API do I need to tap into in writing the neces... | Based on the stackexchange-url ("first Answer") from Mike Schinkel. For testing purposes in a default installation, the category is "Uncategorized". <code> add_filter( 'list_terms_exclusions', 'wpse_59652_list_terms_exclusions', 10, 2 ); function wpse_59652_list_terms_exclusions( $exclusions, $args ) { global $current_... | how do you prevent showing a particular category on the admin dashboard for specific user roles? | wordpress |
I have recently started to learn WordPress and after learning how to use it at basic level I immediately started to learn how to develop templates since this is what interested me from the start when I started to learn it. I am reading stackexchange-url ("WordPress 3 Complete") and at Chapter 6 the book guides you to d... | You have to make sure WordPress finds the directory where your theme is. There is a useful function doing all the work for you: <code> bloginfo() </code> . <code> <link rel="stylesheet" href="<?php bloginfo( 'stylesheet_url' ); ?>" /> </code> | Wordpress stylesheet isn't being added | wordpress |
I'm a complete newbie, so would appreciate some help. Is there a wordpress plugin that can display all posts/archives as a part of a tree structure? With high-level parents being <code> year </code> and children being <code> month </code> Something like this, <code> -2012 ---Jan ---Feb ---Mar . . . . -2011 ---Jan ---Fe... | Since you're a beginner I would like to mention that WordPress already has an archive widget. If ever it does not suit your needs, You can browse through the available archive plugins at wordpress.org and choose which one is the best for you. | Wordpress widget which displays archive tree | wordpress |
Currently I've divided posts into 5 different categories, based on the categories I've created 5 page templates. all of the pages are listed into the home page navigation menu. in my home page I'm showing 5 posts in five different categories. when they clicked a post that post will shown in the single page template(tha... | The »Template Hierarchy« doesn't allow this per default. Inside your <code> single.php </code> template, you can call <code> load_template() </code> . This will allow you to simply include the template you need, based on the <code> in_category() </code> conditional tag. <code> // inside single.php if ( in_category( 'fo... | How to show a post single post in page template | wordpress |
I'm developing a theme that uses a Twitter Tweets custom widget (Not coded by me). There are several widget areas within the theme and if I try and include the Twitter widget in say the sidebar and the footer at the same time I get this error; <code> Fatal error: Cannot redeclare echo_tweets_js() (previously declared i... | Just... call the function again - you only need to include it once! <code> include './path/to/lib.php'; echo_tweet_js(); // a little tweeting here ... echo_tweet_js(); // and a little tweeting over here! </code> | Give a function a unique ID | wordpress |
I've spend the better part of a day trying to figure this out. My custom taxonomy shows up in the WordPress admin, I can add it to a nav and display it with wp_nav_menu, but when I click on any of the terms I get a 404 even though I have a taxonomy.php in the theme. Any ideas? <code> /** Product custom post type **/ ad... | Okay, I feel quite silly, but what it comes down to is you can't have a custom post type and custom taxonomy with the same name. (Well... you can, but your taxonomy templates won't work) In my case I changed my content type to "product" and my taxonomy to "products". This fixes everything along with a permalink refresh... | Custom Taxonomy template not showing | wordpress |
Just curious what developers think about extending the <code> WP_List_Table </code> class for use on plug-ins. I am working on a plug-in that will show a list of users (ID, name, email) then pull data from another plug-in that created a subscription date and access level in the user meta table. The plug-in will be in t... | Its not a private class, only its methods (some) are defined as private so as long as you extend the class and use your own instance of theme extention you should bs safe and fine. | List Table API - Safe to use? | wordpress |
So as the title states - using WPTouch Mobile plugin (NOT Pro) I either want to make the shortcodes work as they should or remove them altoghether. Currently they render on the page as <code> [shortcode] </code> which is no good. I am good with a hack or any other solution. | I think you mean you want to make your own short codes work on the mobile theme? This is possible, try the wptouch admin panel options to enable your plugins. You can also copy your short code to the functions.php file in the wp touch theme folder. Finally ... You may have to get the pro version of wptouch so you can d... | WPTouch - how to remove shortcodes or make shortcodes function | wordpress |
I'm having a go at designing a premium WP theme, and I've found numerous plugins that allow you to load fonts from Google Web Fonts and other services. However, how do I let administrators actually configure the site-wide heading and body text fonts? To clarify: When writing a stylesheet, I need to type in the name of ... | Just a suggestion: Learn from another plugin Take a look at this plugins code to find out how it integrates Google Fonts http://wordpress.org/extend/plugins/wp-google-fonts/screenshots/ Learn by example create your own Theme Panel a. Here's a wp-tut http://net.tutsplus.com/tutorials/wordpress/how-to-create-a-better-wor... | Use external fonts in Wordpress stylesheet | wordpress |
I'm really having trouble locating the documentation for the Recent Tweets widget anywhere. It's not a plugin and appears to be native. All I want to do is to be able to move the <code> tweet_time </code> underneath the <code> tweet_text </code> . If you take a look at the website , you'll be able to see the time of th... | It's part of the Webzine theme - if you take a look at the source, near the bottom, there's a rather hefty chunk of JS that queries Twitter & renders the tweets. Now whether that code is sat there waiting for you in <code> footer.php </code> , or called in from somewhere else, I don't know - if the latter, you'll h... | Any advice on customising this twitter feed? | wordpress |
The image below shows a recent (failed) attempt to crack my Wordpress install. It's easy for me to look at that and see what they were doing, but is there a plugin that exists that monitors this data and can catch events like this? Especially for something as blatant as this, I would like to block the IPs, but it's not... | I use http://wordpress.org/extend/plugins/limit-login-attempts/ which blocks IPs when login attempts exceed set limit you set. Limit Login Attempts blocks an Internet address from making further attempts after a specified limit on retries is reached, making a brute-force attack difficult or impossible. If you're on a h... | Is there any pre-existing plugin to track and block IPs with suspicious activity on my site? | wordpress |
How can I modify my query in order to exclude certain posts by slug? Is it possible? <code> query_posts(array('category_name' => 'Mycat', 'posts_per_page' => -1)); </code> Ty | You can get the post ID from the slug with the <code> url_to_postid() </code> function: <code> $ID = url_to_postid(slug); </code> then just exclude the ID from your query: <code> query_posts(array('category_name' => 'Mycat', 'posts_per_page' => -1, 'post__not_in' => $ID )); </code> You can create an array of p... | How to modify the query to exclude posts by slug? | wordpress |
I am trying to create a modular plugin that includes action hooks for developers to add content before and after the main shortcode content. I'm having some trouble because anything I do in the function called by the action hook is always echoed out at the top of the shortcode instead of inside the shortcode where it b... | Try this: <code> function example_shortcode( $atts ) { $shortcode_output = "<p>Some shortcode content.</p>"; $shortcode_output .= "<p>More shortcode content.</p>"; ob_start(); do_action('below_shortcode'); $below_shortcode = ob_get_contents(); ob_end_clean(); $shortcode_output .= $below_shortcod... | Using action hooks inside of a shortcode | wordpress |
So I'm really new to Wordpress and I'm trying to create a simple widget. I want the widget to list the logos of my site's affiliates (similar to the "check out our shows" section on http://www.howstuffworks.com/ ). I also want it to be easy for the administrators to add/remove images from the list of partners. In other... | Why not use Links Categories ? There you can use images, descriptions, create categories and sort out everything. There would be no need to create a widget as you can use the default WordPress one. Case you were to create your own widget, you can query these items with WordPress functions. | Link listings with image | wordpress |
I'm using a custom loop to display posts using pagination. My query shows 4 posts per page, and there are 4 pages, so 16 posts in total. Is it possible to load in the last page of posts first? So when I load the query, it first shows page 4, then when I click 'show next' it shows page 3, et cetera? | Is it possible to load in the last page of posts first? Order <code> DESC </code> instead of <code> ASC </code> and make use of the <code> posts_clauses </code> filter. <code> function wpse_59557_order_desc( $pieces ) { // Add conditionals here and abort in cases, where we don't want this, for e.g.: // if ( ! is_home()... | Displaying the last page of posts | wordpress |
I have a collection of nearly 3000 swf files that will be used in some of WP's post. Two options that I can think of-- Upload them to WP Media Library,they'll become attachments, I can query attachment to get them. FTP to host, create database table, query them directly. Which way would you recommend? | Your best bet is to go with option 2 and alter the DB or use a plugin like http://wordpress.org/extend/plugins/add-from-server/ , I can't imagine uploading 3k large files through a http interface like the WP uploader. A 3rd and probably better option is to just use a CDN like amazon to host the media files, since WordP... | How to manage a big collection of files with wordpress? | wordpress |
How can i get "post id" in post edit area for add_filter in functions.php? I want to change file name automatically during upload. so i need to obtain post id. the code is as follows: <code> add_filter( 'wp_handle_upload_prefilter', 'custom_upload_name' ); function custom_upload_name($file) { list($name, $ext) = explod... | Try using $_POST['post_id'] in the upload area as file.php does not include the global $post object. | Get post ID in post/page edit area | wordpress |
I just did a redesign of my site, AlpineZone.com. I worked with a WP developer on the completion of the site. One thing that was done that I'm not entirely happy with is the way the Resorts section is handled. Here is an example resort: http://www.alpinezone.com/resorts/sugarbush/ I'm 100% happy with the way it looks .... | You can indeed query on post metadata, see Custom Field Parametersfor WP_Query in Codex. I would recommend against using a custom table. EDIT - Here's an example query for all resorts with meta key <code> vertical_feet </code> between 2000 and 3000: <code> $args = array( 'post_type' => 'resort', 'posts_per_page' =&g... | Having a series of pages created based on records in a table with fields populating the pages | wordpress |
So I am working on a plugin and am trying to trigger a js file whenever a post is saved. I have been reading up on this all morning and cannot seem to find why this is not working. Any advice? If I were to paste the js code directly into the plugin it seems to work... I have double checked the path to the js and still ... | You need to hook into admin_enqueue_scripts with your add_my_script function. http://codex.wordpress.org/Plugin_API/Action_Reference/admin_enqueue_scripts Example: <code> function add_my_script() { wp_enqueue_script('qtool-insert-v2'); }add_action( 'admin_enqueue_scripts', 'add_my_script' ); </code> | issues with wp_enqueue_script in my plugin | wordpress |
When a members logs in through WP admin, I would like to redirect them instantly to a custom URL. What will I need to change to make this possible? Respond with step-by-step details would be ideal. | I use this plugin: http://wordpress.org/extend/plugins/peters-login-redirect/ It works dandy for setting different redirects for each role and even user capabilities. | Redirect members to custom page upon logging in through WP admin | wordpress |
I want to display the user names by the reference of user id. Is there any function like get_user_displaynme($userid)? (and one more Is there any shortcode to get group names?) Thanks in Advance | You can use the very same <code> get_userdata </code> function of WordPress to code a specific function. Stick this in your <code> functions.php </code> : <code> function get_display_name($user_id) { if (!$user = get_userdata($user_id)) return false; return $user->data->display_name; } </code> So you can do somet... | how to get current user name by user_id in buddypress? | wordpress |
I have a VPS with, so far 2 osCommerce websites, and it was running fine. I then installed Wordpress 3.4.1 and it was fine as well. I tried a free theme from the theme installer called Hero, and every 30 or so page loads the entire VPS locks up. Not just the apache or PHP or MySQL, but I can't even access the server vi... | Usually the first step is to make sure there is no problem by changing the theme to Twenty Eleven and running the 'same steps' to recreate the problem. Some themes may not be ready for Wordpress 3.4.1 as it introduced a lot of theme related changes. So see if there is anything on the WordPress.org page for your theme o... | Entire VPS locks up when using particular theme | wordpress |
I know qTranslate has the option to hide untranslated content, but that doesn't seem to work. I.e: I have a website with three languages: Dutch, French and English. There is one particular page that has some subpages that are only available in Dutch. I want them to show up on the Dutch website, but hide them completely... | Little hack in my submenu code: <code> function hierarchical_submenu($post) { $top_post = $post; // If the post has ancestors, get its ultimate parent and make that the top post if ($post->post_parent && $post->ancestors) { $top_post = get_post(end($post->ancestors)); } // Always start traversing from ... | qTranslate: Hide untranslated content | wordpress |
Is there a free plugin that I can use for a membership site which includes user login, registration and profile management all from WordPress front end? Thanks | Yes ... there are lots of plugins for this scenario You could just enable BuddyPress which gives you a 'social network in a box' then there are these two plugins s2member WPMU membership lite failing that ... read through the related articles on here for suggestions | Front End Plugin for User Management | wordpress |
When going through your own plugin details and checking the active version downloads. It's helpful to see which version that webmasters prefer, but I see no details on the subject on WordPress (and on here, yet). I recently had an unexpected change in stats, and I can't find anything as to what the time frame is. What ... | The active version pie chart is made up of completely nonsense data that isn't being updated properly at present. What it displays has absolutely no bearing to real-world data. It's on my list of things-to-fix, eventually. Once our stats gathering system is more reliable, I'll do so. However, at present, it is total no... | What is the Timeline for the Active Version Pie Chart in the Repository? | wordpress |
I'm trying to add multiple filters from inside a foreach loop. Unfortunately I can't get the code to reference the value properly. How do I pass the value from the loop to the function? The following sets all the filters to null. <code> foreach ( $myarray as $key => $value ) { add_filter( "plugin_filter_$key", funct... | <code> foreach ( $myarray as $key => $value ) { add_filter( "plugin_filter_$key", function () use ( $value ) { return $value; } ); } </code> Check out use </code> keyword for closures . | How do I pass the value from a foreach loop to an add_filter function? | wordpress |
I am able to add a post featured image to the RSS feed like so: <code> function insertThumbnailRSS($content) { global $post; if(has_post_thumbnail($post->ID)){ $content = ''.get_the_post_thumbnail($post->ID, 'thumbnail', array('alt' => get_the_title(), 'title' => get_the_title(), 'style' => 'float:right;... | You could do it by adding an action to the hook 'rss2_item' like so: <code> add_action('rss2_item', function(){ global $post; $output = ''; $thumbnail_ID = get_post_thumbnail_id( $post->ID ); $thumbnail = wp_get_attachment_image_src($thumbnail_ID, 'thumbnail'); $output .= '<post-thumbnail>'; $output .= '<ur... | How to add post featured image to RSS item tag? | wordpress |
http://css-tricks.com/video-screencasts/ Try to look at this famous site which also powered by wordpress. The content in the loop is different from the single post. It use "dl" element in loop, but not main content in the single post. It something like it has a another brief summary of a post that will only display in ... | you can add additional information to your posts through using post meta: http://wp.tutsplus.com/tutorials/plugins/how-to-create-custom-wordpress-writemeta-boxes/ If you want to check if Wordpress is going to display just a single post/single page or more, you could use something like this before your loop: <code> $sin... | How to have different content in the loop and single | wordpress |
I'm developing a multilangual theme. I use the __() function for translation, which works just fine. The main language is English, but the second language is German. For that second language, I'd like to add an "/de/"-Slug, so I created a rewrite rule: <code> function rewrite_rule_de(){ add_rewrite_rule('de/(.+?)/?$', ... | My problem here is that <code> get_query_var('language') </code> isn't defined in the function <code> set_my_locale </code> Because <code> get_locale </code> (which applies the filter <code> locale </code> ) is called before <code> wp() </code> (which parses the query & sets up the variables). You'll have to manual... | Multilingual theme: Changing locale based on URL | wordpress |
I need to display all the categories I created for a custom post type then inside of each category I need to loop all the posts that are tied to that category. I tried constructing my WP_Query a number of different ways and I can't get it to work at all. Here's the code I have now: <code> $categories = get_categories('... | Here's how I fixed it.. <code> <!--faq page --> <div class="faq"> <?php get_template_part('./template/global/breadcrumbs'); ?> <h3><span><?php the_title(); ?></span></h3> <?php $categories = get_categories('taxonomy=faqcat&order=DESC'); foreach ($categories as $cat... | Get all active posts that are tied to a custom taxonomy for a custom post type | wordpress |
Will wordpress run cron if I have scheduled emails to send? Seems like if no visit (request) is made to the site, scheduled tasks won't run and therefore emails won't be sent eg. hourly. According to current situation, if there is no visit to the site for few hours ( and than visit is made) than all scheduled emails wi... | You cannot rely on wp-cron for consistent results so you have to look to the server level. Most enterprise-level Wordpress installations need some sort of consistent automation. This is how I automate WordPress in this type of situation. You will need to add a crontab to the server itself. If you're running Linux, you ... | Sending out scheduled emails | wordpress |
I am wondering is it posible to define add_editor_style to specific post types? Currently I am using this function.. <code> // EDITOR STYLE add_editor_style('editor-style.css'); </code> But I would like have multiple editor styles for various post types. So guessing it could be like this... <code> if ( ... ) { // EDITO... | The first issue is that <code> add_editor_style() </code> is usually called in Theme setup functions that get hooked into <code> after_setup_theme </code> - which is well before the query is set up and the post type determined. So, you'll need to move <code> add_editor_style() </code> to a separate callback, that gets ... | Define add_editor_style to specific post types? | wordpress |
I'm working on a project where I use the default posts as "Products", default category as "Application" and a custom taxonomy called "Groups". I want to list "Products" by "Application" (category.php) but group them together into their respective "Groups": Automotive (Application) Silver (Group) Product 01 Product 04 P... | I've found a solution! <code> <?php // Get current Category $get_current_cat = get_term_by('name', single_cat_title('',false), 'category'); $current_cat = $get_current_cat->term_id; // List posts by the terms for a custom taxonomy of any post type $post_type = 'myposttype'; $tax = 'mytaxonomy'; $tax_terms = get_t... | Display category posts grouped by taxonomy | wordpress |
I run a Wordpress site that has more than 300 authors. Is it possible to create some type of community in the backend (dashboard)? Ideally, a space where the authors can discuss with each other in a thread type of system, with admin news and so on. The closest thing I could find was the Admin Microblog but by reading t... | What I do for almost every site with multiple authors: Create a separate blog for meta discussions, for example <code> meta.example.com </code> . Use P2 as theme . Install Authenticator to allow access for members only. Install something like Inform about Content , so the members get an email whenever something new was... | How to develop a community feature in the dashboard for multiauthor site | wordpress |
I have a custom post type called <code> species </code> which consists of a number of <code> meta_fields </code> . Ideally, what I'd like, is a word count for each <code> species profile </code> (that's just the term I use for a singular post of type <code> species </code> ). So, for example, when you click the <code> ... | I think your best bet is to hook save_post and save the count for each post to a meta field. It's not feasible to do the calculation when the back end is loaded, every post will have to be queried and sorted in memory. Likewise, doing it all in MySQL will require some significant query modification, and still then you ... | Sort by post word count in admin area | wordpress |
I'm trying to get category ID of the current archive displayed. I tried: <code> // category (can be a parent category) $current_cat_ID = get_query_var('cat'); // print_r ($current_cat_ID); </code> It doesn't print anything... | you can use <code> get_queried_object() </code> <code> $category = get_queried_object(); echo $category->term_id; </code> | get current category ID php | wordpress |
I've just converted my HTML version of a theme over to Wordpress, and I'm currently converting the dropdown menus over. What WordPress processes: <code> <ul class="dropdown"> <li id="menu-item-190" class="menu-item menu-item-type-custom menu-item-object-custom current-menu-item current_page_item menu-item-home... | You could just add a CSS rule like so: <code> ul.sub-menu { visibility: hidden; } </code> . | Wordpress Menus - How to add inline styles to UL menus | wordpress |
Just occured to me: what's the point of password protecting www.yoursite.com/wp-admin when a user can just type www.yoursite.com/wp-login.php, bypassing the password on /wp-admin? Am I missing something here? I've ready many blogs/posts that suggest adding this extra layer of protection to wp-admin using .htaccess/.htp... | The protection from .htaccess is for the folder <code> /wp-admin </code> it's not for the URL Open up your ftp programme (or download WordPress) and look inside /wp-admin By only allowing your IP access this folder you're blocking a lot of possible exploit issues (as mentioned in comments below). I always prefer to log... | Why should I password protect WP-Admin? | wordpress |
I uploaded to a WordPress site (3.3.1) a plugin that works perfectly in my other sites (3.3.1 and 3.4), but when try to activate it I get Fatal Error. When I go to check the plugin's main file content to do some changes and identify the error I detect that at the end of my code appears some random code from my file rep... | Check if you have a class or function with many <code> echo </code> 's, that are called on the functions <code> register_activation_hook </code> or <code> register_deactivation_hook </code> . Also - this functions must use static functions. Also, is it possible that you have a <code> var_dump() </code> inside your sour... | random code at the end of file after plugin upload | wordpress |
For a custom post type, I'm pulling in a list of another custom post types that I need to select for saving ... <code> <input type="checkbox" name="32"> My CPT <br> <input type="checkbox" name="41"> My CPT 2 <br> <input type="checkbox" name="42"> My CPT 3 <br> <input type="checkbo... | You will need to save them as an array and currently your HTML is not in the correct format to do this. <code> <label for="my-cpt-32"> <input type="checkbox" name="cpt_ids[]" value="32" id="my-cpt-32" /> My CPT #32 </label> <label for="my-cpt-41"> <input type="checkbox" name="cpt_ids[]" value... | Custom Post Type, Saving Multiple Checkboxes | wordpress |
I am using this as my starter template: www.html5reset.org/ It's pretty nice, but I believe something is wrong with jQuery in there. In the <code> functions.php </code> it says: <code> // Load jQuery if ( !function_exists(core_mods) ) { function core_mods() { if ( !is_admin() ) { wp_deregister_script('jquery'); wp_regi... | just to help a bit further ... WordPress runs jQuery in 'safe' mode which means in WordPress you need to write code like this <code> jQuery(document).ready(function() { </code> and not like this <code> $(document).ready(function() { </code> But what the HTML5BP has done is added this funky bit of code (probably kindly ... | jQuery in Wordpress - Why is it not working? | wordpress |
Does anyone know how can I display in the loop thumbnail's name, alternative text, title, caption, url? Thx for all advices and suggestions | Try the following code inside the loop and modify it as per requirement. <code> $thumb_id = get_post_thumbnail_id(); echo 'Name = '. get_post_field( 'post_name', $thumb_id ).'<br />'; echo 'Alt = '. get_post_meta( $thumb_id, '_wp_attachment_image_alt', true ).'<br />'; echo 'Title = '. get_the_title( $thumb... | Thumbnail informations (meta) | wordpress |
Apologies if this is the wrong site to be asking this, but I just downloaded a template for a website that I want to customise. On my Mac I have a program called Espresso which allows me to 'preview' any website that contains any mix of client-side and server-side files. Is there an equivalent on the PC? I essentially ... | You should install any program - for example MAMP - that allows you to use Apache and MySql. Then go to wordpress.org and download the latest copy of wordpress. Install it and upload your theme in the <code> wp-content/themes </code> folder. | What program can I use to preview my wordpress site? | wordpress |
Trying to submit a field value from a popup modal window to my WordPress parent window meta-box. On my add post page I have a metabox with a field type 'text'. The id of my 'text' field type input is 'tumble2_kaltura-video' Next to the metabox text field is a button link which opens up a modal box: Once I select my vid... | Use the parent method to pass data back to your meta field. Create a JS function to handle the passing of data from Thickbox to the meta field: <code> function foo_interstitial(data){ $('.form-field-selector').val(data); } </code> Add a submit handler to your thickbox instance that passes to the parent.foo_interstitial... | Form submit from modal window to parent window | wordpress |
I've only ever worked with WordPress on my own server. I'm using wordpress.com for my development environment, but I can't for the life of me figure out how to upload my themes since as far as I know I have no FTP access... I'm sorry if this is something that should be obvious, but all I'm finding in searches is how to... | This is what Wordpress.com says: Because of the way WordPress.com’s technical infrastructure is designed, we are not able to support uploading of custom WordPress themes on our service. You are only allowed to pick from pre-existing themes. | How can I install my custom-made theme on a wordpress.com blog? | wordpress |
This code works for page 1 <code> <?php $paged1 = (get_query_var('paged')) ? get_query_var('paged') : 1; $recent1 = get_transient( 'recent1' ); if ( false === $recent1) { $recent1 = new WP_Query ('cat=3&posts_per_page=5'.'&paged='.$paged1); set_transient('recent1', $recent1, 60*60); } // do normal loop stuff... | "This code works" - but it doesn't! If you're gonna cache paginated posts, you'll need to store them chunked: <code> if ( ! $my_paged = absint( get_query_var( 'paged' ) ) ) $my_paged = 1; if ( ! $my_query = get_transient( "recent_$paged" ) ) { $my_query = new WP_Query( "cat=3&posts_per_page=5&paged=$my_paged" )... | Transient api Caches confused | wordpress |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.