question
stringlengths
0
34.8k
answer
stringlengths
0
28.3k
title
stringlengths
7
150
forum_tag
stringclasses
12 values
I want to get all featured items using query post. featured is meta_key using custom field plugin. I tried bellow,but it failed <code> $featured_item = new WP_Query('posts_per_page=-1&amp;cat=3&amp;meta_key=&gt;Featured List&amp;meta_value=&gt;Yes'); </code> my wp version is 3.1.3 EDIT: <code> $arg2 = array( 'posts_per...
Your <code> meta_query </code> needs to be a nested array, like so; <code> $args = array( 'posts_per_page' =&gt; '5', 'cat' =&gt; '3', 'orderby' =&gt; 'rand', 'meta_query' =&gt; array( array( 'key' =&gt; 'Featured List', 'value' =&gt; 'Yes' ) ) ); </code> And I get the feeling you don't actually need a <code> LIKE </co...
how can i use custom field in query post
wordpress
I'm using a script that is based on jQuery, so I'm not enqueue-ing jQuery directly, but via passing it in the array of dependent scripts: <code> wp_enqueue_script("jquery-plugin-name",'http://hostname.il/blogname/wp-content/themes/twentyten/js/jquery-plugin-name.js', array('jquery'), '1'); </code> This is loading jQuer...
That's the size of the minified jQuery nowadays :) You can load the latest from Google: <code> wp_deregister_script('jquery'); wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"), false, '1.8.2'); </code> Please keep in mind that this can cause issues moving forward, as you ...
How to control what jQuery version to include, with wp_enqueue_script
wordpress
I'm trying to remove "Pending Review" (Status) and "Password protected" (Visibility) options from Publish metabox. Any ideas how can I do it?
i don't see any filters you could latch on it in wp-admin/includes/metaboxes.php. but, you could remove the box and replace it with your own version... for example: this tut removes the categories metabox and replaces it w/ a new version http://www.ilovecolors.com.ar/avoid-hierarchical-taxonomies-to-loose-hierarchy/
How to modify Publish metabox?
wordpress
I'm in a situation where I need to face a situation when there is a WordPress site with landing page and several internal page designs. I know for such situations there is recommended to create more template files for pages with some comments at the beginning like <code> Template Name: Some Style </code> I've done this...
Yes you'd need to add shortcodes to the functions.php file in your themes folder in order to use code like [box]Contained content blah blah[/box] in the WYSIWYG editor learn more about shortcodes and how to use them here http://codex.wordpress.org/Shortcode_API
custom page templating in WordPress
wordpress
I was wondering if anyone can help me out. I am looking to remove the_content part of the loop on my author pages only . So basically, I just want a list of the author posts with only the title and meta instead of the full post. When I went to the author.php file, I found this, which I believe is the code that is gener...
If your Parent Theme, has a template file <code> loop-author.php </code> , copy it to your Child Theme; otherwise, copy your Parent Theme's <code> loop.php </code> template file to your Child Theme, and rename it as <code> loop-author.php </code> . Now, modify your Child Theme's <code> loop-author.php </code> template ...
Editing the loop for Author pages
wordpress
could you figure out why I'm unable to get shortcode filters applied in ajax inclusion of posts? Let me explain better: I've managed to include a post from within another post, through admin-ajax.php , as recommended in the famous 5 tips . Obviously I don't want to display the shortcode tags, nor I'd like to strip them...
Awww... in admin-ajax.php : <code> define('WP_ADMIN', true); </code> in cleaner-gallery.php : <code> function cleaner_gallery_setup() { if ( is_admin() ) { require_once( CLEANER_GALLERY_DIR . 'admin.php' ); } else { require_once( CLEANER_GALLERY_DIR . 'gallery.php' ); } } </code> So I have to manually include &amp; run...
Ajax, filters and shortcodes
wordpress
I have a sql database of historical events, I would like it to post data into the sidebar area of a wordpress site. As I am very new to it I do not have any idea how to proceed. I would be thankful if anyone could help me out. Thanks in advance
You can edit the <code> sidebar.php </code> (or any <code> sidebar-xxx.php </code> file, depends on your theme) and interface with your database using the wpdb class . If your historical events are in the same DB as wordpress you can use the wpdb class straight away, if they are in another DB you can instanciate a new ...
How to send data to sidebar?
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
You're misunderstanding the purpose of <code> home.php </code> , which is not necessarily to output the Site Front Page , but rather to output the Blog Posts Index . In WordPress, the <code> index.php </code> is simply the default fallback template file, that is used when no other, more-specific template file is availa...
wordpress help needed. How to display both home.php and index.php?
wordpress
What processing is done by wordpress when a page is accessed that loads all contextual information into $post and other variables? and is it possible to trigger this process manually (or simulate it) so function calls have this context? The reason I'm asking is because I have written a small plugin that allows users to...
you're requesting index.php which I guess it's the homepage; if I call for example is_category() trough your ajax from the category page I'll get false because the function is being ran on the homepage. Use <code> $_SERVER["REQUEST_URI"] </code> instead (don't forget to sanitize it) you're hooking your handler on the <...
how to get context information inside my funcion
wordpress
For example, if I create a post type called "destinations" does that automatically create capabilities like "edit_destinations" or "delete_destinations"?
It does not automatically create that capability in the sense that there is no new capability registered with WordPress. Instead it defaults to use the capabilities assigned to creating/editing posts. For example, if an author logs in they will be able to create and publish a new destination entry by default. You can o...
When you create a custom post type, does that also create capabilities for editing/deleting that post type automatically?
wordpress
After adding support for a selection of post formats like this: <code> add_theme_support( 'post-formats', array( 'aside', 'video' ) ); </code> how can I then get the list of supported post formats back? I'm building a theme where the user can toggle support for postformat, and I want other admin elements to reflect wha...
Taken from <code> post_format_meta_box </code> ; <code> if ( current_theme_supports( 'post-formats' ) ) { $post_formats = get_theme_support( 'post-formats' ); if ( is_array( $post_formats[0] ) ) { print_r( $post_formats[0] ); // Array( supported_format_1, supported_format_2 ... ) } } </code>
how to get list of post formats supported by theme?
wordpress
I have this custom loop: <code> &lt;?php // Display the top ones $args = array( 'post_type' =&gt; 'reply', 'post_parent' =&gt; $post-&gt;ID, 'r_sortby' =&gt; 'highest_rated', 'r_orderby' =&gt; 'desc', 'order' =&gt; 'DESC' ); ?&gt; &lt;?php query_posts( $args ); ?&gt; &lt;div class="entry-list-top"&gt; &lt;?php while ( ...
Just count the number of returned posts of the first loop: Replace: <code> &lt;?php query_posts( $args ); ?&gt; </code> With: <code> &lt;?php $posts = query_posts( $args ); $count = count($posts); ?&gt; </code>
Displaying the number of posts in a custom loop (without including the number of posts of a loop below)?
wordpress
Is there a way to prevent WP from stripping the HTML from the author bio? I need it to keep my paragraphs. Thanks in advance! :) Edit - Although this question has been answered, I will clarify that I was referring to the Bio textarea when editing individual users.
remove the filter that formats the description. put this in your theme's functions.php: <code> remove_filter('pre_user_description', 'wp_filter_kses'); </code> EDIT - I should mention, if you allow random people to register and add their own bio for display on the site, not filtering that text could enable bad things.
How can HTML be allowed in Author Bio?
wordpress
I just noticed today that the documentation for query_posts() mentions some "disadvantages" of using query_posts for altering the main Loop, notably: 'causes additional SQL queries'. This seems to imply that there's another way / a better way. Obviously there's get_posts() and WP_Query for secondary loops, but I don't ...
When I added the drawbacks to the Codex, I was mainly thinking of using the 'request' filter as an alternative to query_posts(). That filter is only run for the main query, so that solves the problem with 'pre_get_posts', which fires for every query. The downside is that you don't have access to query flags like is_sin...
Alternative to query_posts for main loop?
wordpress
I have a site some having job postings running using jobber base. Now I am going to shift it in WP using jobroller theme that is of 99 USD. I am a developer who always like MVC rather than these CMS. I was thinking of doing it in Yii. But now I came to know about job roller. So I have 2 questions? Is jobroller worth 99...
About OOP Themes) There are dozens of Theme- &amp; Plugin-"Frameworks" out there. And some are OOP. About custom coding) You could also try libraries like WP Alchemy for meta boxes and custom content. "Rilwis" offers another one. Then you could use some stackexchange-url ("front end code") to insert stuff into Custom P...
Is wordpress big enough for my project
wordpress
I have done a lot of researching and haven't found quite what I am looking for, so I am hoping that I can be pointed in the right direction. I am developing an Events plugin that will book a ticket from the frontend. This is no different than any other Form submission, but what I am getting confused with is how to hand...
Send the form action either to your homepage, or to a specific page URL. You can't have $_POST handling within the template because you need to redirect after your process it, and redirect needs to be fired before any HTML output. <code> // you should choose the appropriate tag here // template_redirect is fired just b...
Plugin Form Submission Best Practice
wordpress
I have a number of custom of post types - i.e. <code> 'windows' </code> , <code> 'doors' </code> , <code> 'garages' </code> and I want to load a custom template ( <code> special.php </code> ) whenever my wordpress site has a url that looks like this: <code> www.mysite.com/windows/ www.mysite.com/doors/ www.mysite.com/g...
I assume that your custom post type windows would map onto /windows/ etc? You can customise the template for individual custom post types via single-posttype.php in your theme, e.g. single-windows.php single-doors.php and single-garages.php Wordpress will automatically pick these up You could also use custom page templ...
wordpress - load a template based on the URI
wordpress
I need to change the author element of the feed from dc:creator to author. How does this is possible?
Bearing in mind my comment about, you can use the <code> rss_item </code> hook to add a filter that will let you add the <code> &lt;author&gt; </code> element to your feed <code> function add_author_to_feed($feed) { $feed .= '&lt;author&gt;' . the_author_meta('user_email') . '&lt;/author&gt;'; return $feed } add_filter...
How can I rename the element to in my RSS?
wordpress
One year ago @t31os answered a post with a code I can't access: http://wordpress.org/support/topic/search-custom-field-data His answer... I was feeling adventurous, so i wrote a simple plugin to do it.. http://wordpress.pastebin.ca/1736605 The post search in the admin will now also check against the meta keys and meta ...
Don't know what's wrong with that link but you can see an answer to a similar question stackexchange-url ("how to filter post listing (in WP dashboard posts listing) using a custom field (search functionality) ?") Its just what you are looking for.
admin : search custom fields
wordpress
I've worked with WordPress for a while now and this is the first time I've had this problem, I can't get my permalinks to work without <code> index.php </code> on the URL even though <code> mod_rewrite </code> is enabled, a few things that might help figure the problem out: I'm using apache2 and mod_rewrite is enabled,...
Sigh had to add this to the httpd.conf file on the webserver: <code> &lt;Directory /var/www/&gt; Options FollowSymLinks AllowOverride All Order allow,deny Allow from all &lt;/Directory&gt; </code> First time I have to add it manually, oh well it works fine now :)
Can't get pretty permalinks to work without index.php
wordpress
Tearing my hair out a little bit here! I'm trying to create multiple image-selection boxes so users can upload as many images as they like to the species profile they've created. I'm using the following code in a .js file: jQuery(document).ready(function() { <code> var i = 2; jQuery('a#add_media').click(function() { in...
OK, I've made the changes Otto suggested and it's working nicely - thanks. <code> var uploadClickHandler = function() { str = jQuery(this).attr('id'); substring = str.substring(str.length, str.length - 1); id_to_pass = 'upload_image-' + substring; tb_show('', 'media-upload.php?type=image&amp;amp;TB_iframe=true'); retur...
Why won't this jQuery code work?
wordpress
How I could made a sql query who retrieve all the sticky post in a wordpress database? This is because we use a new app over the old wordpress website database, and I don't know where Wordpress "store" the sticky attribute. Thanks in advance
It's not stored as attribute, but as list of all stickies. Snippet from core: <code> $sticky_posts = get_option('sticky_posts'); </code> So look for the option and then use IDs to retrieve posts.
How to retrieve sticky post in raw sql?
wordpress
I am building a new theme for my site, and I was wondering which is the simplest/lite theme with only the files needed like single.php index.php author.php and so on. I have read about wordpress themes and what files I have to include but I will have to code the default functions like wp-comments if I start from here. ...
asked a few times, this link has some good answers stackexchange-url ("Opinions and recommendations on the best barebones base theme")
Which is the simplest theme for Wordpress to use it as your base?
wordpress
I moved my word press blog from Apache to IIS 7 shared hosting. my database connection is fine. I can access the admin module but I get an empty index.php with "Nothing Found for Index Php Error" in the title bar. Can someone please help.
Start by going to Settings> Permalinks , now click on the default radio button and click save. You probably used .htaccess to enable pretty permalinks, IIS doesn't use an .htaccess file. If the default structure fixed the problems you are having, but you want the old permalink structure, click this link to the WP-Codex...
Nothing Found for Index Php Error
wordpress
I'm using front-page.php to generate a static frontpage for a Web site I'm working on. I can't seem to get Wordpress to display the blog posts on any other page. I tried creating a custom template to display blog posts, but it doesn't display any posts. Also, when I try to set the front-page as a static frontpage manua...
To use a static Front Page, you need to do the following: Create two static Pages , one for your front page content, and one for your blog posts index; their names are entirely arbitrary, but for our purposes, let's call them "Front Page" and "Blog" Go to <code> Dashboard -&gt; Settings -&gt; Reading </code> Set "Front...
Using front-page.php need new blog page
wordpress
How can I build a query to find posts that DO NOT contain a certain meta key or meta value? for example: <code> query_posts( array( 'meta_query' =&gt; array( array( 'key' =&gt; 'feature', 'value' =&gt; '_wp_zero_value', 'compare' =&gt; '!=' ) ) ) ); </code>
Getting posts without a certain meta key is a little tricky, namely due to the database design and the nature of SQL joins. AFAIK, the most efficient way would be to actually grab the post IDs that do have the meta key, and then exclude them from your query. <code> // get all post IDs that *have* 'meta_key' with a non-...
how to show posts that are missing a meta_value
wordpress
I am using wp_list_comments() function to draw the comment list.But,I want change many things in the form like class,styles, reply link and etc... so please help me, How can i customize the comment listing function Thanks
The <code> wp_list_comments() </code> call accepts a callback argument, in which you can define the specifc comment-list markup that you want. I would suggest taking a look at how TwentyTen handles the <code> wp_list_comments() </code> callback.
How can i customize the comment list
wordpress
Before I call the_excerpt(), the_permalink() displays the correct thing. Afterwards, it does not... <code> &lt;?php global $query_string; //strip out the "pagename=blog" so that the query will grab all of the posts instead of the content of the blog page $query_string = preg_replace("/pagename=[a-zA-Z0-9]*/", "", $quer...
I had installed the "Facebook Comments for WordPress" plugin. This plugin attaches a filter to <code> the_content(); </code> . The filter contains the line <code> wp_reset_query(); </code> . Commenting this out fixes the problem (this is sub-optimal though, because, now the client will be unable to update the plugin).
the_excerpt(), get_the_excerpt() and the_content() all killing "the Loop"
wordpress
I have a few sites in a network. I don't want the site administrators to manage things like network plugins, but I would like them to be able to edit profiles of all network users, not use those on their site. At the top of the <code> /wp-admin/network/users.php </code> file is this: if ( ! current_user_can( 'manage_ne...
Here's a solution that worked for me: http://thereforei.am/2011/03/15/how-to-allow-administrators-to-edit-users-in-a-wordpress-network/ Pretty elegant and doesn't involve messing with core.
How to enable a site administrator to edit users in a WordPress network/ multisite setup?
wordpress
I'm developing a theme which supports WordPress' post formats. As a result I am using a big if statement, which can be found below. I would like to link my post titles to the posts while maintaining my theme as XHTML valid. I would like to call images (with classes) in the if statement while maintaining my theme as XHT...
I don't know what you mean by "call images", but this will display the title as a link. <code> if ( has_post_format( 'video' )) { ?&gt;&lt;a href="&lt;?php the_permalink(); ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;?php the_excerpt(); } </code>
Calling Permalinks With PHP
wordpress
I suspect that this is not possible right now, but oh well.. I'll ask, maybe one of you has some intersting thoughts to share. So let's say we have the following taxonomy terms meta-boxes on our post edit page : Team accounting Team supergurus Countries Team developers Favorite ice cream Wouldn't it be nice to be able ...
Thanks for the hint Bainternet, indeed this is very easy to implement with jQuery. Example (the four meta boxes are closed for clarity) : Here's what I did : <code> var $j = jQuery.noConflict(); $j(document).ready(function() { $j("#side-sortables").append('&lt;div id="container_div" class="postbox meta-box-sortables ui...
How to group meta boxes on the post edit page
wordpress
Inside of my current theme directory, I created a folder called "mobile" which contains a separate set of template files, all optimized for mobile. Now, say I setup a function that detects a mobile device, I would like wordpress to now load "mytheme/mobile/header.php" Instead of the themes root header.php and index fil...
<code> if ( condition ) { get_template_part( 'path/to/template', 'mobile' ); } else { get_template_part( 'template', 'mobile' ); // in rootpath } </code> You can also intercept the behavior for <code> get_template_part() </code> with an action hook: <code> // Source in get_template_part do_action( "get_template_part_{$...
Load template inside a parent template
wordpress
I think <code> blogs.dir </code> is supposed to be used to separate content for the different blogs on a network install of Wordpress (MU or 3.0+ with networks enabled), however, I've not been able to find a clear guide to using it. Can someone shed some light and maybe post a few links to information on how to set it ...
<code> blogs.dir </code> was the way to handle specific blog plugins and themes when it was WordPress-MU but since version 3 came out and the WordPress-MU was integrated into WordPress Core and introduced WordPress Multisite, that's no longer the story. WordPress Handles the creation of the new blogs/sites in the datab...
Can somebody tell me how I am supposed to be using blogs.dir for network / MU sites?
wordpress
Is there any reason why Wordpress restricts the amount of posts you can administer at once to 20? Is there a way to display all posts? I want to change the category for about 1800 posts. I don't have the ability to change the post amount under screen options; see here: tinyurl.com/3npm5yz Using WP v3.1.3
It doesn't, in the top right under screen options it says, Show on screen , you can set this to a max of 999 ( I have never tried 999 just fyi) and you can select all, then bulk actions---> edit---> apply. Also I think there are plugins that do this that use direct <code> wpdb </code> functions, so you can effectively ...
display all posts in wordpress admin
wordpress
Is there a plugin that makes external links open in new window, BUT only on the pages or domains or links I specify?
Simple Popup Plugin . this plugin helps to made external links open.. WordPress Popup Scheduler
Is there a plugin that makes extnernal links open in new window, BUT
wordpress
I have one stylesheet linked to my Wordpress page in header section: <code> &lt;link rel="stylesheet" type="text/css" href="&lt;?php bloginfo('template_directory'); ?&gt;/style.css" /&gt; </code> Now, I want to load different stylesheets on a few pages or sub-pages. What's the best/correct way of achieving this? I'm th...
Don't use a shortcode for <code> wp_enqueue_style() </code> ; it won't do any good, because by the time the shortcode is parsed, all the relevant hooks ( <code> wp_head </code> , <code> wp_print_styles </code> ) will have already fired. Write a function, in <code> functions.php </code> , to enqueue different style shee...
Loading different stylesheet on Wordpress pages?
wordpress
Is there a way to find the ids of the pages who contain meta tags/custom fields with a certain key-value pair? Say, for instance, that I wanted to find all of the pages who had a meta-tag/custom-field key of "weather" with a value of "raining", is there a way to do that?
Why not? Same custom field parameters in query should apply and you can use <code> post_type </code> argument to limit query to pages alone.
Find page IDs with specific meta tag key value pairs
wordpress
I have seen this in lots of wordpress themes and using it for a while but don't know what is the significance of it. It seems it does the same work as echo something out. Look for it in codex but failed to find anything about it. May be i have looked in wrong place. So, my question is what does <code> _e("Some String",...
it's for localisation/translation WPEngineer Has a great writeup on how it all works....
What is the significance of _e("Some String", 'String')?
wordpress
Is there a is_user_logged_in() function for Wordpress MU / Multisite (3.0+) where I can add in the network site ID like <code> is_user_logged_in(2) </code> where <code> 2 </code> would be the site_id? Update: After a little digging I came up with the code below. Unfortunately it does not work. //don't use this. does no...
Yes, and no! The way users work in a multisite scenario is that there is a single pool of users, who are then associated with blogs. So, logged in status is common across all the blogs, but you can use <code> is_blog_user($blog_id) </code> to determine whether the current logged in user is a member of that blog. An exa...
Is there a is_user_logged_in() for multisite?
wordpress
This seems to be an easy one but its giving me quite a hard time. get_the_post_thumbnail() suppose to take attribute as an array. Well, everything working right but when i pass style attr its doesn't work. <code> $attr = array( 'title' =&gt; get_the_title(), 'alt' =&gt; get_the_title(), 'style' =&gt; 'float:left' ); $t...
<code> get_the_post_thumbnail </code> attribute array doesn't know <code> STYLE </code> , the fields that are available for you to use are: <code> src </code> <code> class </code> <code> alt </code> <code> title </code> so just use the class and define you class to it: <code> $attr = array( 'title' =&gt; get_the_title(...
get_the_post_thumbnail() doesn't taking style attribute
wordpress
I am having vendor address field for each post using custom field plugin. In single post page.I want to generate bar code.When its scanned by mobile phone.It should display the address of the vendor in text format. Is there any existing plugin.Or any gold suggestions are appreciated. Thanks in advance !
No need for a plugin if you use the Google Chart tool api its very simple, i have a function that i wrote a while back: <code> /* * function to get QR code Image from google chart API * @Params: * $content - (string) the content to store inside the QR code (eg: url,address,string..) * $size - (string) the size of the Q...
plugin suggestion for barcode
wordpress
As the title states all I'm trying to do is get the descriptions for all tags inside the loop on my INDEX.php page to show up. I know you can use code to call specific tag descriptions but I want to avoid that if possible since I'll have hundreds of tags all of which I want to show descriptions for. Is there a way to m...
Modified from the <code> get_tags() </code> Codex Example <code> $tags = get_the_tags(); // for the specific post // $tags = get_tags(); // all tags $html = '&lt;div class="post_tags"&gt;'; foreach ( $tags as $tag ) { $tag_link = get_tag_link( $tag-&gt;term_id ); $html .= "Describtion for ".ucfirst( strtolower( $tag-&g...
How to enable all Tag Descriptions in loop?
wordpress
I know if I had a page that had a permalink such as <code> /stories/ </code> then I could create a page in my template called <code> page-stores.php </code> and it would load in place of the default <code> page.php </code> when that page loaded (see Template Hierarchy ) What I want to know is if I had that two page tem...
This might work: <code> add_filter('page_template', 'custom_page_template'); function custom_page_template($template){ // check your permalink here if(get_query_var('pagename') === 'stories') return locate_template(array('page2.php', 'page.php')); return $template; } </code>
Adjust which tempalte a page uses with a function?
wordpress
I'm using <code> echo get_the_term_list( $post-&gt;ID, 'trpropcity', '', ' ', '' ); </code> to show a taxonomy link, I'd like to make this instance of it only have the first letter capitalized, Cleveland not CLEVELAND, I realize I could just change the taxonomy, but I actually want it all caps everywhere else on the si...
Build the links yourself: <code> $terms = get_the_terms($post-&gt;ID, 'trpropcity'); if($terms) foreach($terms as $term) echo '&lt;a href="'.get_term_link($term, 'trpropcity').'"&gt;'.ucwords(strtolower($term-&gt;name)).'&lt;/a&gt;'; </code>
Make first letter of my taxonomy uppercase
wordpress
This functions at the moment but it only returns the first value from the array. I've been struggling to echo, print, explode, or whatever the multiple custom field values that share the same key (mp3). The shortcode is looking for comma-separated urls aka <code> tracks="http://url1.mp3, http:/url2.mp3" </code> I know ...
Kind of confusing question, but I think you want: <code> [mp3-jplayer tracks="'.implode(', ', get_post_meta($post-&gt;ID, 'mp3', false)).'"] </code> Assuming you get a array of meta key values this will join the into a comma-separated string
explode array within shortcode
wordpress
i've saved and array of 'open days' as a serialised array in a meta value. I was hoping i could then just search this field for the selected dates but i can't seem to create a match. serialised = a:2:{i:0;s:10:"2011-09-16";i:1;s:10:"2011-09-17";} ; // two open dates and was trying this and some variation without luck ;...
Don't serialize the search value, just use <code> 'value' =&gt; '2011-09-16' 'compare' =&gt; 'LIKE' </code> . Otherwise you're essentially looking for; <code> a:1:{i:0;s:10:"2011-09-16"} </code> Which of course doesn't actually match anywhere in; <code> a:2:{i:0;s:10:"2011-09-16";i:1;s:10:"2011-09-17";} </code>
search serialised meta_value for date value?
wordpress
I have come across a problem whilst using the next_post_link() function. It seems that this function automatically echo's, for position reasons I need this to just return the link. Is there any available function or workaround that I can use to achieve this result?
try to work with http://codex.wordpress.org/Function_Reference/get_adjacent_post; example: <code> $next_post_link_url = get_permalink( get_adjacent_post(false,'',false)-&gt;ID ); $prev_post_link_url = get_permalink( get_adjacent_post(false,'',true)-&gt;ID ); </code>
is it possible to get next_post_link
wordpress
I have about 1500 posts I want to change category for. Is there a quick way to do this in Wordpress Admin?
No quick way exists in the WordPress admin for 1500 posts, the better way would be to do it with MySQL directly either by custom queries and updated or by PhpMyAdmin and his friends.
Migrate posts into a different category
wordpress
I created this widget using a simple example on WordPress Codex: <code> &lt;?php function widget_container_latest_posts() { global $wpdb; global $post; get_template_part( '/includes/containers/container-latest-posts' ); } wp_register_sidebar_widget( 'widget_container_latest_posts_1', 'Container Latest Posts', 'widget_c...
You need to implement your Widget using the Widgets API , so that WordPress knows how to make multiple instances of the Widget. Your Widget declaration should take the following format: <code> class My_Widget extends WP_Widget { function My_Widget() { // widget actual processes } function form($instance) { // outputs t...
WordPress Widget multiple use
wordpress
What we have for a project is: multiple sites (production, test, local development); migrated by multiple methods (PHPMyAdmin, Navicat, BackupBuddy); And the issue we are having is that while original production site seems to work fine, rest of the installations are constantly plagued by text encoding issues . Original...
So after about a year (on and off!) I had managed to hopefully get a fix on encoding issue. Why it breaks What my experience boiled down to, is that encoding issue like this are mostly caused by miscommunication when moving data around . in best case this is read mismatch, when correct data is wrongly interpreted in wo...
How to diagnose and keep in check encoding issues?
wordpress
I've created a new custom post type and I need the post thumbnails or featured images generated by the <code> get_the_post_thumbnail() </code> function to be set in percent, rather than pixels, as I'm using a fluid grid. Ideally I would only set the width (to 100%). Is there a way to do this? Potentially using <code> a...
have you tried, <code> if(has_post_thumbnail()) { $image_src = wp_get_attachment_image_src( get_post_thumbnail_id(),'full' ); echo '&lt;img src="' . $image_src[0] . '" width="100%" /&gt;'; } </code>
set_post_thumbnail_size in percent, not pixels?
wordpress
For some posts, I see 404 page, even though posts exist, where is the place in WP where using permalink is decided what object needs to rendered? Thanks!
Jan Fabry wrote a very useful plugin that I think it would be helpful for you to analyze your rewrite rules.
Debugging WP routing
wordpress
I'm Using E-commerce featured product plugin.in this plugin we have a options to select a single product from product list but not able to select multiple options at same time. so any suggest to improve this plugin?
Check the plugin http://jigoshop.com/ , its free and has many possibilities. http://wordpress.org/extend/plugins/jigoshop/
wp E-commerce featured product plugin with muliple option?
wordpress
I'm currently using WP Super Edit. But the same problem persists with TinyMCE Advanced. This is how it is configured: http://i.imgur.com/4PyXi.png http://i.imgur.com/YniBi.png http://i.imgur.com/7MytG.png This is how I (admin) see it: http://i.imgur.com/OAdnF.png This is how my friend (2nd admin) sees it: http://i.imgu...
Try click the " show/hide kitchen sink " button that looks like this:
2nd button row from WP Super Edit or TinyMCE Advanced doesn't show to 2nd admin
wordpress
Using the Google PageSpeed Online , it looks like the CSS/Images/JS files of most of my plugins (including wp-nivo-slider) do not get their expires-headers set. Is there a solution for this so that W3 Total Cache will set the expires headers on all the media on my page?
Make sure your hosting provider offer <code> mod_expires </code> . Because many shared hosting providers doesn't offer <code> mod_expires </code> . Just contact your hosting support.
Plugin Expires Headers - W3 Total Cache
wordpress
I was always a WP guy, built many small sites with it. I will create a new community with a big fanbase and I was wondering if 3.1.3 is fast enough? I didnt have the opportunity to work with it since 3.0. How does it react with heavy traffic web sites? Is it something that will make me worry enough to search for a ligh...
I don't think there is any considerably advanced CMS that you can throw high traffic at and expect it to handle it without any configuration effort. Can WP be used for high-traffic site? Of course and it is being used as such by many sites. But it should be WP on decent hosting and well-configured software stack, rathe...
Is Wordpress fast enough for a heavy traffic project?
wordpress
How should I completely disable the visual and html editor from pages? I know I can disable the visual editor in my profile, but I am trying to lock down the content input areas so that my client doesn't muck things up.
Why not use custom post types and don't add any support for the editor, that is afterall what they are for and the easiest way . The answer in this post covers how to do that, stackexchange-url ("Hide content box with Custom Post Type ?") http://codex.wordpress.org/Function_Reference/register_post_type To remove that f...
Completely disable editor
wordpress
I built something like this: Index Container Widgets Area and I created a widget for that - Categories Widget - Index Container .php with this in: <code> &lt;?php include (TEMPLATEPATH . '/includes/containers/container-grid-categories.php'); ?&gt; &lt;?php ///include (TEMPLATEPATH . '/includes/containers/container-list...
Long answer short: the absolute-best answer, for template-part files in a subdirectory, is to use <code> locate_template() </code> I would recommend referencing the stylesheet path for template file includes, so that those template part files can be easily over-ridden by Child Themes. So, ideally, you should use <code>...
WordPress "include TEMPLATEPATH" or?
wordpress
I need to be able to create posts in a custom post type with custom taxonomies from an XML file. It is from a job feed so when a job is added I need to be able to import it into wordpress. Do I just use wp_insert_post() ?
I did a job like this. Essentially it is parse and <code> wp_insert_post() </code> , but there are couple of fragile things to be aware of: you need some way to reliably track items to prevent duplicates, my approach was to save unique identifier from XML as post's GUID in WP for some obscure reason WP wants GUID to be...
Importing posts from XML into custom post type
wordpress
In JavaScript, I'm using an Ajax call and I'm sending an array of shops. Except for the last element in the array all the shops already exist in the DB. The last element is a new shop. The PHP code should get the array and update all the shops that are already in the DB and insert the new one after the last row of the ...
This really has almost nothing to do with WordPress. You probably haven't created a primary key for your shops table, which should probably be <code> shopid </code> (assuming you're using normal column naming conventions)
Wpdb-> insert() doesn't insert new row after the last one
wordpress
I'm trying to build some sort of a discussion boards by using custom post types and the built in comments. The structure is as following: An archive page to list all the pages of the Forum type, so each page is a "forum" Each "forum" has a title , a small description and then some threaded comments as threads with repl...
Check out User Access Manager for point 1). For stripping back the menus &amp; controlling access, check out the User Role Editor . You can strip user capabilities down to the bare essentials, and a lot of the items in the menu will disappear for them. For example, removing all <code> *_themes </code> privileges will h...
Building Forums with Custom Post Types
wordpress
Videopress doesn't work for me when I drag multiple pages into a template e.g. pulling them in by their path name... <code> $page = get_page_by_path('Showreels/Excerpts'); </code> Does anyone know how I can paste a videopress link directly into the php since the shortcode doesn't seem to work?
I've got it... for anyone else having this problem... Go to where your media is kept on your WordPress.com account i.e. Media > Library Go to edit the video and make sure that 'Display share menu and allow viewers to embed or download this video' - this is so that you can click the 'share' menu on the embedded video on...
Videopress Short Tags not working when pulling page into template
wordpress
I am using twentyten theme and I want there to be two sidebars on my page - one on the left and the second on the right. Can any one tell me how to do that?
Thirty Ten is a child theme of Twenty Ten and could be excellent for you as it comes with 3 columns as you want.
adding multiple sidebars on pages
wordpress
i am building a lists plugin .... i want to have a custom post type "lists" and then obviously also there would be a number of list items for each list .... i have read a fair bit of stuff about taxonomies vs postmeta but i'm still unsure as to which i should use or maybe something else ... it seems taxonomies are real...
Lists of items are already implemented in WP core. They're called custom menus . They are stored as a custom post type + taxonomy. UPDATE: I had assumed that your list items would be other posts, but I'm getting the impression that you just need them to be strings. In this case, menus would be overkill and you should s...
need advice on how to do a lists using custom post types - taxonomy vs postmeta
wordpress
What function can I use to override the multisite maximum file size upload restriction? I have already maxed out the kb upload size and ensured that the max file upload size in php.ini is over 50mb, yet still I'm getting an error uploading an 11mb file.
Make sure you've also boosted post_max_size to at least the same or greater. Check out the other precautions you should also take when doing so.
What function can I use to override the multisite maximum file size upload restriction?
wordpress
I released a new plugin to the .org repository about a month ago, and have committed several new versions since then, but the pie chart on the stats page has always stayed at 100% for an arbitrary version. For example, a week or so after 1.1 was released, it said that 100% of users had 1.0 installed, and recently it's ...
I guess the following things could be a problem: Adding <code> : </code> after header comment "keys" Not using all possible header comments - WP reads the first 8bit (in a not really pleasent way), but I don't know how the repo does Move the <code> /* </code> into the same line as the <code> &lt;?php </code> tag If not...
Repository reporting incorrect plugin 'active version' stat
wordpress
I know there are a lot of posts about this here, but NONE of them have answered my problem. I am working with a custom built theme that has a custom category type (named messagetypes). I have a category created named media. This theme is setup so that I can add a menu item that when clicked, displays all of the items l...
When I do this, I get the desired result from this page, but all of my other page links break (using permalinks.) Because, quite simply, WordPress hasn't got a clue you're asking for a page. It's doing what you told it to do; For all URLs that look like <code> http://example.com/X </code> , look for posts with messaget...
Remove taxonomy base or term from url
wordpress
I am developing a website where I need a webcam chat plugin. I have tried many plugins from wordpress.org but none of them worked. Can anyone please suggest me a working plugin. Plugins that did not work: TokBox OpenTok Plugin Problem : In the dashboard,it only pops up once i.e the first time the plugin is used and sti...
Here's the link to the API for Tinychat . It was hidden in the footer. You could also take a look at this thread on WeekendHackers , where someone is searching for the same solution. Maybe you can put your heads together :)
Need webcam chat plugin for my client
wordpress
On my site I have multiple authors, who can add/edit/delete custom posts and upload (attach) images to those posts. The problem is - when they delete their posts, attachments stay on the server. So, I would like to get rid of all files attached to the post when it gets deleted. Can anyone share and example how it's don...
WP does not do this by default since there is no guarantee that attachment isn't still being used by some other post. Basic logic would be to hook into <code> delete_post </code> , query for child attachments and run <code> wp_delete_attachment() </code> on each. I did quick search in plugin repository and came up with...
Delete post with all files attached to it
wordpress
Currently the Term Database has four columns. <code> term_id </code> <code> name </code> <code> slug </code> <code> term_group </code> . I would like to add another column called <code> menu_order </code> . How can i do this? The outcome i want is to be able to order my custom terms. If anyone knows of a beter way to d...
I have a feeling that modifying that table is not a good idea. I hadn't done something like this, but if I needed to deal with considerable amount of meta information for terms I'd try to leverage Metadata API , which for terms would involve setting up separate storage table .
Add Column to Term Database
wordpress
I've tried and installed loads of free WP plugins that can't do what I would like them to do. I write a fictional news blog and I'd like to be able to display about a dozen or so adverts that I've made myself. They are each going to be 250x250px and need to be in the sidebar of my site. I figured it would be easier if ...
Create a new folder in your WP directory called 'Adverts' Upload all your banner images to this folder as well as a PHP image randomising script I had found with a quick Google search. Place a text widget in your sidebar and add a html img tag linking directly to PHP file.
I'm trying to find a basic plugin for displaying images in a widget
wordpress
I am very new to wordpress and learning on my own.I have started to create a website where I need to upload images . I want to ask if you all usually use the same database to store the image(if so, how?) or use a image uploading site? Thanks
Wordpress images are stored in your wp-content/uploads folder no need for storing in the database, only the img uris get stored there. When you create an new wordpress post or page with your text editor you will notice several icons above it, use the first one to upload images and it will give you the option to add it ...
Where do you upload images on a wordpress site?
wordpress
The Codex promotes this method of using <code> $ </code> inside a plugin/theme JavaScript file: <code> jQuery(document).ready(function($) { // $() will work as an alias for jQuery() inside of this function }); </code> But if you do that you only have access to <code> $ </code> inside ready(). I think functions should b...
You don't need <code> $ = jQuery.noConflict(); </code> Just wrap any functions outside document.ready() within: <code> (function($){ // use $ here safely })(jQuery); </code>
Making $ globally accessible with jQuery.noConflict()
wordpress
I am using the following permalinks structure: /%postname%/ and I also have some multi-page posts that look like /%postname%/2. The problem is I see a lot of 404 errors in webmaster tools for urls like /post-name/random stuff here How can I redirect all wrong URLs to the correct ones ?
Have you tried the Smart 404 plugin? http://wordpress.org/extend/plugins/smart-404/
Redirect wrong links Wordpress
wordpress
I have a Post Category called 'Podcasts' and under it are many other sub-categories. On a page I have titled "Podcast Categories", I would like to list all categories under the "Podcasts" category, as links to their category page. I'm fairly new to Wordpress, what would be the best way of accomplishing this? Thank you ...
You need to use <code> wp_list_categories() </code> ( Codex ref ), using the <code> child_of </code> argument. Assuming you know the ID of the "Podcasts" category, e.g. <code> 123 </code> : <code> wp_list_categories( array( 'child_of' =&gt; '123' ) ); </code> If you need to find the category ID, use <code> get_category...
How can I display a list of categories of my posts
wordpress
In regards to image attachments inserted into a post , I would like to wrap the img tag inside a div tag for specific design purpose. Is there a way to do this automatically after attaching the image file, like through hooks/filters maybe? Thanks in advanced!!
It's the image_send_to_editor filter: <code> if(is_admin()){ add_filter('image_send_to_editor', 'wrap_my_div', 10, 8); function wrap_my_div($html, $id, $caption, $title, $align, $url, $size, $alt){ return '&lt;div class="mydiv" id="mydiv-'.$id.'"&gt;'.$html.'&lt;/div&gt;'; } } </code> For existing images/posts you can ...
Automatically wrap post image in div
wordpress
I'm trying to do a query on wpdb to get the posts commented on most in the past week... Any ideas what I'm doing wrong? <code> $querystr = "SELECT comment_count, ID, post_title FROM $wpdb-&gt;posts wposts, $wpdb-&gt;comments wcomments WHERE wposts.ID = wcomments.comment_post_ID AND wcomments.comment_date &gt;= CURDATE(...
This should do it: <code> $querystr = "SELECT comment_count, ID, post_title FROM $wpdb-&gt;posts wposts, $wpdb-&gt;comments wcomments WHERE wposts.ID = wcomments.comment_post_ID AND wposts.post_status='publish' AND wcomments.comment_approved='1' AND wcomments.comment_date &gt; DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 1 YEA...
WordPress Custom Query to get Most Commented Posts in the Past 7 Days
wordpress
How can I update/add a new title, post content, and category to a post with hard PHP code similar to add_post_meta(), update_post_meta()?
By using <code> wp_update_post() </code> , found in wp-includes/post.php: <code> // Update post 42 $post = array(); $post['ID'] = 42; $post['post_category'] = array( ... ); $post['post_content' ] = 'This is the updated content.'; $post['post_title' ] = 'This is the updated title.'; // Update the post into the database ...
Add title, post content, and category like add_post_meta and update_post_meta
wordpress
When viewing non-custom Posts, you get the likes of this submenu: I'm not using a title - I'm using custom columns with two fields concatenated: Is there any quick and easy way of adding the submenu to my custom post columns? Possibly by actually using the 'title' field on my custom post creation page - without having ...
In the end, I went for this: <code> function species_custom_columns($column){ global $post; if (!isset($title)) { $title = $this-&gt;getValue('genus',$post-&gt;ID,TRUE) . ' ' . $this-&gt;getValue('species',$post-&gt;ID,TRUE); } if (!isset($post_url)) { $post_url = get_site_url() . "/wp-admin/post.php?post=" . $post-&gt...
Custom Post Types: Custom columns with Title submenu?
wordpress
As of now I have a perfectly working script for a single meta-box. (I'll supply the details below.) However, I want to add more meta-boxes but am having trouble wrapping my head around how I would bend or add to this script to get those results. I had someone explain to me that I should create individual include's for ...
You can create as many metaboxes as you want. Use a function to create them then hook into init. The first line should be <code> $meta_boxes = array(); </code> then start each new metabox with <code> $meta_boxes[] = array( </code> <code> add_action( 'init', 'prefix_create_metaboxes' ); function prefix_create_metaboxes(...
How to construct multiple meta boxes
wordpress
I'm trying to write a relatively simple plugin. I have two php files, one is included within the other like this: <code> define( 'PLUGIN_DIR', dirname(__FILE__).'/' ); include_once(PLUGIN_DIR . '/included_file.php'); </code> Things look fine. However I'm getting errors when I try to call some wordpress functions from w...
First, since the <code> if (!function_exists('check_admin_referer')) echo "&lt;h1&gt;check_admin_referer not found&lt;/h1&gt;"; </code> code is working, then you've eliminated the issue being proper including of your Plugin sub-file. Second, all four of those functions are core WordPress functions , so you should never...
can't access some worpress function from my plugin
wordpress
Can I change the order in which connections are displayed ? If I create say three connections and then display them at the bottom of my article, I will get them in reverse order. How can I change that ? I tried to use 'orderby' and 'order' but it has no effect whatsoever : <code> $connected_titles = new WP_Query( array...
Just replace <code> 'order' =&gt; 'DESC' </code> with <code> 'order' =&gt; 'ASC' </code> .
[Plugin: Posts 2 Posts] Changing display order of connections
wordpress
I am new in WordPress, I want to write short code with parameters in function. That is in <code> add_shortcode('short code name','function name','parameter1,parameter2'); </code> In <code> add_shortcode() </code> , I want to pass parameters and this must get in function used for creating short code. Here is the functio...
According to the WordPress documentation , "a minimal example of the PHP code required to create shortcode with attributes" is <code> // [bartag foo="foo-value"] function bartag_func( $atts ) { extract( shortcode_atts( array( 'foo' =&gt; 'something', 'bar' =&gt; 'something else', ), $atts ) ); return "foo = {$foo}"; } ...
how to write short code in word press
wordpress
I'm trying to hide the overflow in CSS for specific template pages but can't seem to get it to work - I know that template pages are prefixed with a class but this doesn't seem to help targeting. I think I could use the is_page_template() function to hide the overflow with JS but this should be simpler with CSS. So thi...
This: <code> html .page-template-showreel-php { overflow: hidden; } </code> ...will target <code> body.page-template-showreel-php </code> . So, two questions: Do you have the <code> &lt;?php body_class(); ?&gt; </code> template tag inside of the <code> &lt;body&gt; </code> HTML tag? Is hiding overflow on the <code> &lt...
Hide Overflow on a Specific WordPress Template
wordpress
I have a custom taxonomy filter that will filter all the pages in the selected taxonomy. I would like the code to select the pages in that taxonomy, and the children of thous pages. Heres the code. <code> add_action('restrict_manage_posts', 'restrict_manage_posts_section'); function restrict_manage_posts_section() { gl...
This hooks into the update action for any post. It'll copy all terms for a given set of taxonomies from a parent to it's children. <code> /** * Update all children of a post with the same terms as itself. * * @param int $post_ID * @param object $post */ function __update_children_with_terms( $post_ID, $post ) { global ...
Taxonomy filter all children
wordpress
I'm trying (but failing) to create 'Best Sellers' and 'New Releases' pages for my website. I'm using WP-Ecommerce 3.8.4 with WP 3.1.3 and I've gotten close but can't seem to get it right. Any help on this would be greatly appreciated... I've added the following code to wp-ecommerce> wpsc-includes> product-template.php ...
<code> wpsc_the_product_title </code> is just a wrapper for <code> get_the_title </code> , and it doesn't take any arguments . Call <code> setup_postdata( $item['prodid'] ) </code> at the start of your <code> foreach </code> loop, and then the function should perform as expected.
How to show Best Selling WP E-Commerce Products
wordpress
I am very new to wordpress . I want to edit a wordpress theme and remove the blogpost area from it so it can be converted into a website. I also want to make some other changes. How I am trying to do it is, " I viewed the HTML code of my page and pasted in Dreamweaver and edited it. Now I am stuck with how to upload it...
Thats not really an ideal way to do it (and will bring all kinds of problems), what your real aim is, is to make wordpress into a CMS this way you can manage it as website from the wp-admin panel, add new pages etc, etc, the link i have added is just to give you an idea of whats involved, there are other Wordpress to C...
How to Use WordPress as Static CMS Without Blog Posts
wordpress
The following functions.php edit (contributed by helgatheviking on the themeshaper forums) allows the use of a "Read More" link with custom excerpts. My problem is simply this: I'm inept at editing functions.php code, but I'd like to safely remove the "wrap excerpt in p tag" portion of this script. How would I do so? T...
This should remove the <code> &lt;p&gt; </code> tags, but leave the styling by replacing the paragraph tag with a <code> &lt;span&gt; </code> class: <code> function all_excerpts_get_more_link($post_excerpt) { return '' . $post_excerpt . '' . '&lt;span class="readmore"&gt;&lt;a href="'. get_permalink($post-&gt;ID) . '"&...
Using "Read More" link with custom excerpt
wordpress
Basically I want to achieve a glossary using custom post types and have some issues setting up rewrites the way I want them to be. I want it like that: The main glossary URL: <code> http://example.com/glossary/ </code> Glossary terms starting with letter A : <code> http://example.com/glossary/a/ </code> The URL for a s...
You can always override the template that will be called with the <code> template_include </code> or a related filter, but this might hide deeper problems with custom archives. As I understand it, you want to use the following structure: <code> /glossary/ </code> should be an archive page for all <code> sumo-glossary-t...
Mixing custom post type and taxonomy rewrite structures?
wordpress
I have a one column page for the home page where I have a mega menu and in side the site there is another page called about us where the mega menu is present but it is in small format just like it differs from the mega menu in width and height.So for home page I have used widget and now for about us page I want the sma...
you can use this, <code> &lt;?php if( is_front_page() ):?&gt; &lt;div class="home-page-menu"&gt; wp_nav_menu( array( 'container_class' =&gt; 'menu-header', 'theme_location' =&gt; 'primary' ) ); &lt;/div&gt; &lt;?php elseif; ?&gt; &lt;div class="inside-page-menu"&gt; wp_nav_menu( array( 'container_class' =&gt; 'menu-hea...
menu in different page in different style
wordpress
This is what I'm trying to do: if number of posts is greater than 20 -> display link to another page (which shows all posts) if number of posts is less than 20 -> don't display the link So far I've been able to return the number of posts using <code> $count_posts = wp_count_posts('inventory'); $published_posts = $count...
If I remember right count of posts in category is stored persistently in category object. So use <code> get_category() </code> or variation of it and fetch the number out of object. Example code (not tested): <code> $category = get_category($id); $count = $category-&gt;category_count; if( $count &gt; $something ) { // ...
Count how many posts in category, based on result display link or not
wordpress
I've refrained from asking this question for a couple weeks, as I wasn't completely certain what I wanted cleared up... think I got it. I'm in the process of putting together a plugin to run a somewhat complex portfolio feature for my new personal site. The need was for a reasonable number of custom fields for each por...
How do I manage them? I have about 20 columns that I'm populating - I've read a few things stating they are created via meta boxes? The custom fields are more of a storage engine for meta data. It's up to you how to use them. And yes, meta boxes are common for that when you need nice way to input/edit them on post scre...
Custom post type's extra fields - how to handle?
wordpress
I am running Qtranslate for my website . I am very impressed by this plugin. Now my only problem is that I cannot set a custom title and description for my homepage per language. I can only setup one line for the title in the general settings for my website. I have installed Qtranslate META where I can set a custom tit...
You have to use a static page in this case: Settings -> General -> Fron Page Display: A static Page
How to set a custom title per language?
wordpress
I was wondering how I could setup a taxonomy metabox on a post edit page that would be similar to the "tags" kind (with search field and automatic suggestions), but without the right to add a new term. So for example if I'm typign a word, I get suggestions of terms that I can use from the existing terms list, but if I ...
I came up with a solution for your first question. i.e the tax metabox that only suggests terms from existing terms list but does not allow you to add new terms. The solution is jQuery based and modifies the default behavior of the tags (i.e non heirarchical taxonomies) meta box. Limitation: Currently it only allows to...
How can I create a taxonomy meta-box with search suggestions but no new terms input?
wordpress
I have a series of posts, all with featured images, but I need to be able to customise the crop top right corner. In this instance, I need them to be cropped from top right, but it would be useful to also know how to position that point myself. At present, the add_image_size() function is taking its crop from the centr...
Intermediate image generation is extremely rigid. <code> image_resize() </code> keeps it close to code and completely lacks hooks. Pretty much only option for this is to hook into <code> wp_generate_attachment_metadata </code> and overwrite WP-generated image with your own (which will need bit of a <code> image_resize(...
How can I make add_image_size() crop from the top?
wordpress
Asked this question on StackOverflow and they directed me over yonder... nice place ya got here =) I've been developing a pretty simple WordPress plugin, and wanted to do some live validation of certain fields on the page, which is where I am stuck. I've been looking everywhere for something that worked, and I simply c...
PLEASE!! PLEASE!! Don't send the php function names from your javascript. Below is the correct way of doing it. It might not be best way but at least secure way. To register your javascript (see the use of plugins_url instead of path_join), Also the validation is now part of your plugin, it does not have to go in separ...
WordPress plugin admin page - using WordPress function in linked php file
wordpress
This is related to another question that I had asked earlier. I'm doing some rewrite code to create some custom permalinks for a custom post type. I think I'm getting it mostly working except I'm getting the following error: I noticed a few things: Whatever I have as the postname gets replaced in the url field as %post...
Okay, I feel stupid. I needed to translate %postname%. I thought it did so automatically since the admin page looked like it had but apparently if you do use custom permastructs, you have to translate even the default tags. My solution: add this to my post_type_link filter: <code> $post = get_post($post_id); $permalink...
Using %postname% tag with a Custom Permastruct creates 400 Bad Request Errors from the server
wordpress
I have a page that displays posts (4 on each row), with a thumbnail image &amp; title for each. Is it possible to click a text/icon link and dynamically switch the page template? I'm looking to provide an alternate view of the posts, perhaps with larger images, more text/custom fields added etc. I thought it would be e...
I think I have a workable solution on what I was trying to do. This works but is there a better way? Also are there any implications I should be aware of when using $_GET? Didn't realize it would be this easy :) perhaps I'm missing something. <code> &lt;?php $view = $_GET["view"]; ?&gt; </code> Then if the URL is domai...
How can I dynamically load another page template to provide an alternate layout of the posts?
wordpress
I need to get a return from a query that provides me with email, username or nicename as well as post title based on author id. The query is to run once daily via cron and look for posts that have spent a specific live time before they come up for removal (the query is intended to run five days and then three days befo...
<code> $emailusers = $wpdb-&gt;get_results( "SELECT p.ID AS post_id, p.post-title, u.user_email " . "FROM $wpdb-&gt;posts AS p " . "INNER JOIN $wpdb-&gt;users AS u ON p.post_author = u.ID " . "WHERE p.post_type = 'sales' AND HOUR( TIMEDIFF( NOW( ) , p.post_date_gmt ) ) &gt;=1)" ); foreach ($emailusers as $user) { // do...
Join inside a wpdb query.. confused!
wordpress
I'm using wp_dropdown_categories() to output a dropdown. In default view (without having clicked it) it shows the name of the first category in the list. I'd like it to say "Categories" . Is this possible? Thanks in advance
You can use the show_option_all argument: <code> &lt;?php $args = array( 'show_option_all' =&gt; 'Categories' ); wp_dropdown_categories( $args ); ?&gt; </code> Function Reference/wp dropdown categories
change default option in wp_dropdown_categories
wordpress