question
stringlengths
0
34.8k
answer
stringlengths
0
28.3k
title
stringlengths
7
150
forum_tag
stringclasses
12 values
I need to run a background process in a plugin that does some work on ALL the posts in a person's database once the plugin is installed. I'm very new at working with wordpress so my research has shown that I can use the wp query or I can use "the loop". Since I'm going through absolutely every single post speed is of t...
"The Loop" is just a name given to the <code> while (have_posts()): the_post(); </code> loop used to iterate over an array of posts returned by <code> WP_Query() </code> . The other function used for querying posts is the get_posts() function, which returns a simple (non-extended) array which you can loop through with ...
Fastest way to loop through all posts?
wordpress
How can I check if the current page is <code> wp-login.php </code> or <code> wp-signup.php </code> ? Are there more elegant solutions than using <code> $_SERVER['REQUEST_URI'] </code> ?
Use the global <code> $pagenow </code> ; <code> if ( in_array( $GLOBALS['pagenow'], array( 'wp-login.php', 'wp-register.php' ) ) ) run_my_funky_plugin(); </code>
Check if we're on the wp-login page?
wordpress
I've got a plugin that transfers some files over to the uploads folder of the site in which the plugin is installed. It works fine, however, the images are not appearing in the Media Manager. I expect some database registration is involved. Given the script below which copies the files into the directory, what command ...
add this to your for each and $filename to each file, <code> $wp_filetype = wp_check_filetype(basename($filename), null ); $attachment = array( 'post_mime_type' =&gt; $wp_filetype['type'], 'post_title' =&gt; preg_replace('/\.[^.]+$/', '', basename($filename)), 'post_content' =&gt; '', 'post_status' =&gt; 'inherit' ); $...
How to get an image transferred via FTP or script to appear in Media Manager?
wordpress
I am creating multiple pages in Wordpress. I understand I can style these with page.php. Is there any way I can style specific pages with custom templates? So for example if I had page About Us I would want a sidebar that has links to our profiles. If I had page Contact Us I would want a sidebar that has links for emai...
there are a few way you can do that: Template Hierarchy - each page with is own theme file using page-{ID/slug}.php Custom Page Templates - Individual Pages can be set to use a specific custom Page Template from the edit screen. but if you are just looking to change whats on the sidebar then there are a few plugins tha...
Custom template for each page
wordpress
I'm creating a new Wordpress template and I have a question: I've added a custom Option Page to my new template (you can see what I'm doing stackexchange-url ("Here") and stackexchange-url ("Here")) but now I would like to add a new function. Do you know Si Contact Form? In this plugin the end user can download a backu...
The easiest way would be to look at the code of Si Contact Form (since it already does what you want) and use the same kind of system. Shortly, you'll need methods to do the following: Create an XML (or other format) document of your theme options. Save/Export the XML document. Import the XML document (There's no point...
How to add an export function to a custom Option Theme Page
wordpress
Is there a way to get my custom TinyMCE button to insert multiple lines of text? Ultimately I am making a "Premade Themes" button where a user will select a theme and it will insert about 6-8 different shortcodes with one click and they can edit the shortcodes accordingly.. A problem I'm having is that all of these sho...
This should be as easy as adding <code> &lt;br /&gt; </code> between shortcodes or every time you want to add a new line and also if you are inserting content you should use <code> mceInsertContent </code> instead of <code> mceInsertClipboardContent </code> unless you are actually getting the content from the clipbard,...
TinyMCE Button to Insert Multiple Lines of Text?
wordpress
I always though the the image manager into wp is not really good... I need to be able to generate square or custom size when i like where i like, much like TimThumb that generate thum on the fly... but a little complicated... what do you use or what is the best plugin...
I have find this faboulous article... just copy/paste it here for future reference : http://webdeveloperplus.com/wordpress/how-to-use-thumbnails-generated-by-wordpress-in-your-theme/
Thumbnail and image management
wordpress
I'm creating a rather complex plugin that synchronizes posts from your server with a thirdparty server. I need to know, if you migrate your wordpress server to a new site, "can" the post ids change? If so is there another unique id? Also, is there any other instance where a post id could change? If the id does change a...
The <code> wp_posts </code> table has a <code> guid </code> field, which should be globally unique, and survive migrations. It is formed by taking the initial post URL, and never changed after that (when you change the title, change the website address, or migrate the posts). This should be pretty safe to base your syn...
Will post id change when migrating to new site?
wordpress
I would like to display all agents a-z, except there is one agent who should always show up last. Ideally I'd like the ordering to be done from the value of a custom field, dName. I was looking around it seemed that meta_query was the new best way to do this but haven't figured it out yet. Current code that shows 10 la...
I just wrote this up so I have not tested it but this is how I would go about forcing one post to be at the end. In the first loop it excludes the posts by its ID number and in the second loop it only includes the post by the ID number, essentially you will need to know the ID of the post. <code> &lt;?php $loop = new W...
Display agents (custom post type) alphabetically, except one who always shows last
wordpress
I'm finding this string appended to the end of my URLs sometimes: <code> /?doing_wp_cron </code> Does anyone know what it for? How can I remove it?
It's a sign that you have <code> ALTERNATE_WP_CRON </code> defined in your <code> wp-config.php </code> In order to do some background processing (like publishing scheduled posts), WordPress redirects you to the URL with <code> ?doing_wp_cron </code> appended.
Why is ?doing_wp_cron being appended to my URLs
wordpress
when using "insert video" from the post-editor - i'm only getting a normal hyperlink to the video - is it possible to display a flash-videoplayer instead? is there a default videoplayer in wordpress or will i need a plugin? in that case - which plugin is recommended? thx
Indeed, the "Insert video" action does not do much beyond creating a link. WordPress does not contain a generic player that can play any video hosted anywhere on the internet, but it does support something better: embedding via oEmbed . This means you can put the URL of the video page in your content, and it will repla...
Wordpress 3.1: Videoplayer implemented?
wordpress
I'm a bit confused about <code> wp_list_pages() </code> function. Lets say I have 3 top level pages (with no parent) and each of them have some sub-pages: page 1 [sub-pages: 1.1, 1.2, 1.3]; page 2 [sub-pages: 2.1, 2.2, 2.3]; page 3 [sub-pages: 3.1, 3.2] What I'm trying to do is to display top level pages 2 and 3 with a...
Thanks to <code> @Bainternet </code> for pointing me to the <code> exclude_tree </code> , although I ended up using a bit different code. It was important to be able to add top-level pages that don't have to appear in the menu (for example for Improved Include Page Plugin . Using the <code> exclude_tree </code> I would...
confused about wp_list_pages() function - how to display selected top pages with all their subpages
wordpress
i'm using the default "insert video" function from wordpress (which inserts a normal hyperlink to the video only) and would like to replace that link with something else like a video player. my question: what's the regex pattern for grabbing all links inside a post? thx
I'll answer your question below, but have you looked at using embeds? Look here for more information: http://codex.wordpress.org/Embeds The simplest regex for this would look something like <code> http\:\/\/.*\b </code> Here's an example of it in action: <code> &lt;?php $file = 'test.txt'; $fp = fopen($file, 'r'); $con...
Retrieving all Links from a Post?
wordpress
Is there a way to get a path to the themes directory without the current theme in the path? ie, in a standard WP install, I would want a reference to: C:\xampplite\htdocs\sitename/wp-content/themes/ But the TEMPLATEPATH constant returns... C:\xampplite\htdocs\sitename/wp-content/themes/currentActiveTheme
<code> dirname( STYLESHEETPATH ); </code> That will return the theme directory. Never assume <code> /wp-content/ </code> below ABSPATH. I’m using often a different directory and domain for <code> wp-content </code> to enable cookieless requests to theme files. Bad plugins and themes break terribly in such cases. Addend...
TEMPLATEPATH without the theme name? No THEMEPATH constant?
wordpress
Has anyone effectively integrated GD star rating and Cube Points ? From the documentation: Plugin Integration CubePoints can also be easily integrated with other plugins. Other plugins can be coded such that certain actions trigger the cp_alterPoints() function to add or subtract points from a specified user. Function ...
From this page , you can see that <code> gdsr_vote_rating_article </code> is the hook you need - it gets called when a post rating is saved.
Has anyone effectively integrated GD star rating and Cube Points?
wordpress
I'm working on a migration from another CMS to WordPress. The old site had terrible SEO-unfriendly URLs in the format <code> http://example.com?lid=1234 </code> . We have imported all the posts from the old site into WordPress and are storing the <code> lid </code> as a custom field. We would love the old URLs to still...
here is an idea, first add <code> lid </code> to query_vars: <code> add_filter('query_vars', 'lid_query_vars'); function lid_query_vars($vars) { // add lid to the valid list of variables $new_vars = array('lid'); $vars = $new_vars + $vars; return $vars; } </code> then use <code> parse_request </code> hook to create you...
URL rewrite based on a custom field value
wordpress
How would one move the sharedaddy buttons included in Jetpack to be placed before a post's or page's content, rather than after it? I see that in <code> sharing-service.php </code> the function that prints the buttons is hooked to the_content filter hook: <code> add_filter( 'the_content', 'sharing_display', 19 ); </cod...
Basically it line 480 in sharing-service.php where it says: <code> return $text.$sharing_content; </code> and it should be <code> return $sharing_content.$text; </code> now changing that file won't keep your changes on updates so you can copy that function (sharing_display) to your functions.php and rename it to someth...
Moving sharedaddy buttons (in Jetpack) to the top of a post?
wordpress
As the title says, I have not found any function to add an option page to a particular custom post type. I would like to keep the option page related to a custom post type grouped together in its own panel, instead of adding it to the "Setting" panel, for example. Any suggestion? Thank you
use add_submenu_page() and as the pass <code> add_submenu_page('edit.php?post_type=YOUR_POST_TYPE_NAME',....); </code>
How to add an option page to custom post type?
wordpress
Got a custom field called <code> startDate </code> but its only on a few events. I was wondering if it isn't set for a post I could use <code> post_date </code> to generate the posts list? <code> // if meta_key _postmeta.startDate isn't set get the rest by posts.post_date query_posts( array( array( 'posts_per_page' =&g...
If you can explain it in SQL, you can query for it! There are three places where we want to change the default query: <code> SELECT wp_posts.* FROM wp_posts INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) WHERE 1=1 AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish') AND wp_postmeta.meta...
Order by meta value or date?
wordpress
actually I'm running a wordpress MU website and each website has its own "life" but now I would like to show last X posts of each blog of my network on the homepage. I know how to do it using Feeds and a plugin named FeedPress but this is a "dirty" way to do it. Is there anyone who knows how to do it? Please Step by St...
If you've already got a solution that works using FeedPress you might as well stay with that, there isn't a particularly clean way of aggregating multisite posts into a single blog. One alternative is to use the Sitewide Tags plugin , but given what you want to do, you should probably stay with what's working.
How to show last post of each website of a MU wordpress in HomePage
wordpress
i've just built my first plugin for wp, and even if it's not a great "code poetry" ;) it works as it should. It's a plugin that transform the default wp gallery using the GalleryView 3.0 jquery plugin ( http://spaceforaname.com/galleryview ). The only thing i'm not able to do is localization. Localization for this plug...
<code> $plugin_path = dirname( plugin_basename( __FILE__ ) ) . '/languages/'; </code>
Plugin Localization
wordpress
How do I add classes in the wp_list_category , I know the wp_list_categories('title_li='); generates classes , but I want to add a class in the parent category link <code> &lt;ul&gt; &lt;li&gt;&lt;a href="#"&gt; link1&lt;/a&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;link2 &lt;/a&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#...
jquery accordion accepts an option called header that allows you to provide a selector to designate the items you want to act as the accordion headers. <code> $('li.categories &gt; ul').accordion({ header: 'li.categories &gt; ul &gt; li' }); </code>
How to add classes in the wp_list_category parent link
wordpress
Anyone has experience using the GD Star Rating plugin? and make a loop that sorts posts by vote/stars?
First 2 results on googling for "gd star rating sort posts by rating' are: How to Sort Post by Gd Star Rating Mirror How to reorder posts Mirror Few examples: <code> query_posts("gdsr_sort=rating"); query_posts("gdsr_sort=review&amp;sort_order=asc"); query_posts("gdsr_sort=rating&amp;gdsr_multi=3"); query_posts("gdsr_s...
Is it possible to sort posts by vote using the GD Star Rating plugin?
wordpress
I'm new to wordpress and trying to learn my way through from making a theme. Right now I am using wp_nav_menu to generate my menu My menu consists of pages and categories However, the default generation of the menu looks like <code> &lt;div id="navi"&gt; &lt;div class="menu-primary-container"&gt; &lt;ul id="menu-primar...
If you look in the <code> wp_nav_menu() </code> function , you see the items are written by <code> walk_nav_menu_tree() </code> , which calls <code> Walker_Nav_Menu </code> to do the work (unless you specified your own walker class). This class contains a method <code> start_el() </code> that is called for each menu it...
wp_nav_menu remove class and id from li
wordpress
I just realized, that i got a complete *empty WP_Query object* on my plain wordpress install. I reseted the DB, deactivated all plugins and activated TwentyTen as theme, but the complete Object simply is empty on every request (public &amp; admin facing). It doesn't matter if i request the " Hello World " post or a <co...
It's empty because you're looking at it before it has a chance to be populated. The top of functions.php is too early. You should be doing it in a 'template_redirect' action. Or, better yet, use the Debug Bar plugin.
empty WP_Query object on local install
wordpress
Is there a way to remove <code> wptexturize </code> only for a certain shortcode?
There is a clue in <code> wp-includes/formatting.php </code> in the function <code> wptexturize </code> : <code> $default_no_texturize_shortcodes = array('code'); ... $no_texturize_shortcodes = '(' . implode('|', apply_filters('no_texturize_shortcodes', $default_no_texturize_shortcodes) ) . ')'; </code> Try using this ...
Remove wptexturize from a shortcode?
wordpress
I have a few plugins that I always set the configuration for exactly the same way. Every time I create a new site, the same plugins go in, and the same amount of time is needed to set them up. Would it be possible to create a config file that overrides whatever wp_options are set per plugin?
You could check which options they add (look at the source code) and then simply write a function like this: <code> /* Plugin Name: Mother of all plugins Plugin URI: http://wordpress.org/extend/plugins/ Description: Offers the &lt;code&gt;$all_plugin_options;&lt;/code&gt; var to access all predefined plugin options Aut...
Default plugin config to override wp_options?
wordpress
I feel like I've been banging my head against the keyboard for a week with this problem. I'm trying to change my current query on my home page to show only posts that are set as standard posts using the new post format. I've looked everywhere for answers (including stackexchange-url ("here") and stackexchange-url ("her...
Okay, I found the answer after some more hunting. Apparently the only way to pull the standard posts is to add: <code> 'operator' =&gt; 'NOT IN', </code> So it looks for posts that aren't in the image post format. Or I have to add an array of terms to the terms line so it won't return any of those formats. Odd, but it ...
Help altering a query to exclude all but standard post format
wordpress
I'm using stackexchange-url ("bainternet's") method for stackexchange-url ("searching custom post_types") and it works great. However, I've recently been requested to return more than one "specific" post type and perhaps individual pages for a support section on our site. I thought adding additional hidden fields would...
change <code> &lt;input type="hidden" name="post_type" value="software" /&gt; </code> to <code> &lt;input type="hidden" name="post_type[]" value="software" /&gt; &lt;input type="hidden" name="post_type[]" value="books" /&gt; </code> i have to run but this should work , just add as many hidden fields as you need for eac...
Searching multiple custom post types and pages
wordpress
Would somebody mind postulating and possible reasons why their is an automated redirect on my homepage that adds /admin to the URL. Please visit www.divethegap.com/update. You will see that it instantly redirects to /admin and does not load the page. There is a folder called admin that is not accessible to a user, but ...
By a process of elimination we have determined that the error was caused by the plugin REDIRECTION. This plugin has now been removed. I must point out that it was never used and certainly never set up to carry out that action. I can only imagine that somehow the creation of themed files must have had similar names to t...
Random and Erroneous Wordpress Redirect
wordpress
What are you experiences compiling Wordpress using Hip Hop? ( https://github.com/facebook/hiphop-php/wiki/running-hiphop ) Specific: is this maintainable with upgrades? is the performance increase bigger than using alternatives? update: also interesting: http://www.phpclasses.org/blog/post/168-Can-NET-make-PHP-run-fast...
Original approach of static compilation in HipHop PHP-to-C++ has been since replaced by HipHop VM just-in-time compilation . Facebook prominently featured WordPress as example application and it no longer requires extensive (barely any by now) core edits. Old answer There is quite extensive presentation Rasmus Lerdorf ...
Experiences with compiling WordPress using Hip Hop?
wordpress
I am looking for what params are passed to my filter function. Where can I find such info in the codex? http://codex.wordpress.org/Plugin_API/Filter_Reference/the_content didn't provide much info I wanted to know if the post is a child of another
I don't think there are any additional parameters passed, per se, to <code> the_content </code> , but global variables like $post are accessible. So something like this would work: <code> add_filter( 'the_content', 'check_for_post_parent' ); function check_for_post_parent($content) { global $post; if ($parent_id == $po...
What params are available with the_content filter?
wordpress
When user clicks on Reply button for a specific comment, how can I then hide the reply button under said comment? Do I have any access to the javascript onclick function that it calls?
Ended up using jQuery to solve this. The form moves around using javascript anyways so it doesn't break anything for users with js turned off. <code> //when reply button is clicked hide it $(".comment-reply-link").click( function() { $(this).hide(); }); //when cancel button is clicked reshow reply button $("#cancel-com...
Hide reply button after moveForm is called
wordpress
hey guys, i know there is something like <code> if ( function_exists('') </code> is it possible to use that with <code> next_posts_link() </code> and <code> previous_posts_link() </code> . The reason I'm asking that is that I have something like <code> &lt;div class="navigation"&gt; &lt;div class="next-posts"&gt;&lt;?p...
Check out this link: http://www.ericmmartin.com/conditional-pagepost-navigation-links-in-wordpress-redux/ :)
only show container with next/prev links if they exist?
wordpress
<code> &lt;?php echo get_the_term_list( $post-&gt;ID, 'people', 'People: ', ' ', '' ); ?&gt; </code> returns something like this: <code> People: &lt;a href="person1"&gt;Person1&lt;/a&gt;, &lt;a href="person2"&gt;Person2&lt;/a&gt;, ... </code> How can I make it return the same thing without links like this: <code> Peopl...
It may be easier to just write the list manually, something like: <code> &lt;?php $terms = wp_get_post_tags( $post-&gt;ID ); //For custom taxonomy use this line below //$terms = wp_get_object_terms( $post-&gt;ID, 'people' ); foreach( $terms as $term ) $term_names[] = $term-&gt;name; echo implode( ', ', $term_names ); <...
How can I remove links from the function "get term list"?
wordpress
I'm trying to filter posts in a category by the year of the post's date. I also want to do this without being redirected to the year template so my ideal URL would be http://example.com/category/reports/2011/ which would load the template file category.php where I could then use query_posts to include only the posts th...
This should work: <code> add_action( 'init', 'wpa12742_init' ); function wpa12742_init(){ add_rewrite_rule( 'category/(.+?)/(\d{4})/?$', 'index.php?category_name=$matches[1]&amp;year=$matches[2]', 'top' ); add_rewrite_rule( 'category/(.+?)/(\d{4})/page/(\d+)/?$', 'index.php?category_name=$matches[1]&amp;year=$matches[2...
Preventing index.php?category_name=something from redirecting
wordpress
i'm running my web in english and german using the WPML plugin. my question: when in english mode - is it possible getting the page_title() but in german? thanks
Let's say the original language of your site is english, then when visiting a german post you would return the title of the corresponding english post like that : <code> // Get the post ID of original post $original_ID = icl_object_id( $post-&gt;ID, 'post', false, 'en' ); // Get original post title $original_title = ge...
WPML: getting page title in different language
wordpress
I'm trying to add some checkbox options to a sidebar search box, similar to this , where the user has the option to choose whether to search <code> All Words </code> , <code> Some Word </code> , or the <code> Entire phrase </code> . I did find this after some searching - Wordpress Search Phrases . The 'sentence' option...
First things first: the name attribute for your "All Words" checkbox shouldn't be 's'. That replaces the search text with "1", so when that's checked, you're searching for "1", not for the search text. I don't think you want to use 'exact' if you're looking to replicate the example you gave in your question. Here's an ...
Search options/filters
wordpress
Background I'm nearing the final stages of constructing my first fairly large WordPress site, and I'm now encountering some friction. For the most part, the site was developed on my local machine and I would push changes up to a staging server for review (stackexchange-url ("see this question for more background")). Th...
I asked this question over a year ago, and during that time we've added more people to our team and developed a much larger number of sites in WordPress. I wanted to walk through our process in case it might help anyone else. Everything in Git This was something I was doing even as I asked the question, but it's good t...
Multiple developers / editors working on a site in progress
wordpress
I'd like to check if the server is running PHP5.2. To do this, I use a activation-hook which will be registered with "register_activation_hook". Instead of just returning a warning, i'd like to auto-disable the plugin and redirect to the plugins.php in WP-Dashboard. Unfortunately, this doesn't work. No error or other o...
You always have to <code> exit; </code> after a redirect.
Deactivate plugin on registration
wordpress
How do I add custom variables to the wordpress query without having to hit the database twice. In the example below I want to add some meta filters. All this code works fine but I have been running query_posts() to execute it. I want to be able to add to the query before it is run by default so I don't have to query th...
As toscho said, you can modify the query in the <code> pre_get_posts </code> hook. That hook gets the query object passed as an argument, so you don't have to read a global variable. <code> add_action( 'pre_get_posts', 'wpse12692_pre_get_posts' ); function wpse12692_pre_get_posts( &amp;$wp_query ) { if( isset( $_SESSIO...
Adding Variables to post query
wordpress
If I click on a category in my Wordpress blog, it displays an excerpt of all articles in the category, and finishes with a word that says "continue" which has no hyperlink. Example here . How do I fix this?
Open the theme index.php (or other theme template file) and look for something like this: <code> &lt;div id="more_reading"&gt; ... &lt;/div&gt; </code> replace with: <code> &lt;?php if ( $wp_query-&gt;max_num_pages &gt; 1 ) : ?&gt; &lt;div id="more_reading"&gt; ... &lt;/div&gt; &lt;?php endif; ?&gt; </code> or just rem...
Category articles "read more" links not active
wordpress
I'm not able to make it work by adding custom rewrite rules into <code> functions.php </code> or adding custom permastructures either. I have this code in my <code> .htaccess </code> that is working fine. <code> # BEGIN WordPress &lt;IfModule mod_rewrite.c&gt; RewriteEngine On RewriteBase / # BEGIN IPHONE RULES Rewrite...
The part between the <code> # BEGIN WordPress </code> and <code> # END WordPress </code> will always be rewritten when the permalinks are flushed. You can either place your extra rewrite rules before this segment, or you can add register them in WordPress as external rewrite rules . If you flush your rules now (by visi...
Rewrite rules in .htaccess get overwritten?
wordpress
We are using CPT's to manage a frequently asked questions page on a site, where the question is the post title and the answer is the post content. There is a main page for the FAQs that shows all posts (FAQ archive page). With this structure we really have no need for the single view for any FAQ and in fact would like ...
Hi @daxitude: Let me first suggest you reconsider. If you don't have individual FAQ pages for each FAQ: You reduce your surface are for search engine optimization and reduce the potential traffic that you might get, and You make it impossible for someone to share a specific FAQ with a friend over email and/or share wit...
Custom post type, no need for single view, plus want permalink rewrites that include hash in URI
wordpress
Under each comment there is a link called 'Reply'. I want to add a class to this link. It's default class is <code> comment-reply-link </code> . How can I do so? I am creating my own theme and I don't want to manually edit files inside the wp-includes directory.
In your comments.php template file use <code> wp_list_comments </code> and set the parameter <code> callback </code> to your defined function that will generate the template. Inside the function you can style the comment reply link. wp_list_comments codex Further reading on comment display
Add class to Reply button in Comments area
wordpress
I have a blog running the latest stable version of WordPress on a dedicated virtual server with the following situation. (Replace [caching plugin] with W3 Total Cache, Hyper Cache, or Quick Cache, as I've tried all three with the same results.) [caching plugin] is disabled. I visit a known bad link on my site (http://e...
Further troubleshooting leads me to believe this was somehow related to the theme I was using. After disabling it and enabling a different one I received the proper 404 headers while using a caching plugin. I still don't know what in the theme would be causing this, but at least there's a workaround.
Getting soft 404 errors (200 status) when caching plugins are enabled
wordpress
is it possible to hide the string: "Comments are disabled" from everywhere? I mean also from posts list, and post page :) Thanks :) EDIT: sorry, the theme is Journal Cruch by Site5.com However I resolved using <code> if (comments_open()) comments_popup_link(); </code> where the comments are displayed, but I don't like ...
Popup link takes five parameters. <code> comments_popup_link('No Comments','One Comment','Many Comments','CSSclass','Comments Disabled'); </code> So you are on to the correct solution. Now just change the above strings to whatever you want them to be for each # of comments. Finally change 'Comments Disabled' to just <c...
How to hide "Comments are disabled"
wordpress
I just think about that... maybe it exist...you will tell me... Wordpressis a beautifull software, and the thing i like the most, is the instant install of the theme and plugin... So i though, why not have a onefile.html upload, and install wordpress ITSELF utomaticly fron the svn instead of having to upload a whole bu...
Update: You can use WordPress QI - http://wpquickinstall.com/download/ Not all servers can run SVN, and servers which have problem in WP 5minute install, can't be cope up with another solution because there is no solution, sometimes server settings are to blame. That said, on a server where everything works fine for a ...
Instant install of wordpress
wordpress
I'm trying to create a new wordpress template and inside it I added a Control Panel, inside this control panel there is an option that allows user to choose where he want's to place a on a map, I try to explain: user can set div's left and top attributes via control panel. Now I know how to add an iframe that can show ...
If you look at Mystique theme (a great example of option panel with preview BTW) you can see that the main idea is to lavrage the form fields OnChange or change() events to load the theme's preview with Jquery and a bit of ajax. So you have one function to load by ajax the preview <code> function mystique_get_site_prev...
Add a preview to a Wordpress Control Panel
wordpress
I'm looking for a plugin or a idea so that my WP 3.1 search engine can index PDF files. Has anyone be through that need too ? Thanks !
The standard WordPress search is pretty basic and only search the database, there are some plugins that extend the search functionality to search even more parts of the database like: Search Everything Search Unleashed but they do not have the ability to search files. There is one plugin that i know of that claims to s...
How to make search engine index PDF files?
wordpress
Is there any free WordPress plugin or theme that sort posts as 'top this year' and 'top last month" or 'top 24 hours' based on voting? I'm using the Vote It Up plugin right now. But it doesn't have the capability of sorting post as a loop. Any suggestions?
Try GD Star Rating - I'm pretty sure it stores vote times and so can be used to do this - you'll probably need to extract the ordering yourself though. http://www.gdstarrating.com/
Plugin or theme that sort posts as 'top this year' and 'top last month"?
wordpress
The documentation for dealing with official WP repository is exclusively about using command line. While I have no bias against that, I do have little experience with VCS and two (or three) different ones I will have to figure out and use in nearest future. So for now I wing it with VCS integration features in IDEs (Ne...
I don't use (widely recommended) TortoiseSVN at moment, but turns out it has very extensive manual, available online and for download in multiple languages . In its own words: This book is written for computer literate folk who want to use Subversion to manage their data, but are uncomfortable using the command line cl...
Any guides on using WP SVN with IDE clients?
wordpress
I'd like <code> get_the_category_list </code> to only display one or two categories instead of all the categories associated with the post. Haven't been able to find any results. <code> &lt;?php echo get_the_category_list(); ?&gt; </code> Any help would be appreciated
Quick idea would be to pass some simple separator like comma and cut from the start of result till it. But I think that if you want better control on output it would make more sense to use level deeper <code> get_the_category() </code> function and build markup yourself.
Display only one result from "get_the_category_list"
wordpress
Basic question, but I want to enable page templates. I have one theme which has page templates enabled. I switched to another but there is no option to change the template, even when creating a new page. How do I switch this option on? I've had a root around on the Codex and forum but can't find it.
Chances are that the theme you've switched to has no page templates defined - they exist on a per theme basis. Here's the Codex reference: http://codex.wordpress.org/Pages#Page_Templates
Enable page templates. How?
wordpress
I have always hosted my own websites on my own hardware, this includes WordPress. I always see on shared hosting sites "WordPress Hosting" which looks to be the exact same as their regular hosting plan. Am I missing something, or is there a difference, and how can I optimize my servers for WordPress?
Hi @Jeremy: Of course you can optimize your servers like the hosting companies do, it just depends on how much skill you have and how much effort you want to take on. Here's a community wiki that might give you an idea of what to consider doing: <a href="stackexchange-url Best-of-Breed Features of a High-End WordPress ...
WordPress hosting optimized servers - Is this just a sales gimmick?
wordpress
in mine network setup, the super admin has the ability to see the tinyMCE editing buttons in the option page, but when i switch to a regular adimin, i can see only the HTML editing buttons (the "rich text"). what can be the reason for that? i can find any thing in the functions.php that indicates that i registered a en...
o.k. the problem is based on a conflict in some of the filters of the tinyMCE, maybe only when it's a network setup (i don't know exactly which filters are conflicted) but i managed to solved it by: 1. installing tinyMCE Advanced: i know this plugin isn't supposed to work in the network setup, but hey! it did the trick...
in network setup super admin has the tinyMCE buttons and the regular admin has not
wordpress
How do you: 1) create a page and select "Blog Template" and also choose which category for the Blog's you want. 2) Then create a blog post and choose the category for that page....resulting in a page that shows all the blog posts for that category? Thanks!
Sounds like you are looking for the functionality of WordPress 3.0 Menus Subpanel . In Dashboard go to 'Appearance' then 'Menus' and you can create a page that will show the posts from a specified category.
Creating Pages that show specific blog categories
wordpress
I messed up the settings with W3 Total Cache (tried to import all the media to my library, didn't work out well, broke all my links to every picture). So I took my latest backup of the database, copy/paste the _post and _postmeta tables inside my phpmyadmin. It brought back the links and pictures as expected, but now a...
You might be able to solve this if you have a text editor with good encoding support. That way, you could switch between the Latin 1 and the UTF-8 encoding until you have the right combination. I use SubEthaEdit which can convert but also reinterpret a file when you change the encoding. The <code> ç </code> should be e...
Faulty restore of the database, encoding issue
wordpress
I've read the codex section on wp-enqeue, but am still struggling. Basically, I would like to get the following to display properly in my theme's widget area (on every page): <code> &lt;link rel="stylesheet" type="text/css" href="/wp-content/uploads/social_counter/css/styles.css" /&gt; &lt;link rel="stylesheet" type="t...
You actually don't need to worry about conflicting with the admin pages anymore. There is a "wp_enqueue_scripts" hook that makes sure the scripts aren't called on admin pages. From WP Codex: <code> &lt;?php function my_scripts_method() { wp_deregister_script( 'jquery' ); wp_register_script( 'jquery', 'http://ajax.googl...
trying to enqueue script in wordpress
wordpress
I've almost finished coding up a function that allows contributers when they are the post author to manage comments left on their own post (portfolio) couldnt find a plugin to do it so had to get myself dirty. It will basically work like this: 1) User leaves a comment on post_authors portfolio. 2) Post_author is notifi...
Easy: <code> function show_portfolio_comments( $post_ID ) { // NOT approved $comments_unapproved = get_comments( array( 'status' =&gt; 'hold', 'post_id' =&gt; $post_ID ) ); foreach ( $comments_unapproved as $comments) { if ( current_user_can( 'edit_published_posts' ) // maybe you'll have to switch to some other cap { ?...
show un-approved comments at wordpress front end
wordpress
I have a custom post type for accessories. When you view the post it also shows related posts. It looks great, but it also shows the current post within related posts. Is there a way to exclude the current post from the loop? <code> &lt;div&gt; &lt;?php $category = get_the_category(); $model = $category[1]-&gt;cat_name...
Try this: For your single-accessory.php template: <code> &lt;?php if (have_posts()) : while (have_posts()) : the_post(); ?&gt; &lt;?php // excludes this post from 'Related posts' in the sidebar $GLOBALS['current_id'] = $post-&gt;ID; ?&gt; </code> For your sidebar or where you want to show related posts: <code> &lt;?php...
Exclude current post from loop
wordpress
All theme styles are in style.css file. Let's say first line looks like: <code> body { background-color: #fff; } </code> Now, I've created an option in admin panel named body_bg. User types #000 there and I want the value in style.css to change. How do I achieve that? The easiest way to me looks like I have to rename s...
If you're wanting styles to be dynamic, then you'll have to emit your CSS file as you are suggesting. However, as WordPress often uses styles.css as a theme definition file, renaming styles.php might cause problems. It might be better to collect all the 'dynamic' definitions into a separate file (eg dynamic-styles.php)...
How do you modify CSS files via admin panel?
wordpress
I'm using Facebook and Digg Thumbnail generator and [FaceBook Share (New)], 2 As you can see if the image is 100px the thumbail is displayed when I press the share button: But with an image with 300px of width: The thumb preview doesn't appear: front-page.php: <code> &lt;?php /** * Template Name: Front Page * @package ...
Finally figured out why. Facebook only allows images with 3:1 ratio.
Facebook is only displaying preview thumbnails that are 100px from my posts?
wordpress
When I try to get an archive for a custom taxonomy, WP searches for a page and doesn’t find anything. The Setup My code from the functions.php: <code> add_action( 'init', 'register_store_taxonomy' ); function register_store_taxonomy() { $args = array ( 'hierarchical' =&gt; TRUE , 'label' =&gt; 'Store' , 'public' =&gt; ...
Did you flush the rewrite rules?
Page queried instead of a custom taxonomy
wordpress
Trying to get Uploadify to work together with Wordpress. I've implented the code from documentation in a metabox in wordpress admin area. I can "select file" and upload it, and Uploadify will show progress, but when I check the destination folder, it's empty. The folder has chmod 777 so I don't understand what could be...
your uploadify.php is all inside a comment so its not really saving the file. change it with this: <code> &lt;?php if (!empty($_FILES)) { $tempFile = $_FILES['Filedata']['tmp_name']; $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/'; $targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata'...
Problem with implenting Uploadify with Wordpress
wordpress
I'm experimenting with adjusting permalinks (for purely educational experimentation). What would I need to place in the "Custom Permalink" option to get my post URLs in the form... /year/month/post-title-goes-here/
<code> /%year%/%monthnum%/%postname%/ </code>
Custom Permalink: /year/month/post-goes-here/?
wordpress
I'm looking for an answer from someone who's implemented HyperDB or has knowledge of it. I have a database which has just passed the 100mb mark a week or so ago, the problem is my host only allows databases of 100mb a time. I was looking to implement HyperDB but wanted to find out some information first. My current dat...
HyperDB lets you split whole tables across different databases but it won't split a single table. You wouldn't want that anyway because that means wordpress would have to query multiple databases to find a single post. However, depending on how your site is set up, you might be able to work around that by creating a mu...
Is it possible to split database tables using HyperDB?
wordpress
I've created a custom post type named agent . I have a page that lists all agents. When I add an agent I have a whole series of custom meta boxes that can be filled out, region, specialty, language... I'd like to add a series of dropdown boxes on the front end that will populate with all the terms from each custom meta...
If you'd try to do this, you'd end up with querying a maybe pretty big load of data, which should be avoided. Best would be to pre-collect the data in some <code> global (array) $prefix_meta_box_values </code> and use this later for front-end output. You could also populate some array on <code> save_post </code> hook. ...
Filter custom posts using auto populated dropdown selectors
wordpress
i'm displaying all posts by category in my template and i was wondering: is it possible to get a list of all tags used by that category? i only found out how to make a tag-dropdown but it's from all articles, i couldn't find out yet how to filter it by category - any ideas? here's the link http://wphacks.com/how-to-dis...
This shows you how to get tags for a category: http://www.wprecipes.com/wordpress-trick-function-to-get-tags-related-to-category
get all tags from category
wordpress
Hi to all I'm trying to create an advanced control panel for my first Wordpress template but I'm not able to add a function that I will need. The function that I'm trying to add is the possibility to choose the position of a DIV (left and bottom) via Admin Panel. (Apologize me for my really bad english) Here is the cod...
From the looks of it your adding php right in the css which will not work. You need to write to the css file itself or dump it right into the html as Jeremy said as I am writing this:) Writing a new CSS file every time you make any changes can tax your system, but works well if your not making lots of dynamic changes t...
Modify CSS via Theme Control Panel
wordpress
I currently have a Blogspot blog and I'm thinking of making the leap to a self-hosted WordPress one instead. Everything I've seems to suggest this is the best way to go for the best possible experience, but main concern is customizability. I've messed around with a few Blogspot blogs and I know that you're given pretty...
The front-end customization options in self-hosted WordPress are absolute. You can edit whatever you want in PHP/HTML templates and CSS style sheets. While WordPress comes with single theme ("Twenty Ten" at moment) the availability of third party free and paid themes for it is huge . See: stackexchange-url ("Where can ...
How customizable is a self-hosted WordPress blog compared to a Blogger blog?
wordpress
I'm looking for a good tutorial on how to create a popup window with a TinyMce button that would allow the user to select from multiple options, enter text into inputs, etc. I know how to create a button that displays a single prompt window, but that's about it and I've been searching for hours. Anyone know some links?...
Here is a nice and fairly new (a year old) tutorial i've read a few days ago http://www.garyc40.com/2010/03/how-to-make-shortcodes-user-friendly/ He as a great example and you cal also download the source files and get a better understanding.
Add popup window to TinyMCE buttons
wordpress
I'm trying to get text only content of posts by ID. I modified this function as follows, but at the moment it returns nothing. I cannot see what's wrong with it. <code> function get_the_excerpt_id($post_id) { $find = get_posts($post_id); $excerpt = $find-&gt;post_content; $excerpt = strip_tags($excerpt); $output = subs...
Instead of using <code> get_posts </code> , which you would use if you wanted to retrieve multiple posts in a loop, you should use <code> get_post </code> , which only retrieves one post by an ID . There is also a built-in excerpt so you might want to go with retrieving <code> post_excerpt </code> . <code> function get...
Function to get content by ID
wordpress
I was wondering how to display just the following buttons: bold italic underline unordered list ordered list insert link unlik blockquote -- Thanks in advance.
Hi @José Pablo Orozco Marín: If you are looking for how to code the custom buttons yourself, WordPress' Codex has a great example that shows you how: http://codex.wordpress.org/TinyMCE_Custom_Buttons The example is complicated because it shows you how to add your own controls but if you are using the standard buttons y...
Showing only certain buttons on tinymice content editor
wordpress
I'm using an API which is accessed with ID/Secret, etc. and use it in different widgets. In each widget however, I'm repeating the entire JSON process (i.e. file_get_contents, decode, etc.). I can't help but think this must be slowing the entire process down. What would be the best way of going about only calling this ...
Use Transients API - http://codex.wordpress.org/Transients_API I would also suggest you to use WordPress HTTP API - http://codex.wordpress.org/HTTP_API instead of <code> file_get_contents </code>
Best Practice for re-using API Data in WordPress?
wordpress
I've been trying to limit the amount of posts a user can create in a specific custom post type, and I had some help from Bainternet by checking out his plugin . I read over that and then came up with my own, but it doesn't seem to be working. I want to make my code much more lightweight than an entire new plugin so I a...
Your array phrasing is wrong, cange <code> $count_posts = count(get_posts(array('author'=&gt;$current_user-&gt;ID,'post_type','newpages'))); </code> To <code> $count_posts = count(get_posts(array('author'=&gt;$current_user-&gt;ID,'post_type' =&gt; 'newpages'))); </code>
Limiting Amount of Posts in a Custom Post Type again
wordpress
I want to build a plugin that grabs certain url params from the query string to build a new query string for the same page. I'm following the excellent the Professional WordPress Plugin Development book, but I'm not sure which hook to use for this action. Here is my action function: <code> add_action( 'init', 'tccl_red...
Like kaiser answered <code> template_redirect </code> hook is indeed appropriate for redirects. Also you should use <code> wp_redirect() </code> function, rather than setting header.
Which hook should be used to add an action containing a redirect?
wordpress
Usually facebook share gets an image from the site to post and shows it as thumbnails. If you press the share this on facebook link in my test page it doesn't. This is my test site: http://alexchen.info/taiwantalk/ This is the code: <code> &lt;?php /** * Template Name: Front Page * @package WordPress * @subpackage Prom...
<code> &lt;meta property="og:image" content="http://alexchen.info/taiwantalk/wp-content/uploads/2011/03/cheating.png" /&gt; </code> Visit http://developers.facebook.com/docs/reference/plugins/like/ and see "Step 2 - Get Open Graph Tags" There's also a lot of WP plugins out there that can help you to generate Open Graph...
Facebook sharing link is not showing a thumbnail of the images within the post?
wordpress
I need to import more than 1000 users from joomla to wordpress. I can do that with csv. My main concern are passwords. I did some googling and found out that it is possible to change wordpress password formats. Can anyone show me some code examples how to do that?
First of all you need to find out which hashing algorithm has been used on the Joomla site to store the passwords. Joomla - different to Worpdress - ships with a variety of hashing algorithms. If you have found out how the hashes have been generated, you can port the hashing function over into wordpress and make use of...
how to use joomla password format in wordpress?
wordpress
There are plenty of articles which explain how to create a wordpress plugin. I'm not looking for that, I'm looking for a schema of the core architecture of a wordpress plugin (an UML class diagram and sequence for example). Has somebody seen anything like that somewhere ? Update: I know plugin can be as simple as a fun...
There is not much to it, really. During the loading of WordPress engine <code> wp-settings.php </code> file is processed. Among other things this files calls <code> wp_get_active_and_valid_plugins() </code> function, that gets list of activated (through admin interface) plugins from <code> active_plugins </code> option...
Where can I find a schema of wordpress plugin core architecture?
wordpress
Did this feature chang in 3.1? I recall that I could change the class of the link in the thickbox popup.
The link window was completely redesigned in 3.1 to make it easier to link to other posts in your blog. The "title" and "class" attributes were removed from this window, probably because the UI team thought they were not used as often?
Can't add a class to links in the visual editor since WP 3.1?
wordpress
So I'm not sure what would be the best way to go about this in terms of best practices and optimization. Scenario: I have query that parses an external XML feed and stores the data using the transient API every 24 hours. This is stored in wp_options and the whole feed is stored in the option_value, one of the numerical...
I would do the following: Create WP-Cron task (or just use daily <code> wp_scheduled_delete </code> one to tag along) and hook your function to it. In that function: fetch XML file; fetch all posts with <code> meta_weight </code> set, using <code> get_posts() </code> ; loop through posts and save comparison result in a...
Compare transient data with a meta box value
wordpress
Assuming I have this URL: <code> http://site.com/?get=something </code> How can I change it to a nice URL that looks like: <code> http://site.com/get_something </code> using WP's URL rewriting system?
First add get to query vars array: <code> function add_query_vars_wpa12572($vars) { $vars[] = 'get' return $vars; } add_filter('query_vars', 'add_query_vars_wp12572'); </code> then add the rewrite rule <code> function author_rewrite_rules_wpa12572( $wp_rewrite ) { $newrules = array(); $new_rules['get_(\d*)$'] = 'index....
Custom rewrite rules for a $_GET request
wordpress
I've tried to follow the example for Testing for paginated Pages but i don't know why it isn't working. i put it in the single.php file for post detection. i don't know why the page_test is broken. example code here: <code> &lt;?php get_header(); ?&gt; &lt;div id="content" class="narrowcolumn" role="main"&gt; &lt;?php ...
the above solution i tried already. Never mind, i solved it, even i don't know why. if some body knows...: this: <code> // not working $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : false; if ( $paged === false ) { </code> didn't worked, but this: <code> // works $paged = get_query_var( 'page' ) ? get_q...
can't use the page_test method to check pagination
wordpress
Wordpress uses the Observer Pattern for its plugin system and operates on the premise of checking if a plugin is activated, scanning the plugins directory and storing everything in an array in the plugins class. Once it gets the activated plugins, it then proceeds to include the plugin script files, however I am curiou...
The active plugins are stored in the 'active_plugins' option, like this: <code> array( 'akismet/akismet.php', 'hello-dolly.php', ); </code> On each page load, WP just loops through that array and includes those files. It's up to each plugin to include any additional files that it may have. When a plugin is deactivated,...
How Does Wordpress Uninclude/Deactivate A Plugin?
wordpress
I am trying to accomplish something somewhat simple I think. I have a menu item at the top of my page that I want to link to the latest post in a certain category. I just need to get the post ID of the latest post in the category so I can pass it to the menu. I want to do this outside of the loop and create a function ...
here is a function that does just that: <code> function get_lastest_post_of_category($cat){ $args = array( 'posts_per_page' =&gt; 1, 'order'=&gt; 'DESC', 'orderby' =&gt; 'date', 'category__in' =&gt; (array)$cat); $post_is = get_posts( $args ); return $post_is[0]-&gt;ID; } </code> Usage: say my category id is 22 then: <...
Get post ID outside of the loop
wordpress
STEPS: Don't forget to use different id numbers in each accordion. For example: id="5" (1 to 10) The title goes between the The lyrics before the Place 2 accordions per posts (like the example below). Or they will mess up. <code> &lt;div class="basic" style="float:left;" id="5"&gt; &lt;a&gt;There is one obvious advanta...
What you're asking for is likely to be possible using a plugin to handle the shortcode. However, I cannot work out from what you've posted what you're trying to achieve. Can you be a bit more detailed in what you're trying to achieve? Rather than giving us the desired outcome, a bit of information on how to get there m...
How to turn this HTML code into a shortcode? (adding song lyrics and giving an id to a div)
wordpress
I'm not very familiar with Wordpress' pagination so I'm not sure if this a stupid question. Layout: Code: <code> &lt;?php /** * Template Name: Pictures Page * @package WordPress * @subpackage Prominent * @since Prominent 1.0 */ get_header(); ?&gt; &lt;div id="tagline"&gt; &lt;div class="container"&gt; &lt;?php // Run m...
To make your life easier use one of the many pagination plugins or ones that i use all the time: WP-PageNavi WP-Paginate and in the case of these two its a matter of activating the plugin , setting up a few options and just drop a line of code to your page, for example if you use WP-PageNavi then in your code change <c...
Adding pagination to a custom template that uses custom post types?
wordpress
Basically, I would like to know how to make a post appear on facebook (like when you press a facebook share button.) the right instant you click 'Publish'?
There are several plugins you can use. One of such plugin is Wordbook.
How to automatically share posts on facebook?
wordpress
Did anyone test if this action is being executed on theme upgrade? Are there any other actions I could use to attach a theme uninstall function?
My educated guess is that process is implemented in Theme_Upgrader class. It does some stuff with <code> upgrader_post_install </code> hook (seems like a good candidate) and it does run <code> switch_theme() </code> under some conditions (that I am too lazy to make sense of at moment).
Does the switch_theme action run when you're upgrading a theme?
wordpress
I like to create child plugin.. Explanation :- I have one parent plugin named X. This will work independently (like other existing plugins). Now I decided to add some extra features to that plugin X (think of it as an upgrade). So I want to create extra features by way of another plugin Y, which will depend on (and inh...
the Best way to do this is have your X plugin made with its own hooks for actions and filters so new plugins (in your case Y) could interact with plugin X's functions and data. Defining your own hooks is fairly easy and simple. Action Hook from the codex: Actions are the hooks that the WordPress core launches at specif...
how to create child WordPress plugin
wordpress
I've got a self hosted blog and yesterday (18th March) the stats package stopped working. I'm getting the message: Your WordPress.com account, [account] is not authorized to view the stats of this blog. where <code> [account] </code> is the name of my Wordpress.com account. I deleted and reinstalled the plugins package...
Switch to the new jetpack plugin and you will be fine.
I have a self hosted blog but now the WordPress.com stats plugin has stopped working
wordpress
I'm using the SoulVision WordPress theme, I'm trying to add a bottom sidebar to the already existing Top, Left and Right sidebars, however, I can't get it to successfully work. Any help would be appreciated. My coding is below. style.css <code> /*-- Sidebar settings --*/ #sidebar { float:right; width:400px; color:#DEDA...
For future askers with the same problem, the solution was to add before the new sidebar : <code> &lt;div style="clear:both;"&gt;&lt;/div&gt; </code> To prevent sidebars from overlapping each other.
Add Dynamic Sidebar to Exisiting WordPress Theme
wordpress
I was updating the codex page example for action hooks , while playing around to get some reuseable functions done (originally for some Q over here @WA). But then i ran into a problem i wasn't aware of before: After hooking into a function to modify the output of a variable, i can't anymore decide if i want to echo the...
If you want to return the data, the best solution is to use apply_filters() and instruct the callback to always return: <code> $output = apply_filters( 'hook_data_handle_'.$args['UID'], $args, $options ); if ( $args['echo'] ) echo $output; else return $output; </code> A less elegant solution would be to use output buff...
hooks & filters and variables
wordpress
Why is it that one cannot get the excerpt by ID like with the title and most other elements. eg. get_the_excerpt(ID). I know how to use it with the $post-> post_excerpt function but that does not return part of the content if no excerpt was entered it simple returns nothing. So what I am trying to do is get the excerpt...
Hi @Robin I. Knight: I view <code> get_the_excerpt() </code> as a function with legacy design. As WordPress usage has grown there are many newer use-cases where it doesn't fit but where the newer functions for getting different data do. One example is the now frequent use of an <code> $args </code> array of function op...
GET the excerpt by ID
wordpress
I'm doing up a WordPress theme at the moment, and I want users to be able to add Google Analytics to their site by just adding their tracking code -- you know, the <code> UA-20149670-1 </code> -type number thing. At the moment I have all the Google Analytics JavaScript code sitting in the <code> &lt;head&gt; </code> of...
Take the GA code from your header and wrap it in a function hooked to <code> wp_head </code> ; <code> function __analytics_head() { $options = get_option( 'themename_theme_options' ); if ( !empty( $options['analytics'] ) ) : ?&gt; &lt;script type="text/javascript"&gt; var _gaq = _gaq || []; _gaq.push(['_setAccount', '&...
Hiding Google Analytics code based on theme options
wordpress
Considering using flot for graphs in plugin and a little lost with dependencies and licensing here. WordPress repository demands GPLv2-compatible . flot is under MIT license , which is GPL-compatible. flot uses excanvas (for IE compatibility) under Apache License 2.0 which is compatible to GPLv3, but not v2. So is or i...
As of May 2012 plugin repo rules have been updated, allowing Apache License 2.0 and some other previously incompatible licenses: The plugin directory’s licensing guidelines have been updated. The guidelines will now allow code that is licensed under (or compatible with) version 3 of the GPL. The guidelines still encour...
Hosting plugin with excanvas (dependency of flot, jqPlot and more) in official repository?
wordpress
I read several articles about configuring the WordPress editor. For example, this snippet shows how to permanently set the editor to HTML or WYSIWYG for all contents . I'm wondering if it's possible to disable the WYSIWYG only when the user is creating a page, leaving it enabled for any other WordPress content type.
The best way to do this is by adding 'user_can_richedit' filter, like so: <code> add_filter( 'user_can_richedit', 'patrick_user_can_richedit'); function patrick_user_can_richedit($c) { global $post_type; if ('page' == $post_type) return false; return $c; } </code> Hope it's useful ;)
Disable WYSIWYG editor only when creating a page
wordpress
In a situation where one has 20 posts per page. I would like to get the current page number in order to make some nice page links at the bottom. How do you get the current page. I tried this <code> &lt;?php echo '(Page '.$page.' of '.$numpages.')'; ?&gt; </code> and it just says page 1 of 1 on every page. Any ideas, Ma...
When WordPress is using pagination like this, there's a query variable <code> $paged </code> that it keys on. So page 1 is <code> $paged=1 </code> and page 15 is <code> $paged=15 </code> . You can get the value of this variable with the following code: <code> $paged = (get_query_var('paged')) ? get_query_var('paged') :...
Get the Current Page Number
wordpress
Hey, im not sure why but php files other then wordpress either redirects to homepage or gives a 404. for example i have a timthumb.php in directory /js/ it was working fine and generating thumnails for me.. but it started to give 404 on even running the direct url. You can take a look here : www.designzzz.com/js/ you w...
Check the permissions on the JS folder against the folders for the rest of the site.
File available but giving 404 in wordpress
wordpress