question
stringlengths
0
34.8k
answer
stringlengths
0
28.3k
title
stringlengths
7
150
forum_tag
stringclasses
12 values
When developing plugins that requires data storage, what's the pros and cons of using one method or another ? The explanation given in the codex is not detailed: Before jumping in with a whole new table, however, consider if storing your plugin's data in WordPress' Post Meta (a.k.a. Custom Fields) would work. Post Meta...
Well, if I take the hat of a WP script kiddie, my answer would be: use post_meta, always. However, I happen to know a thing or two about databases, so my answer is: never, ever, ever, use an EAV (aka the post_meta table) to store data that you might to need to query. On the index front, there are basically none worth u...
Post meta vs separate database tables
wordpress
I installed the Deprecated Calls plugin and it's telling me to change <code> register_sidebar_widget() </code> and <code> register_widget_control() </code> , essentially add <code> wp_ </code> first. I did but I'm getting <code> Missing argument 3 for wp_register_sidebar_widget() </code> and <code> wp_register_widget_c...
The signature of newer function is different: <code> register_sidebar_widget </code> <code> ( $name, </code> <code> $output_callback </code> <code> , $classname ); </code> <code> wp_register_sidebar_widget </code> <code> ( $id, $name, </code> <code> $output_callback </code> <code> , $options ); </code> Can't simply rep...
Missing argument 3 for wp_register_sidebar_widget()
wordpress
Hi all, I'd like to hear what others who are delivering complex non-blog solutions to clients with WordPress as a platform what they are using for automated Regression Testing ? For those not familiar with the term "regression testing" Wikipedia defines it as: Regression testing is any type of software testing that see...
PHPUnit would come to mind, if the WP test suite wasn't so broken, and if WP had been designed and written in a way that it could actually be tested properly. ;-) More seriously, you can test your plugins all you want from their functional standpoint with unit tests and the like. The issue is that these tests won't gua...
Best Practices for Regression Testing WordPress Websites?
wordpress
I’m using Wordpress as a CMS for this site http://www.seadragon.co.uk/new_site/portfolio.html ...and it’s the first time I’ve ever used wordpress so sorry if I get the terminology wrong.... My client needs to be able to add new projects (case studies) to the portfolio section, and each of them can have it’s own slidesh...
A better solution would be to create a "Project" post type and a custom taxonomy to separate the different types of projects. I recently did this on my own website because I wanted a way to keep my projects separate from the rest of my content. I used jQuery cycle instead of Nivo but the concept is the same. Custom pos...
Multiple instances of nivo slider plugin
wordpress
Is there a way to overwrite a core function is the Wordpress core using a plugin? I don't need to inject code, I need to replace the function entirely with a re-written version. The specific function is wp_nav_menu_item_post_type_meta_box() in /wp-admin/includes/nav-menu.php Basically there's a lack of functionality th...
Not really, no. You can override built-in PHP functions, but not user-defined functions. However, all this function does is define a meta box. Why not define your own? Once you've got your own meta box defined and added, you can call <code> remove_meta_box </code> to remove the standard one: <code> remove_meta_box( 'ad...
Overwriting Core Wordpress Functions with Plugins
wordpress
Is there a way to use wp multifile upload system in my plugin?
You could always include the stuff related to swfupload, yes. But there will be a better way in WP 3.1: you'll be able to use the whole upload UI.
Use WordPress file upload in my plugin - on frontend and on backend?
wordpress
I'm using this piece of code to show related posts based on the tag of the post you are viewing. I'd like to modify is a little to exclude the related posts from the loop if they are in the same category of the post you are viewing Reason for this is i already have a loop to show related posts in the same category, so ...
Very similar to what you do with tags. Retrieve IDs of categories for current post: <code> $categories = get_the_category(); $cat_ids = array(); foreach($categories as $category) $cat_ids[] = $category-&gt;term_id; </code> Then exclude them in query: <code> 'category__not_in' =&gt; $cat_ids, </code>
Related Tags not in category
wordpress
Thanks to your suggestions, I enabled wp_debug and discovered flaws with my plugin. I have a filter for sorting posts by votes. I use it when the <code> sort </code> URL parameter is on. <code> add_filter( 'posts_where', 'votes', 10, 2 ); </code> I used to get <code> Undefined index: sort </code> so I modified my funct...
The variable you have named <code> $query </code> is actually the WP_Query instance having filters applied to it. You can simply call its function <code> get </code> to retrieve query vars. For example: <code> function votes( $where, $query ) { $sort = $query-&gt;get('sort'); if (!empty($sort) $where .= " AND $sort &gt...
Check if variable is set in filter
wordpress
I'm curious what dependencies <code> add_image_size() </code> has because I just copied a theme over to a new server and began adding thumbnails to custom post types only to find out that my request for hard-cropping is being ignored, and the images are kept proportional. functions.php <code> ... set_post_thumbnail_siz...
This particular issue was caused by an environment missing GD . After installing GD on the server, the issue was resolved. Of course you will need to go back and re-submit your thumbnails to have correct cropping, or use a plugin to retroactively recreate your thumbnails.
Server B handling add_image_size() differently than Server A
wordpress
Often times, a custom theme for Wordpress will require a dynamic content that reflects a relationship to a top level page of a site. Is there a Conditional Tag that will check if the current page is a grand-child (or separated by further generations) by ID?
Turns out there is an excellent function that has been passed around the Wordpress forums <code> is_tree() </code> <code> function is_tree($pid) { // $pid = The ID of the page we're looking for pages underneath global $post; // load details about this page $anc = get_post_ancestors( $post-&gt;ID ); foreach($anc as $anc...
How can I detect hierarchal relationships beyond children (grandchild, great-grandchild, etc)?
wordpress
I'm wondering how/if I can access more than the most recent X posts defined in the wordpress settings. I've seen plugins that migrate all blog content through RSS, haven't poked around to see their methods. Basically I manage a couple hundred WordPress blogs, and I'm building a newsletter generator for my clients. They...
Codex has example snippet on how to use <code> post_limits </code> filter to override amount set in admin for feed. <code> if (isset ($query-&gt;query_vars['feed']) and ($query-&gt;query_vars['feed'] == 'ics')) add_filter('post_limits','no_limits_for_feed'); function no_limits_for_feed($limits) { return ('') ; } </code...
Get all posts in RSS
wordpress
I have custom roles in my setup and I want to be able to automatically change a user's role thru a function. Say user A has a SUBSCRIBER role, how do I change it to EDITOR? When adding a role we just: <code> add_role( $role_name , $role_display_name , array( 'read' =&gt; true, 'edit_posts' =&gt; false, 'delete_posts' =...
See the WP_User class, you can use this to add and remove roles for a user. EDIT: I really should of provided more information with this answer initially, so i'm adding more information below. More specifically, a user's role can be set by creating an instance of the WP_user class, and calling the <code> add_role() </c...
How to change a user's role?
wordpress
I recently restored a WP multi-site 3.0.1 database from production to a staging environment, and when I try to login, I am being redirected to an HTTPS URL. The browser complains that the certificate is bad, and then when I click "proceed", it says page not found. I have cleared my browser cookies and all that good stu...
I figured this one out finally. It turns out that the data in the wp_usermeta table for user_id=1 (admin) was corrupted. This was apparently causing the SSL redirect issue when trying to login to any domains. Once I restored the proper data for user_id=1 into wp_usermeta, everything worked fine. I would much rather hav...
wp-login.php redirecting to HTTPS
wordpress
i need a help, i have a theme, where in i have a twitter widget, i just want to separate it, and keep it in different file, as if it is a plugin, here are is the complete code, what i have to do? this code was in file admin-functions.php <code> /*-------------------------------------------------------------------------...
Other than order of execution it doesn't really matter where code is run. In general case you can move code to Functions File ( <code> functions.php </code> ) of theme or create simple plugin and it will still work. In this specific case the code seems to be part of WooFramework so you will need to additionally check s...
Converting theme widgets to plugins?
wordpress
I installed WordPress on my website along with a theme close to what I wanted. I then changed virtually all the formatting to make it conform to my site. I don't plan on publishing my version, but I would like to make it my own so as not to confuse it with the original. I get notices about updates to the original and I...
The alternative to using a child theme is to make two adjustments to the current theme although technically only one is actually required. Update the theme name in the theme's style.css file in the commented section at the top, sometimes referred to as the theme's headers. Rename the theme's main folder, ie. <code> wp-...
How to Take Ownership of a Theme
wordpress
I see many methods of showing thumbnails in WordPress, but I'm not immediately sure how I could get only the path to a post's thumbnail rather than the html-ready code generated by functions like <code> the_post_thumbnail() </code> and <code> get_the_post_thumbnail() </code> . What methods are available to me to get on...
Thumbnail is essentially attachment so you can approach from that side - lookup ID with <code> get_post_thumbnail_id() </code> and fetch data with <code> wp_get_attachment_image_src() </code> , like this: <code> if (has_post_thumbnail()) { $thumb = wp_get_attachment_image_src(get_post_thumbnail_id(), 'thumbnail_name');...
Getting Thumbnail Path rather than Image Tag
wordpress
I am trying to output a list of categories per an article. I am using the following code, <code> &lt;?php wp_list_categories('child_of=270&amp;style=none'); ?&gt; </code> (string) Style to display the categories list in. A value of list displays the categories as list items while none generates no special display metho...
I came to a solution for this by reviewing the Wordpress Codex . The trick is to turn off the automatic echo of wp_list_categories, and then use str_replace(). My example follows: <code> &lt;?php $variable = wp_list_categories('child_of=270&amp;style=none&amp;echo=0'); ?&gt; &lt;?php $variable = str_replace('&lt;br /&g...
Remove line breaks in wp_list_categories()?
wordpress
I would like to install a plugin on 3 out of the 20 blogs I have going on my MutliSite WP 3.0. Is this possible?
The plugins folder is shared. You can install one copy of the plugin and activate it on three blogs and not the others. If you don;t want the others to be aware of the plugin's existence... you'll have to use another plugin to exclude it. http://wordpress.org/extend/plugins/restrict-multisite-plugins/ or http://wordpre...
Installing One Plugin on a Few Blogs on a MultiSite
wordpress
My Question: Is it possible to add custom dashboard widgets in the right hand column instead of only on the left hands side? I use <code> wp_add_dashboard_plugin( $widget_id, $widget_name, $callback, $control_callback = null ) </code> to add the plugin code, but it doesn't have any options to allow you to set the posit...
You're right - it doesn't. Neither does the <code> wp_add_dashboard_widget </code> function. So just use the generic <code> add_meta_box </code> and indicate dashboard and placement: <code> add_action( 'wp_dashboard_setup', 'my_dashboard_setup_function' ); function my_dashboard_setup_function() { add_meta_box( 'my_dash...
How to position custom dashboard widgets on side column
wordpress
Is it safe to use <code> $wpdb-> insert_id; </code> to find the <code> id </code> of a last updated <code> row id </code> just after an update? ex: <code> $sql = $wpdb-&gt;insert($table_name, $arrayWithDataToInsert, array('%s','%s')); $results['new_created_id'] = $wpdb-&gt;insert_id; </code> or am I running into the po...
At a higher level, there truly isn't any means to know if the php/db connector will return the correct id by relying on $wpdb-> insert_id. The only way to be 100% sure is to have add a key you know will be unique (and indexed as such); you can then retrieve the id by querying the table against that unique key. The reas...
Safe way to find last inserted id in a table?
wordpress
Please help me understand how to make Multicheck type for metabox. Search for all internet and nothing. Thanks. UPDATE @Jan I have a headache from this function. I dont know whats wrong.I'm trying your method but nothing, then I'm trying get_posts but with this method I have too many troubles. With your method I get th...
The post metadata can store multiple values either as distinct entries in the <code> postmeta </code> table, or as one entry with the value as a serialized PHP array. The serialization may require less code, but the distinct entries allow faster querying later ("give me all posts that have at least option A of the mult...
How to make multicheck for post/page meta box
wordpress
I've got a custom loop that I'm using to display some Real Estate listings that will be available within 60 days. I'm calling it with the following function: <code> &lt;?php $sixtydays = date('Y/m/d', strtotime('+60 days')); $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $query = new PostsOrderedByMeta...
I've run into this problem with PageNavi before. My solution is to hijack the $wp_query variable temporarily and then reassign it after closing the loop. An exmaple: <code> &lt;?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args=array( 'post_type'=&gt;'post', 'cat' =&gt; 6, 'posts_per_page' =&gt;...
Pagination not working with custom loop
wordpress
I added a filter to append a parameter onto the URL when navigating in categories. This is used to sort posts by their votes when browsing a category only if a <code> sort </code> parameter is set. For instance when you click view all posts with most votes, posts with high votes are displayed. From there you can view m...
If you take a look where the <code> category_link </code> hook is defined in category-template.php you'll see this particular hook passes on two variables. The second variable is the category ID, but your callback function treats that second incoming variable as a query object. Simply put, you're looking for a <code> q...
add_query_arg not working
wordpress
What do you guys use for A/B testing with WordPress? Knowing that WordPress has plugins for everything, I went looking for A/B testing plugin and didn't find any. It also looks like http://optimizely.com or similar solution may work together with WorpdPress. But I would much rather prefer managing everything in a singl...
This is not a straight WordPress solution but I would recommend a/b testing feature found in the Google website optimizer. http://www.google.com/websiteoptimizer/b/index.html . It works with your analytics account. You just need to create two (or more) pages in WordPress.
Best practices for A/B testing?
wordpress
I'm writing (rewriting) my plugin to use <code> wp_enqueue_script('jquery'); wp_enqueue_script('jquery-ui-dialog'); </code> Which is great! But to use the dialog I need to load a jquery style sheet with wp_enqueue_style, is there a way to load a built-in style, similar to the way you can load the built in scripts (as s...
I'm a little confused by your question, can you not simply use wp_enqueue_style, which you actually wrote into this threads heading(not sure if you know the function exists or not). <code> wp_enqueue_style </code> works in the same way as the <code> wp_enqueue_script </code> counterpart, but of course as you'd expect, ...
wp_enqueue_style built in styles
wordpress
I am writing a plugin that depends on modal dialogs for screen space. Right now I am using jQuery to create the dialogs, but I want a way that integrates better into the admin theme. Obviously WP has to have some sort of native dialog system (it's used for uploads). How do I access it?
The WordPress admin area uses Thickbox , which is still a jQuery plugin (jQuery is used all over the admin area). You need to enqueue the script and style ( <code> add_thickbox() </code> does this for you), and then all links that have class <code> thickbox </code> will be converted. You need to add some URL parameters...
Creating a modal dialog without jQuery
wordpress
i need some help how can i display custom taxonomies on selected pages? i mean i have 3 custom taxonomies location,duration &amp; courses i have created three pages where i want to display the terms of these custom taxonomies, i have displayed it on my posts by using function <code> &lt;?php echo do_shortcode("[terms]"...
If you want to display a list of all terms in a taxonomy, you can call <code> wp_list_categories() </code> and pass the <code> taxonomy </code> argument to get anything other than the categories: <code> wp_list_categories( array( 'taxonomy' =&gt; 'your-taxonomy' ) ); </code> If you want to use a shortcode for this, so ...
custom taxonomies on pages
wordpress
I hired a sysadmin to set up a VPS server for me and, unfortunately, it looks like things were not set up correctly. When trying to install and update plugins, I run into permissions errors all the time. WP Super Cache is the main issue as it causing my readers to run into 502 errors. Currently, my site does not load p...
It's a very loaded question, I'll try my best here, keep in mind it's 4am, so I'm just giving you highlights, not detailed explanations. Linux I'm assuming you're using a recent version of Ubuntu Change the default SSH port from 22, to something else (/etc/ssh/sshd_config). Either enable AllowGroups or AllowUser in the...
What are best practices for configuring a server for Wordpress sites?
wordpress
I've seen some tutorials showing how to create custom post types - the process seems straightforward enough. The issue I have with this is that the custom type information is part of the theme, and not handled by the WP core. So if the theme is switched for another, they custom type information is lost, and must be por...
Hi @Grant Palin: The <code> register_post_type() </code> function is really agnostic to theme or plugin ; you can use it in an <code> 'init' </code> hook in either place, it really depends on what you are trying to accomplish. For example, if I'm setting up a custom site for a specific client I'll probably just registe...
Use a plugin to handle custom post types?
wordpress
I currently have some custom post types "shops" (actually more like pages than posts) and a custom taxonomy "products" linked to those post types. I'm attempting to create a form (via shortcode) that allows the user to select one (or potentially more in the future) products that when submitted, shows a page listing sho...
Hi @Phil Brown: This is actually really easy (at least #1 and #2 are): You can use any URL that loads a theme template file. For example, you could create a WordPress " Page " and in your Page Template you can use PHP's <code> $_POST </code> array to capture your <code> &lt;form&gt; </code> values. Unless you've got a ...
Create page to handle form submission
wordpress
(Please note this is not a wordpress.org question) Hi everyone, I want every new post on my blog automatically broadcasted on twitter - the same thing is beautifully supproted with facebook. But I cannot find how to activate it on my blog at namgivu.wordpress.com. Please help if you know how to. Thank you!
Hi @Nam Gi VU: In general, this is not really a WordPress question. I'll answer it because I tend to be lenient about how related questions need to be but there's a good change another moderator will close the question and if they do I'll agree. Basically since WordPress.com does not provide this feature you need to us...
How to intergrate wordpress.com with twitter like the way it is with facebook?
wordpress
I'm using the <code> comments_popup_link() </code> function to show the number of comments for each post in a loop. <code> &lt;?php if (have_posts()) : while (have_posts()) : the_post(); ?&gt; &lt;?php if ( get_post_meta($post-&gt;ID, 'thumb_value', true) ) : ?&gt; //something &lt;?php else: ?&gt; //something else &lt;...
Your template code includes <code> $wpdb-&gt;print_error() </code> . This function prints the last database error between <code> [ </code> and <code> ] </code> brackets, and the executed SQL code. But if there is no error, you just see the empty brackets and the SQL. <code> $wpdb-&gt;show_errors() </code> is used to en...
WP database error for comments_popup_link()
wordpress
After reviewing plugins that deal with user roles and capabilities I concluded that I might be better off just hardcoding my settings into my functions.php file. This actually worked out well for me in end effect but I kept running into an issues while I was finalizing the code. As I am sure many of you know (and I end...
The plugin Members is your solution, clean code for read, change and create roles and capabilities; easy and fast. No custom tables and normaly WordPress standard.
Roles & capabilities GUI that does not create separate table
wordpress
I've created a custom taxonomy "foo" with rewrite slug "foo" and query_var "foo". Say for example, I also have terms "bar" and "baz" in the "foo" taxonomy. At the moment, permalinks like <code> /foo/bar </code> and <code> /foo/baz </code> work fine, using my <code> taxonomy-foo.php </code> template. What I'd like to do...
What you want is an index page for custom taxonomies . There is a ticket for that , but it's not clear what is the most obvious thing to show on this page: 1) a list of all posts attached to any term of that taxonomy, or 2) a list of all terms of this taxonomy? Remember that <code> category </code> is also a taxonomy, ...
Custom taxonomy listing page when no term set (all terms)
wordpress
I've never used version control before, but I'm starting to work more collaboratively on WordPress plugins and themes and I think it would be a good idea to have a record of versions and updates. WordPress seems to favour SVN, but Git seems to be the new, cooler alternative. Which version control do you use currently? ...
I use Git for all my projects since it lets me work offline and that happens fairly often for me. Git can interface with SVN if you'd still like to use Git then push your plugins to WordPress.org. http://www.nkuttler.de/post/using-git-for-wordpress-development/ http://hakre.wordpress.com/2010/09/28/git-rocks/
Should I use SVN or Git?
wordpress
i'm looking around for a solution since weeks and can't make anything work yet. the problem is that my server is running debian/lenny and it's not supporting the bundled gd_lib which i need for thumbnailing/cropping stuff. but i could make use of imagick or imagemagick (package vs plugin). my question is: is there any ...
Yes! Orangelab has built a plugin which can replace WP's use of GD with Imagemagick (provided it's already installed on your server - it's not included) for creation of all image sizes and thumbs, and even regenerate existing images too! For anyone who cares about image fidelity, this is huge deal, as GD does not handl...
is it possible to replace the use of gd_lib with imagick or ImageMagick?
wordpress
I have a post having different links. I have to show number of clicks on each link. Is there any link to show number of clicks on the link?
WP-Click-Track http://wordpress.org/extend/plugins/wp-click-track/ The click tracker works in 2 modes: Scans posts and rewrites them to include a tracking element Enables users to create stand alone trackable links that can be embedded in posts or offsite.
Is there any plugin to show number of clicks on the link?
wordpress
I am currently building a plugin and it doesn't know when a user is logged in. <code> global $current_user; echo $current_user-&gt;ID; </code> It works when embedded on a template but not on a plugin? I have a custom database that depends on user_id, whenever I insert a record, user_id field always has a zero value whi...
The $current_user global isn't setup until right before the 'init' action is called. So any code using it shouldn't be fired until that action or later. I would also suggest using the get_current_user_id() method instead of getting the global directly.
Will a plugin able to know is_user_logged_in?
wordpress
I'm using the Multisite functionality of WordPress 3.0, and I have a network of sites built where I display one random post from one of the subsites on the main site's front page. I accomplish this, in part, by using the <code> switch_to_blog </code> function from the old WPMU function list. Up until yesterday I could ...
It appears that switch_to_blog might be too unpredictable to rely on for major site design. Here's my first attempt at a SQL-based solution. <code> function get_intro_post($blogid, $thumb_size='') { global $wpdb, $post; // Get the system defined table prefix $prefix = $wpdb-&gt;prefix; // Create a full table prefix by ...
Why would switch_to_blog stop working?
wordpress
I created an author's page using: <code> &lt;?php if(isset($_GET['author_name'])) : $curauth = get_userdatabylogin($author_name); else : $curauth = get_userdata(intval($author)); endif; ?&gt; </code> and then a standard loop, which displays all posts' titles published by that author. I'm trying to separate the display ...
If you're using an author template there's absolutely no need to setup(set) the author query parameters, they'll be setup ready in the query object present on the author page.. You could additionally avoid the need to create numerous queries(one per category currently), by iterating over the query you have, extracting ...
Display posts separated by Category in Author's page
wordpress
I created a custom URL parameter for sorting posts by their vote scores. I have a "most voted" link that sends a <code> ?sort=most_voted </code> URL paramater and using a query posts filter I display posts with most votes. If for instance I want to display most voted posts in category 5, I'll need a URL like this <code...
You will need to intercept the links generated by WordPress and append the query var onto the relevant URLs. You can do this quite easily with a filter on category URLs with something like... <code> function add_my_query_var( $link ) { $link = add_query_arg( 'sort', 'most_voted', $link ); return $link; } add_filter('ca...
Preserve custom URL parameter on more pages
wordpress
I've got a plugin that needs to interogate the post preview (the contents of the rendered page that's presented when the user clicks "Preview Post". To attempt to obtain this input stream into a code variable, I'm using wp_remote_get like so: <code> $response = wp_remote_retrieve_body( wp_remote_get( 'http://localhost/...
Have you checked out the following plugin? http://wordpress.org/extend/plugins/public-post-preview/
How can I call "preview post" from wp_remote_get with authentication?
wordpress
I'm seeing a lot of visits in my Analytics to my home page with the query string "?cat=2-5-results". These pages are getting a lot of traffic. To the best of my knowledge, I'm not using this parameter on my site anywhere. If I google "wordpress ?cat=2-5-results" I find a lot of other sites with the same phantom pages. ...
It's used (together with the search query) to measure number of results for a search query, it's not supposed to show up in Analytics like this, this could only happen due to people scraping your site and clicking through to the actual URL...
What does ?cat=2-5-results mean at the end of URLs?
wordpress
I'm making my own comment template (stackexchange-url ("like this")) and I need to know how can I get the comment and ping count for the current post, maybe using a fast database query or something like that? Note that I can't use <code> count($comments) </code> or anything like that, because I'm not running the defaul...
you can use this custom function in the functions.php of the theme: <code> /** * count for trackback, pingback, comment, pings * * embed like this: * fb_comment_type_count('pings'); * fb_comment_type_count('comment'); */ if ( !function_exists('fb_comment_type_count') ) { function fb_get_comment_type_count( $type='all',...
Fastest way to get the comment and ping total count for a post
wordpress
I'm adding voting features to a theme. Visitors can vote posts Up or Down. I created a table for storing number of votes for each post and that works fine. Now I'm trying to sort posts by their votes. I have "voted up" and "voted down" links. For instance, when you click on "voted up" a new parameter <code> sort=up </c...
If you have your data in separate table adding support for it in query is somewhat messy. Basically you will need to filter <code> posts_where </code> and <code> posts_join </code> to modify raw SQL query so that your custom table is joined and checked against your custom values. As per [faster :)] anu's suggestion it ...
Custom query_posts() parameter
wordpress
Using a WordPress multisite network with Buddypress. In order to modify the top nav bar, I've written a function to replace part of the menu. Calling it thus: <code> add_action('bp_adminbar_menus', 'new_adminbar_blogs_menu', 6); remove_action('bp_adminbar_menus', 'bp_adminbar_blogs_menu', 6); </code> Works perfectly in...
I am not sure about BuddyPress specifics. In general case remove doesn't work when it is firing before function is actually added to the hook. Between core, plugins, parent and child themes there are a lot of relative combinations of add/remove possible. In such case to make remove fire properly you need to wrap it int...
Why doesn't remove_action work in my plugin?
wordpress
Warning: Invalid argument supplied for foreach() in /.../ipn_res.php on line 28 Warning: Invalid argument supplied for foreach() in /.../ipn_cls.php on line 30 From line 28 is a foreach loop: <code> foreach ($paypal_ipn-&gt;paypal_post_vars as $key=&gt;$value) { if (getType($key)=="string") { eval("\$$key=\$value;"); }...
Contact plugin's developer and ask him to fix?.. But I guess that is probably not an option if plugin is broken badly and remains that way. For a quick band-aid try this right after object is created, to handle case of constructor not setting up field properly: <code> if( !isset( $paypal_ipn-&gt;paypal_post_vars ) ) $p...
Plugin could not be activated because it triggered a fatal error?
wordpress
I'm displaying the comments for a post my way, using <code> $comm = get_comments() </code> and then passing <code> $comm </code> to <code> wp_list_comments() </code> (stackexchange-url ("this is the reason why")). How to disable WordPress from loading comments from the database into <code> $wp_query </code> , when the ...
You can't prevent <code> comments_template() </code> from making an SQL query. Well, you could maybe hook into the DB layer to prevent just that specific query, but that would be very cumbersome to do. If this is for a theme, you could just remove the call to <code> comments_template() </code> and replace it with your ...
Prevent WordPress from loading comments
wordpress
I have a ajax request hooked on "template_redirect" (the ajax requests the post's url), and I want to display only the comment template: <code> function get_comm(){ if(isset($_GET['get_my_comments'])): $offset = intval($_GET['get_my_comments']); echo $offset; // offset will be the same as "cpage" global $comments, $wp_...
<code> $comments </code> , or <code> $wp_query-&gt;comments </code> , is initialized by <code> comments_template() </code> , which you call in your template file when you want to load the comment sub-template file. So at the time of <code> template_redirect </code> it is not yet initialized. As Chris said, you should c...
Getting $comments outside the comment template
wordpress
I'm trying to create a custom post query for sorting posts that have been voted "thumbs up". I'm joining my custom "wp_post_votes" table (which stores the number of votes each post received) with the default "wp_posts" table and displaying posts <code> WHERE votes &gt; 1 </code> . The WHERE cause is causing an SQL erro...
Should be: <code> $where .= " AND voted &gt; 1"; </code> Other notes: instead of hardcoding table names you should use <code> $wpdb-&gt;prefix . 'post_votes' </code> ; instead of checking in global <code> $_GET </code> you should declare your filters as accepting two arguments and code functions accordingly, these filt...
SQL error with custom query
wordpress
Hi I have a website like www.shankpress.com, it is wordpress v3, and i want my users to have blogs hosted in my site and have url like: blogs.shaknpress.com...and I can show who got the most popular blog entry etc... users can openly register, create a blog, start blogging and so on ... I am willing to buy solutions if...
To run multiple blogs on single installation of WordPress you need to enable and configure <code> multisite </code> functionality, see Create a Network . While that will take care of basics, managing network of blogs controlled by users (rather than single admin/team) reliably and securely will likely require much more...
Host a blog engine in my wordpress site
wordpress
I am in the process of developing a new theme for my blog and am making a featured content slider. The issue that I am having is getting wordpress to force the image to the dimensions that I want it to be. The exact dimensions are 494px x 168px. I've tried simple using <code> the_post_thumbnail( array(494, 168) ); </co...
For post thumbnails you can either crop and image to the thumbnail size or scale the image. To enable crop you can call the thumbnail 1 of 2 ways. Name a size in the functions.php file like so: <code> &lt;?php add_image_size( 'my-post-thumbnail', 494, 168, true ); ?&gt; </code> and then call it in the theme file <code>...
Featured Image Size
wordpress
I've just installed Wordpress here at arun.sanspace.in But, don't know why, it doesn't display any images. I want to know why? I have another Wordpress installation on the same server which works great. What exactly is the problem here? Am I doing something wrong? While I copy the image location from the placeholder an...
I've figured it out. I had enabled hotlink protection. I installed the new blog in a new subdomain which was not added to the hotlink protection. So, it prevented the image requests. Now I added to the list and everything's fine. Silly me. :-(
Why no images on a fresh Wordpress installation?
wordpress
I am creating my first ever plugin for a membership site. I have a custom table named <code> subscription </code> with a <code> subscr_user_id </code> column whose values are taken from <code> $current_user-&gt;ID </code> . So when a current user subscribes, a new record is inserted into the table where <code> subscr_u...
You need to tell $wpdb what subscriptions when initializing your plugin: <code> $wpdb-&gt;subscriptions = $wpdb-&gt;prefix . 'subscriptions'; </code>
How to query custom db table?
wordpress
I'm working on a site which has a fully customized front page. Now I'm asked to add a more classic looking blog type page which will be reacheable at <code> http://domain/blog </code> . I tried creating a custom (empty) page called <code> blog </code> and put some code into <code> page-blog.php </code> , but the proble...
Hi @Kemp: Assuming you are using WordPress v3.x (as I don't remember how this works in earlier versions) this is what you need to do if starting from scratch: Create a " Page " and call it "Home Page" (or whatever.) Create another Page and call it "Blog" (or whatever.) In the admin console select the "Settings" > "Read...
How can I create an alternative home page?
wordpress
I am not sure which solution here would work best as a solution but what I am looking for is just a simple way to enter an optional domain through a metabox on the page edit screen and then just select a template from the default page templates wordpress uses. I am assuming there must be a simple way to accomplish this...
This code will allow you to set a custom meta value, and if the domain name (or subdomain if you edit the code) matches it, the query will be changed to match that post. The page template will only be used for that request, not for requests via the "normal" URL. This does not change links on that page: should they go t...
How to let a single post have its own domain name
wordpress
How can I add a page to the menu and define for the menu item that all subpages should be included by means of a simple checkbox?
you might be interested in one of my threads. Here: stackexchange-url ("How to Hard Code Custom menu items") Thanks!
Default menu editor with automatic page list
wordpress
(Satisfying minimum text requirement)
Here is a code I used to do it: <code> // make category use parent category template function load_cat_parent_template($template) { $cat_ID = absint( get_query_var('cat') ); $category = get_category( $cat_ID ); $templates = array(); if ( !is_wp_error($category) ) $templates[] = "category-{$category-&gt;slug}.php"; $tem...
How can I make all subcategories use the template of its category parent?
wordpress
I am using multipress, but users with small screens cannot access the HTML tab as the Publish meta box has a div that slides above it, disabling the ability to click it. One idea is to force a single column layout, but there are no options for this in screen options. Is there another way to do it?
You can use the filter <code> screen_layout_columns </code> to set only one column for the post screen <code> get_user_option_screen_layout_post </code> to force the user option to 1. The following code will do it: <code> function so_screen_layout_columns( $columns ) { $columns['post'] = 1; return $columns; } add_filte...
how do I force a single column layout in screen layout
wordpress
Can you recommend a plugin that enables notification on multiple email addresses on posted comments? Looking for a plugin that both notifies a global list of email addresses and the author of the post.
Use this plugin: comment notifier http://wordpress.org/extend/plugins/comments-notifier/
Notify multiple email addresses on comments
wordpress
I want the links widget in my sidebar to display links based on the page the user is on. For example, if the user is on the home page I want it to display link1, link2 and link3. But if the user goes to the 'About' page I want the links widget to display link4 and link5. Is there a way to specify conditional display of...
Widget Logic http://wordpress.org/extend/plugins/widget-logic/ Also Query Posts Widget is very useful http://justintadlock.com/archives/2009/03/15/query-posts-widget-wordpress-plugin
Conditional Display of Links in Widgets
wordpress
I'm making a custom query for posts using something like: <code> $p = new WP_Query(); $p-&gt;query(array('offset' =&gt; 30, 'posts_per_page' =&gt; 10)); </code> If I have 36 posts on the entire blog, <code> $p-&gt;post_count </code> will return the number of posts that were retrieved, 6 in this case. I need to get the ...
The found_posts property <code> $p-&gt;found_posts </code> will return it.
WP_Query with the "offset" argument
wordpress
( Moderator's Note: Original title was: "Steps to move multiple wordpress installations to a WP MU installation") Any tips on moving multiple WordPress installations to a single Multisite[1] installation? [1] Multisite is the new name for WPMU.
For the record MU functionality was merged into core and is now referred to as <code> multisite </code> . Codex has guide at Migrating Multiple Blogs into WordPress 3.0 Multisite
Steps for Moving Multiple WordPress Installs to a Multisite Install?
wordpress
I have a php file with some variables which I would like to use. When I include it in the header.php the variables in that file are not recognized at footer.php and some other places. Where is the best place to include this file so its content will be shared all over the wp files.
Variables have a certain scope. The PHP Manual explains that in detail . So when you set a variable you should know in which scope those are set. This depends on where you set them and how that file gets included. As Rarst already suggested, the function.php file is an ideal place as it gets included on the global spac...
where to include a php file
wordpress
Is it possible to remove a broken theme from WordPress using only the WordPress dashboard? i.e, without using cpanel or FTP? Background: When you are doing customer support, its rare that you have access to the user's FTP or cpanel, but its pretty simple for them to set you up as a temporary user to troubleshoot their ...
You can use <code> Appearance &gt; Editor </code> to kill theme's header in <code> style.css </code> . Won't really remove it, but will prevent it from showing up as available in WP.
How do you remove a broken theme from WordPress Admin (without FTP or Cpanel)
wordpress
How can I customise the the new user welcome email ? I tried 'http://www.sean-barton.co.uk/wordpress-welcome-email-editor/' however it conflicts with some of the other plugins I need to use, Cimy Extra Fields. There is one other plugin that is to old for wordpress 3.0.1. Will
SB Welcome Email Editor works by replacing <code> wp_new_user_notification() </code> with an own version. The original version can be found in <code> wp-includes/pluggable.php </code> , the plugin uses an elaborate replacement with all kinds of options. You can do this to: create a new plugin (just a PHP file in <code>...
How do I customise the new user welcome email
wordpress
I'm getting 3 very similar phpMyAdmin errors on one of my WordPress databases. <code> More than one INDEX key was created for column `comment_approved` More than one FULLTEXT key was created for column `post_title` More than one INDEX key was created for column `lead_id` </code> Anyone know how to resolve these?
As it writes, a problem with the indexes definitions of those tables. Please try a repair on the reported table and see if that helps. Have you activated a specific add-on lately or did you alter tables?
What do these phpMyAdmin errors mean on my WordPress databaes?
wordpress
For a plugin, I need to build my own very early post content and comment content filter. Post content/text changing works, i.e. the modifications end up in the client's browser. But my comment content/text modifications somehow are not persistent, i.e. the client receives the original comment text. The point in time I ...
The function that includes the comments template also (re)loads the comments . This means that whatever you do before that point, if you don't save it to the database it will not be used. There is no way to prevent this SQL query from happening, but you can override the results by hooking into the <code> comments_array...
How modify the comment content persistently based on $wp_query?
wordpress
What causes this error (generated while uploading any theme to this WP site) <code> Unpacking the package… Incompatible Archive. PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir Record signature </code> I've tried to upload several different popular themes to the site.
This error comes from the library that manages ZIP formatted archives: http://www.phpconcept.net/pclzip/user-guide/19?showall=1 After a quick web search, two solutions came up: 1) Which version of WordPress are you using? For version 2.8 this seems to be a known and fixed issue. Hence, an update of WordPress could help...
Incompatible Archive. PCLZIP_ERR_BAD_FORMAT (-10)
wordpress
I have WP Multisite and now I want to track the different sites. I'm using Multisite Domain Mapping to map <code> www.mysite.com </code> to <code> http://subsite.mysite.com </code> My questions is: a) Do I need to add the same google analytics script to all themes? b) when creating the script at GA, I have the followin...
Hook the script into the footer, which is easy enough. http://wpmututorials.com/plugins/how-to-hook-into-the-footer/ As stated in the post, toss that into mu-plugins, it will track all your site, regardless of domain. GA can sort it out on their end. totally do-able.
What type of Google tracking should I use?
wordpress
Because it's not working for me. This code checks if a user has just registered. I want to redirect him to a custom page if so. Otherwise, redirect him to the homepage or admin page. <code> function mylogin_redirect($redirect_to, $url_redirect_to = '', $user = null) { if( $user-&gt;ID ) { $user_info = get_userdata( $us...
Probably because the global <code> $current_user </code> isn't valid yet, which is used by <code> current_user_can() </code> . However, you can use this instead; <code> if ($user-&gt;has_cap('manage_options')) { return admin_url(); } </code>
How to use current_user_can()?
wordpress
In the code below, I'm attempting to get a reference to the body content of the current post's fully rendered preview... <code> $response = wp_remote_retrieve_body(wp_remote_get('http://localhost/mysite/test-post/?preview=true&amp;preview_id=28&amp;preview_nonce=640bc54ca4')); $post-&gt;post_content = $response; </code...
The URL is okay, what you need to add are cookies that authenticate you as the user who is allowed to see the preview. That is basically sending headers. I would start with the HTTP API (Wordpress Codex) looking for a method to add additional HTTP headers and set your cookies. Otherwise - because probably this is somew...
What URL do you pass to wp_remote_get to load the body of the current post's preview?
wordpress
The code below resides in my theme's functions.php and creates a custom upload icon on top of the WordPress content editor, alongside the default upload icon. Images uploaded via this icon get a special flag in wp_postmeta called _imageTop to differentiate them from standard attached images (to allow me to do special t...
1) The attachment_fields_to_save filter does not get applied, even though I can see the echo'd text inside the media-upload.php window. I know this because the _imageTop meta only gets written to the database when I comment out the if(isset) check Try to exchange $_GET with $_POST and see if it works. If so, you need t...
Custom attachments uploader code. Almost there!
wordpress
I have problems to checkout the wordpress.org plugin repository via SVN on <code> https://plugins.svn.wordpress.org/ </code> . First it starts all looking well: <code> &gt;svn --force checkout https://plugins.svn.wordpress.org/ A plugins.svn.wordpress.org\lumberjack ... </code> But while it progresses, it gets stuck: <...
Okay, looks like this is a problem with windows. I tested this now under linux and it worked like a charm. I have no idea what is causing this, but that specific plugin which is problematic is looking wired in svn anyway. So solution is to use a SVN client on linux. It just works.
How to checkout the wordpress.org plugin repository?
wordpress
Off Topic? Maybe, point me to where this would be On Topic! Hi All, My daughter attends a private school. Recently their wordpress website was hacked and they need some help cleaning it up. I don't have the experience with wordpress to help. Are there services or websites that they could use to find the expertise to he...
See FAQ: My site was hacked « WordPress Codex and How to completely clean your hacked wordpress installation and How to find a backdoor in a hacked WordPress and Hardening WordPress « WordPress Codex
Need help cleaning up a wordpress site after being hacked
wordpress
Hello I am wandering if anyone can recommend, from first hand experience, a reasonably simple CRM or project management plugin for wordpress. I have read stackexchange-url ("this question on the topic.") But am looking for slightly more detail and if possible someone who has actually used one of these. The functionalit...
The only project I know that is viable is rolopress, download it and see what you can adjust. FYI I have a related question open here: stackexchange-url ("stackexchange-url but for a PRM. But the thing you are looking for is I think not a CRM system but a PM/software project system, all your requirements are met with R...
Can anyone recommend a wordpress based CRM/Project Management system or plugin?
wordpress
Part of a voting script I'm working on: I'm checking a custom table in my WP database to see if a user already voted for a post by checking the IP address and the post id. If the user's IP already exists for the post they voted, I want to echo "Already voted!" otherwise add the IP. This is what I came up with.. <code> ...
On your <code> if() </code> , it should be like this: <code> if (!($wpdb-&gt;get_row("SELECT voter_ip FROM " . $wpdb-&gt;prefix . "voter_ips WHERE post_id = $post_id AND voter_ip = '$voter_ip'") </code> Notice the quotation mark added on <code> $voter_ip </code> .
if statement on database query
wordpress
The code below if from my WP plugin which gives a filtered listing of categories excluding the "uncategorized" category from display. However, when the user chooses "Show Hierarchy" from the widget setup options, the resulting display includes "uncategorized". Given that I've placed 'exclude_tree' => 1 into the $cat_ar...
It's hard to say from your code. The <code> exclude_tree </code> parameter of wp_dropdown_categories() is pretty undocumented in codex. It's making use of get_categories() which does not list it at all. If you don't have children within that category, you can consider to use the <code> exclude </code> parameter instead...
How to exclude "uncategorized" from custom categories widget?
wordpress
I'm working on my wordpress site, and I want to have a page that shows all posts from the category 'portfolio' on a separate site. I'm using the following technique: http://codex.wordpress.org/Pages#A_Page_of_Posts However, on my testblog this works fine ( http://dev.litso.com/portfolio-2/ ) but on my live blog it does...
So, apparently I accidently copied the comment <code> Template Name: Portfolio </code> to my page.php as well, so when I selected the 'portfolio' template wordpress just picked page.php out of the two possible templates. May be a warning for other people that have this problem :)
Page with posts from category doesn't work
wordpress
This div element is causing a big gap on my wordpress page, specifically on the single post page. It's nowhere in the themes, I can't seem to find where this div element is coming from. Have you encountered this before (the highlighted element)? PS : Happens on chrome only. UPDATE: Still having this problem even with t...
It looks to me like JavaScript for your lightbox. edit If this only happens in Chrome, there is a rendering bug that has gone unfixed for quite some time. Add height:100%; to the body or html element in your css.
Where's did this div element come from?
wordpress
My theme options save routine is below. I'm finding that if the $value['id'] being passed from my options array has a period in it, the data does not get passed and the options appear to break at that point. Should I opt for another character or is there a workaround for using the period character in an option name? Fo...
Dots and spaces are replaced by PHP for array indexes via POST and GET. That may cause your problem.
Dot "." in option value foobars save options function
wordpress
While I've typically used include or require on their own to save long term code maintenance I've started to use get_template_part and locate_template as using built in WordPress stuff is always best. My question is are you supposed to be able to pass variables through to the results of either get_template_part or loca...
Like stackexchange-url ("MathSmath wrote"), get_template() does not support the re-use of your variables. But locate_template() infact does no inclusion at all. It just locates a file for inclusion. So you can make use of include to have this working just like you expect it: <code> include(locate_template('custom-templ...
Passing Variables through locate_template
wordpress
I am using Breadcrumb NavXT plug-in in my pages but now I am facing a problem I need to hide the "Home" link in some pages. I can do that either by hiding it in CSS or by not creating it at all. in PHP If I want to use CSS - I dont have any indication for first link and its "> > " separator - there is no id or special ...
Update stackexchange-url ("Mtekk's answer") does basically what I was suggesting w/o the need to touch the plugin itself, so my answer is of quite theoretical nature. stackexchange-url ("He describes how to do that easily"). I think the easiest thing for doing so as you're mainly confident with the plugin (saying somet...
recommended breadcrumb plugins with possibility for hiding "Home" link
wordpress
In the w3 total cache there is the option to set the time until the cache is flushed (and thus, recreated on the next time a visitor comes by). My question is, assuming I've got a lot of content on my site that doesn't change almost ever, why would I not just set the caching to stay for days (instead of getting flushed...
The one possibility is caching broken page. For example some database query fails (which is not uncommon in shared environment and/or under load) and some page gets displayed broken / with errors. Since caching doesn't assume integrity checking it can cache such page... And your cache interval is days - page is broken ...
Should the page cache be refreshed often?
wordpress
I am writing a plugin where I have custom taxonomy (category). I want to prevent any user from deleting some of custom categories . Is there any way how to do so. Let's say that category with id1-id10 nobody (admin included) can delete.
If you want to prevent deleting a single or a list of category IDs within the admin, you can prevent so by blocking all requests that delete the category. There is no hook in wordpress you can make use of to use easily, but there's always a work-around. In my example I use the <code> check_admin_referer </code> and <co...
can I prevent WP users (even admin) from deleting custom categories?
wordpress
Is there a way to change the default text paragraph style in WP without changing CSS by hand? I.e. I need GUI for that. In particular, I want to configure padding height between paragraphs.
It depends on your theme. With most themes you'll have to manually edit the CSS to do this. But some themes have control panels that allow you to make changes to the design without editing the code. If you'd rather not write code but would like to make changes to your site, I'd suggest using a theme with design options...
Configure paragraph style without editing CSS
wordpress
This seems to be a Thematic theme bug becuase if I switch to other themes, everything is working as expected. This is not the first time I created a frontpage using a static page. I made sure I followed this: http://codex.wordpress.org/Creating_a_Static_Front_Page . Any idea pls?
You should definitely check this page : http://themeshaper.com/forums/topic/posts-inside-the-pages-and-subpages
Why does my Posts page only show a single post when using Thematic?
wordpress
I've installed a wordpress site for a client. The site resides on mttv.co.il For some reson I'm being locked out of the system most of the time with no error message displayed The system takes the login &amp; password and just redirecs me back to the login page. Any help would be much appreciated
If worpdress redirects you back to the login and password page (and not displaying any info that login/password was wrong), this is a sign that the login session is broken. Most often this is related to cookies. Wordpress needs cookies for you to login. If cookies are not properly set or deleted later or are just mis-c...
Why am I locked out of the system?
wordpress
I'm using an IFRAME to let multiple sites embed one interactive element. On the IFRAME's actual page it works fine, and it looks fine on another website I embedded it. But when I embed it in a WordPress blog, all my apostrophes show up as squares. I tried removing all smart quotes and apostrophes with "dumb" quotes, no...
The apostrophs get translated in <code> &amp;#39; </code> for the apostrophs, i guess it is an xss security feature. Check settings > reading > encoding (UTF8) but im not sure. (maybe the theme sets another encoding fixed in the header instead of reading the global variable). In any case your embed show correct in my W...
WordPress kills an IFRAME's apostrophes
wordpress
I'd like to insert some mysql data into every new blog that's created on my buddypress system. How can I hook up to the newly created blog data? ID, for example, would allow me to insert it right from the PHP. Is there a better way to do it? Thanks!
see: stackexchange-url ("How To Modify New Sub Blog Immediately When Super Administrator Creates It?") The code I wanted to post I unfortunately could not post beacause "body is limited to 30000 characters; you entered 62367" so ... the following filters are handy (from WordPressMU plugin for site admin to set defaults...
How to run scripts when a new blog is created in Buddypress?
wordpress
Edit I removed the original Question as this Q has far above 1.000 views now - which means it's important to a lot of people - to show you something that works a) without a custom Walker &amp; b) is easy. Note: I only removed to original Q, because it was pretty unspectacular. The Task Add css classes to all nav menu i...
I'm going to start by saying something similar to Horttcore.. Is there a reason you can't simply provide a differing container element for the given menu, it should provide enough specificity to style it uniquely. Although, you could do something like this to conditionalise menu args based on the menu's location.. <cod...
How to add (css) classes to only one wp_nav_menu()?
wordpress
I've created some custom metaboxes for my post write screen. Is there any way to make some of them display collapsed by default? Just in case I'm not using the correct terms or not being clear in my question I will elaborate: The metaboxes on the post write screen have a toggle switch in the upper right hand corner of ...
To display a metabox collapsed or closed by default, it is good to know that adding <code> closed </code> to it's class attribute will display it closed. All meta-boxes main divs that have <code> closed </code> in their classname, are displayed in the closed form. When the arrow is clicked it will be removed or added (...
Make Custom Metaboxes Collapse by Default
wordpress
I have a multi lingual site. On the site I want to display youtube movies using fancybox (or any other equivalent solution) The plugin is installed and set. When checked on the He version - all works well. On En on the other side, it redirects to youtube. EN: http://www.mtbsuisse.com/en/category/videos/ HE: http://www....
Got a different solution. Just replaced wp-fancybox-easy with wp-lightpop . Wp-lightpop works wonderfully out of the box. 2 changed I needed to do were: 1. go to the setting page and change the links to be displayed as popup (otherwise it's open the language navigation links as overlay) 2. change box style (look&amp;fe...
Fancy-box Esay wordpress plugin fails to work on Multilingual site
wordpress
I'm getting the feeling that adding Widgets via MySQL query is not as simple as I thought. I was under the impression all data is stored in the <code> options </code> table, but it seems like I was wrong. Any idea how to place a widget via $wpdb? What data should be written down? And where? Thanks!
Placing widgets via a MySQL or something MySQL abstracted via the global variable <code> $wpdb </code> that is an instance of the WPDB class is not trivial. That's not because MySQL is something complicated or because <code> $wpdb </code> is useless at all but this has do something with the way the widget configuration...
Placing a widget with $wpdb query
wordpress
Is there any filter which can be used in a plugin to process the content of the text widget before it is rendered?
Filter widget_text (for the text) widget_title (for the title) Example <code> function add_smiley($content) { $new_content = ''; $new_content.= $content . ':)'; return $new_content; } add_filter('widget_text', 'add_smiley'); </code> Note that this works only for the content so not if you have a widget with only a title...
Is There A Hook To Process The Content Of The Text Widget?
wordpress
Is there a WP plugin that allows user to edit in-page footnotes in WYSIWYG manner? No weird syntax. No HTML pane. Update: Perhaps I'm missing something, as I'm new to WP. All footnote plugins that I saw use custom syntax. Example: <code> Blah blah blah ((my footnote)) blah </code> Other: <code> Blah blah blah [ref]my f...
From all the footnote plugins that I'm aware of, they don't provide the functionality you're looking for. It's normally expected that a user edits the footnotes content in the place where the footnote is edited in the current plugins. But the list is pretty impressive. So probably you might want to look on your own: Fo...
WYSIWYG-able Footnote Plugin
wordpress
After i add these codes to functions.php: <code> add_editor_style(); function childtheme_mce_btns2($orig) { return array('formatselect','styleselect', 'underline', 'justifyfull', 'forecolor', '|', 'pastetext', 'pasteword', 'removeformat', '|', 'media', 'charmap', '|', 'outdent', 'indent', '|', 'undo', 'redo', 'wp_help'...
If you always want <code> &lt;br/&gt; </code> instead of <code> &lt;p&gt; </code> for newlines you can change the TinyMCE configuration : <code> forced_root_block: false, force_br_newlines: true, force_p_newlines : false, </code> I think you cannot do this based on the context (use <code> &lt;br/&gt; </code> when in <c...
Theme Advanced Styles in Visual Editor and Paragraphs
wordpress
I'm working on a personal voting plugin, I don't intend to release it publicly because I'm still learning WP. In general, you can vote posts "up" or "down". I have 2 tables, one collects IPs (to disallow voting multiple times) and another table named "post_votes" collects the number of votes for each post. When I publi...
No offense, but I think I'm agreeing with a commenter from your other question... You really need to read PHP, MySQL, and regular expression tutorials before you get into any of this. More importantly, you need to learn how to search a code base using regular expressions in your favorite editor, and understand the code...
add_action for publish_post doesn't work
wordpress
How can I get the archive links for a custom post type? get_day_link() doesn't seem to work
From the top of my head, <code> get_day_link() </code> does not work for custom post types. This might work in 3.1 as you can add archives to your custom post types.
Custom post type - get_day_link()
wordpress
By default, Wordrpess sites have at least 2 URLs that can be used to reach the home page: <code> www.site.com/ www.site.com/hello-world </code> Both these URLs point to the same page, the default "hello world" post that WordPress creates. How can theme developer's specify a canoninical url meta tag to suggest to search...
You might probably want to install Canonical URL’s for WordPress (Wordpress Plugin) . It allows you to specify a canonical URL for each post and page. So you can configure the way you want. The plugin is not big, you probably can integrate the functionality easily into your theme then.
How to use Canonical URL meta tag to avoid duplicate content issues with WP home pages
wordpress