question stringlengths 0 34.8k | answer stringlengths 0 28.3k | title stringlengths 7 150 | forum_tag stringclasses 12
values |
|---|---|---|---|
I'm using the up/down voting feature of this plugin and would like to not allow people to 'down vote'. So basically, if they like the post, they vote it up, and if not, they leave it how it is. Is something like this possible? | I just gave a quick look at the plugin and in my opinion it would be easier to tweak the way you use it rather than to tweak the code itself. What you want is basically already existing in the ' Rationg options ', it's the heart option that only allow the user to do a like, or 'up vote', which is just the same. You the... | Any way to change WP-PostRatings so you can only vote up? | wordpress |
I'm experiencing a somewhat endless loop in the file mo.php <code> /wp-includes/pomo/mo.php </code> when loading the site's default text domain. The PHP error is: <code> Fatal error: Maximum execution time of 30 seconds exceeded in ...\wp-includes\pomo\streams.php on line 62 </code> I can work around this by disabling ... | I was able to fix the problem by switching the xdebug extension. I had a vc9-nts version installed and switched to vc6-nts which solved the issue. | POMO_Reader-> substr() call endless loop? | wordpress |
I want to use jQuery UI tabs in my WordPress 3.1.4 pages. I write programming tutorials for a VB .NET audience but like to provide C# source as well, and I want to use the tabs to let the readers switch between the two. I could probably make my own given time, but this was supposed to be a "learn things about jQuery" p... | The short answer is that you need to include a jQuery UI CSS "Theme" with your code. The jQuery UI framework is actually a combination of JavaScript and CSS (and it looks like you've only included the JavaScript). As a quick test, I just applied the "Base" theme to your code here . (Notice on the sidebar, under Manage ... | How do I use jQuery UI tabs in a WordPress page? | wordpress |
I have created a widget that have to run some code using the wp_footer hook as well. But if you extend the WP_Widget, the wp_footer runs twice! Has someone already past for the same issue? Here is an example: <code> /* Plugin Name: Test Description: Test Plugin by Romulo De Lazzari Version: 1.0 Author: Romulo De Lazzar... | That code doesn't look like it conforms to the current Widgets API. Perhaps your problem is related? First potential issue: your class <code> test </code> should be <code> plugin-slug-test </code> , in order to avoid naming conflicts. Second potential issue: the only functions inside of your WP_Widget extending class s... | wp_footer hook running twice | wordpress |
I've got an <code> add_action </code> in functions.php, the action is for <code> save_post </code> and the function I'm running I've named set_attachment_url. I'm simply getting the first attachment on a post and setting a custom field with the URL of that attachment. Good news is, everything works great when I'm addin... | the update post function actually calls the insert function so it should work, now I'm not sure but try changing: <code> if(!strlen($photo_url)){ </code> to: <code> if(empty($photo_url)){ </code> since php <code> strlen() </code> returns 0 on an empty string. | Post via wp-admin and via iOS app, same hooks and triggers involved? | wordpress |
Why is my table row background image not appearing in Wordpress. Is the stylesheet for the theme suppressing it in some way and if so, how can one override that to make the image show, or is there some other fault causing it not to appear? Note the other image in the table does display properly so the path to the files... | What does Firebug or Chrome Developer Tools report on the rendered background image URL? Does it return a 404? Try changing this: <code> style="background-image:url(/wp-content/plugins/xxxxxxwidget/image2.png) </code> to this: <code> style="background-image:url(<?php echo wp_plugins_dir(); ?>/xxxxxxwidget/image2.... | Why is my table background image not showing in wordpress? | wordpress |
Pretty much as the title says, I want to use the "link" button from the HTML mode in the Visual Mode in the WYSIWYG editor (the link/unlink in visual is to "advanced" for my liking). Is this possible without too much of a hassle? | Sorry, but no. :) You can't simply use the html-button in the wysiwyg-editor. Both are different programms and have nothing in common except for their location. You'd have to unregister the current buttons, write code for a new one (that fits your likings) and then add this one. You'll find hundreds of tutorials for ad... | WYSIWYG – Getting the "link" button from HTML mode in Visual mode | wordpress |
Just looking for a recommendation on the best plugin to allow javascript in a post or page. | Or, you could just give users the 'unfiltered_html' capability. This can be done with a plugin such as Capability Manager . Warning: don't allow untrusted users to insert random scripts into the post content. With JavaScript, they can steal HTTP cookies from other users, including yourself, giving them administrator ri... | What's the best plugin for allowing javascript in a post or page? | wordpress |
Is it only me or this is what's happening? I just want to get all posts starting from a certain offset, like 10. Instead I get all posts starting from the 0. | <code> posts_per_page => -1 </code> is equivalent to <code> 'nopaging' => true </code> , which basically means no LIMIT clause is used at all. The workaround is to set posts_per_page to a large number. This is a limitation of the LIMIT syntax itself: http://dev.mysql.com/doc/refman/5.0/en/select.html | WP_Query: offset ignored when posts_per_page is -1? | wordpress |
I'm trying to delete around 250 posts at once, but the next page I am taken to displays the error: Request-URI Too Large The requested URL's length exceeds the capacity limit for this server Does Wordpress need to use a HTTP Post action to delete posts? | Thanks. I ended up deleting them through PHPMyAdmin. They were all in the same category. | Internal Server Error 414 - Request-URI Too Large | wordpress |
I am a little confused, the Wordpress 2.8 Widget API reffers to WordPress version 2.8 or is refferred to API version? Should I use 2.8 Widget API for writing my WordPress 3.1.4 widget? | WordPress APIs usually refer to group of functions and concepts and are not versioned. Any versions refer to WP itself (or in some cases to bundled components, developed by third parties such as jQuery). In WordPress version 2.8 creating widgets was refactored from older code (which you shouldn't care about) to newer c... | Wordpress 2.8 Widget API is suitable for Worpress 3.1.4 plugins development? | wordpress |
I am making a plugin and I have a bunch of different data types that I am creating edit pages for. I'd rather not have to create a separate function to add each one to the admin menus, since they're all using the same function to display their edit page. I have tried: <code> `add_submenu_page('upload_manage', "Programs... | Your menu slug (5th parameter) can't be the same across multiple pages, and it obviously can't have an & in it, but you can have all the pages you want call the same callback function (the last param). <code> add_submenu_page('upload_manage', "Programs", "Programs", 'manage_options', 'manage-programs', "manage_data... | Is it possible to add an admin page using add_submenu_page() and pass a var in the query string? | wordpress |
I am trying to render content generated by a php file in [jQuery Colorbox][1] through AJAX in my WordPress site. The PHP resides on the same server in the same domain. It works perfect when I run it on localhost but it's not working on the server. Here is the link to my site - http://shabdcreatives.com/portfolio The li... | You should not load wp-blog-header.php yourself. Use <code> wp-admin/admin-ajax.php </code> instead, as described here: http://codex.wordpress.org/AJAX_in_Plugins | Colorbox ajax loading of outside HTML content works perfect on localhost but not on server | wordpress |
When I echo get_permalink() in a function that's called from archive.php, it reflects the permalink of the last post that's assigned to the category. How can I echo the permalink of the category page instead? | Like so: <code> echo get_category_link( get_queried_object() ); </code> | What is the_permalink() on a category page? | wordpress |
Is it possible to check if a custom field exists for a given post within the loop? For example, I'm using functions like <code> get_post_meta($post->ID, 'Company', true); </code> preceded by a <code> <h4> </code> tag, but I'd like to check to make sure that there is a value for the custom field "Company" befor... | The WP <code> get_ </code> methods are here to retrieve data, not to display them. You can easily check the var - containing the data - before adding your head tags: <code> $my_post_meta = get_post_meta($post->ID, 'Company', true); if ( ! empty ( $my_post_meta ) ) echo '<h4>'.$my_post_meta.'</h4>'; </cod... | Check if a specific custom field exists? | wordpress |
I've been looking for a way to import videos from YouTube as posts in regular intervals. Preferably daily, weekly is fine too. For the past hour I've been playing with this plug-in: http://www.ternstyle.us/products/plugins/wordpress/wordpress-automatic-youtube-video-posts It offers the ability to post videos to Wordpre... | It is possible, but you'll have to do a little work on your own (the Plugin is not needed). First, load the Zend GData Class . Second, you'll have to read trough here . | Importing YouTube Videos As Posts - From Playlists | wordpress |
For some reason I can'g get pagination using previous_posts_link and next_posts_link working. Here is the code I have... <code> <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?> <?php // The Query $the_query = new WP_Query( array( 'post_type'=>'article', 'posts_per_page'=>2, 'order... | The pagination works only, if the <code> paged </code> attribute in the the global <code> $wp_query </code> variable is set. You could store your query manually in this global or just use <code> query_posts() </code> instead of <code> new WP_Query() </code> . <code> <?php $paged = (get_query_var('paged')) ? get_quer... | Pagination with custom post type not working | wordpress |
I've set up a custom post type called 'properties'. These posts can be tagged with the custom taxonomies of 'area' and 'university'. I would like to be able to have a form with a drop-down for each tag. When the form is submitted I would like to go to the URL that displays the archive of those tags. Two questions reall... | To understand how to do it you first need to know how the url query works or more specifically what query vars you need, so: <code> 'post_type' </code> - to filter by post types. <code> 'area' </code> - to filter by area taxonomy. <code> 'university' </code> - to filter by university taxonomy. so your url would look li... | How to go to tag archives using a form | wordpress |
I think proxy based comments mostly spam. So what is the best way of determining proxy using comments ? | It's possible, but it's unlikely that you succeed for comment spammers (and how do you separate them from legitimate proxy users?): <code> $proxy = $_SERVER['HTTP_X_FORWARDED_FOR']; </code> | Is it possible to determine proxy based comments? | wordpress |
Here's what I have in my sidebar.php: <code> <aside id="sidebar"> <?php if ( is_user_logged_in() ) { echo '<a href="/community"><img id="visit-the-forums" src="'. bloginfo('template_url') . '/images/visit-the-forums.png" alt="Check out the Forums!" /></a>' } else { echo '<a href="/communit... | Does the markup after <code> <?php get_sidebar(); ?> </code> show up? I would guess that this is a silent PHP error, as your lines within the if/else block do not end with semi-colons. :) | sidebar isn't showing, what's wrong w/ this code? | wordpress |
I'd like to add a button the the WordPress editor's toolbar. When clicked, I want to open a modal dialog (exactly like what you get when you click the "Paste from Word" icon). This might be more than one question, so the first question I have is what code to I need to add to my theme's functions.php to place the button... | Here is a nice tutorial I've read http://www.garyc40.com/2010/03/how-to-make-shortcodes-user-friendly/ He as a great example and you cal also download the source files and get a better understanding That's how I added a custom button to the tinymce editor in my plugin simple TOC which you can also download , look at th... | How can I add a custom button to the post editor toolbar? | wordpress |
I'm developing a theme for a customer in which i need several versions of the same image. In my functions.php file i've added all the image sizes i need. For instance: <code> if ( function_exists( 'add_theme_support' ) ) { add_theme_support( 'post-thumbnails' ); } if ( function_exists( 'add_image_size' ) ) { add_image_... | It turns out WP got confused because i used the settings> medias screen to also set the "medium" dimensions to 670x290. This redundance seems to disable entirely both the "medium" and the "listing-post-thumbnail" dimensions. Replacing the medium dimension values to 0 and then regenerating the thumbnails solved the issu... | custom image size not being fetched | wordpress |
I'm working on a WordPress plugin and want to make sure that all text that is displayed is prepared for localization. I'm having trouble localizing the text that resides inside an array. For instance, I have the following code inside a class <code> var $control_type_default = array( array( 'key' => 'automatic', 'val... | You can't do that, at least not from a GUI translation helper app, because these are set to pick up strings from standard functions like <code> __() </code> , <code> _e </code> etc, they can't read variables (including string variables) Instead try: <code> var $control_types = array( array( 'key' => 'manual', 'value... | Preparing a string in an array for localization | wordpress |
I am trying to set cookies to re-route returning users to my a specific page within my Wordpress site. I'd like some advice with these 2 things: Where in the Wordpress php files should cookies be checked before loading any content to handle a redirect? Is there a good file this should exist in over others? How do I pro... | Ah, realized I needed to hook this into the <code> init() </code> . SOLUTION: I created a function in functions.php that would set and check the cookie. for this to work properly, after defining the function, outside the function call this: <code> add_action('init', 'function-name'); </code> | Setting custom cookies in Wordpress | wordpress |
When I want to redirect the user after successful registration, I just use "registration_redirect" filter hook. How about when registration fails, which filter hook should I use? I looked into wp-login.php but I didn't see any filter/action hook that I could use. How do I go about this? | You could add an htaccess redirect or try out the theme my login plugin: http://wordpress.org/extend/plugins/theme-my-login/ . It has options for custom redirection. | Redirect to custom url when registration fails? | wordpress |
I'm currently using some JS to pop open the WordPress Media Library in a thickbox container and return the URL of a selected image, then display it. <code> window.send_to_editor = function(html) { imgurl = jQuery('img',html).attr('src'); jQuery('#upload_image-' + id_to_pass).val(imgurl); output_code = '<img class="m... | Take a look at this http://sltaylor.co.uk/blog/hijacking-the-wordpress-media-library-overlay/ | Using the WordPress Media Library and returning the Attachment ID rather than URL? | wordpress |
I'm trying to setup a function in functions.php that removes an image from the post_content on save. Everything works up until the time I'm trying to save the content, the page just hangs and I get a '500 Internal Server' error. <code> function remove_post_image( $post_ID ){ // get the post $the_post = get_post($post_I... | <code> content_save_pre </code> would be a much better hook for striping the images and as for setting post thumbnail as post Meta you can use <code> save_post </code> since the first hook gets fired before post Id is set and you need that for <code> update_post_meta </code> . | Remove image from post_content on save_post | wordpress |
In Drupal you have the GUI to create whatever type you want. How about in WP, do I still have to code to create one? | Even though there are plugins to register Custom Post Types in WordPress, this is not the way it should be done. According to core developer Andrew Nacin, Custom Post Types should be implemented (in code) not registered (by clicks). This makes them more managable and easier to improve and further develop or hack. Also,... | How does WP custom post types fare compared to Drupal's? | wordpress |
I have read a lot of turorials an even the codex widget API, but can't solve my doubts: What are the really difference writing WorPress 3.x widget plugins? if there exists. this doubt came when trying to create plugin containing an widget I have actived <code> WP_DEBUG </code> and saw the notice that <code> register_si... | As per stackexchange-url ("your other question") rather than trying to use older API to implement widgets it is better to use newer and current approach as per Widgets API in Codex. The difference is that newer code is more reliable and more functional (allows to easily have more complex features, such as multiple inst... | What are the really difference writing WordPress 3.x widget plugins? | wordpress |
how are you? I want to using a string query to list tags in array and using it. I write this query but dosen't work <code> $tags= $wpdb->query("SELECT * FROM $wpdb->term_taxonomy , $wpdb->term_taxonomy WHERE $wpdb->term_taxonomy.taxonomy = post_tag"); foreach($tags as $tag){ echo $tag; } </code> please help... | Use get_terms() . | I want a query to list tags | wordpress |
I have my single-property.php showing custom post type 'property', within this page I want to also show the custom post type 'agent' that belongs to the author of property, each author only has one post of custom post type 'agent'. I imagine it needs to go something like this, single-property.php with the query to show... | You can use the <code> $post->post_author </code> , so before your loop add <code> $agent = ''; </code> then inside the loop add <code> $agent = $post->post_author; </code> and then create a second query after you loop ends: <code> $agent_query = NEW WP_Query(array('post_type' => 'agent', 'author' => $agent... | Run second query on page based on author of the first query | wordpress |
This question was discussed on stackexchange-url ("here") and I believe stackexchange-url ("here") as well, but I was wondering if anyone knew of any updates to this since then? To clarify, I currently have a custom taxonomy called 'Days of Week' so I only use seven terms (Monday, Tuesday, Wednesday etc.) but under <co... | I have a new answer for this, use my brand new plugin: http://wordpress.org/extend/plugins/custom-taxonomy-sort/ . I hope this helps with this issue. | Sort Custom Taxonomy Terms in admin by custom order | wordpress |
For example i've <code> domain.com/about?project=1 </code> but i've permalinks enabled and i'm using thins to generate the pagination paginate_links . The proble is that the links generated are like this <code> domain.com/about?project=1/page/1 </code> and it breaks everything because the project is taken as <code> 1/p... | To add arguments to the links in paginate posts, use the <code> 'add_args' </code> argument in the function. You have to pass the arguments as an associative array. So, to add <code> project=1 </code> to the end of all your links, you would do this: <code> global $wp_query; paginate_links(array( 'total' => $wp_query... | Passing custom args in paginate_links | wordpress |
The text returned by the_excerpt() does not respect my widget format. I couldn't explain it better so I will just show you my code: <code> function widget($args, $options) { extract($args); $post_type = $options['post_type']; $num_of_posts = $options['limit']; // Create a new instance $second_query = new WP_Query( arra... | as you are working with strings, you need to use a function which returns the value, instead of echoing it; in this line: <code> $byh_content .= "<p>" . the_excerpt() . "</p>"; </code> use <code> get_the_excerpt() </code> http://codex.wordpress.org/Function_Reference/get_the_excerpt | Broken markup when using the_excerpt() in a widget? | wordpress |
Is it possible to let a non-admin user (e.g an editor / author or another role) manage the users? I am working on a Wordpress website where multiple people manage the website, and there will be someone who must be able to manage the users, but does not need access to all the admin features. Thanks. | First off, there is no generic "manage users" ability. There are several individual abilities under that rubric. See http://codex.wordpress.org/Roles_and_Capabilities Anyway, you have a couple options. You can add certain capabilities to existing users or you can create a new custom role with the capabilities you need.... | Wordpress manage users as non admin | wordpress |
I need to <code> get_the_tag_list </code> but want to remove whitespace within individual tags. Thus, <code> firefox, internet explorer, opera </code> becomes <code> firefox, internetexplorer, opera </code> All the filters I found removed whitespace from the HTML, not the content itself. | <code> $tags = get_the_tags(); $tag_links = array(); foreach((array)$tags as $tag) $tag_links[] = '<a href="'.get_tag_link($tag->term_id).'" rel="tag">'.str_replace(' ', '', $tag->name)).'</a>'; echo implode(', ', $tag_links); </code> | return get_the_tag_list with whitespace removed | wordpress |
The majority of new user signups I receive on my Wordpress blog look dodgy, with @someblog.com, @somearticle.com, or @gmail.com addresses. What do they gain by signing up as a new user? | Some are attempting to leave their links behind, they believe the quantity not quality approach will actual help increase SEO rankings. The other reason would be affiliate marketing garbage links trying to make a penny. | What do spammers gain by signing up as a user? | wordpress |
I am running wordpress 3.2rc2 multisite. I inserted a few .mp4 videos into the root of my domain so that I can run a few basic tests with the jw player. When I try to access the url to the .mp4 video, I somehow end up with a wordpress 404 page. This is also causing errors within the jw player saying that either the fil... | A missing mime type should not cause a 404 page but the AddType needs to be wrapped in <code> <IfModule mod_mime.c> </code> tags. <code> <IfModule mod_mime.c> AddType video/mp4 .mp4 .m4v AddType video/mpeg .mpeg .mpg .mpe AddType video/asf .asf .asx .wax .wmv .wmx AddType video/avi .avi AddType video/quickt... | wordpress htaccess is hijacking my .mp4 files | wordpress |
I use hack of stackexchange-url ("Chris_O") for highlighting the search terms. When a user enters the search keywords without any blank space in the beginning or at end of the search string it retrieves and highlights the search terms in the corresponding records nicely. But if the user enters the search string with bl... | i agree w/ chip, you need trim() i'd try replacing: <code> $keys = implode('|', explode(' ', get_search_query())); </code> with <code> $keys = implode('|', explode(' ', trim(get_search_query()))); </code> | How to strip/remove all blank spaces at the beginning/end of a search string | wordpress |
I'm trying to figure out a way to include a div(which will contain a background image) for a specific tag. This block of code works but fails when a post has more than 1 tag. I'm using a page called tag.php which is the default template for all tags. I'll have quite a few tags so I don't want to create template files f... | Here are 2 solutions: Using Tag titles <code> <?php switch( single_tag_title( '', false ) ) { case 'Books' : include 'tags/books.php'; break; case 'Tables' : include 'tags/tables.php'; break; default : break; } ?> </code> Using tag slugs: <code> <?php if ( is_tag( 'books' ) ) { include 'tags/books.php'; } else... | Detect tag page and include an Image for that specific tag | wordpress |
When I'm reading a custom type post in the single view, I see that the URL is www.my_site.com/my_custom_post_type/title_of_my_post. How to get rid of this ugly /my_custom_post_type/ ? | <code> register_post_type( 'my_custom_post_type', array( 'rewrite' => array( 'with_front' => false ), // other args )); </code> Make sure you flush your permalinks after changing your code - simply going to Settings > Permalinks is sufficient. | Getting rid of /my_custom_post_type/ in the single view URL | wordpress |
I'd like to allow my users to send their WordPress login credentials along with their comment, as opposed to having to log in first, and then post their comment. I'm not really sure where to hook into here, and any help would be much appreciated. My basic plan is to get the user's login and pass (and comment), log the ... | You can log a user in securely by simply calling wp_signon with the proper credentials. This has to be done before any output is produced, so that WP can set the users cookie properly. Example: <code> $user = wp_signon(array('user_login'=>'example', 'user_password' = > 'swordfish')); </code> That will do a proper... | Send along login credentials with comment content | wordpress |
I know how to get the value of a custom field, using code like <code> get_post_meta($post->ID, 'company', true); </code> . Is there a way to get the name of the custom field? | to get a post custom fields name you can use get_post_custom eg: <code> $post_meta = get_post_custom($post->ID); foreach ( $post_meta as $key => $value ) echo $key . " => " . $value . "<br />"; </code> this will print a list of custom_field_name => custom_field_value | How to Get the title of a custom field? | wordpress |
How can I define the maximum number of revisions on a per-post type basis? For example posts have 3 max revisions where as pages have a max of 10. | I might be wrong, but my first guess would be that this is not easily possible, because number of revisions gets saved into constant and does not seem hook-able. From quick search relevant checks are in <code> wp_save_post_revision() </code> and it's very rigid. | Define maximum number of revisions per post type? | wordpress |
Does anyone know of a wordpress theme or plugin that offers custom user registration + 'My account' panel? I'm trying to build a cashback site.. would appreciate if you could share themes or plugins that could do the job. | Just echoing what Chip already said: Themes are for presentation , plugins are for functionality. Custom user registration and a 'My Account' panel would be in the realm of custom functionality. To quote another WordPress developer: If you're building a bathroom and you change the wallpaper, the toilet shouldn't disapp... | Can anyone suggest a wordpress them with built in user management | wordpress |
I've been writing some Wordpress plugins, and I've been having some problem with Wordpress putting magic quotes on POST and GET data. Specifically, the "wp_magic_quotes" function in \wp-includes\load.php, which is called (presumably on every response) in wp-settings.php. This function adds magic quotes to the data even... | Simply put WP turns indeterminate situation (magic quotes might or might not be enabled in server configuration) into determinate (magic quotes are always present and server configuration does not matter). Rather than messing with this for all WP core it makes much more sense to simply strip slashes in your code on you... | Wordpress and magic quotes | wordpress |
Hi I have built a settings page which from the menu leads to: http://www.mysite.com/wp-admin/admin.php?page=theme_options The problem is that when I go to save the options and I am an EDITOR user I get this error: You do not have sufficient permissions to access this page. I am using User Role Editor plugin and edit_th... | I am not sure this is the issue here, but if I remember right the current limitation of Settings API is that <code> manage_options </code> capability is required for everything to be saved properly. Quick search shows it might get fixed in 3.2, see this trac ticket . | Insufficient permissions to save options | wordpress |
Hi iam developing a plugin to activated a couple of plugins. i.e: the plugin jetpack has six plugins and all gets activated on a single install,like wise i need to activate a group of plugins from acivating this plugin. for example consider a plugin called 'site plugin' which has sub folders of other plugins. when i ac... | You're main pluggin can use register_activation_hook and use the function you register thru the hook to activate you're necesary pluggins. Smth along these lines : <code> // get already activated plugins $plugins = get_option('active_plugins'); $puginsToActiv = array('Plugin1', 'Plugin2', 'Plugin3'); if($plugins) { $ch... | Wordpress plugin for activating other plugins | wordpress |
Been looking around for an alternative to this method: http://allcreatives.net/2011/02/02/using-the-native-wordpress-tinymce-wysiwyg-editor-with-your-custom-post-meta-textareas/ To add the WYSIWYG capability to custom metaboxes. You get so little control with this method, is there any other way? | Use this class: http://www.deluxeblogtips.com/p/meta-box-script-for-wordpress.html and then call the metabox like this (don't forget to read the manual and view some examples): <code> $meta_boxes[] = array( 'id' => 'textmetabox', 'title' => 'Your Meta Box Title', 'pages' => array('post', 'slider', 'whatever-yo... | Add TinyMCE to CPT metaboxes in 3.1? | wordpress |
What are the best practices for using post_id? Can I use this safely in my templates to call specific posts, or will these post_id's ever change? The reason I ask is that randomly today the post_id's changed on my site, and I'm wondering what could have caused it. It didn't mess up any of the permalinks (thankfully!) b... | Post ID's do not change. The reason behind this is the ID column in MYSQL is the primary key for the table. It is auto incremented when a new row is added. It is improbable that a post ID would change programatically unless someone is doing something rogue in the database. | will post_id ever change? Can I safely use post_id for custom queries? | wordpress |
Is there a well-coded plugin or function that will enable me to create a global feed for only one post type in a multisite setup? | Perhaps you might be able to achieve your goal by combining the feeds of the posts you are interested and create a new feed this way? That's what I did for a multisite setup. In this setup I created a page template which would load the rss feed which I created using Simple Pie (to combine all rss feeds into one cached ... | Global site feed plugin/function for custom post type? | wordpress |
This might be a stupid question, and maybe I've missed some best practices thing, but I've been having this problem with clients using sites on WordPress. Let's say we have a fairly complex page that requires some good amount of HTML code inside the page itself. We put it up and it looks great. Now, month later client ... | One thing you could do is create page templates for complex pages and simply add the content through the editor, leave as little mark-up as possible in the editor. Another thing that might help is using the editor style (activated with <code> add_editor_style() </code> in <code> functions.php </code> ) and defined in <... | Editing Complex Pages in Visual Mode | wordpress |
On one of my page templates I need to include the contents of several other pages. For example, if my page template is called Fruit, I need to pull in page content from pages named Apple, Pear, Orange, Lime, etc. This gives my user the ability to edit Apple and Lime individually from admin area. I'm trying to use get_p... | get_page_by_title returns an id not content. here is an example of what I use to get content from a certain page id. call the function <code> $page_id = get_page_by_title('title'); $excerpt = get_excerpt_by_id($page_id); </code> in functions.php <code> function get_excerpt_by_id($post_id) { global $wpdb; $query = "SELE... | Unable to use get_page_by_title() more than once per page? | wordpress |
i've been having a world of difficulty w/ the WP-minify plugin. usually i get 400/bad request errors when i try to access the combined/minified script or style files. this tends to break the entire look of my site. but on my last site i came across a new error... when i try to view the combined script i see the followi... | "open_basedir restriction in effect" errors mean the host is very restrictive in terms of php configs. The open_basedir setting prevents scripts from reading files (via requires, includes, any of the file handing functions, etc.) from directories that are not marked as "safe." It was designed to prevent users from acce... | WP-Minify 400 errors and open_basedir restriction in effect | wordpress |
When it comes to excerpts, do you believe TimThumb or WordPress thumbnails is the way to go? And why? Answers will not be graded (but may be criticized). | In my opinion the built in <code> <?php add_image_size( $name, $width, $height, $crop ); ?> </code> function is much more flexible, easy and with less overhead. It does resize-crop, so I don't see a reason to go back to TimThumb (which I used extensively in the past). | What is your take: TimThumb vs. WordPress Thumbnails? The great debate | wordpress |
I've got 3 languages on my site. Picking the same featured image 3 times for the 3 versions of each article is boring. Is there any way to do it only once ? (same for picking a tag) | You'll find the answer here : http://wpml.org/2011/05/new-plugin-wpml-media-translation/ | WPML : how to pick a featured image only once for different languages? | wordpress |
I'm working with a team of developers on a new site and we've experienced an issue. All of have a local install (under SVN) of WP 3.1.3 running on our machines, but we're all connected to the same remote database. The issue comes in when one of us creates a new plugin and installs it. Until the plugin files are checked... | I recently had a similar issue, sadly, the only way around it was either local database for each Dev team or all dev teams working on a shared remote environment. Save your self the time and brain melt downs looking for another solution and pick whichever works better for you and go with it. | Multiple Instances sharing the same database in a development environment | wordpress |
I'm trying to fix a friend's feed to show full content in the category feed instead of only a summary. He's already done the setting bit, but it still doesn't seem to work. Thoughts? EDIT: The feed in question is http://blogs.gnome.org/happyaron/category/debian/feed/ | Full Text Feed plugin shows full content....follow the installation steps there,and then goto settings-> Reading-> For each article in a feed, show=> select Full text and save.it'll work.if you want to implement via the code means, <code> <?php if (get_option('rss_use_excerpt')) : ?> <description><![CDAT... | How to make category RSS feeds show full content | wordpress |
I can't seem to get <code> post__in </code> to work with custom post types. Is this true? What's the alternative? <code> $args = array('post_type' => array( 'post', 'page', 'tf_events', 'duka' ), 'orderby' => 'menu_order', 'showposts' => -1, 'post__in' => explode(',',$mtheme_featured) ); query_posts($args);... | You said the post type is called 'tf_event', but in the 'post_type' array it's 'tf_events'. | Query custom type posts by array of IDs | wordpress |
I have a problem with the wordpress editor. It keeps removing my enters and scrambling the content. How can I solve this problem? | I'd suggest using editor style for your wysiwyg. Add <code> add_editor_style(); </code> to your functions.php and then add a new file called <code> editor-style.css </code> to your main theme directory. Your editor style should reflect the basic css settings like your actual frontend content width, H1, H2, p etc tags s... | wysiwyg is scrambled | wordpress |
As I mentioned stackexchange-url ("here"), I'm planning to moving my blog to a new hosting provider from WordPress.com. I think I've settled on Page.ly as the new home for it, and I was hoping to get the benefit of experience from any of you who have transitioned an existing blog specifically from WordPress.com to page... | You can expect to lose your site stats. You can expect your site to be harder to find. You can expect to have greater freedom in terms of customization and possible features. You can expect to have to upgrade your WordPress version periodically. You can expect less users commenting, as WordPress.com uses a social netwo... | What can I expect when moving from a hosted (WordPress.com) blog to one hosted by Page.ly | wordpress |
I am trying to outline a new project where I want to give my users the ability to customize their 'profile' pages in my website theme. Concepts like adding in their own background images, choosing templates etc. It seemed logical to me to store this information in the author meta, as that seems to be the only table tha... | Authors are rather simple content objects in WordPress. They have roles and capabilities , some basic meta data and their own edit screens. That’s it pretty much. If you want to add a custom taxonomy to authors you have to mirror each user with a (hidden) custom post type because the author object doesn’t support taxon... | What are 'authors' in Wordpress, and is there an author 'metabox class' available anywhere? | wordpress |
I need WP to show an embedded representation of a url such as http://domain.com/1121 using oembed. I have setup http://domain.com/1121 with a discovery link: <code> <link href="http://www.domain.com/generator/oembed/?url=http%3A//domain.com/1121" rel="alternate" type="text/xml+oembed" /> </code> I'm aware that WP... | Your XML root element was 'OEmbed', not 'oembed', as given in the spec. XML element names are case-sensitive, per the XML spec. | Wordpress refuses to show oembed URL | wordpress |
I've seen a few plugins that add rich text editing to the default "Text" Widget. However, all of the ones I've tested are either too complicated (or try to do too much) or don't work properly with the latest WP versions. I'm just looking for a simple rich text toolbar with a minimal feature set (basic formatting and li... | I've never found one that was reliable and/or not a huge resource/memory drain. :( I ended up using the very handy " Page in Widget " plugin instead - it has the advantage of all the functionality of a regular editable page and your widget content won't accidentally get wiped, which has happened to me far too often. So... | Simple rich text editor in Text widget? | wordpress |
I have my WordPress post format codes: <code> <?php if ( has_post_format( 'image' )) { echo 'This is a image post'; } ?> </code> And my code to grab the first image from a post... <code> <a href="<?php the_permalink() ?>"> <?php $image = catch_that_image(); if( $image ) { ?> <img src="<?ph... | here: <code> <?php if ( has_post_format( 'image' )) { ?> <a href="<?php the_permalink() ?>"> <?php $image = catch_that_image(); if( $image ) { ?> <img src="<?php echo get_template_directory_uri(); ?>/scripts/timthumb.php?src=<?php echo $image; ?>&amp;h=240&amp;w=280" class... | Help Combine These Two PHP Codes | wordpress |
When a user creates a new post there is a meta field on the back end where they can enter the id of the nextgen gallery to display. I want to then display in their post the gallery which corresponds to the id they entered. When I run the code below $meta echoes as #3 and the gallery shows, so I know that for this post ... | Perhaps try: <code> echo do_shortcode('[nggallery id=' . $meta . ']'); </code> | Displaying NextGen Gallery using value from meta not working | wordpress |
I am using WooTheme's Canvas theme and would like to "hardcode" in the [post_comments] shortcode into my theme. [post_comments] displays a comment link with comment count (ie Comments 10) in my post. Right now I am inserting the [post_comments] shortcode into my theme's meta "Meta Manager"; however, this is not ideal f... | Check out do_shortcode(): http://codex.wordpress.org/Function_Reference/do_shortcode <code> do_shortcode('[shortcode option1="value1" option2="value2"]'); </code> So your example would be: <code> do_shortcode('[post_comments]'); </code> What might be easier is to tap into the underlying comment functions: http://codex.... | How do I hardcode a WordPress shortcode into my theme? | wordpress |
Is there anyway to customize the default WordPress widgets or do i need to create my own? For example, I want my recent post widgets to display date aswell. Thanks in advance! /Richard | You'll have to create your own but you can copy the code and customize from /wp-includes/default-widgets.php If you edit the defaults they'll screw up when you update WP. | Customizing wordpress default widgets? | wordpress |
I have my own SQL string to select Custom Post Type posts with specific WHERE clause. I've used the offset and limit to return appropriate posts depending on a page being displayed. That's working fine. Now, I would like to make <code> previous_posts_link() </code> and <code> next_posts_link() </code> functions work. T... | Ok, I got there at the end. I couldn't use <code> WP_Query </code> class as I really needed to have my own pretty big and complex SQL. Here is what I ended up having: In <code> functions.php </code> I have my custom SQL and logic for counting the values needed for the WP pagination logic: <code> function vacancies_curr... | Pagination with custom SQL query | wordpress |
I'm working with post formats, most of my code looks similar to this: <code> if ( has_post_format( 'standard' )) { echo '<?php get_sidebar(); ?>'; } if ( has_post_format( 'aside' )) { echo 'this is an aside'; } if ( has_post_format( 'chat' )) { echo 'this is the video format'; } </code> But I also want one of the... | use <code> get_post_format </code> : <code> $format = get_post_format(); if ( false === $format ) echo "no post format"; </code> EDIT - an example using a switch statement: <code> $format = get_post_format(); switch( $format ){ case "aside": echo "aside"; break; case "chat": echo "chat"; break; default: echo "standard"... | If Statement Post Formats: No post format selected | wordpress |
I am using Register Plus Redux. I don't know what happened exactly but after I upgraded to 3.1.4, the password provided on registration isn't recognized. I have to go in using admin account and set the password again. This does not happen with the default registration form though. I don't where to contact the author, i... | This is a bug in the Register Plus Redux and has nothing to do with other plugins. Normally when you register with normal wordpress, it sends you a temporary password that you can modify after.. what happens with RPR is it sends you by email the temporary password generated by wordpress but puts in the database the pas... | Cannot login due to incorrect password right after registration? | wordpress |
Somewhere in my code I need to know what is the current language and display a certain custom field or another one based on this knowledge. How can I know this information ? | WPML defines constants that you can use go get the current language: <code> ICL_LANGUAGE_CODE </code> - current language code (eg: en,fr,sp). <code> ICL_LANGUAGE_NAME_EN </code> - Name of the current language in English (eg: English, French. Spanish). <code> ICL_LANGUAGE_NAME </code> - Name of current language, in the ... | WPML : how to determine manually the language in which a given page is displayed | wordpress |
I am using WordPress 3.1.4 by now. I am confused with where (which hook) do I use: to register and/or enqueue scripts and styles on front- and back-ends? Questions: Which are right hooks to use? All front end register/enqueue scripts/styles in <code> init </code> ? Why is there no <code> admin_print_styles-{xxx} </code... | Why registering and queuing properly matters it should be in time - earlier than script/style is up for being output to page, otherwise it is too late; it should be conditional - otherwise you are loading stuff where you don't need it and cause performance and functionality issues, for this you need WP environment load... | Where is the right place to register/enqueue scripts & styles | wordpress |
we're using the Atlas HTML sitemap plugin, which caches the sitemap using the transients API with a call like: <code> set_transient( 'dmac_html_sitemap', $output, 60*60*24*7 ); </code> Now, we also have a multi-site setup and I was wondering where the transients are stored and if WP multisite is keeping them separate. ... | Default Transient API behavior is to use Options API for storage and so behavior identical to options. However if there is external object cache (declared by plugin or whatever) then they get stored using object cache functions instead. So basically it will work in scope of current site, unless there are plugins that m... | Transients API and multisite | wordpress |
I'm currently displaying custom taxonomies in a drop down menu. Each taxonomy has its own little wrapper in the sidebar. Is it possible to move the taxonomy to inside of my custom write box for ease-of-use purposes? | The following is taken from a "move author to publish box" task, but it should give you a starting point. Next you should take a look at "/wp-admin/edit-form-advanced.php" where you'll find something about <code> get_object_taxonomies() </code> to see how your stuff get's named, so you can remove and add stuff. <code> ... | Can custom taxonomies be displayed inside of a custom meta box? | wordpress |
I have a taxonomy eg. authors. I want to create a custom UI for. I think integrating with a Meta Box together with other post meta will make things easier for the user. Also I think a jQuery UI AutoComplete (Multiple comma separated values) is more appropriate So I will need to know how I can "update_post_taxonomy". I ... | The function you are looking for is <code> wp_set_post_terms() </code> which can create the terms if they don't exists and you can specify if to appended or replace existing terms. so you can remove all none user terms. as for if post does not have the taxonomy term , add it you can use <code> wp_get_post_terms() </cod... | How to update post taxonomies (Creating a custom UI for Custom Taxonomy) | wordpress |
I am manipulating an img element in functions.php using jQuery by changing the src attr on hover. How do I make so the absolute path works? Currently, when I view the image directly in the browser it brings me to 404 page. Relative path doesn't work either. | i always start every theme w/ some constants ` define('THEME', get_bloginfo('stylesheet_directory')); //or you could use this one: //define('THEME', get_stylesheet_directory_uri()); define('IMAGES', THEME . '/images'); ` and some others, but the point is that at any place in my code i can point to my theme's image fold... | Absolute path to stylesheet_dir/images/my_img.jpg does not work? | wordpress |
I installed the Wordpress System Health Plugin and it says that the revisions table in my database is at 70% capacity with 994 rows. I don't fully understand what this means. I anticipate that my site will get much larger than it is today. Questions Am I going to run into trouble or is there some way I can increase tha... | SQL query to run via phpmyadmin <code> DELETE a,b,c FROM wp_posts a LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id) LEFT JOIN wp_postmeta c ON (a.ID = c.post_id) WHERE a.post_type = 'revision' </code> That query will remove all post revisions from your wp database,, But remember always back up your database b... | The revisions table in my database is at 70% capacity and growing. What should I do? | wordpress |
Is there a way to wrap a wordpress shortcode around a div in a template file? Here is my code: <code> <div id="subscription"> <?php do_shortcode('[subscribe]');?> <p>This is subscription text</p> </div> </code> I've also tried <code> <div id="subscription"> <?php do_shortcode('[su... | If by template file you mean a php file in the themes folder, you can call do_shortcode to have the shortcode processor do its magic on your div. EDIT: not entirely sure I understand what you want, but you could try this: <code> <div id="subscription"> <?php do_shortcode('[subscribe]'.call_php_function().'[/su... | Wordpress Shortcode wrap around div | wordpress |
I prefer not to use asterisk markers on required fields in the comment form. So I'd like to remove or alter the 'required fields are marked (*)' message. Being a good wordpress user, I'd like to do it with my functions.php. I can work out how to filter most areas of the form, but not this. I'm guessing it will involve ... | What you need to use is <code> comment_form_defaults </code> filter that has large and nested <code> $defaults </code> array passed. That array will have (among other things) something like this in it: <code> fields author << this will have something like <span class="required">*</span> in it email &l... | Alter required message using comment form api | wordpress |
I'd like to have a query that returns posts grouped five by five. Right now I have a simple query loop like this one : <code> <?php if( $query->have_posts() ) : ?> <ul class="posts"> <?php while ( $query->have_posts() ) : $query->the_post(); ?> <li> <?php the_title(); ?> </li&g... | you can create a simple counter and condition: <code> <?php $count = 0; ?> <?php if( $query->have_posts() ) : ?> <ul class="posts"> <?php while ( $query->have_posts() ) : $query->the_post(); if ($count < 5){ ?> <li> <?php the_title(); ?> </li> <?php }else{ echo '... | How to setup a query to output posts by groups of five? | wordpress |
I need to find only posts with a tag <code> forest gump </code> . I've tried: <code> new WP_Query('tag=forest+gump'); </code> , <code> new WP_Query('tag=forest gump'); </code> . However they both return ALL the posts and not only the posts with <code> forest gump </code> tag. Single tags (without spaces) work fine, tho... | <code> new WP_Query(array('tag_slug__in' => array('forrest-gump', 'forest-gump', 'questend'))); </code> <code> new WP_Query('tag=forrest+gump,forest+gump,questend'); </code> should work too... | tag search using WP_Query | wordpress |
I just created a web page that uses a lot of JavaScript to build a fancy form that helps build an build the object/html behind an mp3 player for a user. I got it working and tested in a plain-html page outside of WordPress. I then copied into a WordPress "page", took out the <head> tag, changed <body> to a ... | You'd be much better off creating a custom page template , pasting your HTML into the file, then simply attaching the template to a page in the admin. WordPress applies a lot of filtering on post/page content , and it's probably wreaking havoc with your code (not to mention you've got things there that belong in the <c... | Use of Javascript with Dojo/Dijit on a WordPress page | wordpress |
I have installed wordpress in directory above the root called "wp". I'm having issues with the google xml sitemap generator. I cannot rebuild the xml code and write it the sitemap.xml file. I have been on the phone with my hosting company and they assure me the file does have full control for its file permissions. Does... | Hate to self promote BUT ;) My WordPress SEO plugin actually fixes this by not generating a static file at all. It works in all circumstances. | google xml sitemap won't work on directory install | wordpress |
Okay, let's assume that I want to create a dynamic "printable" page using a system that doesn't play well with wordpress's theming engine, is there a way for me to define a "permalink" in my plugin that will call a predefined function, also in my plugin? If you're familiar with Drupal it's similar to how their hook_men... | Something along the lines of this would probably do it: <code> function wpse21372_init(){ add_rewrite_rule( 'your-page-regex/?$', 'index.php?wpse21372=1', 'top' ); add_rewrite_tag( '%wpse21372%', '([^&]+)' ); } add_action( 'wp', 'wpse21372_wp' ); function wpse21372_wp( $wp ){ if( isset( $wp->query_vars['wpse2137... | Creating a path in a plugin to call a function | wordpress |
I am creating a largely static site for the collections/archives office of a library. Since I am expecting most content to be created once and slowly appended or modified over time, instead of regular posts, my first inclination is to make everything a page. On the other hand, I have pages/posts that exist in two or 3 ... | the way WordPress stores pages in the database is the same as it stores posts, so it makes no difference if the content is created as pages or posts (static or not). And if most of the content is static you can always use a caching plugin to serve that content as static. | Posts vs Pages and categories | wordpress |
I have page called "Apple", the page's ID id 2533. In page.php file I have line: <code> echo $bannerimg </code> And this function in functions.php: <code> if ( is_page( '2533' ) ) { // also tested with 'Apple' $bannerimg = 'apple.jpg'; } elseif ( is_page( 'test' ) ) { $bannerimg = 'test.jpg'; } elseif ( is_page( 'admis... | <code> functions.php </code> is processed way before you can know which page is being loaded. Instead of assigning value to variable put your code into function and use that function in <code> page.php </code> template. | Why isn't is_page working when I put it in the functions.php file? | wordpress |
I'm having an interesting problem that I can't seem to solve. While creating a widget, I have created a select field with options that can be chosen on the widget screen. It all works perfectly fine, except when I save the widget, all of the options in the select field vanish. They all come back, with my chosen option ... | Found it. There was an extra closing slash on the opening select field. | SELECT field options disappear when saving widget | wordpress |
Is there an straight-forward example anywhere of using wp_update_post() to edit post_meta on the front end? I have not been able to find any good learning resources. What I want to do is display post meta in an input field and when a user clicks submit trigger <code> wp_update_post(); </code> . Thanks! | <code> wp_update_post </code> isn't used for updating custom fields (ie postmeta content) - you should use <code> update_post_meta </code> | What action hook updates post meta? | wordpress |
Hey guys i recently created a theme. I want to show home.php when a visitor visit home page but all my blog posts are listed in index.php file. Can someone suggest me how to display index.php i tried http://www.mysiteurl.com/index.php but it redirecting me to http://www.mysiteurl.com/home.php Please advise me. Thanks | I don't think you fully understand the meaning of templates in WordPress. You do not choose template by including it in URL, WordPress deals with choosing template by making sense of URL request. See Template Hierarchy in Codex. | How to display both home.php and index.php | wordpress |
I have a custom post type, called App. This has details like the name, description, thumbnail image, and some custom fields. Then I have posts about this app, that I'd like to associate with it. In the end, I'd like to be able to view the custom post type and all the posts that are associated with it. But I don't see a... | No you don't really have to create a category to associate your different post types. You can use this great Post 2 Post plugin by scribu. It does exactly what you are trying to do. | Associate custom post types with normal posts | wordpress |
I have written a small class that will handle enqueues in my theme : <code> <?php class Header { public function init_hooks() { add_action('wp_print_scripts', array(__CLASS__,'include_all_files')); } public function include_css_files() { wp_register_script('style.css', get_bloginfo('stylesheet_url')); wp_enqueue_scr... | You mean you call your class right before closing HTML tag? It is too late to enqueue scripts then. Don't hook into <code> wp_print_scripts </code> to enqueue your scripts and styles. I just stackexchange-url ("learned") this today from Rarst. So change your init_hooks function to something like following: <code> publi... | Enqueue scripts inside a class | wordpress |
Is it possible to add a checkbox to all widgets loaded into sidebars? For example, I'd like to allow the site owner to choose whether any widget should appear on the home page, inside pages, both or neither. I'm thinking a checkbox interface appended to the widget control interface. Has anyone done something like this ... | There are plugins that can do this like Widget Context or Widget Logic . If you want your own solution then it's pretty easy: hook your function with the checkbox on <code> in_widget_form </code> hook your widget update function <code> widget_update_callback </code> (update the widget option) check if the option was ch... | Option to show/hide widget depending on is_home? | wordpress |
I need to switch WordPress's post context, sort of like <code> switch_to_blog() </code> but for posts. What's the safest way to alter WordPress's global state and switch it back? | Use <code> setup_postdata() </code> to change and <code> wp_reset_postdata() </code> to roll back to original. | What's the safest way to switch and restore a post global? | wordpress |
In the multi-site wordpress install, you get a very nice "upload settings" in the network admin settings. (see attached image). I am trying to change these settings without using php.ini for a single-site wordpress install and I can't find them anywhere... help? Tim Attached: Network Admin Settings Example: | create an file <code> php.ini </code> and copy via ftp or ssh to wp-admin; inside this file the follow values; play with values for test and see the result. <code> memory_limit = 32M upload_max_filesize = 32M post_max_size = 32M file_uploads = On </code> | How do I change the upload file size limit in single-site wordpress install? | wordpress |
Normally when using a rich text editor, when you hit return (i.e. do a full paragraph return) Your text is wrapped i.e. <code> <p> my text </p> </code> however this does not happen in wordpress. Is there any way to trigger this functionality? | This happens at the time the content is output the browser. At that point, the content is passed through several filters, one of which is called <code> wpautop </code> . This filter function is defined in <code> wp-includes/formatting.php </code> . In combination with the other default WordPress filters, this generally... | Why does the HTML editor not wrap my code in paragraph tags when I press enter | wordpress |
When I add an image to a post I want it to be in a div e.g. , and I want that to be done automatically, so I don't have to do that in HTML editor. I don't want to use js to accomplish this and by the way I want to know how to automatically add custom classes to a image in a post. Cheers! | By default images already have unique class's but this depends on your theme. Use firebug and hover over the images and you should see stuff like <code> class="aligncenter size-full wp-image-1525" </code> . If you want to change the class or id or alter any attributes of the image you can use the <code> get_image_tag <... | How to wrap every image in a post with a div? | wordpress |
I'm one of the contributors for the Meta Box Class here on Github ( link ) and before I get too deep, I wanted to ask if anyone knew of a straight forward way to allow users to add additional fields "on the fly", having an "add" button with a text field to add additional fields (i.e. list items). I've seen this done a ... | Agreed, I've seen it too, but I don't think there's any readily available API or method. For me, I use a lick of jQuery; <code> <input type="text" class="list-item" name="list_items[]" /> <input type="button" class="button-secondary" id="add-list" /> <script type="text/javascript"> ( function( $ ) { $... | Add custom fields within meta box class "on the fly" | wordpress |
I'm trying to figure out how to do, Second Level Menu as a template function, that persistent when visiting any level, whether its a top level page, or a grand children Page. Any Ideas? | example: <code> <?php //get top level page ID; $top = ( $post->post_parent ) ? array_pop(get_post_ancestors($post->ID)) : $post->ID; echo '<ul>'; wp_list_pages('title_li=&child_of='.$top.'&depth=1'); echo '</ul>'; ?> </code> | Second Level Menu | wordpress |
Thanks to @Anu's stackexchange-url ("correction") I now have a function to update_post_meta from the front end. Something is wrong in my script however, because with the function below nothing is being displayed on the page. It only displays is a white screen. if I take out the <code> if ( empty($_POST) || </code> sect... | Change your nonce verify to actually verify and update post meta, else do nothing. But don't use exit at the top of your template. <code> // top of page if ( isset( $_POST['drw_inventory'] ) && wp_verify_nonce($_POST['drw_inventory'],'update_drw_postmeta') ) { //if nonce check succeeds. global $post; $postid = ... | Front-end update_post_meta snippet displays white screen? | wordpress |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.