question stringlengths 0 34.8k | answer stringlengths 0 28.3k | title stringlengths 7 150 | forum_tag stringclasses 12
values |
|---|---|---|---|
I have 10 category, and when i select a category in the sidebar il list all the post from that category.... FINE, beautiful Now, i like a page, with some text and photos and then after that content, i like to have all the post from a category listed, just like the category view... Is there a plugin or a short code that... | Try this... <code> <?php function list_post(){ //or you can use the cat id here, check the codex for WP_Query $q = new WP_Query(array('category_name' => '<cat slug here>')); if($q->have_posts()): while($q->have_posts()):the_post(); the_title(); endwhile; else: echo "No posts found!"; endif; wp_reset_p... | Shortcode to display all the post from a category in a page | wordpress |
I have a site with WP installed at /blog, and I'd like to just get a list of the latest blog posts to display on the site home page... that is to say, my custom (PHP) home page, NOT a Wordpress page. I found this , but it doesn't work-- the latest version of Wordpress is looking for Translate_Entry.php or some other ki... | You have several options. XML-RPC http://codex.wordpress.org/XML-RPC_Support is the place to start. The API exposes a large number of methods to access WordPress data "outside" of the full WordPress context. Difficult to setup, connection requests overhead. wp-load.php Include <code> wp-load.php </code> to load up Word... | How can I get a list of latest posts outside of my WP install? | wordpress |
I want to make a cookbook style wordpress website, on which visitors can place comments inline. Like you do in a paper book with a pen: between the lines. Or like how MS Word handles comments. Does anyone know a plugin that makes this possible? I've searched and searched, but all I found was this and it was of no use: ... | There is a plugin with that readers can post comments inline, like in Microsoft Word. The WordPress plugin bases on inlineDisqussions by Tsi and is called Inline Comments: http://wordpress.org/plugins/inline-comments/ Inline Comments adds the great Disqus Comment System to the side of paragraphs and other specific sect... | Is there a plugin for posting inline comments, like in MS Word? | wordpress |
1. Basic settings API callback. Using Settings API my $sanitize_callback validating function looks like: <code> (...) if($type == "foo") { $valid_input[$id] = $option[$id]; } else if($type == "bar") { $valid_input[$id] = wp_filter_nohtml_kses($input[$id]); } (...) </code> It's almost the same as in this great theme by ... | Always develop with <code> WP_DEBUG </code> set to <code> TRUE </code> . You've a typo: <code> array_push($valid_input[$id], $input[$id]; </code> (missing <code> ) </code> after the <code> array_push </code> ) You can't push to arrays that are not ... arrays. <code> // So, check this before pushing: $valid_input[$id] =... | Settings API - save an array of options as one setting (array_push?) | wordpress |
I am looking for a trending topics plugin as displayed on techcrunch . I have searched alot to find the vertical displaying plugin. If anyone could help out, I would be very thankful. EDIT: Here is a visual image of how it should look like. | If by hot trends you mean the categories, you can list the categories with the most posts using this plugin: http://searchwordpressplugins.com/plugin/most-popular-categories/ Some styling work will be needed, but that is unavoidable no matter what plugin is used. Tech Crunch however uses tags not categories, so instead... | Trending Topics Plugin | wordpress |
Ok i have a custom post type on my blog called videos, where i only post a video. There's a sceen cap below On the right are the latest post from the custom post type, on the left is the video, and under the video is the date and time, category and tags. But the problem is that it is getting the wrong, Tags, Categories... | The problem lies in how you are displaying the videos on the side. Somewhere you are looping through some posts to produce that list. Notice the last post on that list in the screenshot is an interview with once upon a time - and thats what the categories and tags are related to. Why is this happening? WordPress stores... | Custom post type getting wrong categories and tags | wordpress |
I'm looking to have the default view for Groups be the Forum component instead of the Activity component. What's the best/easiest way to alter the default landing component/page? | [Edit - My original answer will only work in the upcoming BP 1.6] For the moment, you'll have to use something like the following, which is a modified version of bp_core_new_nav_default() (a function that is broken in the case of groups, because of various slug-related stuff): <code> function bbg_set_new_group_default_... | What's the easiest way to change the default landing page for BuddyPress groups? | wordpress |
This is one of those problems that I've spent way too much time on, and there is probably a VERY simple solution that I am missing. Any help would be greatly appreciated. I am trying to populate a select box with names from custom data (meta_key "pyd_pub_author"). But, I cant just call the data directly, because it als... | I found my error in the above query. There still may be a better way to do this, thank you kaiser, and I will update once I've done more study. What I forgot to do was GROUP_CONCAT another meta_value so i could pull out different bits. It still seems longer than it needs to be, but it gets the job done fast. Here is th... | wpdb Custom Meta Data with 2 conditions | wordpress |
I'm at a bit of an impasse trying to satisfy this client's requirements. Long story short, they would like an overall site that certain people can access and modify, plus a blog with a completely different look and feel. Their current site was just redesigned, and it is what I'll be primarily porting to WordPress. They... | You could go with multisite, but as long as they're only asking for a different look and feel, you could work it out with Templates and conditional statements for enqueueing styles, scripts, etc. For the ease of things, I'd go with a single site install. | Single install or multisite? | wordpress |
is there a way that i can place a certain widget any where on the site. For example: I'm using the text widget in my sidebar, for the title i put youtube, and i placed the youtube embed code in it. But i want that widget to go at the top of the site how do i make this possible, while still using the widgets menu, but n... | Just register another widget area. Don’t take the name sidebar literally, you can use the fields anywhere on your page. In your theme’s <code> functions.php </code> : <code> add_action( 'after_setup_theme', 'register_multiple_widget_areas' ); function register_multiple_widget_areas() { register_sidebar( array( 'name' =... | How do i manually place a widget code | wordpress |
I really hope this is a facepalm moment, b/c i'm getting frustrated with this. Making a quick loop to show certain attachment images. lifted it almost straight from the codex but wp_get_attachment_image() isn't behaving like I'd expect. isn't the ID part of the wp_get_attachment_image the ID of the attachment? is that ... | solution: the the face palm i was waiting on at some point i must've been debugging something and for who knows what reason i put a <code> function wp_get_attachment_image_src($attachment_id, $size='thumbnail', $icon = false) { return false; </code> right at the beginning of wp_get_attachment_image this is all localhos... | use wp_get_attachment_image() to show attachments | wordpress |
I am using Optima Express theme (real estate inventory) plugin for my wordpress website. And it is working perfect in admin are. But as i started to use it in front end it is started to conflict with Jquery of current active theme. It does work with Twenty-Eleven, Twenty-Twelve but not the " Striking " and " Karma "the... | From the looks of it, the IDX plugin is coded properly with noconflict, but there is some inline JS in the themes that is not. Wrapping those functions in <code> (function($) { // your functions here })(jQuery); </code> will take care of the problem. All JS in WordPress should be run in noconflict mode, so yes you'll n... | Which wordpress theme is compatible Optima Express theme (real estate inventory) plugin? | wordpress |
How do I list a custom field and custom taxonomies for each result in my loop below? <code> <?php $temp = $wp_query; $wp_query= null; $wp_query = new WP_Query(); $wp_query->query('post_type=customtype&showposts=10'.'&paged='.$paged); while ($wp_query->have_posts()) : $wp_query->the_post(); the_title... | You can get custom field values with <code> get_post_meta </code> . Like so... <code> <?php $wp_query = new WP_Query(); $wp_query->query('post_type=customtype&showposts=10'.'&paged='.$paged); while ($wp_query->have_posts()) : $wp_query->the_post(); the_title(); // <- works if( $some_meta = get_po... | How do I list a custom field and custom taxonomies for each result in a loop? | wordpress |
I'm using custom post types for a few pages where I have a very customized template...but I only need one of each post (maybe not the best way to go about this...but it's built so I'd like to not have to change this). Is there a way to remove the "Add New" link on the left side admin menu just so the user doesn't keep ... | You can remove the 'Add new' submenu page like so: <code> add_action( 'admin_menu', 'myprefix_adjust_the_wp_menu', 999 ); function myprefix_adjust_the_wp_menu() { //Get user id $current_user = wp_get_current_user(); $user_id = $current_user->ID; //Get number of posts authored by user $args = array('post_type' =>'... | Custom Post Type, limit to one | wordpress |
I am making a review system where i need to find update rating average when: A comment gets approved from pending/trash/spam. A comment gets upapprove from approve A admin post reviews (auto approved) A comment gets edited (from backend or frontend custom dashboard when user wants to edit/update/remove his already made... | The <code> comment_post </code> hook is called with a <code> $comment_id </code> as the first argument. You can see why your function is failing. Same goes for the <code> edit_comment </code> hook . Simply add the following at the beginning of your business function: <code> if ( !is_object( $comment ) ) $comment = get_... | Running a function on comment status change | wordpress |
I have a widget which can be updated every time with few values and admin update it on daily basis now how to get its last update time. | When you save the widget, you can save a field (which won't be setable in the admin interface) which stores the current time and then use that when you go to do the widget output. | Last Update time in widget | wordpress |
I have the following in functions.php of my custom theme: <code> <?php add_theme_support( 'post-thumbnails' ); add_image_size( "main-slider", 671, 252, true ); add_action( 'init', 'create_main_slider_post_type' ); add_action( 'init', 'create_external_link_post_type' ); function create_main_slider_post_type() { regis... | For post type to appear I need to see <code> 'public' => true, </code> in register_post_type(). | Post types disappeared | wordpress |
I am doing some cross-host benchmarking with wordpress, and rather than going to the huge trouble of setting up an identical install of wordpress on each host, a huge investment of time, etc., I want to create a single php file that would simulate the php demands of wordpress and use that file to gauge each host's rela... | Afaik there's no real performance test available (what exactly do you want to check?), but you can stackexchange-url ("find a plugin that came out of the first Q below"), that might help you doing some profilling. An interesting read might be… stackexchange-url ("refactoring WP to improve memory performance") ge... | cross-host benchmarking with wordpress | wordpress |
I'm using Wordpress XMLRPC support. The content fetched through an XMLRPC client does not have the automatically added <code> <p> </code> tags, whereas pages rendered on the blog of the Wordpress install do. Is there an easy way to get the <code> <p> </code> tags coming through the XMLRPC content as well? | So, the default xmlrpc <code> get_post </code> function does not have any nice filters for you to use. The solution: roll your own XML-RPC callback! Hook into <code> xmlrpc_methods </code> and add a custom method, in this case called <code> post_autop </code> . The array key will be the method name, and the value the m... | How to enable wpautop for XMLRPC content | wordpress |
I'm working on a WordPress site for my band and I'd like to mark every 3rd post on our blog page to have a special class applied to it, anybody have any pointers on how to achieve this? Any help is very very appreciated, thanks! rock n roll. | My approach. No extra function, no filter. :) <code> <div <?php post_class( 0 === ++$GLOBALS['wpdb']->current_post % 3 ? 'third' : '' ); ?>> </code> Alternative: <code> <div <?php post_class( 0 === ++$GLOBALS['wpdb']->wpse_post_counter % 3 ? 'third' : '' ); ?>> </code> | How to mark every 3rd post | wordpress |
I know I can use <code> enqueue_script </code> and <code> enqueue_style </code> to register scripts and stylesheets, however I'm trying to print out just the link to the adminbar css: <code> <link rel='stylesheet' id='admin-bar-css' \ href='http://mysite.com/wp-includes/css/admin-bar.css?ver=20111209' type='text/css... | to print a single style: <code> wp_print_styles('admin-bar'); </code> to print a single script: <code> wp_print_scripts('admin-bar'); </code> note that the handle must be registered first using wp_register_style() or wp_register_script(). http://codex.wordpress.org/Function_Reference/wp_register_script http://codex.wor... | How can I print out a single stylesheet or javascript link? | wordpress |
I'd like to add a meta box to all my pages (not posts) but it looks like I am only able to add it for a specific post based on the codex? <code> add_meta_box( $id, $title, $callback, $page, $context = 'advanced', $priority = 'default', $callback_args = null ); </code> | Try this. This is part of some code I use. <code> // Add meta boxes to Page add_meta_box( 'RelatedImage', __('Related images'), 'related_images_meta_box', 'page', 'normal', 'high' ); function related_images_meta_box($object) { $nonce = wp_create_nonce(plugin_basename( __FILE__ )); ?> <input type="hidden" name="wp... | Add a meta box to ALL Pages | wordpress |
Im trying to use Isotope( http://isotope.metafizzy.co/ ) to filter my Wordpress posts, http://i44.tinypic.com/fco55k.jpg this is how my site looks like, i would like to filter posts depending on a post category so i need to add a class name to each post and then filter it using isotope <code> <li><a href="#" d... | Not sure you got Isotope and filters working yet ?? There are 2 things I think you missed the Filters need to be wrapped in a class (so that the jquery can be actioned by the click on the a links) like so: <code> <ul id="options"> <li><a href="#" data-filter="*">show all</a></li> <li>... | Wordpress and isotope filtering | wordpress |
I would like to add a select list in the <code> Page Attribute </code> box you see on the right side in the administration interface for pages. Does anyone know if that is possible? Or at least add a custom box below this box? | There are no convenient hooks to add something to that box. You could do one of two things. 1. Add a new Meta Box You do this by hooking into the <code> add_meta_boxes </code> action and calling <code> add_meta_box </code> . You can specify a callback function in your call to add_meta_box. That callback will take care ... | How can I add extra attribute in the 'Page Attribute' section in wp-admin for pages? | wordpress |
I have this array, below, to set custom user meta ( <code> lh_userbadges </code> ) in <code> user_meta </code> but I'm not exactly sure how to update just parts of the array later on... <code> $lh_user_badges = array( 'lh_userbadge_comments25' => '0', 'lh_userbadge_comments50' => '0', 'lh_userbadge_comments75' =&... | You can just assign a new value to the <code> 1h_userbadge_comments25 </code> key. Like so... <code> <?php $meta_value = get_user_meta($user_id, 'lh_userbadges', false); // just assign this key a new value $meta_value['lh_userbadge_comments25'] = 25; </code> Then just save it again. <code> <?php update_user_meta(... | How do I update a specific object in an array, in user meta? | wordpress |
I have a custom post type that includes many custom fields. I would like to add them as a search target to admin search. Currently the admin search searches only the content and the title, I would like it to search these custom fields as well. Is there a way to do that ? | It is possible, but you'll have to play a little bit with the actual query. As always, the furious <code> posts_clauses </code> filter comes to action: <code> function wpse_alter_posts_search( $pieces ) { global $wpdb; // Make the input save $search_string = like_escape( $_GET['s'] ); // Your new WHERE clause $where = ... | How can I change the admin search posts fields? | wordpress |
I have a custom post type that is created using a form on the site. I want to disable new post creation from wordpress admin. Is there a way to do that ? | There are several ways (depending on what you're trying to do): If it's about the "publish" button You could… …remove the capability from the targeted role with <code> remove_cap() </code> …remove the 1) 1) see bottom of the answer by @toscho …or the whole meta box 2) <code> remove_meta_box(... | How to remove 'create new post' entry for a custom post type? | wordpress |
I created several blogs. Two are sites I maintain but others are sites I created for other people and I retain administration access to them just in case they need me to go and fix some page, but I don't want to receive notifications every time they have a new comment waiting for moderation. Is there a way in WordPress... | This is a one time work for every blog you maintain. Go to Dashboard > Settings > Discussion and see following: E-mail me whenever: Anyone posts a comment A comment is held for moderation Someone likes one of my posts Someone follows my blog Unmark the option at which you don't want to recieve any email notifications. ... | Is it possible to not receive email notifications for comments? | wordpress |
I need to register a metabox in my WordPress custom post, but only in case the post is permanent saved in database. What I mean, when the user click on "Add new" I don't want to display the metabox. When the user click on "Publish" after the page refresh display the metabox. The post status doesn't matter (published, p... | As an alternative to @m0r7if3r's solution, the <code> add_meta_boxes </code> hook optionally passes two variables, the post type and post object. You can use this to conditionally add your metabox. New posts have the post status of 'auto-draft'. <code> add_action( 'add_meta_boxes', 'myplugin_add_custom_box',10,2); func... | Condition display metabox in case the post is saved | wordpress |
I´m trying to make a slider which takes thumbnails from a certain custom post type and displays for of them for each "slide". I get the slider and thumbnails to work like they should, but I´m unsure of how I should modify the loop to get it to display 4 posts in a container, then repeat with the next 4 posts and so on.... | Tried very simple math. <code> <div class="slide"> </code> will print after every 4 post. So, if statement with old school logic <code> $i%4 == 0 </code> <code> <div class="slides_container"> <?php $args = array( 'post_type' => 'fastighet', 'numberposts' => -1, 'orderby' => 'ASC' ); $posts = get... | Modify this loop to fit my jQuery slider (slides) | wordpress |
I made a custom page with a template that is just a loop with custom query string for a list of posts from a specific category but when I view the page it only shows one post with the title being the title of the page. I don't understand why it doesn't return the loop of posts. What am I doing wrong? Heres the page tem... | You should remove $query_string from the template. the Quesry string contains params specific to your page... your loop should look like this: <code> <?php query_posts("posts_per_page=10&cat=3&orderby=asc&paged=".get_query_var('paged')); if (have_posts()): while(have_posts()): the_post(); <!-- your cu... | Running a loop with a custom query string on a custom page template | wordpress |
I'm trying to query the database for posts based on multiple custom fields. This is easy enough with the code below if values are simple: <code> $querydetails = " SELECT wposts.* FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = 'field' AND wpostmeta.... | You can't query the database for a value in the array. However you can grab the entire array and parse the array to get your value. Check out PHP ARRAY-VALUES . More than likely you'll need to use a for each statement. Does the value your trying to get appear in the same spot in the array? If so it should be easier to ... | Retrieving custom field array value through db query | wordpress |
I am using TinyMCE Advanced plugin according to qTranslate in a wordpress 3.3 installation. My question is: why does tinymce translate visual editor new line ("enter" key) in a <code> <p>&nbsp;</p> </code> instead of <code> <br/> </code> ? Is it possible to change this behavior? | Go into Settings -> TinyMCE Advanced, and check the option <code> Stop removing the <p> and <br /> tags when saving and show them in the HTML editor </code> . This will allow you full control over those tags inside the HTML view. For a single line break without overriding the editor, use <code> Shift+Enter ... | TinyMCE Advanced newline problem | wordpress |
We are trying to create a function for breadcrumbs that will show not only the path to the current page, but also to other pages with the same parent page. For instance, on example.com/parent1/child3, the breadcrumbs would show Home > Parent1 > Child1 > Child2 > Child3 > Child4 rather than simply Home > Parent1 > Child... | idk about working it back into your breadcrumbs... which by nature i think are hierarchical. but this should give you a list of the pages that have the same parent as the page you are on (aka its siblings) albeit in a totally unstyled way <code> global $post; $args = array('child_of' => $post->post_parent, 'exclu... | Breadcrumbs showing Parent and Child Pages | wordpress |
Through API functions, I want to define a new Navigation menu, select it in the current theme, and then insert a few Pages as menu items. This is to be done for instance on a theme activation. Through a (moderately painful) process of reverse engineering the database inserts and updates after manually setting up the Na... | I might be misunderstanding you, but why not use <code> wp_create_nav_menu() </code> ? E.g., this is what I do to create a custom BuddyPress menu when I detect BP as active: <code> $menuname = $lblg_themename . ' BuddyPress Menu'; $bpmenulocation = 'lblgbpmenu'; // Does the menu exist already? $menu_exists = wp_get_nav... | Programmatically add a Navigation menu and menu items | wordpress |
I want the defult CPT listing to include not all posts but only some, according to a specific taxonomy. is there a way to do that ? | This trick should help you... <code> <?php add_action('pre_get_posts', 'filter_posts_list'); function filter_posts_list($query) { //$pagenow holds the name of the current page being viewed global $pagenow; $post_type = $query->get('post_type'); //Check the post type and whether its the list page, then set the tax... | How to create custom post listing in the admin? | wordpress |
I would like to create a site like: http://demo2.woothemes.com/?name=sentient for my clients, so that they can see the range of themes I offer. I own many templates from different providers, and sending them to the providers will not help as there are quite a few and not all offer this functionality (not to mention tha... | what about a plugin like: http://wordpress.org/extend/plugins/theme-switcher/ | Need to create a Theme demo site that features multiple themes | wordpress |
My theme implements an AJAX action that returns some dynamic content and needs some functions from the Wordpress environment. How can I construct a URL for the AJAX call in the most elegant and robust way? In particular, I see lots of themes and plugins directly linking to PHP files that are inside their directory tree... | Read AJAX in Plugins . Themes work the same way. So, you get an API, some gotchas inclusive. :) Our tag ajax is quite popular too; you may find some good solutions there. | How to create a specific frontend URL (not a Page) from a theme or plugin? | wordpress |
I have WPTouch Pro installed and it does a great job at device detection as well as handling most blog posts. However, I want to make a mobile version of a homepage that doesn't have any blog posts. I know you can edit the css for a theme by making a child theme and editing it. Is this the preferred method to get WPTou... | You can write a Child Theme as for any other theme. This way you can extend the functionality override stuff that's wrapped inside a <code> if ( ! function_exists('function_name') ) </code> statement in the parent themes functions.php override templates There should be no real difference between such themes and normal ... | How do you create a custom WPTouch theme? | wordpress |
I have a custom post textbox that I want to sanitize using <code> wp_kses </code> before I update my post meta. I was looking for examples of common <code> $allowed </code> settings, but I have only seen this example: <code> $allowed = array( 'a' => array( // on allow a tags 'href' => array() // and those anchors... | I would disagree with the solution posted by @JaredCobb, <code> wp_kses() </code> is much more flexible than the method he presented. It can strip out unwanted attributes from tags without destroying the tags themselves. For example, if the user put in <code> <strong class='foo'> </code> , <code> wp_kses() </code... | Typical wp_kses $allowed | wordpress |
I'm trying to troubleshoot an issue on a client's site. There is one specific page which appears as "not found" unless you log in and then visit the front end, in which case it appears normally. The visibility on the page is set to public, and in every other way it's a normal boring wordpress page. Stranger still, it o... | Try to reset your permalinks. If that doesn't work I'd make sure their isn't another page named schedule in the root directory. It's possible there is an older (deleted page or post) with the same name stuck in the database as well. I've experienced this when I deleted a page or post and then created a new one with the... | Page only shows when user is logged in (even with visibility set to public) | wordpress |
Hey everyone, a simple question. Question I need to add one more category: Events in the if statement along with News which is stated in the code. How can I add it? Thank You very much :) Code <code> <?php if (in_category('News')) : ?> </code> | This is the answer :) <code> <?php if (in_category(array('News', 'Events'))) : ?> </code> | Add 1 category more to If_in_category statement | wordpress |
Is there a way to hide the main "title" and "description" boxes for a custom post? I have a custom post with a large meta box. I won't be using the regular title and description so I would like to either hide it or collapse it so the user won't have to scroll to get down to my meta box. | When you register the CPT, you register it with <code> supports </code> . If you do not include <code> title </code> and <code> editor </code> in this array wordpress will not display the main title or the TinyMCE editor. | Wordpress admin for a custom post, hide/collapse the main "title" and "description" boxes | wordpress |
The title might not a 100%, feel free to correct... I'm building a custom theme that has a couple of costume theme locations for menus (1 main menu, 1 footer menu, 1 "Follow Live" button). These are specified as a Theme Location in the Menu's panel. I'm having an issue with the footer menu: when that theme location doe... | If you set <code> fallback_cb </code> to <code> false </code> , it will not show anything if the menu doesn't exist. The codex does a pretty great job of detailing the parameters of <code> wp_nav_menu() </code> , it's DEFINITELY worth a read. | Hide custom menu when when no menu selected | wordpress |
I have trawled the net looking for an answer to this, but for some reason all I can find are actual examples, but without that particular explanation, which is clear say in the case of scripts. Can someone explain to me why it's important/advantageous to enqueue styles when developing a theme, rather than just using <c... | It's important to enqueue the stylesheet because it will allow child themes the flexibility of dequeueing it as well as allowing it to be listed for dependencies and a multitude of other things. It just generally allows greater flexibility, both for you and for any other developers who interact with your code. It's als... | How important is it to enqueue a theme's stylesheet? | wordpress |
For some reason, I suddenly get <code> 500 Internal Server Error </code> when I try to add menu item to a menu and I can't figure out why. I'm running Apache2 with Centos 6 OS on a VPS. I have PHP 5.8 and MySQL 5.1 This is the error message: Internal Server Error The server encountered an internal error or misconfigura... | I found this message from Mark Jaquith, WP lead developer: The WordPress core team is quite aware of this issue, and it is absolutely something that needs to be solved. It is an issue with how the menus are saved. Too much data is passed back. It takes a lot of memory and computation time, and many servers are configur... | I'm getting a '500 Internal Server Error' when I try adding menu items | wordpress |
How can I show a list of Users with alphabetical headings? For example: A Adam Alan B Bill Bob I've found examples that do it with Posts, but I can't figure out how to make it work with <code> WP_User_query() </code> :( | After a good bit of tinkering I've come up with something. It's certainly not the BEST method, but since there's not a good way to do it through the core directly without having to do a bunch of array-reordering, I think SQL is a better solution here. Anyways, the SQL is as follows: <code> SELECT users.*, meta.meta_val... | List Users alphabetically with heading | wordpress |
My functions.php file is getting on the long side. Is it all right to use includes to break it up (php includes I mean) or is this considered bad form? | Many theme frameworks and complex themes break up functions into different files and include them in one file called functions.php, sometimes within a folder called <code> inc </code> . If it's your own theme, you can pretty much do what you want. If it's a theme to be released, end users typically look for a functions... | Functions.php and includes | wordpress |
I know that I can get my translations into JavaScript doing: <code> $MyTranslations = array( 'translation1' => __("Some String 1", "MyTranslations"), 'translation2' => __("Some String 2", "MyTranslations") ); wp_localize_script( 'jquery', 'my_translations', $MyTranslations ); </code> But looking at some of WordPr... | Use the filter <code> 'mce_external_languages' </code> . From <code> wp-includes/class-wp-editor.php </code> : The following filter loads external language files for TinyMCE plugins. It takes an associative array 'plugin_name' => 'path', where path is the include path to the file. The language file should follow the sa... | How to provide translations for a WordPress TinyMCE plugin? | wordpress |
I'm workin on a website that's goin to have two horoscope sections: The normal zodiac - Updated weekly The chinese horoscope - Updated yearly The Normal Zodiac This section will have pages for each sign of the zodiac with informations like current week forecast , color, gem, best month day and etc. The Chinese Horoscop... | I would handle this with 2 custom post types and then a few custom taxonomies, depending on what kind of organization you want on that. I would use one custom post type for each horoscope (normal vs chinese) and then each would have a taxonomy for sign (separate taxonomies, not the same taxonomy for the two). If the ge... | Best way to save horoscope data | wordpress |
I am writing a plugin to send an invitation to a friend which opens up a form when a link is clicked. I encapsulated all the functions in class by following the code given in the Report Broken Video plugin by @toscho. The relevant code is below: <code> /* Plugin Name: Send Invitation Plugin URI: http://w3boutique.net D... | The best way to use your class without knowing the object is an action . You register the action before the theme files for presentation are loaded, WordPress will handle the rest. Sample code: <code> <?php # -*- coding: utf-8 -*- /** * Plugin Name: Plugin Action Demo */ add_action( 'init', array ( 'Plugin_Action_De... | Using a plugin class inside a template | wordpress |
I have a custom field named 'rating' that holds decimals from 1.0 to 10. I am trying use wp_query to get me all the posts with a rating of 8.0 to 10. What I have so far almost works perfectly but it does not return posts with rating of 10. <code> <?php add_filter('get_meta_sql','cast_decimal_precision'); function ca... | The issue is that the default comparison for <code> meta_query </code> is a <code> CHAR </code> comparison, so the order that the numbers would be in by default would be 1, 10, 2, 3, 4, 5, 6, 7, 8, 9, a, etc. To resolve this you need to modify your <code> meta_query </code> as follows: <code> 'meta_query' => array( ... | Compare meta_query decimals not working right | wordpress |
Is there any way to put some instructions for a custom post type inside the post admin at the top of the add/edit page? I know you can put the instructions inside of a meta box, but at the top would be easier for the user to read.... | You should be able to add help tabs with <code> add_help_tab() </code> . You'll need to filter which page you add it to based on the data returned by <code> get_current_screen() </code> , but that's simple. | Instructions for a custom post type | wordpress |
The query below works as expected, showing cpt event ordered by meta_value, what I haven't figured out yet is how to remove posts for past events or events which have started. The start date for events is currently stored as, 'yy m d' and the date is chosen using jQuery datepicker. <code> <?php global $post; $args =... | The date format is incorrect. I'm not sure how you have stored the date, but the format you've used in the query, <code> date("MM d yy") </code> outputs 'MarMar 07 1212'. It shouldn't really matter that the input is being done by jQuery datepicker: The input should be in a pre-specified format - so you can interpret in... | Remove posts from query for events whose start date has passed | wordpress |
I recently installed WordPress on IIS 7 and wired it up to SQL Server 2008R2. The installation went fine. Right off the bat, I can see on post is present (just in the count) but none are listed; I added a few posts. In the admin menu, under posts, I see that there are six published posts "Published (6)". However the li... | I had the same problem. From my log file I can see its breaking on the query that returns the posts. I managed to get this working by going to "wp-includes\query.php", and then removing the $limits variable from the query. It seems that this is breaking on sql server. Find this line: $this-> request = " SELECT $found_r... | Wordpress, IIS7, SQL Server 2008, not showing posts (displays 'Nothing Found...') and only shows counts in admin - how to fix? | wordpress |
I am tired of the tinymce editor in wordpress and I really love the stackoverflow editor which allows me to write with markdown grammar. So I want to write blog with markdown in wordpress. Now I am using this plugin in my wordpress: Plugin Name: Markdown QuickTags Plugin URI: http://brettterpstra.com/code/markdown-quic... | Welcome to WordPress stack exchange! Just yesterday I created WP-Markdown, which enables Markdown on your posts. It also provides the same interface as this website (the toolbar, and live preview) - however, currently only for comments and bbPress forums (if enabled). That said, (since it would be straightforward to do... | Is there a plugin that provides a stackoverflow style editor for wordpress? | wordpress |
I am running a multisite install with domain mapping and W3 Total Cache set up on each of the sites. I don't use a network in the traditional sense - each site is generally independent. I only have the second checkbox checked in "Domain Options" for the mapping plugin, if that gives you any sort of idea. Each site's ad... | i don't know if it is the best method, but something i just did recently (having picked it up from an answer here) was to remove the menu page if certain conditions aren't met and also to update the caps on all the removed pages so that they can't be accessed by someone slick enough to remember the URLs. <code> add_act... | W3 Total Cache - How to disable "Performance" menu under multisite? | wordpress |
Simple shortcode turning overcomplicated <code> <?php function recent_posts() { $q = new WP_Query( array( 'orderby' => 'date', 'posts_per_page' => '1') ); $list = '<ul>'; while($q->have_posts()) : $q->the_post(); //$location = bloginfo('template_directory'); $imgsrc = get_post_meta($q->ID, 'blog... | Looks like you've got two issues: The first is your use of $q-> ID. This is not the correct way to get the current post id from inside a loop. You want to use get_the_ID(). The second issue is you should be using get_bloginfo() instead of bloginfo(). Bloginfo echo's the data directly while get_bloginfo() returns it (al... | Display post_meta in Shortcode | wordpress |
I have been building a tabbed option page based on some tutorials I found, using the settings API. Here is the code http://pastebin.com/bbSnhFP5 . It's all actually working fine for me but it's not ideal and I'm sure there's a better way around it. The problem is that when I used this tutorial as a base and adapted it ... | You only need one <code> register_setting() </code> call. The rest can be handled internally. I wrote a Settings API tutorial that explains how to do so. Without delving too deeply into the code from the tutorial you linked, just based on the screenshot it appears that the Digital Raindrops code bypasses the standard, ... | Tabbed theme options query about add_settings_section callback function | wordpress |
I'm using a content section on my homepage to switch through multiple loops with ajax tabs and to do that a tutorial told me to make multiple pages and assign each page with a different template which contains the loop I want to display. But by doing that I'm creating top level pages that display loops on a blank page ... | You can use the constant DOING_AJAX to check if a current request is AJAX or not. This would let you do something like this in your templates: <code> if ( DOING_AJAX ) { //show your content } else { //return 404 error global $wp_query; $wp_query->set_404(); } </code> | How to make pages that arent indexed for ajax applications | wordpress |
How could I make it so the ' Home ' button / text link doesn't appear in the top menu as the user navigates to a subpage?? (So the menu stays the same accross) | I usually use a custom menu, which lets me take move any menu item around that I want. Twenty Eleven does support a custom menu in the primary navigation area, so perhaps that would be your quickest solution. | How to hide 'Home' button from appearing on supages - twenty eleven theme | wordpress |
I've added a custom taxonomy and I wanted to know if there is a way to edit a custom taxonomy's description. Here's the description field. IS there a function that provides access to this field? And if so, would I be able to use it in the New Posts page? | If you <code> get_term() </code> you can access the description via the <code> description </code> property. To update a term you can use <code> wp_update_term() </code> . | Edit custom taxonomy description programatically | wordpress |
I'm currently using @kovshenin's tutorial here on adding a thumbnail (a featured image) to my post type admin columns. Would it perhaps be possible ( and how :) ) to retrieve the first image attached to a post first, if no featured image available? (and perhaps return a local hosted image if also no featured image avai... | Yes it is possible. I believe it is better if you put it in a conditional statement Check for featured image easy ; Check for attached file with an image mime type using this and this ; Check for any <code> <img> </code> tag in the post content ( detail ); If there is no image at all, then use a default image Hop... | Grabbing the first image attached to a post and use it with the admin columns | wordpress |
In the Wordpress admin, how can I programmatically find out which page ( <code> themes.php </code> , <code> widgets.php </code> , etc.) I'm on? | You can determine that with wordpress' <code> get_current_screen() </code> function. It will not return just a page name though, it will give you an object containing a bunch of different data on what screen you're on. | In the Wordpress admin, how can I find out which page (themes.php, widgets.php, etc.) I'm on? | wordpress |
I want to use a form from the <code> Contact Form 7 </code> plugin to allow the users to upload a document to my website. The problem is that I'd like to manage those uploads from WordPress instead of receiving them in my E-Mail. Is there a way of redirecting the output of those forms to a PHP script, or something simi... | Take a look at the <code> wpcf7_before_send_mail </code> hook CF7 provides. <code> add_action("wpcf7_before_send_mail", "wpcf7_do_something_else_with_the_data"); function wpcf7_do_something_else_with_the_data(&$wpcf7_data) { // Everything you should need is in this variable var_dump($wpcf7_data); // I can skip send... | Contact Form 7 - process form using a PHP script, instead of mailing | wordpress |
I'm trying to set up multiple loops on a page. The first loop will display the latest four blog posts, and the second loop below it will display the latest eight blog posts with pagination. I set up the template below but only the first four blog posts show. Ideally, four blog posts for the first loop would show, then ... | add the loop code to the query_posts section; example: <code> <div id="blog-list"> <?php query_posts( array( 'posts_per_page' => 8, 'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1 ), )); if( have_posts() ) : while( have_posts() ) : the_post(); ?> <div class="post" id="post-<?php... | Basic multiple loops only displaying first loop | wordpress |
I have the following code showing up a sub-menu on my website (in my <code> header.php </code> file) that shows all well and good, however when I open up a post it dissapears: <code> <div id="dep-menu"> <?php global $post; if (!is_front_page()) { // so I don't display a link on the homepage saying "Homepage" i... | your menu is pages oriented. pages have parents and the query asks for the parent and the siblings. When accessing posts, posts have no hirarcy, wp_list_pages will not work and you cannot query posts by parent. The big question is what you'd like to display when accessing a single post... if you want to display the mai... | wp_list_pages() not showing on posts | wordpress |
After some trouble with custom post type/custom taxonomy permalinks I'm trying out custom post types with hierarchy = true and capability_type = 'page'. Would I miss out on any blog capabilities or go against some unspoken WordPress rule if I used this structure for my blog and my subblogs? Blog (hierarchical CPT) Subb... | This would be a bad idea Because custom post types are not blogposts, they thus dont have the same features with URLs etc. Going this route runs counter to the intentions behind custom post types, which are intended for building web apps, e.g. an event post type or a ticket post type etc So there will be many things mi... | Use a hierarchical custom post type for a main blog and subblogs? | wordpress |
Hi I have a WordPress site where all the content is in English, however I need just one page to be in Arabic with left to right text, plus some bullets which obviously appear on the right instead of on the left, how do I go about creating such a page? | @toscho is right about the direction of the text... But as someone who builds websites in hebrew all the time i would reccomend you create a custom page template by putting this tag in a copy of page.php <code> /* Template name: arabic page */ </code> THen you can design it differently... maybe remove the sidebar which... | How to add just one page in Arabic | wordpress |
I just installed bbPress 2.0.2 forum plugin for WordPress, and would like to change the text of link <code> Home </code> to <code> iGeek </code> (or anything else, for that matter). So the breadcrumb <code> Home › Community </code> becomes <code> iGeek › Community </code> (or something like that). How do I do that? In ... | The string is now in <code> bbpress/includes/common/template-tags.php </code> . Hook into <code> bbp_no_breadcrumb </code> , register a filter for <code> gettext </code> and change the text: <code> add_filter( 'bbp_no_breadcrumb', 'wpse_44597_change_home_text' ); function wpse_44597_change_home_text( $translated, $orig... | How to change the text of link 'Home' in bbPress forum breadcrumb? | wordpress |
I have no code to let you correct/see, I'm still in 'thinking stage'. What i would like to achieve is this: A real estate website with a few search functionalities. This new agency (REALLY NEW we have no office actually!) will split the city in 4 (or more) parts, in each one of these part there will be different houses... | I solved my problems using this simple plugin: http://www.don-benjamin.co.uk/tag/custom-search/ | How to let users choose where to search for posts? | wordpress |
I have this code for the loop, and I need to exclude a category <code> 4 </code> from this loop. Any suggestions on how to achieve this? Code that starts the loop <code> <?php if(have_posts()): ?> <ol class="item_lists"> <?php $end = array(3,6,9,12,15,18,21,24,27,30,33,36,39,42,45); $i = 0; while (have_p... | you could use wp_parse_args() to merge your arguments into the default query <code> // Define the default query args global $wp_query; $defaults = $wp_query->query_vars; // Your custom args $args = array('cat'=>-4); // merge the default with your custom args $args = wp_parse_args( $args, $defaults ); // query pos... | Exclude the category from the WordPress loop | wordpress |
I am using woocommerce and have some 'product attributes' which are just a taxonomies. I have the following taxonomies: pa_color pa_material pa_style the pa_ stands for product attribute and it is built-in to WooCommerce handles these taxonomies, so I can't change that. WooCommerce also comes with product categories (p... | You could try something like this: <code> function custom_rewrite( $wp_rewrite ) { $feed_rules = array( 'product-category/(.+)/material/(.+)/color/(.+)' => 'index.php?product_cat='. $wp_rewrite->preg_index(1).'&pa_material='. $wp_rewrite->preg_index(2).'&pa_color='. $wp_rewrite->preg_index(3) 'produ... | Rewrite Rules for Multiple (more than 2) Taxonomies | wordpress |
I have put my wordpress installation liek these : http://www.mydomain.com/cms for the testing time, and time to implement thing in the database. Now i have switch the whole thing to : http://www.mydomain.com/ (root). How is it possible to tell all the request to /cms to be / (root). i know htaccess can do that, but i p... | htaccess : http://www.htaccessredirect.net/index.php | Redirection with a wildcard | wordpress |
So i found the code below from another question on here, it displays a list of titles from a custom post type, my question is, How do i get the list to randomize? <code> <?php $queryObject = new WP_Query( 'post_type=announcements&posts_per_page=5' ); // The Loop!if ($queryObject->have_posts()) { ?> <ul&... | <code> WP_Query </code> has an <code> orderby </code> property which can be set to <code> rand </code> . If you change your query string to <code> 'post_type=announcements&posts_per_page=5&orderby=rand' </code> you should be good to go. You might want to take the time to read through the whole documentation for... | Random Custom Post Type Titles | wordpress |
I have written a short code to display a video off of amazon, and it works. However it is not being placed as expected on the page. I have put the shortcode after the <code> <!--more--> </code> tag but the video displays before the excerpt ruining the layout of the page-of-excerpts. The page is entered like this:... | Had a bit of a brain wave and thought I would capture the output and <code> return </code> it in the function. Turns out it fixed the problem so the final code ended up looking like this: <code> function amazon_video($atts){ extract( shortcode_atts( array( 'file' => $file ), $atts ) ); $url = get_bloginfo('url'); $r... | Shortcode not displaying video as expected | wordpress |
I have a custom function which looks if an attachement has a certain caption value, if so the attachement is selected, like so <code> foreach ($attachments as $attachment) { if ($attachment->post_excerpt == 'single-gallery') { </code> But how can i give a attachement two or more values and select one? So if i give a... | You should not misuse the caption for such values. Just stackexchange-url ("add separate fields for those data"). There are also plugins for media tags which may fit better to your needs. | How to set a conditional statement for $attachment-> post_excerpt, to check for value? | wordpress |
I'm trying to add a column to the manage screen that displays the Title and url of the post. I got the Title to work but it's not pulling the url. Basically I just want to show the url that's not been cut of like what sometimes happens in the edit screen. Here's my code: <code> function change_columns( $cols ) { $cols ... | Always use <code> get_permalink( $post_id ) </code> to get the URI of a post. It takes care of changed permalink structures and SSL. Be aware that the similar named function <code> the_permalink() </code> does not accept a parameter. To get the permalink of a custom post type (or a regular post outside of the loop ) yo... | Add Post Url to Manage Edit Screen | wordpress |
I am trying to integrate bbPress with WordPress, and the only thing in my way (for now) is the sidebar. How do I disable sidebar in bbPress? I know that one way is to manually remove or comment out <code> <?php get_sidebar)(); ?> </code> in all bbPress template files. But I would like to know if there a way that ... | Okay, I manually commented out all instances of <code> <?php get_sidebar)(); ?> </code> in bbPress templates like so: <code> <?php //get_sidebar)(); ?> </code> Alternatively, you can simply remove the code as well. But I consider it a bad idea, in case you want to have sidebar in the future. | How to disable sidebar only in bbPress and not WordPress? | wordpress |
I created a navigation bar like tab system for my header and I can get all but my news button to highlight on that page. The news is a static page for all of my blog/news post. Not sure if it's my code but if anyone has any ideas, much thanks to you. <code> <?php $parent_title = get_the_title($post->post_parent);... | Per your comment: Because I wanted the freedom to customize the HTML and CSS of the menu. I didn't want the generated html like: ul or li tags. Plus it gives me freedom to set up my links the way I want them. – blackbull77 20 hours ago You can do all of that with the output from <code> wp_nav_menu() </code> (except for... | Highlight static blog page link in header | wordpress |
I created a page titled company. But the permalink turned it into /company-2/, trying to change it to just /company/ doesn't work. The website just has 8 pages and none is called company (don't know if company as page title is used in the past?). What can i do and what is the cause? Where should i look? Not afraid to u... | Check the slugs of the other pages - chances are /company/ is being used for one of those. You could also go to /company/ on your site and see if anything pulls up. | Strange permalink issue: can't rename /company-2/ to /company/ | wordpress |
I created a custom post type. When I click "Add new" for this post type, I see among other meta boxes a "Main Slider Item SEO" meta box. This SEO is superfluous. Can I remove it? add_action( 'init', 'create_post_type' ); function create_post_type() { register_post_type( 'main_slider_item', array( 'labels' => array( 'na... | I found a solution: Set <code> 'public' => false </code> in register_post_type(). (After this I also need to set <code> 'show_ui' => true </code> to retain it in the admin interface.) | Remove Post Custom Meta Box | wordpress |
all In my theme there is a notification at top. After user login he can see the notification update. when click on notification i want to make change in database alert field value 0 to 1. My ajax call in theme <code> $("#notifications-button").click(function() { $.ajax({ type : 'POST', url: "http://localhost/rupp/wp-ad... | You need to add the <code> $where </code> parameter to your update statement because it doesn't know which row to update. The <code> $wpdb->update() </code> method has no default value for the <code> $where </code> argument so you must supply one. http://codex.wordpress.org/Class_Reference/wpdb#UPDATE_rows Try this:... | Using AJAX in wordpress theme | wordpress |
My question: This code retrieves the categories. I need to exclude the category number:81. Is there an easy way to exclude it in this code? <code> <?php $cat_lists = retrieve_cat_data_sp( get_option('bn_exclude_home_lists') ); for ($i = 1; $i < count($cat_lists); $i++ ) { if( (get_category( $cat_lists[$i] )->c... | If retrieve_cat_data_sp is the function from stackexchange-url ("this question") then that returns categories except the ones given in the argument: <code> $cat_lists = retrieve_cat_data_sp('81'); </code> It essentially a wrapper for <code> get_categories </code> . So to exclude multiple Ids <code> $cat_lists = retriev... | Exclude the category in Wordpress | wordpress |
I've had a look for anyone experiencing the same issue but to no avail. I am currently working on a Wordpress site that previously did not have permalinks, so have added these (i.e. to change the URLS from ?p=123 to /about/the-company etc.) in the standard way but I've ended up with the homepage displaying a 404 error.... | Try checking what your front page is set to in Settings > Reading. It should either have the your latest posts option selected, or the static page option selected and the front page set to a valid page. Edit: Wait... the http://www.walkerpoolenixon.com/wordpress url you provided doesn't exist! Maybe you mean http://www... | Wordpress home page showing 404 error | wordpress |
Is there a way to have multiple "featured" images (or just images) per post...I mean without putting it into the regular text editor. I would like to have some control where the images go...hence make it work the way the featured image works (i.e. a separate meta box) | Take a look stackexchange-url ("at this Q"). | Muliple featured images (or just images) per post | wordpress |
This question is about HTML code comments <code> <!-- like so --> </code> rather than about post/page comments. I specify the WYSIWYG, but this problem arose in the HTML view, not the Visual. I've been building a site for a client, and she came to me with a problem — she had tried to comment out part of her page ... | This is a duplicate of stackexchange-url ("another question") and (I'm sorry!) a bug in WP. As @Otto says in the comments to that question, this is an edge case problem (not many users know or care about using comments) and is not likely to get fixed soon unless you'd be interested in contributing . EDIT: I looked for ... | why do HTML Comments in the WYSIWYG break the page display? | wordpress |
What I'm trying to do is very simple. Whenever someone visits, say <code> site.com/socialproof.png </code> , I want it to use a rewrite rule to point it to a file in my plugins folder. Can I do this with WP's rewrite rules or do I need to manually add it to the <code> .htaccess </code> file? What would I use as the rew... | Using .htaccess rewrites wouldn't be a good approach since it would fail when the plugin is disabled. You also can't rewrite image URLs with WordPress because its native request parsing does not recognize single file names. However, if an image doesn't exist, the web server will redirect the request over to WordPress f... | How can I dynamically generate an image with a static image URL? | wordpress |
I added a new file in the theme folder and it doesn't seem to be working properly. The first line <code> get_header(); </code> creates an error <code> Fatal error: Call to undefined function get_header() </code> like it's not seeing any includes. Any ideas why that happens? All files in the same theme folder work just ... | You are prbebaly using wordpress elements outside the loop and since its a file ou dont access directly from wordpress structure but a file you created yourself you should include <code> <?php require_once("../../../wp-load.php"); ?> </code> Above the doc type opening tag in sendEMail.php file.. | Added a new template file to a theme - get Call to undefined function error | wordpress |
I'm using this code to plant a script on a spesific page, it works but inserts the script into the bottom of the page not the top - I'm at a loss to explain why! Is there a way to do this that results in the script being inserted inside the head tags. <code> function single_page_load() { if ( !is_page_template( 'intera... | <code> wp_enqueue_script </code> accepts 5 parameters. The fifth one is <code> $in_footer </code> . If that parameter is set to true the script will load in the footer. If it is set to false it will load in the head, unless a dependency (like jQuery in your code) is set to show up in the footer. | Loading scripts on a single page plants the script in the footer | wordpress |
I have a site with user registration and I have a few specific qualifications that I must fulfill. The login/registration area should be on its own page within the template using a custom page template (im going to use jquery tabs for login/reg); i dont want to use the regular wordpress signup/login page. I must be abl... | Gravity Forms is a premium one, but was the only one that solved without flaws a custom registration I needed to implement... Appart from the Premium part, I have to inform that only the Developer licence will give you access to the User Registration extension. If you go past the Premium-Developer issue, check their fo... | What plugin(s) are best for this User registration task? | wordpress |
So I am using the http://woothemes.com/woocommerce/ plugin for eCommerce and it's registering jQuery local and conflicting with my default jQuery call from Google CDN. It took a long time but I isolated the issue to the following lines of code within <code> woocommerce.php </code> : <code> $suffix = defined('SCRIPT_DEB... | Actually it looks like your calling jquery wrong. You should always use wp_enqueue_script, otherwise your asking for conflicts. Don't call it manually. The lines you pasted in from WooCommerce don't load jquery directly - they load it by setting the dependencies for the other scripts. WordPress handles the rest. If you... | Unhook jQuery from WooCommerce via `functions.php`? | wordpress |
I have an additional menu that appears on some single.php pages. To this menu I would like to add an li with a link to a PDF which is uploaded to the post by a custom field (advanced custom fields helps with this). I found a snippet on how to add todays date to my menu, and thought I could maybe use this as a starting ... | Try this: <code> // Filter wp_nav_menu() to add additional links and other output add_filter('wp_nav_menu_items','add_pdf_to_menu', 10, 2); function add_pdf_to_menu( $items, $args ) { if( $args->theme_location == 'extra-menu') { $pdf = get_post_meta( get_the_ID(), 'mcf_uppsagning-pdf', true ); if ( $pdf ) $items .= ... | Populate wordpress menu with link to custom field value (file download) | wordpress |
I'm using a plugin called Foliopress WYSIWYG . While using this plugin, images found in the_content loop using relative image path instead of absolute paths. So all the feed images looks broken. This plugin stores images in <code> http://mysite.com/images </code> folder instead <code> wp-content/uploads </code> folder.... | Something like this should do it, you may have to fiddle with the <code> preg_replace() </code> to get it to work the way you need, but the concept (and, more importantly imo, the regex, is there). <code> if( is_single() ) { add_filter( 'the_content', 'wpse44503_filter_content' ); } function wpse44503_filter_content( $... | Replace image urls(absolute instead of relative) by using filter in single page | wordpress |
I recently switched themes, and my old theme had templates for sitemap and archive (in fact the archive was one of my most viewed pages.) When I switched themes the link to the archive and sitemap page still works, but they are blank pages. I really need to get this fixed, and I have no idea how. I'm assuming I need to... | I ended up just using the template that Wordpres.org provides. Everything seems to be working fine now. thanks! | Need help with adding templates (archives and sitemap) to Wordpress child theme | wordpress |
I have run into some WordPress code which does POST requests to API sites and in the POST parameters for the SSL property it has <code> $params = array( 'body' => $_POST, 'sslverify' => apply_filters('https_local_ssl_verify', false)); </code> So why not simply put false or true? | The <code> apply_filters() </code> function lets plugins and themes override the value. So yes, you could manually set <code> sslverify </code> to <code> false </code> . The code snippet you included will set it to false in the absence of any filter. Let's say I have a plugin that wants to force it to true. I would add... | The 'https_local_ssl_verify' filter | wordpress |
I'm trying to make a simple widget that displays a list of posts, and is followed by some metadata from each post. Here is my code: <code> $eventdate </code> contains the metadata i need to retrieve. <code> query_posts(''); if (have_posts()) : echo "<ul>"; while (have_posts()) : the_post(); $eventdate = get_post_... | <code> query_posts() </code> is for main query, it would be more wise to use <code> get_posts() </code> function to get you events. <code> // Modify get_posts args for your needs $events = get_posts( array ( 'post_type' => 'events' ) ); if ( $events ) { echo '<ul>'; foreach ( $events as $event ) { $event_date ... | get_meta_data within a loop | wordpress |
I have the following coding: <code> <?php global $post; $args = array( 'numberposts' => 8); $myposts = get_posts( $args ); foreach( $myposts as $post ) : setup_postdata($post); echo '<a href='.the_permalink().'>'.the_title().'</a><br />'; endforeach; ?> </code> Dreamweaver is highlighting a p... | Not sure if it is causing Dreamweaver to flag an error (try running it?), but on the second from last line you want to be using <code> get_the_title() </code> . This returns the posts' title, whereas <code> the_title() </code> will echo it. <code> echo '<a href='.the_permalink().'>'.get_the_title().'</a><... | PHP Syntax Error on get_posts | wordpress |
Hi I have this plugin http://pastebin.com/a7t1SPXj which imports feeds from various websites. There are two problems I would like help in solving. The first is that I would like to place a limit on the date of the oldest feeds retrieved, limiting all results to the last 7 days. Secondly when I add more than 10 feeds it... | Instead of checking and updating the feeds every time you do the shortcode, instead register cron tasks for each feed timed to their update schedule. Also saving the feed items as posts, and storing the GUID in the posts meta, then only saving the feed items that are new, will simplify things. It will also let you use ... | How to make this plugin more efficient | wordpress |
Hey i am trying to learn wordpress developement on my own, I'm building a celebrity gossip blog and i need help. I want to build a video page. Does anyone know of a plugin or anything that i can use that allows me to have a flash video player that also accepts youtube links as well. Something like, Inserting the video ... | Have you had a look at Tubepress - http://tubepress.org/ ? Then you could create a new category and a custom layout for that category. | Building custom pages with a video player | wordpress |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.