question
stringlengths
0
34.8k
answer
stringlengths
0
28.3k
title
stringlengths
7
150
forum_tag
stringclasses
12 values
I see that there are hooks for manipulating WP_Query before it gets its posts (parse_query, pre_get_posts), but I can't seem to find any hooks for after the WP_Query object is populated. I have a custom table for my plugin-specific post-associated meta data that I would like to fetch from after a WP_Query object is pop...
As you haven't stated what you are trying to achieve and have just mentioned you need to fetch associated data. You have two options to query your custom table: You need to do a custom query separately using the post id from the post object while iterating over the posts. Modify the joins of main WordPress query, so Wo...
Hook/action after WP_Query gets posts to query custom tables for post-related meta
wordpress
I have featured images switched on in my theme: <code> add_theme_support('post-thumbnails'); set_post_thumbnail_size(256,128, true); add_image_size('icon', 128, 128, true); </code> but the Featured Image box isn't showing up anywhere when I edit a page. What's confusing is that the exact same theme, the same set of plu...
Have you checked the "Featured Image" check-box within the "Screen Options" drop down menu beneath "Howdy, your username"? If that's not the case, we can look into it even further. Update: WordPress MU users: Try going into "Network Admin", then click on settings, then enable image upload box, and save.
Featured Image meta box not showing up
wordpress
Anyone can recognize the current Wordpress backend, but I don't want that. I want to change it using my own design and I want to have a seamless navigating experience for my users. How can I change the dashboard appearance? I googled a lot of posts and questions, and it seems like you can only change the CSS of most th...
I use a custom include file that I created to modify the dashboard. Some of the hooks and filters are commented out by default but most of the stuff is here to remove menus, change wp logos, remove meta boxes, remove dashboard widgets, etc... <code> &lt;?php /* File: cleanup-dashboard.php Description: Clean up and cust...
How can I change the dashboard appearance?
wordpress
I'm trying to html5ize a Genesis child theme. So far I've figured out how to replace the Doctype via hook but am having trouble figuring out how i can change the divs to sections and articles without touching the core files. Can anyone point me in the right direction?
You could create all your own templates in a child theme but the core engine does contain the HTML tags and ids. For me this is the problem with Theme Frameworks (Unless your willing to totally commit to them). The code quality is outstanding but it's just too much work to roll things your own way. Just to remove the t...
Wordpress Genesis Child Theme Filter divs
wordpress
Is there a way to delete a Post From Front-End and it's attachments permanently? This is a snippet that moves the post to the trash can, but it doesn't remove attached images (they remain on the server) and it doesn't remove the post permanently? Could someone please help? <code> &lt;?php $url = get_bloginfo('url'); if...
Try: <code> &lt;?php if (current_user_can('edit_post', $post-&gt;ID)) echo "&lt;a href='" . wp_nonce_url("/wp-admin/post.php?action=delete&amp;amp;post=$id", 'delete-post_' . $post-&gt;ID) . "'&gt;Delete post&lt;/a&gt;" ?&gt; </code> You can decide when to empty the WordPress trash by adding this code to the wp-config....
Delete Post From Front-End and attachment permanently
wordpress
I have a client who uses PDF files for their newsletter, I don't think that this is a good idea personally, but it's not negotiable. They have a news page where they put real time news and they'd like to add a sidebar to this page where there would be links to download these PDF files which would update automatically w...
You could also use 'post_parent' => 0. All unattached attachments are assigned 'post_parent' = 0. Here is where I found that. I'm sure that there is a more authoritative resource somewhere, but this worked for me. :)
How would I go about listing only unattached media in say a sidebar?
wordpress
i'm hoping i'd find some help in regards to inserting ads into wordpress default rss feeds (i do not use feedburner) <code> &lt;?php function insertAds($content) { $content = $content.'&lt;hr /&gt;&lt;a href="http://www.wprecipes.com"&gt;Have you visited WpRecipes today?&lt;/a&gt;&lt;hr /&gt;'; return $content; } add_f...
Take a look at the_content_feed as a replacement for the_content_rss.
Inserting ads into wordpress default rss feeds
wordpress
Here is my function: <code> function insert_img_rel_attrib( $html, $id, $caption, $title, $align, $url ) { $postID = ??? $rel = "&lt;a rel='shadowbox[".$postID."]'"; if ($url) {$html = str_replace("&lt;a",$rel,$html);} return $html; } add_filter( 'image_send_to_editor', 'insert_img_rel_attrib', 10, 6 ); </code> How do ...
This should work within your function: <code> get_post_field( 'post_parent', $id ) </code>
How to retrieve the postID in a "image_send_to_editor" hook function?
wordpress
I currently have this, <code> &lt;?php $meta = get_post_meta(get_the_ID(), 'rw_agentPhone', true); echo "office:"; echo $meta; // if you want to show ?&gt; </code> Which is fine provided there is a value for rw_agentPhone, but if the profile has no value entered it still displays office:, how can I rewrite this so that...
This is very basic. Invest some time in a PHP tutorial. It’s fun! :) Anyway … <code> &lt;?php $meta = get_post_meta( get_the_ID(), 'rw_agentPhone', TRUE ); // get_post_meta() returns an empty string if it doesn’t find anything. // We just test for this. If the string is not empty, we print it out. '' != $meta and print...
Show label for value only when value exists, basic php
wordpress
I'm using the WordPress database and back end to administer the news for my band's website and everything is working great however I'd like to disable the front end of WordPress itself. I have the WordPress installation installed in <code> /wordpress/ </code> and obviously the admin section is under <code> /wordpress/w...
To make sure only the front end redirects to <code> domain.com </code> , make a theme that uses the PHP header() function. Create a folder called redirect or something. Add two files to the folder: <code> style.css </code> and <code> index.php </code> (necessary for a valid WP theme) In <code> style.css </code> , add s...
Disable front end to use as CMS only?
wordpress
Can you recommend a tutorial or a plugin in wordpress that lets you achieve a similar gallery, like this http://www.whitehouse.gov/photos-and-video/photogallery/may-2011-photo-day Large Preview then at the bottom a thumbnails then an album. I also like cooliris because it supports fetching images from facebook and flik...
You would have to create custom templates, but your reference page is fully achievable using the NextGen Gallery plugin.
Image gallery plugin
wordpress
I am trying to code in more consistent manner and would like to know what is the difference between WP: template_directory vs TEMPLATEPATH.
@tanktery <code> template_directory </code> is the URL of the active theme's directory. Before version 2.6 of WordPress it was a local path. <code> TEMPLATEPATH </code> is also the URL of the active theme's directory. Before version 2.6 <code> TEMPLATEPATH </code> was used but now it is recommended to use <code> &lt;?p...
What is the difference between WP: template_directory vs TEMPLATEPATH
wordpress
I have several sub-categories set up. Everything displays properly as far as nesting (see below) when creating a new post. Category 1 --Sub Category 1 --Sub Category 2 --Sub Category 3 Category 2 etc After I select a sub-category, then go back and edit a post, the sub category that I check shows up like this (note how ...
This "feature" has been in WP for quite a while. You can disable it by installing this small plugin: http://wordpress.org/extend/plugins/category-checklist-tree/
Why aren't sub-categories nested after creating post in the WP Admin?
wordpress
I am developing a installable theme in wordpress I have created a contact form and called that form in footer but I want to create a widget that should be theme based mean i dont want any plugin.I can create a widget but for this i need to put the file in plugin folder that I don't want that should be completely theme ...
A contact form is pure plugin stuff. It has to survive a theme switch. Put it into a plugin and prepare your stylesheet for the common possible positions.
how to create theme based widget that can be drop in sider bar or footer
wordpress
I have a custom taxonomy, and would like to force the user to select at least one term from that taxonomy when creating a post in the WordPress admin back-end. Is this possible?
No. This is not completely possible. One solution would be to swap out the default UI on /wp-admin/post.php &amp; /wp-admin/post-new.php. You can provide the user with radio buttons or a select box. This will work relatively well, but can not be 100% trusted. There is still the possibility that a user could remove all ...
How to enforce the selection of at least one term from a custom taxonomy?
wordpress
I was wondering that if you do an AJAX call on an admin page and I wanted to see if the user had the capability to edit a page, would that info be sent along the call or do I need to manually sent that data?
You don't need to send any additional data, since the user cookies (which are used for authentication) will be sent by default. You have access to all the WP functions, including current_user_can().
Does an AJAX call on the Admin Side Automatically include the User Data/Capabilities?
wordpress
I installed a new WP site on local machine with wamp server. When a new user registers it gets the "registration successful" message but a mail with the password is never sent. Also checked the junk folder. What can be the cause?
Probably your local setup since Wamp does NOT come with mail server. But you can configure the STMP settings of PHP to point to another server in your LAN which runs an SMTP server, or to the SMTP server of your ISP. this thread has an example of how to set it up: http://www.wampserver.com/phorum/read.php?2,31302,70969
Mail isn't sent after local site registration
wordpress
I'm planning to follow this tutorial in order to allow my subscribers to add images to comments (actually a custom post type called "Replies"). Wordpress filters <code> &lt;img&gt; </code> tags by default (except for the admin). Will my Wordpress site be vulnerable to Cross-Site Scripting (XSS) if I allow img HTML tags...
Many evil things can be done by including an image. The question is how well WordPress filters them. To give you an idea: File names should be checked properly. The actual image data can contain javascript. Also, EXIF data could contain javascript.
Will my Wordpress site become vulnerable to Cross-Site Scripting (XSS) if I allow img tags in the comments area?
wordpress
I am excluding comments from specific categories. However, when I try to exclude more than one, it doesn't work. This works: <code> &lt;?php if (!in_category('7')) comments_template(); ?&gt; </code> This does not work: <code> &lt;?php if (!in_category('7 , 9')) comments_template(); ?&gt; </code> or <code> &lt;?php if (...
I would suggest using category slugs instead of ids. Please try something like this: <code> if ( ! in_category( array( 'bunnies', 'tacos', 'banana-pirates' ) ) ) { comments_template(); } </code>
How do I specify more than one category?
wordpress
This is happening in more than one section of our website, but in different yet similar ways. Scenario One: We have a URL structure like this... mydomain.com/some-category/?subject=Some+Subject I'm trying to get pagination properly working. I urlencode() the space and get the +, but it doesn't matter if I use a space o...
You can hook into WordPress’ slug algorithm and create your own slugs. For an example look into my plugin Germanix URL . I’m not sure if WordPress can accept requests with an <code> + </code> without further tweaking tough. If just want to allow the slug without much coding, install Germanix and create a second plugin ...
Modify Wordpress to not replace + (plus) characters from URLs?
wordpress
let's say I have 100 categories and each has 10 custom fields for it self,for example : category Computer : Cpu - Hard - Ram - ... category TV : resolution - inch - usb support - ... ... now I want the editor only can see related custom fields to post(ex. computer) , I don't want them to see like 1000 custom fields and...
Try using magic fields . It will let you create a custom panel for each category, where you can specify just the custom fields needed for that category. It allows you to present it all in a very user friendly way as well, as well as manuy, many, many other cool things. The plugin will change your life if you do this so...
Wordpress Custom Fields by category
wordpress
I am trying to hook in to automatically sign-in the user after registration. (using a GravityForms registration form). None of the hooks seem to be working. I've tried: gform_user_registered, user_register, a filtered 'update_user_metadata'.... Why would this not kill the script after a registration happens? <code> add...
Use the Gravity forms gform_user_registered hook. It fires after the registration and will return the $user_id. <code> function my_auto_login( $user_id ) { wp_set_auth_cookie( $user_id, false, is_ssl() ); wp_redirect( admin_url( 'profile.php' ) ); exit; } add_action( 'gform_user_registered', 'my_auto_login' ); </code>
Registration Hooks don't appear to be working
wordpress
I would like to get the last term that was searched, but when not in the search.php page. For that, I know, I could use get_search_query() function, but if user clicks on a post for example, so he is now in the single item and that function will retrieve an empty string. I want to preserve that search phrase and get it...
Best solution would be to store the search phrase on the client-side via local storage or, where not available, in a cookie.
Get search term not on searh results page?
wordpress
Ok so i have added a custom field into the users edit profile page where they can add a link to a url of an image they want. I am currently using this for contribitors and above but i also have a small little profile box on my site that gets a users avatar from gravatar. I used the code from before but changed it aroun...
Ok so i got it working like i want. Now all i have to do is figure out if i want a user to be able to upload there own image or not. <code> &lt;? $userpiccur = wp_get_current_user(); $userpicloc = 'http://avatars.mydomain.com/'; $userpictyp = '.png'; $userpicurl = $userpicloc.$userpiccur-&gt;user_login.$userpictyp; $us...
get_user_meta Short Profile Section
wordpress
I have a client who's site will be making heavy use of custom post types to configure their site. But I'm between a rock and a hard place for their requested home page. In reality, the home page will be a stack of specific "pages" within WordPress. Basically, there will be pages for: Intro , Blog , About Us , Portfolio...
Thanks to @toscho for the useful answer, but it felt a bit hackish to me, so I poked around a bit and figured out I could add a filter instead: <code> function wpa18013_add_pages_to_dropdown( $pages, $r ){ if('page_on_front' == $r['name']){ $args = array( 'post_type' =&gt; 'stack' ); $stacks = get_posts($args); $pages ...
How do you use a CPT as the default home page?
wordpress
I have declared a scheduled event in a plugin like this : <code> function shedule_email_alerts() { if ( !wp_next_scheduled( 'send_email_alerts_hook' ) ) { wp_schedule_event(time(), 'hourly', 'send_email_alerts_hook'); } } </code> Then i wanted to change the frequency to 'daily', by doing so, replacing the original func...
Ok, I could solve the problem by using <code> wp_clear_scheduled_hook() </code> I commented out my schedule declaration and added <code> wp_clear_scheduled_hook('send_email_alerts_hook') </code> at the end. Then deactivate - reactivate my plugin, which removed my scheduled hook. Then removed <code> wp_clear_scheduled_h...
How can I change the frequency of a scheduled event?
wordpress
The function <code> get_current_site() </code> that's in my themes' footer.php file doesn't return the 'site name' property as specified in the docs (and expected in the theme). The purpose of the function is to return all details about the parent site on a multi-site setup. The only return values I am getting are the ...
Try using <code> get_current_site_name() </code> to insure you get the site name so something like this: <code> echo get_current_site_name(get_current_site()); </code>
get_current_site() not returning site name
wordpress
I've given the task of moving several well established blogs from wordpress.com into an independent hosting using Wordpress. Wordpress.com uses a special parser for taking stuff like this: <code> [youtube=http://youtu.be/JN3n34dS] </code> and converting this to a YouTube embed (for example, this happens with other link...
you could use phpMyAdmin to do a search&amp;replace on the wordpress database for the old youtube embed string and then replace with the new one. Should be possible since the syntax is similar enough. edit: to add stackexchange-url ("from this other stackexchange question"): Search RegEx is a good plugin to be able to ...
Convert Wordpress.com embed links to normal embeds
wordpress
Is there a way to disable image attachment links trought a filter in functions.php or something ? I know it's possible to do it manually when you add an image to a post but I want to disable this functionality by default. UPDATE What I want to do is set the "Link URL" option to "none" and remove / hide it from the uplo...
If anybody is interested in do the trick, my solution is this: <code> function remove_media_link( $form_fields, $post ) { unset( $form_fields['url'] ); return $form_fields; } add_filter( 'attachment_fields_to_edit', 'remove_media_link', 10, 2 ); </code>
Disable image attachment links
wordpress
For single posts and pages, I would like to add certain <code> rel </code> attributes to all the images on the contained therein added with the "Add Image" functionality on the edit screen. The attribute would be <code> rel="lightbox[post id]" </code> What function would I filter to accomplish this most effectively?
image_send_to_editor <code> function insert_img_rel_attrib( $html, $id, $caption, $title, $align, $url, $size, $alt ) { /* Run your magic on the image $html to insert rel attrib */ return $html; } add_filter( 'image_send_to_editor', 'insert_img_rel_attrib' ); </code>
Best way to programatically add "rel" attributes to page and post images
wordpress
I figured out how to exclude the current post from displaying in my single-post view sidebar, but now I want to exclude parent categories and display only children. Any ideas how to do this? Much obliged!! <code> &lt;div id="sidebar" class="grid_4"&gt; &lt;div class="item portfolio"&gt;&lt;hr&gt;&lt;/hr&gt; &lt;h4&gt;S...
I spent almost two months building and debugging Total Widget Control to do exactly this for all of a sites widgets. Bear with me as I strip the code out of Total Widget Control and try to make it usable for you. <code> global $wp_query $twc_menu_item_object = $wp_query-&gt;object_id; //is the object id of the current ...
How to exclude parent category but show child categories?
wordpress
Is there any plugin where users can comment with Facebook or Twitter or OpenID...
I use disqus on my site and it works quite well.
A plugin where users can comment with Facebook or Twitter or OpenID
wordpress
Ok so i have added a custom field inside of the WordPress edit profile field where a contributor and above can add a custom image if they do not use gravatar. Now i am trying to write a if else statement and this is what i have <code> &lt;? $hasauthorpic = (the_author_meta('author_pic')); if (function_exists('get_avata...
You need to use get_the_author_meta() instead of the_author_meta() <code> &lt;?php $authorpic = get_the_author_meta('author_pic'); if ($authorpic) echo $authorpic; else echo get_avatar( get_the_author_email(), '80' ); ?&gt; </code>
If Else Gravatar Author Picture
wordpress
Say I want to add this link: http://localhost/taiwantalk2/user-login/ Which is a Page with a template called page user-login.php : <code> &lt;?php /** * Template Name: bbPress - User Login * * @package bbPress * @subpackage Theme */ // No logged in users bbp_logged_in_redirect(); // Begin Template get_header(); ?&gt; <...
From what I understand, you want a URL to your page, that will work even if you change the page slug? You can do this by linking to the default permalink for that particular page, for example http://localhost/taiwantalk2/?page_id=139 . This URL will always work even if your permalinks are updated. WordPress handles the...
Is there any way to display the link of a Wordpress page without relying in its slug (or full path)?
wordpress
I have no problem doing this in a comment, as an administrator: <code> &lt;b&gt;bold test&lt;/b&gt; &lt;i&gt;italics test&lt;/i&gt; &lt;u&gt;underline test&lt;/u&gt; &lt;font color="#ff9900"&gt; color test&lt;/font&gt; </code> But the subscribers can't underline, add color to words nor add images. Is it that only the a...
The tags that are allowed in comments are stored in the <code> $allowedtags </code> global variable . You can try adding elements to that list (the key is the tag name, the value is an array of allowed attributes). If you have problems with the timing you can play with the <code> CUSTOM_TAGS </code> global variable .
Expanding the allowed HTML tags in comments?
wordpress
I have a class inside a file that i <code> include_once() </code> from the functions.php of my theme. The class can be used as stand alone plugin, or integrated in a theme. Inside the class i want to fill a class variable (inside the <code> __construct() </code> function) with the native wordpress function <code> get_p...
get_plugin_data() is only defined in the administration section. What info did you need to get from the plugin's header that you would need to display in the theme? If the answer is none, I would suggest that you place a conditional call in your constructor. Something like: <code> if ( is_admin() ) { $var = get_plugin_...
Call to undefined function `get_plugin_data()`
wordpress
I'm currently extending my pagination plugin, after a hint by @toscho. So the plugin will now use the same filters, hooks and arguments as the native wordpress pagination functions. My problem is that the different wp functions name their arguments ... different. Example: This is how you change the text for the "Next" ...
<code> wp_link_pages() </code> and <code> paginate_links() </code> work in different contexts: The first on a single paginated page, the latter on an archive. So <code> is_archive() </code> should be your criterion to decide which text you use, or better: which filter you use in <code> apply_filters() </code> .
How to deal with equal & similar arguments for a function?
wordpress
I had the site on oldsite.com but was using the database at newsite.com, everything was working great. I moved the site to newsite.com, now when I try adding a new post using a custom post type, it disappears, I am still able edit older posts, of the same custom post type. I checked the db when I create a new post noth...
Try re-generating the permalinks structure. And check that you have the correct urls in the general options (WPURL and URL)
Switched server & domain name, now custom post types won't save
wordpress
What favicon plugin should I use in order to define favicons for Wordpress when I run in multi-site mode. Uploading favicon.ico files is not an option for multi-site wordpress instances. I am looking for something simple that will not pollute the generated pages with hidden advertising. EDIT: Looking to be able to defi...
Now I am successfully using All In One Favincon Plugin.
Favicon plugin for WordPress running in network mode (multisite)?
wordpress
I basically want to create a table (preferably AJAXified) that lets the user enter a line of information, and be able to add new lines of information, and delete selected ones. I've found stackexchange-url ("this post") and stackexchange-url ("this post"). The design side looks very straightforward, but I want to know ...
I pretty much started in the same place as you a while back, and have created something similar. Here's what I think you need to know. 1) Work out how to create your basic hello world first and foremost. A simple plugin will consist of a few comments at the top of a PHP file dropped into your plugins directory. Notice ...
Any guides on creating custom admin pages?
wordpress
For example, in portfolio section I want to have 3 images that are positioned always in the same place in all the posts. I know there is a plugin that does this but I need to accomplish this without a plugin.
The best advice is to use the plugin. I can't think of any reason to rebuild functionality that already works well and exists. If you absolutely need this functionality in the theme, you can include the code from the plugin into your theme by removing the header in the plugin's main file and requiring it in your theme'...
How to add multiple featured images to post/page without a plugin
wordpress
Some of my clients don't have CPanel access to their WordPress, so I have to copy and paste from the built-in editor to pull out the PHP. Is there a way within that admin interface to grab all the PHP files? I don't have FTP acces.. gr...
You should demand access to ftp or the command line, working without is is crippling and to be blunt, silly.
Download PHP and CSS from the Wordpress admin page without FTP
wordpress
When you develop a site on wordpress you may want to create posts/pages with the same name, something that wordpress does not allow by default. Use cases: <code> example.com/en/contact example.com/fr/contact example.com/en/support/contact </code> I am currently using WPML plugin in order to create multilanguage sites a...
When you develop a site on wordpress you may want to create posts/pages with the same name, something that wordpress does not allow by default. This is statement is not true. WordPress will allow you to set up pages with the "directory" structure that you specified right out of the box. I was just able to do this on my...
How to create posts or pages with the names in wordpress?
wordpress
I'm trying to create an advertisement block to be placed on a single post (single.php) such that the div class or id is left aligned and the post content wrapped around it. I checked the single.php and this is the only piece of code I notice is what displays the post. <code> &lt;div class="entry entry-content"&gt; &lt;...
You have to put your advertisement block just before <code> &lt;?php the_content(); ?&gt; </code> in a separate div-layer and add some css to it. E.g. single.php <code> &lt;div class="entry entry-content"&gt; &lt;div class="advertisement"&gt; &lt;p&gt;Your advertisement&lt;/p&gt; &lt;/div&gt; &lt;?php the_content(); ?&...
Adding a div class or id inside the_content()
wordpress
I'm updating a plugin of mine and am have a hard time figuring out the "best way" to build in a specific bit of functionality. The plugin allows users to associate images from their media library to any term of any taxonomy. I'm currently working on creating functions that users can add to their themes and plugins to g...
I'd say your third option is the way to go. Incidentally, why did you roll your own static cache in <code> taxonomy_image_plugin_get_associations() </code> instead of using the built-in WP_Cache API for that? Is there a reason <code> wp_cache_get </code> wouldn't work here? Seems like using the WP object cache would op...
How to organize and cache additional data associated with terms?
wordpress
I have never used the child theme function. so I am curious if it is possible to use this function to create a mobile version or no? I know that there are mobile plugins for this but I was curious if can use a child there for this
I don't see why it wouldn't be possible. I use a switch plugin to display a totally different theme for mobile. A child theme is a totally different theme. The dependencies on the parent theme should still work, as they are WP functions built in. Give it a try with a super simple child theme so you don't waste too much...
use child theme for mobile version
wordpress
I've created a custom widget and placed it in functions.php. You can see the widget here: http://pastebin.com/3uWpeaFx (I've also created a similar widget that grabs a random image; it's included with the pastebin.) The widget allows users to plug in up to ten blocks of text/HTML, stores them in an array in JS, and dis...
No parent necessary: the difference between a not-working widget and a working widget was this: <code> $text1 = apply_filters( 'widget_text1', $instance['text1'], $instance ); </code> vs: <code> $text1 = apply_filters( 'widget_text1', empty($instance['text1']) ? '' : $instance['text1'], $instance, $this-&gt;id_base); <...
Custom random quote widget breaks when used in multiple sidebars
wordpress
I am having trouble with my rewrite rules with my new nginx install. If I access the image manually like here, incredible.devpreview.co/wp-content/blogs.dir/2/files/2011/05/stockvault-colorful-illustration108811.jpg It shows up But WordPress is looking for it here incredible.devpreview.co/files/2011/05/stockvault-color...
The Nginx Multisite method outlined below has been tested and will work for subdomain Multisite installs and will also work with the domain mapping plugin. To simplify the process of making future changes the server files are organized into 3 separate files. The first is nginx.conf which holds the basic configuration a...
Nginx WordPress Multisite Rewrite rules
wordpress
How do I change the formatting on http://wordpress.barrycarter.info/index.php/voronoi-temperature-map/ so that (for example) the map's nearly flush with the bottom of the menubar? I don't want to edit page.php, since that'll change all pages, not just this one.
After creating the specific CSS you need to format the page how you like, you could: Create a custom page template with the CSS and assign the template this page. Create a page-{slug}.php file with the CSS, where {slug} is the page slug for this page (most likely the filename should be page-voronoi-temperature-map.php)...
Change CSS/formatting on specific page, but not pages in general?
wordpress
I want to display this file: http://data.barrycarter.info/aprswx.txt on wordpress.barrycarter.info, but all my attempts fail because of preprocessing: http://wordpress.barrycarter.info/index.php/test-kml-fail (use "view source" to see what parts of the file WP "hides" from view).
Use a plugin like syntax highlighter evolved. http://wordpress.org/extend/plugins/syntaxhighlighter/ Or wrap it in <code> &lt;pre&gt; </code> or <code> &lt;code&gt; </code> tags.
Display KML (or other "raw data" file) nicely in WP?
wordpress
There's a "Jobs" section on my website (custom post type), with various associated taxonomies (language spoken, type of contract, location, etc.) The website also has a very big user base (about 10 000 subscribers). These users have access to a form where they chose "jobs" criterias they are interested in, in order to ...
Make the user query when the job is submitted and put all matching subscribers in a queue. At the end of the day run through the queue once and send the mails.
What is the most efficient way to execute recursive complex queries?
wordpress
I am using a front end script to upload images , all works fine but recently i noticed the uploaded images are not saved in proper directory. My settings are to Organize my uploads into month- and year-based folders. my folders are 2011-> 03,04,05 (march , April , may). The problem is that if i upload a file today it s...
Look into the first lines of this function: <code> function media_handle_upload( $file_id, $post_id, $post_data = array(), $overrides = array( 'test_form' =&gt; false ) ) { $time = current_time('mysql'); if ( $post = get_post($post_id) ) { if ( substr( $post-&gt;post_date, 0, 4 ) &gt; 0 ) $time = $post-&gt;post_date; }...
media_handle_upload weird thing
wordpress
I'm thinking of doing up a couple of premium themes, and selling copies of them. I've never done anything like this before, so I have a couple of questions. I appreciate that this is mainly a forum for asking technical questions, so if anyone wants to point me in the direction of somewhere that might be more appropriat...
There is no way to prevent the free distribution of your theme. You could make it harder by selling a copy that is restricted to a license key and a salted hash of the domain. But even if you put the code for this in a pre-compiled script it will be possible to get around it. Sell support, upgrades and reliability, not...
How do you protect a premium theme from being copied?
wordpress
Im trying to build a function which grabs the feedburner "readers" using <code> wp_remote_get() </code> . I noticed that it frequently returned a value of <code> 0 </code> . I assumed at first that it was a WordPress error (handled by <code> is_wp_error() </code> ) or a flaw with <code> wp_remote_get() </code> . Wrong ...
WordPress can be inconsistant as to hen is returns a <code> WP_Error </code> object and when it just returns <code> false </code> or <code> string(0) </code> when actually there was an error. I am not sure exactly what feedburner is returning to not trigger a <code> WP_Error </code> from <code> wp_remote_get() </code> ...
is_wp_error() and handling errors
wordpress
I'd like to exclude a specific user account from showing up in the activity stream. I found this code that's supposed to exclude the Admin. Any clue how to exclude a specific user? (this code goes in bp-custom.php) <code> &lt;?php add_action("plugins_loaded","bpdev_init_sm_mode"); function bpdev_init_sm_mode(){ if(is_s...
<code> &lt;?php add_action("plugins_loaded","bpdev_init_sm_mode"); function bpdev_init_sm_mode(){ global $current_user; if(is_user_logged_in()) { get_currentuserinfo(); if("someusername" == $current_user-&gt;user_login) { remove_action("wp_head","bp_core_record_activity");//id SM is on, remove the record activity hook ...
Exclude User from Activity Stream in BuddyPress?
wordpress
The code below shows the active sub menu of the Main Menu. It's nearly perfect, however, I need it to show ALL subitems of these sub items, and their children. AKA unlimited depth. Thanks in advance! To further clarify here is an example: WP - Main Menu Home About News (Active Menu Item) Press Social Facebook Twitter S...
After no solution from the community :-/ and days of reviewing it over and over I determined I simply had to change a 2 to a 0 for unlimited depth, and now it works perfectly!
Show All Children of WordPress Menu
wordpress
I am currently running WordPress 3.1.2 on PHP 5.1.6. The minimum requirement for WordPress 3.2 is going to be PHP 5.2.4 or greater. If I keep running WordPress 3.1.2 and there is a security issue will they provide security updates for 3.1 or will I be forced to upgrade my version of PHP so that I can upgrade to WordPre...
WordPress backports security updates usually 1-3 versions back but they don't promise anything. The WordPress LTS philosophy is that LTS = " Long Term Suckage " The Long Term Suckage theory is: While I like the theory of LTS, what happens in practice is it covers up the incompetence of IT or developers because they put...
Will there be security updates for 3.1 once 3.2 is released?
wordpress
i'm using an rss to post plugin. The posts fetches from the RSS do not have any pictures associated with them. Is there a way to automatically assign a 'featured image' to posts from a category? Another option is that in my WP theme, with the custom field as 'thumb' I can add images/reuse same images.. is there a way t...
if i understand your question correctly then have a go with Justin Tadlocks get the image plugin , olden but golden and does the default image per category etc.
How to add featured images to posts from a category
wordpress
I have custom post types registered and they are working fine with their normal URLs. My Custom post types have 'members' as their slug. Now I am trying to have a custom permalink for my custom post types. Here is my $wp_write-> add_rule <code> $wp_rewrite-&gt;add_rule('members/.+?/(.+)/$','index.php?post_type=pasha_me...
It appears that WordPress cuts off the final <code> / </code> before it starts matching the URL. So make it optional in the regex and it should work: <code> members/.+?/(.+)/?$ </code> If the city and company parts will not contain slashes it could be even more clear to use <code> [^/]+ </code> to match them ("everythi...
Custom Permalinks for Custom Post Types
wordpress
Is it possible to take the blue publish button in back end of the wordpress and place it in the frontend near the post in my index.php. I need a way to publish the pending article without going to dashboard and only admin can see the publish button? <code> &lt;?php $args=array( 'post_type' =&gt; 'post', 'post_status' =...
First create a function that will print the publish button : <code> //function to print publish button function show_publish_button(){ Global $post; //only print fi admin if (current_user_can('manage_options')){ echo '&lt;form name="front_end_publish" method="POST" action=""&gt; &lt;input type="hidden" name="pid" id="p...
Publish pending article from front end with a button?
wordpress
This is my first real delve into custom post types and taxonomies, i suppose it will all come to me in a flash of inspiration but right now i have confused myself beyond all realms of possibility and need some advice as whether im going on the right track. heres what i have: Three custom post types, namely: sale rental...
Looks like you got the hang of it. Taxonomy template is an archive of posts that share a term just like categories or tags, so if by looped view you mean archive then yes you are correct. you can create just one template that will include all taxonomies and use the get_template_part function to include the correct loop...
Custom post type and taxonomy page templates
wordpress
I'm trying to set the Post Title or Post Content as the caption in my Nivo Slider . Any ideas on how to do this?
You need to set the "title" attribute of the images to be the post title. You can do it like this: <code> title=' . get_post_title() . ' </code> You will have to modify the HTML output of the plugin, but it should not be very difficult at all.
Custom Caption on WP Nivo Slider
wordpress
For those who are curious, I'm changing the theme but this theme relies on CSS3 and HTML5 and displays very ugly in IE 8 or below. - Especially the navigation. What I want to do is keep my old theme and use it for IE users only, I assume if this can be done for a mobile site, it can for IE. Would it be easier to just g...
maybe you can somehow use template redirect? I'm not too clear on how it works, but it may be worth investigating. <code> function my_check_is_ie() { global $is_winIE; if ( ! $is_winIE ) return; // load template for IE include(TEMPLATEPATH . '/IE_template.php'); // or maybe? if( is_home() ) include(TEMPLATEPATH . '/IE_...
Making an IE only site (Like a Mobile only site)
wordpress
Okay so the website I webmaster for http://www.detroitdungeon.com has been having some analytic issues as of lately. I have the google analytics plugin installed and it was working fine for quite sometime. All of a sudden the plugin caused IE users to crash after the page had loaded. So instead of using the plug in I d...
<code> &lt;?php include('footer_content.php');$delight_mainfont = get_option('delight_mainfont');echo '&lt;div id="footcopy"&gt;&lt;span class="left"&gt;&lt;a href="http://zenverse.net/delighted-black-wordpress-theme/"&gt;Delighted Black&lt;/a&gt; designed by &lt;a href="http://yourchristianspace.com"&gt;Christian Mysp...
Analytics causes website to crash
wordpress
I'm writing a custom plugin that allows a particular page to have it's own sidebar with widgets. It works great so far, but what I'd like to do is generalize it more and allow the plugin to "override" the dynamic sidebar of any page (if it has a custom sidebar) without having to edit any template files. I've tried seve...
<code> dynamic_sidebar() </code> calls <code> wp_get_sidebars_widgets() </code> to get the list of all sidebars and their widgets. This output is filtered through <code> sidebars_widgets </code> , so you can stackexchange-url ("modify it to add or remove widgets"). This array only contains widget IDs, so you need to re...
Override dynamic_sidebar() in plugin?
wordpress
I'm sure this is an inappropriate question for this SE because it's not programming related AFAIK but maybe someone here has an idea. I've been posting code into my blog for years and have had no formatting concerns. Now all of a sudden, when I copy and paste code from whatever IDE I'm working in, the LFs are stripped ...
This almost certainly appears to be a Google Chrome issue (though the bug is still probably within WordPress, since Chrome does preserve all tabs and linebreaks when pasting into the Paste Text or Paste from Word areas, so Chrome is not itself stripping out the linebreaks.) I'm recommending we close this cause it proba...
Pasting code into WordPress post - LFs being eaten
wordpress
First, Here is the full error: <code> PHP Fatal error: Call to undefined function download_url() in /path/to/wordpress/wp-admin/includes/media.php on line 562 </code> I have also posted the related functions at the bottom of my question. I am modifying a script for my company's website which allows us to automate the r...
You have to include /path/to/wordpress/wp-admin/includes/file.php this file also, as the media.php uses the function download_url() from that file.
PHP Fatal error: Call to undefined function download_url()
wordpress
I've assigned a specific html page (let's call it an author bio page) to each user in the 'website' field within the user admin area. How do I get that URL to display within a single page post? I'm assuming that I'm to use $curauth-> user_url but it returns a blank page.
you need to assign <code> $curauth </code> and since you are not on an author archive but on a regular page you can use get_userdata function and pass the user ID like so: <code> $curauth = get_userdata(1); //and then use echo $curauth-&gt;user_url; </code> or if you are in the loop you can use <code> the_author_link()...
Author website URL
wordpress
is there a way to add custom user meta fields (like the one in the profile.php which contain specific user data), but only an admin (or an other user with enough capabilities) can change them? Maybe I'm thinking too complicated, how would you tell your site visitors who from your users is doing which work on the site, ...
I think I get what you are saying, and if not, forgive me: just add your meta fields / metabox inside: <code> if( current_user_can( 'administrator' ) ){ // put code here } </code> *this is assuming you aren't asking how to add a metafield or metabox.
Add User meta fields, which only admin can edit
wordpress
I am sure I am missing something very straightforward, but there seems to be no way for me to upload a photo for my profile or for a user profile the will be used in place of the placeholder white on grey silhouette that my theme displays. I did Google for this, and I seem to get a bewildering array of possible plugins...
These images are called Avatars . By default, WordPress works with the Gravatar service , which hosts your avatar on one central location so you don't have to upload it to every site you comment on. It is based on your e-mail address (you see it on action on this site too). If you want to provide the functionality to l...
How do I allow users to supply a photo/image to be used instead of the grey/white silhouette?
wordpress
I tried to add thumbnail support to my theme <code> add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size(133, 133, true); add_theme_support( 'post-thumbnails', array( 'post' ) ); add_theme_support( 'post-thumbnails', array( 'page' ) ); </code> So this isnt working, or at least I'm not sure how this should wo...
This looks flawed: <code> add_theme_support( 'post-thumbnails', array( 'post' ) ); add_theme_support( 'post-thumbnails', array( 'page' ) ); </code> Do you see the post thumbnail box on pages? If so, you have just overwritten the support on posts with the second declaration. Better: <code> add_theme_support( 'post-thumb...
How do you get thumbnails to show up in the admin edit post?
wordpress
Does anyone know why wordpress converts some html entities to their numeric equivalents? I've found that in some posts, where a non-breaking space <code> &amp;nbsp; </code> entity would be appropriate, wordpress uses <code> &amp;#160; </code> instead. Seems to me that using the symbolic version of the entity would be b...
In XHTML entities are not part of the DTD, and user agents are not required to support them. Exceptions: <code> &amp;amp; </code> , <code> &amp;lt; </code> , <code> &amp;gt; </code> , <code> &amp;quot; </code> and <code> &amp;apos; </code> . To keep WordPress X(HT)ML compatible numeric references are used instead.
Anyone know why wordpress converts some html entities to their numeric equivalents?
wordpress
I am learning development of plugins, I am stuck into saving the plugin options form data. I have a plugin options page, where three fields asking for number of videos, height and width are coded. When I enter the values into it, and hit on save its just saving one value, that is, number of videos. Here is my code <cod...
First, you really should be storing your options as an array in <code> wp_options </code> . But should you choose not to, you really should change the names of your second and third options; "height" and "width" are entirely too generic, and almost assuredly will cause conflicts. You're passing <code> name="height" </c...
Wordpress plugin form not saving data
wordpress
Hey everyone, I can't se the image of the post (it is attached through gravity form as a post-image) with this function I see the missing image icon with the title and the working link but no thumbnail image.? It is suposed to be more or less ( authors last 2 posts in the widget area) I suspect the problem is here : <c...
Do I understand right that you mean featured thumbnail image for a post and not just any attached image? See <code> get_the_post_thumbnail() </code> function and your usage will be something like this: <code> $output .= get_the_post_thumbnail( $authors_post-&gt;ID ); </code>
Function to call the attachment image from post
wordpress
In the TinyMCE editor that comes with WordPress there is no button to insert image from link. I know that you can do this using the upload/insert section. But let us say that I don't want to allow users to upload images but want them to be able to insert images by linking them. If I remove the upload capabilities, the ...
TinyMCE Advanced allows you to add several buttons including images.
How to insert image from link in TinyMCE
wordpress
I have 1 important taxonomy that contains 2 different custom post type content. I want somehow show them in same taxonomy page with both paging. Well.. i am not sure i can do that or not. Is it possible to paging 2 different CPT in same taxonomy?
You can create two separate loops with pagination - and place them in side by side div containers - with pagination links inside each div. You would include the pagination links in each div, because you might have more of one post type then the other, and therefor more pages than the other. The columns will paginate to...
2 custom post type paging in 1 custom taxonomy
wordpress
I am trying to add tinymce editor in my frontend from where users can post. But no luck so far. Here is the code: PHP: <code> add_action('wp_print_scripts', 'my_enqueue_scripts'); function my_enqueue_scripts() { wp_enqueue_script( 'tiny_mce' ); if (function_exists('wp_tiny_mce')) wp_tiny_mce(); } </code> Javascript: <c...
Well, Thanks to wp 3.3 now we have <code> wp_editor() </code> function to do that :)
How do i include tinymce editor in frontend?
wordpress
From what I have read, I have come to understand that all WordPress plugins,(including premium ones) should be GPL licensed . If this is the case, can the installation be limited to a single domain? As far as I understand, GPL allows you to reuse the code. Doesn't it? I'm asking this because I have seen some premium pl...
GPL prohibits restricting the code in any way. You can restrict the support or non GPL parts of the plugin (images/css) to a single domain but you can't restrict the GPL code to a single domain. Q&amp;A: WORDPRESS &amp; GPL MATT MULLENWEG's response to the same question:
Single Domain/Multiple Domain installation restrictions allowed for plugins?
wordpress
Currently, permalinks are set to /%postname%/. I'd like to prefix "blog" before all standard posts. I'm using several custom post types, each with their own rewrite rules in the setup. How can I setup a custom prefix for my standard WordPress posts?
did you try defining your perm structure like: /blog/%postname%/ If each one of your custom post types has its own slug defined, this should work like you are asking.
How do I set a custom base URL for standard posts?
wordpress
On the WordPress archive template I am using a custom excerpt function that includes a reference to <code> strip_shortcodes() </code> . For some reason, shortcodes are being rendered and displayed in the archive. Example: http://arisehub.org/blog/page/2/ Scroll down to "Sing a New Song with Joshua Cunningham" Notice th...
JW Player Plugin for WordPress does not register its shortcode like all other shortcodes, so <code> strip_shortcodes() </code> will not know about it and not strip it. In the code there is a note that this is because it uses argument names with a <code> . </code> in it, and WordPress does not support this. There are pr...
Cannot strip JW Player shortcode?
wordpress
I want to add some custom fields to allow a user to select items from the Media library for the custom post (in the add/edit view) Is there a way to do this?
My answer will be in the form of links. The WPAlchemy meta box class supports this: http://www.farinspace.com/wpalchemy-metabox/ + tutorial http://www.farinspace.com/wordpress-media-uploader-integration/ A tutorial on how to do it, mainly javascript: http://www.webmaster-source.com/2010/01/08/using-the-wordpress-upload...
How do I add media to a custom post type?
wordpress
I am fairly new to WordPress, and I would like to have a list of the most recent posts in a certain category appear in a right-hand panel (I can do this with all posts, but not specific categories) I am using the Twenty Ten theme, on wordpress.com. I have found the following code, but unsure if or where this can be add...
The fastest way, a plugin: http://wordpress.org/extend/plugins/category-posts/
Display most recent posts in category with Twenty Ten theme widget
wordpress
Just curious if anyone knows of a plugin or a way to add sorting for Plugin searches in the Administration of a Wordpress site. I find myself searching through all kinds of plugins, ultimately just wanting to see what has the best rating or highest number of downloads. Kind of surprised Wordpress hasn't added this feat...
Good question, I have noticed it and couldn't (at the time) find a plugin that fixed it. My solution: Open the Wordpress Plugin Directory page and search there - you get a lot more options. Copy the plugin title over to your site's plugin admin page and search there - then install from there. It's quicker than download...
Plugin search sorting for admin section - Wordpress
wordpress
The code below is the function for pagination in my wordpress blog. Presently it outputs 7 pages and then the .. last page number. How can I reduce this number so it shows only 5 pages and then ... last page number? <code> function emm_paginate_loop($start, $max, $page = 0) { $output = ""; for ($i = $start; $i &lt;= $m...
I believe you're using 2 custom functions one of them is emm_paginate_loop() you're showing. But i saw that settings for that custom pagination is on function emm_paginate() and specifically "gap": 'gap' - Default is 3 (int). The minimum number of pages before a gap is replaced with ellipses (...). But that only sets a...
How to reduce the number of pages in pagination
wordpress
I need to know is it possible to somehow erase the original image uploaded via Gravity form : post image - post field?! With the situation now I receive 4 images. 1 original (can be whatever user has on his PC - up to 4 MB which clutters the server) and 3 which Wordpress creates according to specifications (thumbnail, ...
How about this: <code> add_filter( 'wp_generate_attachment_metadata', 'delete_fullsize_image' ); function delete_fullsize_image( $metadata ) { $upload_dir = wp_upload_dir(); $full_image_path = trailingslashit( $upload_dir['basedir'] ) . $metadata['file']; $deleted = unlink( $full_image_path ); return $metadata; } </cod...
Delete the original big size image after upload and leave only 3 images crunched by media gallery
wordpress
I've placed the following code in my functions.php file <code> if(!is_home()){ echo "Not Home";} if(is_home()){ echo "Home";} </code> However, no matter what page I'm on, I get "Not Home", And I'm real sure I'm on the home page, but still get "Not Home". What am I missing?
If you just place it in <code> functions.php </code> , not in a function in <code> functions.php </code> , it will be called too early. WordPress includes <code> functions.php </code> before it parses the URL and determines whether you are actually on the homepage or not. Since WordPress 3.1 there is an extra warning (...
is_home() returns false on the home page! When is the home page NOT the home page?
wordpress
So I enabled custom excerpts on my pages with this function. <code> add_action('init', 'page_excerpts'); function page_excerpts() { add_post_type_support( 'page', 'excerpt' ); } </code> However, When I enter a data into the excerpt field I still have the content returning in the loop instead of my newly added excerpt. ...
Perhaps try this: <code> &lt;?php global $more; $more = false; ?&gt; &lt;?php the_content('&lt;span&gt;Continue Reading&lt;/span&gt;'); ?&gt; &lt;?php $more = true; ?&gt; </code>
How do I pull excerpts from pages?
wordpress
I'm trying to create some pretty URLs for links querying multiple taxonomies. I'm using the "Taxonomy drill-down" plugin, although the main usage is now integrated @ the core it still has some helpful function for templating :) An example URL querying multiple taxonomies ( working ) would be: domain.com/?tax1=foo&amp;t...
<code> (.*) </code> matches everything, so it will "eat up" the extra characters (it is "greedy"). If the URL is <code> /tax1/foo/tax2/bar/ </code> , the first <code> (.*) </code> will be <code> foo/tax2/bar/ </code> , so nothing is left for the second match. Instead of <code> (.*) </code> you can use the "non-greedy" ...
URL rewrite rules for multiple taxonomies query
wordpress
I would like to create a navigation menu where I will be displaying two level pages. To illustrate that: Parent 1 Parent 2 Parent 3 (current) Child 1 Child 2 Child 3 Parent 4 So I would like to display all the parent pages in my navigation container but only display children pages when the user is currently on its pare...
This is pretty easy, as WordPress sets css classes for the parent pages. Default we hide all sublists (ul) from the menu with <code> .menu ul { display: none; } </code> Then when the parent page is selected we use the css classes that are set by WordPress to show the sublists again. <code> .menu .current_page_ancestor,...
Displaying Subpages while on Parent page?
wordpress
I'm developing a plugin that I'll install for all my clients to make WordPress slightly easier to use for them. One of the things it will change is the default TinyMCE configuration. It'll add things like <code> underline </code> and <code> justifyfull </code> to the first TinyMCE row. I know I could use other plugins ...
<code> tiny_mce_before_init </code> is a filter that gets the whole TinyMCE configuration , but there are filters that act on smaller parts of it, like <code> mce_buttons </code> for only the buttons . The advantage here is that they act on arrays, so it's easy to add or remove parts from them. This is how Vipers Video...
Adding TinyMCE buttons without removing plugin buttons?
wordpress
Is it possible to include or exclude specific named widgets that are assigned to a named dynamic_sidebar call? For example, if I've registered a sidebar named "my_sidebar" and the user had placed a "Links" widget into it, I want to be able to include or exclude it based on a custom setting in my theme options panel. Is...
<code> dynamic_sidebar() </code> calls <code> wp_get_sidebars_widgets() </code> to get all widgets per sidebar. I think filtering this output is the best way to remove a widget from an sidebar. <code> add_filter( 'sidebars_widgets', 'wpse17681_sidebars_widgets' ); function wpse17681_sidebars_widgets( $sidebars_widgets ...
Call dynamic_sidebar but include/exclude named widgets?
wordpress
I'm trying to add items to the admin bar but only for users with certain capabilities, such as <code> add_movies </code> in a plugin. The problem is that, according to stackexchange-url ("@toscho") and stackexchange-url ("@TheDeadMedic"), the plugin executes its code too early in the order of operations to use <code> c...
The check will be called too early if you just write it in your plugin file like this: <code> if ( current_user_can( 'add_movies' ) ) { add_action( 'admin_bar_menu', 'wpse17689_admin_bar_menu' ); } function wpse17689_admin_bar_menu( &amp;$wp_admin_bar ) { $wp_admin_bar-&gt;add_menu( /* ... */ ); } </code> Because it wi...
How to show a admin bar menu item only to users with certain capabilities?
wordpress
I'm trying to create a rather large and extensive settings page with various options of very similar type. Since there will be about 20 different fields, and the differences between most of those being simply their ID, I'd like to avoid creating a separate callback for each one. Is it possible to make a callback with a...
The last optional <code> $args </code> argument the you can pass to add_settings_fields() </code> is passed to callback. So it seems you can use same callback just fine. Hope I am right because I just stumbled onto this two minutes ago because of discussion in chat. :) PS looked through code and it's indeed relatively ...
Add_settings_field() parameterizing callback?
wordpress
I have noticed that when I am in my Dashboard and switching from main Dashboard to for example plugins, Twitter seems to be loading something. As I am located in China where Twitter is blocked, it always takes forever for my browser to realise that Twitter cannot be loaded, and thus before the page(s) finish loading. T...
problem not resolved, temporary solution is to add a host entry for the twitter host to point it to localhost as offered by @Dunhamzzz and explained further by @Roman and @Jan
Browser loading content from Twitter in admin area?
wordpress
I'm developping a plugin to manage a base of users and I'd like to show them in the same type of table used in other parts of the WP admin (post lists, user lists, etc.), I'd like to have the same look and the if possible the column sorting too.
You came to this in a bad time of changes. Tables in admin are being migrated from the old and scary ways to new shiny <code> List Tables API </code> using subclasses of <code> WP_List_Table </code> . Problem is - while classes are already in and being using core code, they are currently not meant for being used otherw...
How to use WP default post list tables in a plugin?
wordpress
I am working on a new version our site. Today I was going to put the blog on the new version. Our current website and the successor I am building are on different servers and accessed by different domain names. So what I did was import the database the blog uses into the dev site. Then I copied all the files and put th...
If you didn't hand-change the wpurl in the dev database, what probably happened is that you entered your url, and WP made a 301 redirect to the live site. Then, without realizing it, you changed the url config in your live site. To make it work: Put this in your wp-config.php <code> define('WP_SITEURL', 'http://your-wp...
Copying wordpress to another server breaks it on original server
wordpress
I have the following code generated by wordpress for my nav1: <code> &lt;div id="nav1"&gt; &lt;ul class="menusm"&gt; &lt;li class="page_item page-item-6"&gt;&lt;a title="Inicio" href="http://localhost/road/" class="top_level"&gt;Inicio&lt;/a&gt;&lt;/li&gt; &lt;li class="page_item page-item-11"&gt;&lt;a title="Quienes S...
jQuery Solution if you're using jQuery you can use: <code> var $li = jQuery('ul &gt; li:last-child','#nav1'); </code> to select your last menu child. Then after you select it you can chain it with another function: <code> $li.wrapInner('&lt;input type="button" value="My Button!"&gt;'); </code> Then all together: <code>...
Page menu with one image link instead of page title?
wordpress
If anyone can help me I would be gratefull! I got a gravity form with the post_type fields including the submit image when submited it displays the: title content image tags So my question is: When I go to single.php I posted a code: <code> get_related_author_posts(); </code> which calls the authors last two posts in f...
I would use <code> wp_get_attachment_image() </code> ( Codex ref ), which returns a fully-formed HTML IMG tag: <code> &lt;?php wp_get_attachment_image( $attachment_id, $size, $icon ); ?&gt; </code> I assume you already know how to get the attachment image ID? The default image size is <code> thumbnail </code> , but you...
How to: Retrieve an attachment image from post and output it
wordpress
I want my to reach my website's main page when entering an url like: http://example.com/blog However, I can't seem to get it to work with a typical rewrite rule: <code> RewriteRule ^/blog$ / </code> I'm always taken to my site's 404 page. Works fine if I specify a specific file (e.g. "/foo.html") instead of "/", but "/...
The redirect has to be a 301, not an internal request. Otherwise WordPress will search dor a page named blog . And you don’t need mod_rewrite. <code> # Apache 1.3 needs a complete URL RedirectMatch Permanent ^/blog$ http://example.com/ # Apache 2.x needs just the path RedirectMatch Permanent ^/blog$ / </code>
How to redirect a virtual page (e.g. /blog) to the home page?
wordpress
I don't think I ever had practical need to create folders/files in WP before, but for a plugin I need cache (for resized images) folder in <code> wp-content/uploads </code> . Which raises the question - do I really need to go through all the process with <code> Filesystem API </code> (including messily asking for FTP c...
<code> wp-content/uploads/ </code> should be writable for the server (otherwise it would be impossible to upload a file, no?). If you are going to create something under this directory, it is safe to use <code> wp_mkdir_p() </code> . I would only use <code> WP_Filesystem </code> if there is a chance the server does not...
Creating directory in uploads - wp_mkdir_p() or WP_Filesystem?
wordpress