question stringlengths 0 34.8k | answer stringlengths 0 28.3k | title stringlengths 7 150 | forum_tag stringclasses 12
values |
|---|---|---|---|
I am trying to understand data sanitization (not data validation) to help me write secure themes for WordPress. I have searched the Internet trying to find a comprehnsive guide for theme developers detailing best practices. There were couple of resources I came across including the codex page titled Data Validation, th... | This codex page explains it pretty well I think. The most important and commonly used function is probably <code> esc_attr </code> . Take this example: <code> <a href="<?php print $author_url; ?>" title="<?php print $author_name; ?>"> <?php print $author_name; ?> </a> </code> If <code> $au... | Data sanitization: Best Practices with code examples | wordpress |
this question is strongly related to this stackexchange-url ("question") where I already got a working answer. I have a custom-post-template named "wr_event" and a custom-taxonomy named "event_type". This "event-posts" have a meta-box where I set the event date and I use this … <code> function change_order_for_events( ... | Just use the appropriate conditionals : <code> function change_order_for_events( $query ) { //only show future events and events in the last 24hours $yesterday = current_time('timestamp') - 24*60*60; if ( $query->is_main_query() && (is_tax('event_type') || is_post_type_archive('wr_event')) ) { $query->set... | Sort custom-posts in archive.php via meta-key? | wordpress |
Check the line; list($term_id,$taxonomy_id) = $result in the code snippet below. ( towards the bottom ). Why am I missing the term_id & the $taxonomy_id when I echo their values? Aren't they supposed to be populated by the wp_insert them? <code> <code> $term_name = 'Uncategorized'; $term_slug = sanitize_title('Unca... | The problem is the use of the php function <code> list </code> . If successful, <code> wp_insert_term </code> returns something of the form: <code> array(2) { ["term_id"]=> int(307) ["term_taxonomy_id"]=> int(325) } </code> You can't use <code> list </code> with this as <code> list </code> only works for numerica... | Missing term_id and term_taxonomy_id when adding a term using wp_insert_term() function | wordpress |
I'm currently using a plugin, which includes jquery version 1.6.4 like this: <code> function thethe_image_slider_head_scripts(){ wp_deregister_script( 'jquery' ); wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/ jquery.min.js', false, 'latest'); wp_enqueue_script( 'jquery' ); wp_enqueu... | First: do not de-register core-bundled scripts in order to register some arbitrary version of those scripts . WordPress currently (at time of writing) comes bundled with jQuery 1.7.1. When WordPress 3.4 comes out next month, that version will be (IIRC) 1.8.x. Core, Themes, and other Plugins will all rightfully expect t... | Register google jquery gets overwritten by plugin | wordpress |
I created a register template for Wordpress with some ajax so that users can click on the register link in my header and the register form opens up in a lightbox. For some reason on submit, if there is an error or success message my form gets displayed twice. Any help appreciated. I am confused because I have almost id... | Your form is displaying twice because you are handling your AJAX wrong, and using the template that shows the form as the response too. You need to wrap the form code in an if else statement that checks if there is an AJAX request currently in operation. But more obviously, you're going about AJAX completely the wrong ... | Register Template | wordpress |
I was coding my recent comments widget, and using $wpdb-> get_results and I wanted t use cache so it doesn't perform the query every time the page loads, so I used: <code> $comments = wp_cache_get('mycomments'); if ($comments == false) { $query = //some sql stuff $comments = $wpdb->get_results($query); wp_cache_set(... | In WordPress v2.5+ the object cache is not persistent. It will save things in memory, but for persistent caching across page loads you will need a plugin see here: http://codex.wordpress.org/Class_Reference/WP_Object_Cache#Persistent_Caching Alternatively, use transients, which are persistent. The identifier must be 45... | How wp_cache is supposed to work, and does it help with performance? | wordpress |
I'm currently working on a site that's targeted for beginners in a new language. Now I'm looking for something that can ease my work with having two different versions of the same post. One "easy to read" and one with more adept language. In the front end there should be some sort of option that let the user tab to whi... | I think that having two separate posts for the easy/adept versions is going to be hard to manage consistently, especially if you end up with alot of content. It would be easier to use custom fields to store the two sets of information within the one 'post', then use javascript to toggle between which one is visible on ... | Having two different versions of the same post? | wordpress |
I'm not sure if there is a solution for that but I'll ask it anyway :) I've built a custom-post-template and a related custom-taxonomy. The taxonomy works as kind of "categories" for the custom-post-template. The taxonomy has terms like "car, house, wood". I use <code> metaboxes </code> to add custom meta-data to my cu... | This question is possibly a duplicate of: stackexchange-url ("Only show metabox when date-value in other metabox is over?") Broadly there are two ways of achieving this. Using the <code> add_meta_boxes </code> hook to pass two variables: post type and the post. Then add the metabox only when the post has a certain term... | Show metabox in custom-post-template depending on taxonomy term? | wordpress |
I’m maintaining a rather simple blog where a small number of people are registered as administrators to write posts. When making a link to the authors URL in a posts meta data, I use the function <code> get_author_posts_url(authorid). </code> This links to e.g. <code> mydomain.com/author/bill </code> This is the correc... | I believe you may be over-thinking this. I don't use comment author URLs very often, but if I'm not mistaken, the URL for the author of a comment is usually the website URL the user has set in their profile. I had the same issue once. The author didn't have his own website, so he wanted his comments to link to his prof... | Comment author url link is wrong? How to change from authors/ to author/ | wordpress |
probably a weird question. I'm using the custom MetaBox and CustomFields Class by jaredatch on Github. I have this "event-date" metabox: <code> $meta_boxes[] = array( 'id' => 'event_date', 'title' => 'Event Date', 'pages' => array( 'wr_event', ), 'context' => 'normal', 'priority' => 'high', 'fields' =>... | Not sure about the linked class - it seems they collect metaboxes immediately and so there is no information regarding what post is being viewed. In general though - yes it is possible. To add a metabox: <code> add_action( 'add_meta_boxes', 'myplugin_add_my_custom_box',10,2); </code> See the source code here . This <co... | Only show metabox when date-value in other metabox is over? | wordpress |
I've built this responsive site on WordPress and got a little curious as to how I can set the post thumbnails in percentages. Any help would be much appreciated. | This is not possible, images must have real absolute sizes :) A post thumbnail is essentially a different sized version of the image. While you can calculate how much for example 70% of 1024 is, and genereate a ~700px wide image, you cannot do this for each of your visitors. It would kill your host's CPU... The closest... | Set Post Thumbnails in Percents | wordpress |
I find myself needing to pass custom data to a filter provided by a 3rd party plugin. All of the ways I've seen to do this are really complicated and hard to wrap my head around. Take this example: <code> $score = 42; //Some crazy calculation I don't want to repeat. function add_score_to_title($title) { return 'Quiz Re... | You have at least two options: Globalize the desired variable, and then reference it inside the callback Wrap the score calculation logic with a function, then reference it inside the callback Globalize the Variable <code> <?php global $score; $score = 42; //Some crazy calculation I don't want to repeat. function ad... | How to Pass External Variables to Filters/Actions | wordpress |
Is it possible within the save_post action to determine whether it's a new post being created or an existing post being update? | I ended up just checking for the existence of a custom value prior to setting it. That way, if it's a newly created post the custom value would not yet exist. <code> function attributes_save_postdata($post_id) { if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return; if (!wp_verify_nonce($_POST['_attributes_no... | Check for update vs new post on save_post action | wordpress |
I was managing a site, taking over from a previous administrator. With his last breath, he changed something on the site, precisely on the login section: http://www.spiritualresponse.com/login/ I don't know if intentionally or not, but the login form has vanished. This is an ASAP task to fix it, so what I can gather, t... | the 'login' menu button points to a page - to execute php code in pages you need a plugin such as the 'exec-php' plugin or similar. in the meantime use http://www.spiritualresponse.com/wp-login.php to login | Wordpress automatically adding html tag around PHP code | wordpress |
So long story short, i was told by a new job that they want me to migrate 2 WP sites to other hosting id assume. now, im a so-so WP noob....i googled around so that when i go into work, i atLEAST have some notion of what im doing lol, and then i came across "backupbuddy" lets call it (BB) for now. so long story short, ... | Simple answer - Backupbuddy is idiot proof. I use it for all my client Web sites that purchase a maintenance plan which includes scheduled backups. Now the boon for me is whenever a client wants something changed on their Web site, I use BB to create a most recent backup, download the archive and install to my local Li... | BackupBuddy, for backups, backups in general etc, any good? | wordpress |
I have a custom post type with a metabox text input area that I want to have a shortcode inserted into from a thickbox when a link is clicked on from the modal window. Using the code below right now it just closes the modal window when the insert button is clicked. Please tell me where I am going wrong. I have the thic... | I got it, since it was an iframe I guess I was needing to target the parent window. <code> jQuery('.insertdownload').click(function(){ var did = jQuery(this).attr('id'); did=did.replace('download-', ''); if (jQuery('#format').val()>0) { parent.jQuery('#my_new_field').val('[download id="' + did + '" format="' + jQuer... | Add text to metabox input text field from Thickbox | wordpress |
For some reason I can't find any working / recent Wordpress plugins that have the featured content / list that are on the right of slider window. EG: Does anyone know where I can find any to use? | CodeCanyon is a great resource if you havent already visited it check it out. You will have to pay for most plugins but most are of a high standard. Here are a few i found for you: This one is very configurable and allows multiple layouts: http://codecanyon.net/item/premium-featured-posts-slider/full_screen_preview/163... | Features Posts / Featured list WP Slider plugins? | wordpress |
I have added some text on tinymce editor on load. (Every time you click on Add new the tinymce editor load with this text.) but problem is how to enable css class which are using in default text. Thanks | Use <code> add_editor_style </code> e.g.: functions.php <code> add_editor_style('custom-editor-style.css'); </code> http://codex.wordpress.org/Function_Reference/add_editor_style | How to include own css on wordpress tinymce editor? | wordpress |
I have a custom-taxonomy for a custom-post-type just like categories. I've used the standard loop in my <code> taxonomy-event_type.php </code> template so far … <code> if ( have_posts() ) : while ( have_posts() ) : the_post(); </code> This meant that the template only showed the posts associated with the current term (... | You second query performs an entirely new query and does not have the terms set. Besides, it's not as efficient to 'redo' the query. Instead, hook into <code> pre_get_posts </code> and change the order there: <code> function change_order_for_events( $query ) { //Check if currenty query is the 'main query' and event typ... | Custom WP_Query breaks default behaviour of viewing right post associated with tax-term! | wordpress |
I have an image upload form that is being added to <code> the_content </code> using a filter. However, the existence of this image upload form makes it so that comments cannot be added. Because there are two submit buttons, the comment submit button seems like it's actually submitting the image upload form. Here is the... | Well, this is definitely a little hackish but what I ended up doing was changing the action on the form to "[mysite url]/wp-comments-post.php". Then I took advantage of a few action hooks in wp-comments-post.php to hijack that page: <code> add_action('pre_comment_on_post', array($this, 'process_image_upload')); </code>... | Image Upload Form is Disabling Comment Addition | wordpress |
I want to do a query and sort posts by views. Is this possible? I'm not even sure where to start.. | WordPress does not maintain post view count by default. But you may find the following post helpful. stackexchange-url ("Does wordpress have a post hit counter?") You may also have a look on the WP-PostViews plugin. Many thanks. | Does wp track views for posts? | wordpress |
<code> function my_bp_nav_adder() { bp_core_new_nav_item( array( 'name' => __('information', 'buddypress'), 'slug' => 'info', 'position' => 15, 'show_for_displayed_user' => true, 'screen_function' => 'all_conversations_link', 'default_subnav_slug' => 'testing', 'item_css_id' => 'all-conversations' ... | The problem is that you're not specifying which template BuddyPress should use to display your content. There are a couple of ways to do it (see https://github.com/boonebgorges/buddypress-skeleton-component/blob/master/includes/bp-example-screens.php for a few options), but I suggest the following <code> // This is the... | Buddypress Adding a Nav item and Calling Custom Fields | wordpress |
what's the best way to add a class to the div with a class of post every 4 seconds using jquery? <code> <div class="34 post"> <img width="311" height="417" src="#" class="#" alt="newspapers" /> <h2><a href="#">Headline News Part 2</a></h2> <p>testing new content</p> </... | <code> var post_count = $('.post').length, current_index = 0; setInterval(function(){ $('.post').removeClass('display').eq(current_index).addClass('display'); current_index++; if(current_index > post_count) current_index = 0; }, 4000); </code> Wrap it in a jQuery document.ready function :) | what's the best way to add a class to the div with a class of post every 4 seconds using jquery? | wordpress |
What I'm trying to do is quite simple: I want to add a custom field named 'Button' to each post that will show a button (image) on the page with the value as its link. It's basically a button that will show on every post, the link that the button points to will be entered in the value field of the custom field. This is... | You need to echo <code> get_post_meta() </code> , like this: <code> <div class="button"> <a href="<?php echo get_post_meta($post->ID, 'Button', true); ?>"> <img src="<?php echo get_template_directory_uri() . '/images/button.png'; ?>" alt="link" /> </a> </div> </code> | wordpress get_post_meta / the_meta to output custom field value | wordpress |
How to make in the admin's dashboard a <select> with the list of all posts of specified post type? I need this in order to save a post ID with <code> set_option() </code> call. How to do this? | Use <code> wp_dropdown_pages() </code> to create the drop down. It accepts an <code> post_type </code> parameter. To avoid collisions with plugins filtering this function you may use <code> walk_page_dropdown_tree() </code> and build your own <code> select </code> . See stackexchange-url ("this post") for a code exampl... | Selecting a post in Dashboard | wordpress |
I have no idea how to do this and really need your help please … First I created a custom-post-template called "wr_event" - then I added a custom taxonomy (like categories) to this post-template! <code> register_taxonomy( 'Type of event', 'wr_event', array( 'taxonomy' => 'event_type', 'label' => 'Types', 'singula... | You can create the file taxonomy-event_type.php. That will be used when you use the url /?event_type=lectures or /event_type/lectures. You can use wp_list_categories by adding 'taxonomy' => 'event_type' to the arguments (see http://codex.wordpress.org/Template_Tags/wp_list_categories#Display_Terms_in_a_custom_taxonomy ... | List custom taxonomy as navigation - taxonomy pages with all it's posts? | wordpress |
I need to receive some special $_GET parameters for a custom page I'm making, i know how to receive this through a simple $_GET like mysite.net/products/?id=1 , but I wanted to use the URL style of my WordPress like mysite.net/products/1. How to retrieve $_GET variables from rewritten URLs? | To be added on <code> init </code> : To register your custom variable ('id' in the question) <code> add_rewrite_tag('%mycustomvar%','([^&]+)'); </code> To create a re-write rule: <code> add_rewrite_rule('^product/([0-9]{1,})/?','index.php?p=4&mycustomvar=$matches[1]','top') </code> 4 is the id of the 'product' ... | How to retrieve $_GET variables from rewritten URLs? | wordpress |
thanks for taking a minute to read my question. I've done some googling and I can't seem to find the answer to this question anywhere. Forgive me if it's somewhere here on stack exchange already. I'm using this plugin to allow "< prev" and "next > " links in my set of pages. I can change the page order using the wor... | Haven't checked the plugin you mention... but I use this solution for doing an "author" navigation. I adjusted the functions and this should probably work without the plugin (untested). You need to adjust the ID, and the conditions itself if you want more exclusions. [edit: corrected functions, the queries were missing... | Is it possible to skip certain specified pages when using links? | wordpress |
I need to do two things: Add a CGI variable (say filter=21) to the current query and make a link to this modified URL. Fetch the value of CGI variable "filter". How to do that in WordPress? | First off, these aren't CGI variables, they're query string arguments . WordPress, by default, will remove any query arguments that it doesn't recognize. So you need to register them with WordPress and then pull them back out of the query. First, add your new query variable: <code> function wpa_48528_vars( $vars ) { $v... | How to get CGI variables? | wordpress |
Noob question. Is there another way of getting a posts title without using the_title(); I'm asking because I am using a function the take a string parameter, then after some code, returns this string. When I pass in the_title(); as this parameter, for some reason it isn't coming in as a string, therefore, the method fa... | This is because <code> the_title() </code> echos the post title (see the linked documentation). Use <code> get_the_title() </code> instead which returns the title as a string. Edit You have two options: Use <code> get_the_title() </code> to return, rather than echo, the post title Filter <code> the_title </code> to ech... | Get title of post without using the_title(); | wordpress |
i am using a front built in (article directory plugin) tinymce with wp_editor. what ever i tried i cant get the word counter to work automatically.. i can count the words fine in the HTML tab using a jquery word counter but not in the wysisyg tab since its an iframe... i got some new white hairs dealing with this issue... | A while later i decided to try it again... (needed it for a project) this time i went for clean jquery and i got it to work! here it is: the working & easy to use way to count words while they are being written inside a wp_editor both in the html editor and visual editor. <code> <script type="text/javascript">... | Count Words using tinymce in the front-end | wordpress |
I installed MultiSite with the URL set as http://example.com , but now I want to force all requests to go over HTTPS, so I'm trying to change the URL to be https://example.com . I've gone through the database and updated all the <code> siteurl </code> and <code> home </code> values to have https , but the site still lo... | There are plugins to set the site to SSL. Why not use one of them? And you do have an SSL certificate installed and active? | Switching MultiSite installation from HTTP to HTTPS | wordpress |
I am looking for a way to display the most used tags over the last 30 days. I am no coder, but I have come up with this mashup to display a list of the most used 28 tags (preference to fit my theme). I cannot, for the life of me, figure out how to limit the tags to the most used in the last 30 days. Here is what I have... | The problem was that the SQL query code was getting the <code> term_taxonomy_id </code> , not the actual tag ID. I added an additional INNER JOIN using the <code> term_taxonomy </code> table to get the <code> term_id </code> . This seems to work, but if a mod can improve this, please do! <code> <ul id="footer-tags"&... | Display list of most used tags in the last 30 days | wordpress |
1.Is there any way to reblog only the excerpts of WordPress posts to another WordPress with the featured image(option to choose the size of the image we prefer) and link to the WordPress site to see the full post from specific category/ies or tag/tags? 2.Will it cause me any problem to my page rank and the Google searc... | 1 - RSS is the best way. See FeedWordPress | simple and flexible Atom/RSS syndication for WordPress and WordPress › SimplePie Plugin for WordPress « WordPress Plugins and Developer's Guide - Google AJAX Feed API - Google Code 2 - Probably | Reblog WordPress to another WordPress? | wordpress |
I need a booking system with availability calendar for my website, something simple with some basic forms. I want to be able to insert for each post a "book now" button with an availability calendar for each post(apartment, house) I've found this plugin It's nice and simple but It doesn't have an availability calendar ... | Try Wordpress Booking Calendar , it's quite complete! | booking form with availability calendar | wordpress |
First off, I'm on a Windows 2008 box running IIS7 with a <code> web.config </code> file not <code> htaccess </code> . That being said, I've stackexchange-url ("migrated my old Apache(XAMPP) installed WPMS site over to a new IIS7 server") successfully with one glitch: my media files are doing some really funky stuff. //... | I figured it out. Here's the wordpress.org forum thread of me working through it. | Media Library won't recognize SOME old files after move | wordpress |
How to get a value of a field set with Media Custom Fields (programmatically)? | As taken from : http://wordpress.org/extend/plugins/media-custom-fields/faq/ How does this plugin handle my data? Media items are stored in WordPress just like regular posts. This enables us to use native WordPress functions to store and retrieve your custom fields. Due to this, your data is stored in a very future-pro... | Media Custom Fields - get a value with PHP | wordpress |
So I got a custom search form with three dropdowns containing three different custom taxonomies. The problem is, I'd need the taxonomy slugs in the address for the search to fuction properly, because now I only get the IDs. If I have product category with the name/slug of 50 , when searching it outputs the taxonomy ID ... | Nothing stands out as 'wrong' - though you do have a few errors: The third tax_query conditional is missing a closing bracket The third tax_query should be querying <code> precio </code> not <code> $ubicacion </code> . Cast the ID variables as integers I'd suggest putting WordPress into debug mode to highlight any synt... | taxonomy query to output slugs instead IDs | wordpress |
I'm trying to use the tinyMCE in the Wordpress front end and not using wp_editor() because I need the editor to be created through Ajax (something that a wp_editor can't handle as far as I know). Does anyone know where in the Wordpress core they create the functionality where an image within the tinyMCE textarea can be... | To your primary question: It's a tinymce plugin and can be found here: wp-includes/js/tinymce/plugins/wpeditimage/ I'm not sure but I guess you would have to rewrite some code if you want to use it with a non-wp instance of tinymce. Never tried it, but I'm pretty sure it will not work out of the box. Second question: A... | How to make image in TinyMCE clickable | wordpress |
When I go to the url <code> mysite.com/photos/120 </code> I'm wanting to get the <code> 120 </code> out. In the PHP I want to be able to grab these "parameters" like the url was <code> mysite.com?page=photos&id=120 </code> or even just <code> mysite.com/photos?id=120 </code> Can I leverage rewrite rules ? Or do I n... | After many days of doing research on this, the answer was this simple: <code> $wp_query->query_vars['page'] </code> wrap that in an <code> intval </code> and viola. | rewrite rules and querystring | wordpress |
Now that <code> is_taxonomy($taxonomy) </code> function deprecated how do I know if a taxonomy exist? What's the alternative? On a second note, the codex for <code> wp_insert_term() </code> says that if the taxonomy does not exist, an error is fired. Here, the "if taxonomy exists" part is ambiguous to me. Does that mea... | See Codex page for <code> is_taxonomy </code> This function is deprecated as of Version 3.0. Please use taxonomy_exists instead. <code> wp_insert_term </code> uses <code> taxonomy_exists </code> to check if the taxonomy exists. This means if the taxonomy is a registered taxonomy. (It would be odd if <code> wp_insert_te... | is_taxonomy is deprecated. What's the alternative? | wordpress |
I'm using a shortcode to pull in different loops via the loops-name.php. For some reason it is always at the top of the page. I googled it and using echo instead of return causes that problem but with my code I am not using echo. Here's the shortcode: <code> // setup the shortcode for use function friendly_loop_shortco... | You can buffer the output like this: <code> ob_start(); include(locate_template('loop-'.$module.'.php')); return ob_get_clean(); </code> EDIT. I tried this, worked fine. <code> function friendly_loop_shortcode( $atts, $content = null ) { extract( shortcode_atts( array( 'category' => '', 'module' => '' ), $atts ) ... | Shortcode always displaying at the top of the page | wordpress |
I want to filter posts in such a way that only posts, for which <code> get_post_meta($post-> ID, "project_cat", true) </code> (it returns a post ID) is equal to my specified value, are shown. Any way to do this? I am especially interested in ways to do it compatible with WP-Paginate plugin . | The <code> WP_Query </code> object accepts a post meta argument. Generally speaking you want to do the following: <code> $my_query = new WP_Query( array( 'post_type' => 'post', 'meta_query' => array( array( 'key' => 'project_cat', 'value' => 'my-value', ) ), // Other query properties ) ); </code> Where 'my-... | Filtering posts by post meta data | wordpress |
Might be a really simple question... I am trying to pull out a category name in PHP and display it on my page. I have multiple category sections on this page, and each need to pull their respected name as an h2 . Here is what I am currently doing: <code> <div class="category-section"> <h2><?php the_categ... | I would advise against query_posts for readability purposes as its easier to make mistakes and you can end up muddled when you nest them. ( You also missed out an equals sign in your syntax. Instead use WP_Query, and check for when no posts are found, e.g. this code: <code> <div class="category-section"> <h2&g... | Define specific category name in PHP | wordpress |
How can get a modal window to work from within the wordpress admin? I want to create a modal window that will work from a meta box within the wp-admin. Any ideas? | Give the anchor a class of thickbox and make sure that the thickbox script is enqueued on your admin page using <code> add_thickbox </code> <code> add_thickbox(); </code> and <code> <a href="your url" class="thickbox">click here</a> </code> You can see what <code> add_thickbox </code> does here: http://hitc... | Modal window from within Wordpress admin | wordpress |
There doesn't seem to be a standard technique for differentiating first/top posts. After looking around, I found this method: <code> $current_query = new WP_Query('post_type=current&post_status=publish'); // Pull out top/first post $first_post = ( $paged == 0 ) ? $posts[0]->ID : ''; while ($current_query->hav... | You shouldn't need to do any special queries for this. Here is one way to accomplish it <code> /** * conditional check ensures special class only shows on top post on first page. * if you want top post on page 2, etc. to have special class, just set $first_post to true */ if( (int) get_query_var( 'paged' ) > 1 ){ $f... | Customized first post techniques | wordpress |
I am creating a custom theme for wordpress, which will have a settings page. i am adding the option to exclude pages from the navigation, which will simply work on the page id separated by a "," here is the code i have so far: <code> <ul class="tabs"> <?php $exmenuitems = get_option('exmenuitems'); $recentPost... | You probably want to explode your list of page ID's using the explode function . Something like; <code> <?php $exmenuitems = explode(",",get_option('exmenuitems')); $recentPosts = new WP_Query(); $recentPosts->query (array ( 'post__not_in' => $exmenuitems, 'post_type' => 'page', 'showposts' => $menuitems... | exclude pages in custom menu | wordpress |
I created custom post types & custom taxonomies for these. Example: <code> actors </code> (taxonomy) for <code> movies </code> (post type). Now I want to show up in my widget some terms and a <code> more </code> link for the <code> actors </code> terms archive. So guys, How do i get the taxonomy archive link / url?... | Use <code> get_term_link </code> e.g. to print out a list of actors terms linking to the archives: <code> $terms = get_terms('actors'); echo '<ul>'; foreach ($terms as $term) { echo '<li><a href="'.get_term_link($term).'">'.$term->name.'</a></li>'; } echo '</ul>'; </code> However!... | get term archive url / link | wordpress |
I'm using the following walker to create a dropdown menu that I will use on a mobile version of a project I'm working on... it works fine, however, when I select the page, it doesn't load the page, what am I missing? <code> class Walker_Nav_Menu_Dropdown extends Walker_Nav_Menu{ function start_lvl(&$output, $depth)... | You have to tell the browser to change the address in some way. A simple javascript solution is to put the item URL into the value attribute, and trigger the address change when the option is selected. Replace: <code> $output = str_replace('<li', '<option', $output); </code> With: <code> $output = str_replace( '&... | dropdown menu, with walker | wordpress |
** REVISED POST ** I have a custom post type called <code> photo_group </code> that allows you to input an array of photos. I also have a single post called "photos" which is re-written to be my-website.com/photos When a user goes to the photos page I want the first (and only one ) <code> photo_group </code> to display... | For sliders and photo stuff you best bet is to code it yourself, especially in your situation where your grabbing photos from one area (CPT) and displaying them in another. It's fairly simple to find a good js image slider/gallery and then just drop <code> WP Query </code> into it. You can of course browse here and see... | photo gallery implementation like tmz | wordpress |
I would like to have a big header side advertisements like this: What is the best way to achieve that? | Register sidebars for the banners, then use the text widget to place your code in it. The default widget will strip some HTML code, so you may want to use something less invasive like my Unfiltered Text Widget . | Big side banners | wordpress |
probably a rather weird question but I have no idea if this is possible or not!? I created a <code> custom-post-type </code> to handle events. An event always has a future date but once this date is over I want to be able to write a review of the event and add this to the post itself. So imagine an event as a kind of g... | I believe this answers both of your questions(this and stackexchange-url ("this")), Take a look at My Meta box class which lets add nay type of field you want in a custom metabox. Once you have the class all you need to do is something like this: <code> //include the main class file require_once("meta-box-class/my-meta... | meta_box or custom_field as a second tinymce post-instance? | wordpress |
I have an English blog. In one of the pages I want to include a Hebrew paragraph between two English paragraphs (I expect the English text to be left-aligned and the Hebrew text to be right-aligned). I can get the Hebrew text to be right aligned, but not in a right-to-left way (e.g. the period at the end of the sentenc... | You can add a hebrew shortcode to wrap around your hebrew text and then use the CSS2 direction attribute to indicate the text direction. e.g.: In your themes functions.php: <code> function hebrew_shortcode( $atts, $content = null ) { return '<p lang="he" DIR="RTL">' . $content . '</p>'; } add_shortcode( 'he... | How can I input a single right-to-left paragraph (Hebrew) into an English page/post? | wordpress |
There doesn't appear to be any reference to wp_trim_excerpt() outside of it's declaration - I've checked both the Trac and Xref - when does it work its magic? | If you've already looked in XRef, you've seen this comment at the top of the doc block: <code> /** * Generates an excerpt from the content, if needed. </code> So it's not used in core, but is available for you to use if you need it. Update Let me explain a little of what's going on: excerpt_length and excerpt_more are ... | When is wp_trim_excerpt() called? | wordpress |
I'm looking for a solution to display a tag list that shows how many times the tag has been used in posts as well as link to a list of results. I found a php code snippet you posted on the Wordpress forum here http://wordpress.org/support/topic/how-to-display-the-number-of-posts-under-each-tag?replies=30 <code> <?ph... | This will output a list of all tags, sorted by the most used tag first. Each tag has the number of times it has been used following the tag in parentheses. The parentheses and number of times used is in a <code> <span> </code> . To remove the parentheses, change <code> <span>(' . $tag->count . ')</spa... | How to create a linked tag list in my sidebar | wordpress |
I am using get_the_title to set up the taxonomy term for my query, which has worked fine in testing up until I had a title with more than one word, title of "catalogs" works, title of "new catalogs" does not work. When I say doesn't work I mean that, the_post_thumbnail and get_post_meta don't return anything. <code> &l... | The term needs the slug of the term, not the human read description so "hello-world" not "Hello World" Try using the <code> sanitize_title </code> function: http://codex.wordpress.org/Function_Reference/sanitize_title Also, add an else case for your loop to catch the 'no posts found' case, etc, when you have an issue i... | Using post title as term in query, only working with single word titles | wordpress |
I've built a custom post type called "Events". Each event has a future date and I don't want to use the normal <code> postdate </code> of the post. I want to use <code> add_meta_box </code> to add some inputs for this "event-date". Do you have any idea how I could use the probably same date-picker as there is right now... | Never really thought about it, but it should indeed be a good option. The date picker is called from wp-admin/includes/meta-boxes.php (line 183) as: <code> <div id="timestampdiv" class="hide-if-js"><?php touch_time(($action == 'edit'),1,4); ?></div> </code> and touch_time() is defined in wp-admin/incl... | add_meta_box: Datepicker like the one for postdate? | wordpress |
As I'm currently using WordPress only as a registration platform for GlotPress I was wondering if it would be possible to somehow redirect users visiting <code> http://translate.mydomain.tld/account/ </code> to <code> http://translate.mydomain./account/wp-login.php?action=register </code> ? <code> http://translate.mydo... | Place this in a plugin or in functions.php <code> if(is_home()){ wp_redirect(site_url('/wp-login.php?action=register')); } </code> | Redirecting home to /wp-login.php?action=register | wordpress |
I am soooo close to getting this to work but I have one outstanding issues. The featured posts code keeps repeating itself before/after each post. Any help would be greatly appreciated. The code below is what is currently in my loop. NEW CODE per CHIP <code> <?php // Define featured posts query $featured_query = new... | After discussing in chat and seeing the parent index.php file: http://pastebin.com/27r0FJ3x The main loop in loop.php is not actually the main loop at all: <code> <div id="main" class="<?php echo $containerWidth; ?>" role="main"> <?php get_template_part('breadcrumbs'); ?> <?php if ( have_posts() ) ... | Featured Posts Code - Repeated featured posts | wordpress |
Just wanted to get a straight answer on this: when submitting query_vars to a call to get_posts or WP_Query, is sanitation needed or does WordPress already take care of that? | No. Parameters given to the <code> WP_Query </code> object only need to be escaped for the database query - this is handled by WordPress. | Sanitation needed for WP_Query or get_posts calls? | wordpress |
I added a post and made it password protected. The post does not show up in a category list I placed on the Courses page, nor does it show up in the search unless you go directly to the page and then login. It then starts appearing on the Courses page. Any idea how to have the link to the post visible? The page they sh... | If a post password is applied and the user is not logged in, the post will not show up in search results. This is the expected behavior of <code> WP_Query </code> : <code> // If a search pattern is specified, load the posts that match if ( !empty($q['s']) ) { // added slashes screw with quote grouping when done early, ... | Password Protected Post is invisible until you login | wordpress |
I am creating new plugin so i need add a java script file and css file. These are my javascript files jquery.min.js jquery-1.3.2.min.js jquery.tabify.js Css file: newstyle.css | WordPress already ships with jQuery. There is no need to include it in your theme. Javascript Let's say your <code> jquery.tabify.js </code> file is located in <code> /js/jquery.tabify.js </code> in your theme. Include the following code in your <code> functions.php </code> file: <code> function jquery_tabify() { wp_en... | how to include javascript file and css file in wordpress | wordpress |
<code> wp_register_script('SliderViewer', '/js/SliderViewer-1.2.js'); wp_enqueue_script('SliderViewer'); get_header(); </code> however, <code> mydomain.com/js/SliderViewer-1.2.js </code> doesn't exist. My js is in the ftp at <code> thewebsite -> wp-content -> themes -> BLANK-Theme -> js </code> What's the p... | You're registering/enqueueing your script wrong. You should register/enqueue in your theme's <code> functions.php </code> file instead of inside the header/page. Also, you need to use your theme's directory ... which will be along the lines of <code> mydomain.com/wp-content/themes/BLANK-Theme/js/SliderViewer-1.2.js </c... | getting a js file for one page | wordpress |
Simple question, really. I know pretty much nothing about SEO, and i'm trying to define a good structure for this clients online magazine. I already know i'll be using a few custom taxonomies along with categories and tags, but the question is: if not using any SEO plugin, are either Categories, Tags and Custom Taxonom... | Short answer: No. When you're working with SEO, there are three things to take into account: Site content Site meta descriptions Site findability (it's a word, I swear!) Site Content Search engines will parse your site's content looking for content and keywords. Create good, useful content and it will be fetched, parse... | Are Categories, Tags and Custom Taxonomies any different in regards to SEO? | wordpress |
What is the proper way to include a stylesheet with my options panels in wp-admin for a given plugin or theme. In other words -- the stylesheet that styles the panels. I mean, in my panel template code, I'm doing something like... <code> <style type="text/css"> @import url("../wp-content/plugins/myplugin/panels/s... | The best practice method of enqueueing admin stylesheets is to hook into your appearance page's specific hook , using the <code> admin_print_styles-{hook} </code> , where <code> {hook} </code> = <code> {admin_page}-{menu_slug} </code> . I'll assume: This is a Theme You are properly using an appearance page, via <code> ... | Proper way to include stylesheet for panels | wordpress |
Right now I'm doing this (pseudo code) <code> posts = content_type("special_stuff"); $i = 0; $n = 5; $while(have_posts) { if($i == $n) { // print the content } ++$i; } </code> This is what I'm doing to always get the <code> n </code> th item. I'm sure there is a better way, but I'm kind of a WP noob. Related: (this que... | First of all learn WP_Query class. Answering on questions: (this question) How do I grab the nth element of a content type? eg. always getting the 1st or 5th most recent element from the db. <code> $query = new WP_Query( 'post_type=special_stuff&posts_per_page=1&paged=5' ); </code> List item <code> // The Query... | Grabbing specific content | wordpress |
I am working on a website where I am specifying links to pages within my site in other pages. I am using the same permalink post name structure i.e. http://example.com/sample-post on both development and production and I am using /index.php/sample-post/ to link to a specific blog. This works on production but not on de... | Managed to work this out. I have posted the step on stackexchange-url ("stackoverflow"). Hope it helps someone. | Getting links to work the same on development and production | wordpress |
Is there a way to define <code> wp_editor() </code> with custom tinyMCE buttons? I've noticed the wp_editor function reference mentions that one of the <code> $settings </code> arguments can be <code> tinymce (array) (optional) Load TinyMCE, can be used to pass settings directly to TinyMCE using an array() </code> . My... | You pretty much had it, according to the description. Here's what you might be looking for for instances 2 and 3 (for instance 1 you can leave the settings empty to get the default set of buttons): Instance 2: <code> wp_editor( $distribution, 'distribution', array( 'media_buttons' => false, 'textarea_rows' => 8, ... | Creating a wp_editor instance with custom tinyMCE buttons | wordpress |
In my Wordpress post I click on edit post and skip over to the html editor tab and click on it. I have a pre on that page and when i give it a rel and publish its all fine but when I skip back over to visual editor it just takes out the rel attribute. | <code> function extend_tinymce( $values ) { $elements = 'pre[id|class|title|rel]'; if ( isset( $values['extended_valid_elements'] ) ) { $values['extended_valid_elements'] .= ',' . $elements; } else { $values['extended_valid_elements'] = $elements; } return $values; } add_filter('tiny_mce_before_init', 'extend_tinymce')... | Can't give tags rels | wordpress |
I am creating a plugin that has a php file in the plugin directory which is accessed directly via a custom rewrite url. I need this file to be able to use the three functions mentioned in the title. At the moment, I am including the wp-load.php file which gives me access to all of these functions. However, I've been re... | These functions are already accessible if you use the rewrite API . When your file is parsed WordPress has loaded already, so do not include core files a second time . | Access bloginfo, get_option, and plugins_url from a non-core php file | wordpress |
This isn't a question about how to build a WordPress plugin. Rather, what, if any, guides could be applied to how to put together the file architecture of any plugin. Some other programming languages or libraries have very controlled ways of organizing directories and files. Sometimes this is annoying and highlights th... | Note that plugins are all "controllers" by WP standards. It depends on what the plugin is supposed to do, but in all cases I would try to separate the screen output from the PHP code as much as possible. Here's one way to do that easily - first, define a function that loads the template: <code> function my_plugin_load_... | How to structure a plugin | wordpress |
I'm using this function <code> plugins_url() </code> . But it always echoes main site url even in subsite. So i'm getting ajax errors like <code> Domains, protocols and ports must match. </code> Lets say my main domain name is <code> blahblah.com </code> and my subdomain is <code> mysubdomain.blahblah.com </code> Is th... | The <code> plugins_url() </code> function is designed to work in WordPress Multisite. Here is an example of its proper usage: <code> <?php echo "<img src="' .plugins_url( 'images/wordpress.png' , __FILE__ ). '" > '; ?> </code> If you are using this function in a file that is nested inside a subdirectory, yo... | What is the function to get plugin base url in multisite? | wordpress |
I was trying to load wordpress in a smarty template and i have got a lot of errors that has the same origin "Fatal error: Call to a member function the_function() on a non-object". The solution to such error is by declaring the wordpress global objects before loading wordpress like this: <code> global $wp_rewrite; </co... | As I've mentioned in the comments - you shouldn't need to modify / touch WordPress globals directly. It seems you are getting the errors because you are trying to load WordPress within Smart - this is a bit of a hacky approach. I've not used Smarty at all, but WordPress has its own way of handling templates and trying ... | What is Global Wordpress Objects? | wordpress |
The line breaks on my comments are not being considered. I've inspected the elements in google chrome and it seems that wordpress is not adding paragraph tags <code> <p> </code> to them, while in the body text it does. The comments.php in my template has the following snippet: <code> <ol class="commentlist">... | Thanks to @toscho I've found the problem. Crayon Syntax Highlighter 1.9.1 seems to have a bug . While it's not fixed, one workaround that is reasonable for me is unchecking the "Allow Crayons inside comments" option. | Add paragraph tags to comments | wordpress |
I do most of my development in Drupal, however I am working on a Wordpress site and I need to make a form. Which got me thinking, is there a Form API for wordpress like there is Drupal? Is there a way to add a form by using php? Any links to documentation (which I haven't found) or blog posts would be greatly appreciat... | No, but it should ;) There are several custom field class's (backend). wpAlchemy : https://github.com/farinspace/wpalchemy Meta Box Script: https://github.com/rilwis/meta-box My-Meta-Box: https://github.com/bainternet/My-Meta-Box meta-box-class: https://github.com/corycrowley/meta-box-class Meta Boxes Class: https://gi... | Does Wordpress have a "Form API" | wordpress |
I would like to be able to display my last X wordpress posts in the sidebar of my phpBB3 forums. Since I can't use WP's functions (because trying to use WP's functions into phpBB3 generates conflicts), I have to use a hand-made php script. So, my question is, has anyone a custom php script that would enable me to retri... | Try RSS, like Magpie RSS - PHP RSS Parser or Google Feed API — Google Developers to pull posts without using WP's library. Google Groups has forum posts on pulling images, and someone at SO found a way to pull images from Magpie: stackexchange-url ("stackexchange-url There are lots of other resources via Google. | How can I externally retrieve a post's custom sized image | wordpress |
I created a widget that uses a jquery plugin, and I used is_active_widget to enqueue the script, it's working fine but it's also including the script even on pages that doesn't show this widget. so is there a way to only enqueue the script if this widget is showing ? thanks in advance. | You should be able to call <code> wp_enqueue_script() </code> as part of your Widget output. Edit Quick-and-dirty, using the bare-bones Widgets API class example: <code> <?php class wpse48337_Widget extends WP_Widget { public function __construct() { // widget actual processes } public function form( $instance ) { /... | How to enqueue script if widget is displayed on page? | wordpress |
Is there code or a plugin that would make it possible to add default backgrounds, like you can with default headers in Twenty ten. Seems like the same frame work for backgrounds and headers. | There's no default way to do that yet, though there is a Trac ticket . I found this (untested) that may work for you: http://www.devblog.fr/2011/05/16/plusieurs-fonds-personnalises-wordpress-add_custom_background/ It's also worth noting the 3.4's new way of defining a default background (still just one, though). Edit H... | Add default Backgrounds | wordpress |
I'm sending the content of a custom post type in a plaintext email (it's to send competition entries to a panel of judges), so I need to make sure that <code> $post->post_content </code> is correctly sanitised first. Is there a filter I can use for this, or if not, what sanitisation do I need to do? Update: I've jus... | You will want to use sanitize_email(); <code> return( sanitize_email( $email ) ); </code> Here is the Codex link so you have it: http://codex.wordpress.org/Function_Reference/sanitize_email Cheers! | Sanitising post content for use in an email | wordpress |
I'm trying to hide a help page from editors, added by the gravity forms plugin. I believe I've run into the same issue before with other plugins, so I'd like to know the correct way to do it for 3rd party plugins. This is what I have so far which does not work. It does of course work for other WP menus so I'm wondering... | Ok, Eugene's Answer works in the case of a plugin that doesn't deals with custom capabilities. http://codex.wordpress.org/Roles_and_Capabilities The WordPress Plugin API allows Roles and Capabilities to be added, removed and changed. Since Plugins might change Roles and Capabilities, just the default ones are addressed... | Removing an admin page added by a 3rd party plugin. Gravity forms in this example | wordpress |
I use <code> wpdb </code> to connect to a custom db, then I use the following query: <code> $my_row = $wpdb_c->get_results("SELECT Employee.Name, Area.Name, Area.Region FROM Area INNER JOIN Employee ON Area.ID = Employee.Area_ID WHERE Employee.ID = " . get_the_ID()); </code> How do i refer to each of the <code> Name... | Modify your query and use tha SQL alias <code> as </code> <code> $my_row = $wpdb_c->get_results("SELECT Employee.Name as Employe_Name, Area.Name as Area_Name, Area.Region as Area_Region FROM Area INNER JOIN Employee ON Area.ID = Employee.Area_ID WHERE Employee.ID = " . get_the_ID()); </code> then in your code use <c... | How to reference same column name but different table in custom db query | wordpress |
I'm not sure I'm allowed to ask a question like this on this forum, however I'll try. My question is not yet about a technical problem but how my complete theme-architecture might be build to fit my purpose. My site is mainly about upcoming events - e.g. like lectures and workshops. I'd like to list all upcoming lectur... | I would do this with a custom post type, probably "Events" in your case, custom (probably hierarchical) taxonomy, and custom postmeta. You can register the post type with only the capabilities you need, then extend those capabilities with custom metaboxes for the custom postmeta. This custom meta is going to be your ev... | Calendar Solution: Handling upcoming Dates with Posts? | wordpress |
I need to get any post category id from the post id(Not for current) Post. How can i ? Thanks | You can try this code for getting category id from post id: <code> global $post; $category_detail=get_the_category( $post->ID ); </code> | How to get Category Id from Post Id ? | wordpress |
I get this error while trying to load wordpress in a smarty template. But when I visit wordpress I dont get that error any where. the code I use to load wordpress is : <code> {php}include $_SERVER['DOCUMENT_ROOT'].'/wordpress/wp-load.php'; get_header();{/php} </code> The Error : Fatal error: Call to a member function a... | Found the solution. just add this code before including wp-blog-header.php. <code> global $wp_rewrite; </code> source: https://github.com/kayue/WordpressBundle/issues/2 | Fatal error: Call to a member function add_rewrite_tag() on a non-object in /wp-includes/taxonomy.php on line 333 | wordpress |
This is from the codex. <code> <?php get_term_by( $field, $value, $taxonomy, $output, $filter ) ?> </code> Suppose I have a taxonomy system as follows; taxonomy: "healthy foods" and it's a hierarchical taxonomy and your hierarchy goes exactly like this; <code> healthy foods fruits red ones green ones veggies red ... | <code> get_term_by() </code> just returns the first matching term, 'first' meaning some internal order in MySQL. If having multiple terms with the same name matters in your case, don't rely on <code> get_term_by() </code> alone. | how does get_term_by know which term to return when the same term appears twice in a hierarchical taxonomy? | wordpress |
I have been following this post exactly: stackexchange-url ("stackexchange-url and have everything working in the backend but when I try to use <code> echo get_post_meta($post-> ID, 'songs', true); </code> in my template all that is shown is <code> Array </code> . Any ideas? I would appreciate it. | You might wish to try; <code> <?php $mykey_values = get_post_custom_values('my_key'); foreach ( $mykey_values as $key => $value ) { echo "$key => $value ('my_key')<br />"; } ?> </code> Where my_key would be equal to songs. Another example of what I might do in a situation where I am dealing with multi... | How to display meta box data using "Meta boxes as needed" | wordpress |
I was wondering if we can set the order of a function hooked to wp_footer(), I created a function that echos: <code> <script> ajsfunction(); </script> </code> and I also enqueued the js file of this function and printed it in the footer but the above is being printed before linking to the js file so it's no... | The recommended way is to call your function inside the .js file you are enqueuing. Is there any reason you can't do that? If you need access to dynamic data like WP options from within your script, use <code> wp_localize_script </code> to initialize a javascript object with the data you need: <code> $data = array('som... | Is there a way to set the order of wp_footer hooked functions? | wordpress |
I'm using the theme-check plugin to check my theme for errors and recommendations, I'm using get_template_part() in theme files like header.php and index.php but in functions.php I'm using include_once() theme-check is not pointing at these, it's pointing at include_once used in a widgets.php file which is included in ... | Your <code> functions.php </code> doesn’t create output, so you should use <code> locate_template() </code> . Example: <code> locate_template( 'php/functions.nav-menu.php', TRUE, TRUE ); </code> You’ll find this function in <code> wp-includes/theme.php </code> . The first parameter is the file path relative to the them... | Should we use get_template_part() in functions files instead of include_once? | wordpress |
This is what I added in my theme's functions.php file to enable formatting for excerpts in Wordpress ( source of the tip ): <code> remove_filter('get_the_excerpt', 'wp_trim_excerpt'); add_filter('get_the_excerpt', 'bwp_trim_excerpt'); function bwp_trim_excerpt($text) { $raw_excerpt = $text; if ( '' == $text ) { $text =... | This is one of the reasons why HTML markup is removed from excerpts in the first place, to prevent such issues like this from occurring however, where there's a will, there's a way... You can, through using regular expression, close the open tags applicable to the excerpt only and you might want to take a look at the f... | Issue with enabling formatting in excerpts in Wordpress | wordpress |
All my blog contents are well prepared in MS Word. Some contents have image flow chart. On copying the contents from Word doc, i am not able to copy the Images. How should i copy both contents and images from word doc to the Blog? Or Is there any way to upload each doc file which will directly extract the contents incl... | The better way would be to use Windows Live Writer . It's a Microsoft product that's part of the Windows Live Essentials suite . This program allows you to copy-paste content from a Word document, or just build the post out as you would in Word. But the advantage is that it can also talk directly to your WordPress site... | Upload .doc to blog | wordpress |
I'm building a portfolio post type and I want to have a way to mark certain pieces as featured, some as normal (default) and others as archived. The pieces would only ever be one of these 3. Because of the singular value it makes sense to me that this be post meta. But, i've read that querying by taxonomy is supposedly... | I'm not sure that one can be called categorically faster than the other. And, in any case, it's only really going to emerge when you start to scale up to many, many objects. The issue is this: The postmeta table is a key-value table that is not indexed. If you have a certain number of rows in the table - say, a few hun... | How much faster is a tax query than a meta query? | wordpress |
I'm using Wordpress Form Manager to allow users to post from the front end and I need to place values for the post in different spots in a single post template. The code they offered doesn't return anything in or outside the loop. For instance I need to put the url of the file upload into a script to play a song. The t... | Look at this.. http://www.campbellhoffman.com/form-manager-faq/#putting-submission-data-on-a-post-or-page | Get a submitted value from front end post form for single template | wordpress |
I need to change the color of some custom link elements in dropdown of my wordpress custom menu here . There 3 items in my dropdown that dont have any url associated with them: Air Duct Chimney Dryer Vent They will be just the headers for other dropdown items below them. I need to be able to change their attributes suc... | Enable the <code> CSS Classes </code> (Screen Setting -> Flag CSS Classes) and use it to customize every menu item that you want to be styled in a different manner. You must use a Custom menu, of course. | How to manipulate attributes of url-less dropdown item in a the custom wordpress menu? | wordpress |
I made a little plugin that enqueues 1 .js file and 1 .css file into a theme's front-end. All it does it load a grid on top of the theme so I can visualise the design. If this plugin was activated on a live site, is it possible that only I (the super admin) can see the JS and CSS files included onto the front-end? All ... | <code> function load_grid() { if ( current_user_can( 'level_10' ) ) { wp_enqueue_style('grid_css', plugins_url('/lib/css/grid.css', __FILE__) ); wp_enqueue_script('grid_js', plugins_url('/lib/js/grid.js', __FILE__), array('jquery') ); } } add_action('wp_enqueue_scripts', 'load_grid'); </code> | Making a plugin only available on the front-end for the logged in super admin | wordpress |
Thanks to Wordpress calling their content 'posts', it makes it hard to find information on dealing with forms submitted with the POST protocol. My question is simple, the answer should be simple to a seasoned Wordpress developer. Using a Wordpress plugin which has a form in the widget method of the class, I named the v... | Okay, I've looked at the function description for get_field_name() and it says that this function is specifically designed to be used in the form method of the Widget class. I found no uses in the Wordpress code outside of the form() method. <code> /** * Constructs name attributes for use in form() fields * * This func... | How to handle forms from sidebar widgets - Processing $_POST variables using get_field_name() | wordpress |
I would like to manage multiple sites running as part of a single wordpress network, but I don't want to personally host each of the individual sites. I don't mind if my database holds all the tables for each site, but I don't want to be the sole host for all the files, etc for each site. Is there any way to do this? | A multi-site network only has one set of files: There is only one WordPress installation that is shared among the various sites. There is only one database shared among the various sites. The database and WordPress files don't need to be on the same physical machine, but they need to have access to one another. The Wor... | Can you set up a wordpress (multi-site) network to work across multiple hosting accounts? | wordpress |
I'm developing a theme using a test installation (using InstantWP), but when I upload it to a staging site, for some reason the nav menu looks inflated. After looking at the source, it turned out to be that for some reason my test install uses the class <code> .sub-menu </code> while the staging install uses <code> .ch... | What One Trick Pony said; look in Appearance > Menus on both sites and check if the menu has been populated. If so, check to see if the Theme Location has been set and saved. If they are different that may be what's causing different menu structures to be rendered. Let us know how it goes - good luck! | .sub-menu or .children? | wordpress |
I have WP_DEBUG set to ON to show errors and notices. Of all notices the one that is bothering me is <code> Notice: attribute_escape is deprecated since version 2.8! Use esc_attr() instead. in /Users/john/Documents/htdocs/wp-includes/functions.php on line 3467 </code> . I started commenting the code to find which funct... | This proves that the problem isn't core: I switched the theme to twentyeleven where the problem does not appear at all. Core functions are not throwing those notices. Your Theme is calling the deprecated function(s) somewhere - perhaps in a filer callback for <code> the_title </code> . Search your Theme files to find t... | Notice: attribute_escape is deprecated | wordpress |
I want to get a specific wordpress nav menu as a list in my custom php page outside of wordpress. How to do that? | There are a few ways, here's one: <code> // no theme output define('WP_USE_THEMES', false); // initializes the entire Wordpress require '/path/to/your/wp/wp-blog-header.php'; // here you print your menu wp_nav_menu('your_theme_menu_location'); </code> Even if theme output is disabled, the theme's functions.php should s... | How to get wordpress nav menu outside of wordpress system? | wordpress |
I've got something about this on the WPML support forums, but I figured I could ask here as well. Here's the important info: I'm running a WP Multisite setup with custom post types, custom fields, custom everything it seems. In a particular template file, I've got a secondary loop that's pulling a list of items from a ... | My solution was to register the custom post types on the site where I'm calling it from, then in WPML's settings set them to translate. This is in WPML -> Translation Management -> Multilingual Content Setup, down at the bottom. I assume it works by tricking WP into using that site's rewrite/translate rules when it doe... | WPML with WP_Query serving up all 3 languages | wordpress |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.