question
stringlengths
0
34.8k
answer
stringlengths
0
28.3k
title
stringlengths
7
150
forum_tag
stringclasses
12 values
I'm pretty new to Wordpress, so sorry if this is an obvious mistake :) I've just moved a site from local installation on my computer to a live server. When I'm trying to install plugins or upgrade the Wordpress vs, I get this error message: Could not open handle for fopen() to C:\Websites\Danabick-shanuniCoIL\site/wp-c...
So, after I couldn't find the string in the db or the files, I looked at it again closely, and the path looked similar to what I have on the server. I guessed the c:/ wasn't referring to the local installation I had, but to the location on the server. Talked to the hosting company, and apparently it was a permissions i...
can't upgrade wordpress or install plugins, it seems to "think" it's still on a local installation
wordpress
I have two custom post types (Authors and Partners). I display their archive page's in the main navigation and use archive-authors.php and archive-partners.php to make a couple small tweaks to the display of posts in each. Now, my client would like to display some text before the archive's post listing. So far I can th...
One of the easiest (although not the only) of ways to achieve this is by creating a custom options panel in the WP dashboard that will allow your client to create and update information that can be used through out your template files with no technical knowledge being necessary. You can either paste the following direc...
Display Editable Text Above CPT Archive Listings
wordpress
Ok so I have an issue with wordpress that has been driving me mad the last few days. I have a custom post type called "help-line" this post type then has 13 categories and some of these categories have sub categories. I also have 5 custom fields. When I create a post under help-line I assign it to whichever category it...
Categories by default only show posts, as do tags. This limitation is not enforced on custom taxonomies, and it can be overriden via a filter. If you place this into your functions.php, then posts of type <code> help-line </code> will be shown in the listings. <code> // before we grab the posts in a query add_filter('p...
Custom PT, Taxonomys and wordpress query
wordpress
I'm trying to stick a post in the search results for the value and meta_key meta_value. If the search results in the post is meta_key - sticky and meta_value - fatured, the display on top of these posts. This is my search.php : <code> &lt;?php get_header(); ?&gt; &lt;?php if (is_paged()) $is_paged = true; ?&gt; &lt;div...
A simple hack. Edit: putting the featured post ids in an array and checking that array in the main loop. <code> global $post; $post_IDs = array(); foreach($post_info as $post_info_obj) { $post_IDs[] = $post_info_obj-&gt;ID; } $featured_IDs = array(); $query1 = new WP_Query(array('meta_key'=&gt;'sticky','meta_value'=&gt...
How to stick custom post at the top in search results
wordpress
I am using Wordpress 3.3.2 with the following plugin: - http://wordpress.org/extend/plugins/advanced-access-manager/ The plugin works perfectly but the author said there is currently no way to achieve this from the plugin, So I am wondering if there is either another plugin or any code modifications I can make to achie...
You could do something like (in your functions.php file); <code> if(current_user_can('member')){ add_filter('get_sample_permalink_html', 'perm', '',4); function perm($return, $id, $new_title, $new_slug){ global $post; if($post-&gt;post_type == 'testimonials') { $ret2 = preg_replace('/&lt;span id="edit-slug-buttons"&gt;...
Remove the Edit button in posts for permalinks on certain user roles? WP 3.3
wordpress
When developing a plugin, is there a way to automatically determine the minimum version of WordPress that's required to run it? I want to make sure that the <code> Requires </code> header is accurate, but manually checking every time I call a new core function is tedious and error-prone. I'm thinking a script could fig...
I just found a solution as an automated service over at http://de.wpseek.com/pluginfilecheck/ It's does exactly, what was asked for including the generation of list of used functions and giving a suggestion for the Plugin-Header comments.
Automatically determine minimum WordPress version required for a plugin?
wordpress
In the script below, I'm calling out from archive.php to functions.php to retrieve a list of posts that have been flagged in a category reserved for my "blog" posts. I'm listing these posts in summary with the count determined by an option called "blog_count". I need to add paging to this function so that the blog_coun...
Rather than using <code> next_posts_link </code> and <code> previous_posts_link </code> , try <code> paginate_links </code> . It lets you specify the current page and total page count. For example: <code> echo paginate_links( array( 'base' =&gt; add_query_arg( 'cpage', '%#%' ), 'format' =&gt; '', 'prev_text' =&gt; __('...
How to add paging to query
wordpress
This page I am editing in the html editor. I pasted in my list from my text editor. You'll notice that the second last list item is all a link, thats because wordpress has taken it upon itself to wrap the whole thing in an empty tag! Why is it doing this and more importantly, how do I stop it? FYI here is the relevant ...
I don't remember which one, but there is probably a conflict with tone of your plugins. I had the same issue in the past. Deactivate all of you plugins, then go through and reactivate them one by one.
Wordpress adding in anchor elements when I save a page in html editor
wordpress
I created a new baseball website. To create the site, I basically just duplicated my football site and changed/modified the theme. Being that I simply copied a site, all of the JetPack Site Stats reference the old football site stats. So, top posts, top seaches, total views, busiest, etc. all refer to the football traf...
From the official developers: "The site stats are maintained by wordpress.com, not your own site, therefore, there is no way to delete old stats"
Delete old JetPack Site Stats? encrypted_search_terms in top search terms
wordpress
I like to use a child-theme. The parent functions.php <code> function starkers_widgets_init() { // Area 1, located at the top of the sidebar. register_sidebar( array( 'name' =&gt; __( 'Primary Widget Area', 'starkers' ), 'id' =&gt; 'primary-widget-area', 'description' =&gt; __( 'The primary widget area', 'starkers' ), ...
Check the code bellow, I think that should work. <code> add_action( ‘after_setup_theme’, ‘remove_default_sidebars’, 11 ); function remove_default_sidebars(){ remove_action( ‘widgets_init’, ‘starkers_widgets_init’ ); } </code>
Unregister widget from Child-Theme
wordpress
I like to use the Starkers Theme and build child-theme. So, I`d like to remove the this primary menu Starkers (functions.php) <code> function starkers_setup() { // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'primary' =&gt; __( 'Primary Navigation', 'starkers' ), ) ); } endif; </code> My c...
The Starkers theme setup is hooked to <code> after_setup_theme </code> , at a priority of <code> 10 </code> . So you basically have to wrap the unregister function inside another function (child themes functions.php file) and add it later than the parent themes setup function, so it gets first added by the parent and l...
Unregister Nav Menu from Child-Theme
wordpress
I managed to create new custom fields in the profile page. However, the new fields are located below the Password section. My new fields is more about the user personal details, which should located below/above Biographical Info section. But this new field always display below to the password section, this will be very...
let's continue the saga then :) Yesterday I released a new version of my plugin that deals with customizing the Profile page, among other things. So the subject interests me quite a bit. I managed to move the whole block of custom usermeta using stackexchange-url ("this answer"), but haven't found much room for maneuve...
How to add field above password section in profile page
wordpress
So I'm trying to figure out how to properly use the get_current_screen. For learning sake, I'm just popping an alert for a specific page. I've looked at http://www.deluxeblogtips.com/2012/01/get-admin-screen-information.html and the codex on WP_Screen and get_current_screen (hit my max links cause my rep isn't 10 yet) ...
<code> wp_enqueue_scripts </code> is only fired on the front end, and not on admin screens. For loading scripts admin side, you'll want the hook <code> admin_enqueue_scripts </code> . Passed as an optional argument is the page hook. (Examples include <code> edit.php </code> , for the admin edit page (which lists pages/...
get_current_screen and the WP_Screen class
wordpress
I used wp menus in the past but always registering a location and then using: <code> &lt;?php wp_nav_menu( array( 'theme_location' =&gt; 'header-menu' ) ); ?&gt; </code> To display a menu on that location on my theme I would first create a menu, and then assign it to that location. Well now what I would like to do is t...
Umm u can do that easily. And this is the way I do how i register my menu in function.php <code> add_action('init', 'register_custom_menu'); function register_custom_menu() { register_nav_menu('custom_menu', __('Custom Menu')); } </code> Then in ur admin panel u create different the menu by ur disired name. And get the...
Displaying wp menus by name without using theme locations
wordpress
I'm trying to simply disable my comments section from one of my categories from showing up on my posts. How do I do this? Whats the code and where do I insert the code from a general standpoint? Thanks
1.In your single.php find the location where it include the comment template. 2. Then Check the category name of the post. 3. Use if else statement to check if its the category u want/not to display the comment and include it by desire.
Remove Comments section from certain category posts
wordpress
As a site admin, I'd like to have control over things. I'd like to prevent my contributors and authors ( who generate content for me ) from creating new tags. I don't want that tag taxonomy to turn into a zoo! Especially when you know that wordpress creates separate terms for apple and Apple! I give them a while list (...
This Wordpress Answers thread has exactly the information you are looking for - stackexchange-url ("Plugin to restrict non-admin user to existing tags") Simply change "administrator" to whatever you need.
Is it possible to disable certain user roles from creating tags?
wordpress
I keep on getting this error on updating a user: <code> PHP Warning: Cannot modify header information - headers already sent by (output started at /wp-admin/includes/update.php:134) in /wp-includes/pluggable.php on line 866, referer: /wp-admin/user-edit.php?user_id=4&amp;wp_http_referer=%2Fwp-admin%2Fusers.php </code> ...
It is usually because there are spaces, new lines, or other stuff before an opening tag, typically in wp-config.php. This could be true about some other file too, so please check the error message, as it lists the specific file name where the error occurred (see the link below for more info on "Interpreting the Error M...
Cannot Modify Header Info Error on updating User Profile
wordpress
I want to put my lecturers for my students as PDF files in my wordpress, is it possible?
Yes it's possible. File upload is a default feature of WordPress. You don't need to use plugins for this. Read how to upload files in WordPress .
Is there a plugin for uploading files such as PDF files?
wordpress
Hi I would like to choose a WordPress Responsive framework to start with on all my client projects. I have shortlisted to Roots and Bones http://www.rootstheme.com/ http://themble.com/bones/ I would like to know what are the main differences between the two, maybe from others who have used them, and any advice as to wh...
There's no right or wrong answer to this question which might mean this question gets closed. But you should research this elsewhere as its already been widely debated on blogs online - for and against, pros and cons. That aside, you need to decide what the purpose of using a framework is - for YOU. As my purpose(s) ma...
Choosing between Wordpress responsive frameworks
wordpress
Im using wp favorite posts to show a list of favorited post by a user on a page. It creates a loop of posts but I can't figure out how to use conditional tags for posts in the loop. Specifically for posts in a certain category I need to show the image inside the loop below. So in the regular loop on my index page I jus...
Figured it out. Just need to add $post_id to the template tag like so. <code> if (in_category('videos',$post_id)) { </code>
Using in_category for non standard loops
wordpress
Whenever I go to my "Your Profile" page to edit any of the settings other than the password, I have to manually empty out the password field to avoid errors/nags. Is there a filter I can place in functions.php that will empty the password field by default?
By default the password fields should appear "empty" on the "Your Profile" page. Make sure your Wordpress installation is up to date and try deactivating any plugins that extend the user profile page and commenting out any code in your functions.php file. There is most likely a conflict with one of these plugins.
Filter to remove the default password on "Your Profile" page
wordpress
When adding a metabox, i.e.: <code> add_meta_box( 'metabox_id', 'Metabox Title', 'my_metabox_callback', 'page', 'normal', 'low', array( 'foo' =&gt; $var1, 'bar' =&gt; $var2) ); </code> how do I add a <code> class </code> to it for css styling? I'd like to avoid having to call each <code> id </code> in the style rule fo...
Just add the class to the markup you are generating in the callback.
How to add a class to meta box
wordpress
Alright y'all. I want to dynamically display the information of the 2 most current posts to the screen. So far I have only been able to get results by hard coding the ID into the query. Is there a way to retrieve this data dynamically? <code> query_posts('showposts=2'); while (have_posts()) : the_post(); ?&gt; &lt;?php...
The correct way: <code> $my_query = new WP_Query('posts_per_page=2'); while ($my_query-&gt;have_posts()) : $my_query-&gt;the_post(); ?&gt; &lt;?php global $post; print_r($post); // &lt;-- this is your postStuff ?&gt; &lt;?php endwhile;?&gt; &lt;?php wp_reset_query(); ?&gt; </code> Normally, you dont't need to globalize...
How can I query the db to access current post information?
wordpress
So my theme has a tag.php, that contains this line: <code> get_template_part('loop','tag'); </code> that runs the loop and spits out the tag entries. I'm modifying it to include post thumbnails (using if(has_post_thumbnail()) { the_post_thumbnail() }), but have run into a need to add more styling. to do this I need to ...
I think you misunderstand the purpose of <code> get_template_part() </code> . It is a wrapper for <code> locate_template() </code> , which itself is just a wrapper for <code> include() </code> . By calling <code> get_template_part( 'loop', 'tag' ) </code> , you are telling WordPress to look for/include a file based on ...
how to replace get_template_part('loop','tag') with explicit styled version?
wordpress
I liked to customize my profile page by adding new fields to get more info from the user like "Gender" or "Speaking Languages". I managed to get the text input form to work, the problem I having now is on the radio and checkbox type of input. Here is my code: <code> function my_user_field( $user ) { ?&gt; &lt;h3&gt;&lt...
You are missing the "checked" value for the inputs <code> &lt;input type="checkbox" name="language" &lt;?php if (get_the_author_meta( 'language', $user-&gt;ID) == 'Mandarin' ) { ?&gt;checked="checked"&lt;?php }?&gt; value="Mandarin" /&gt; Mandarin&lt;br /&gt; </code> Also, the usermeta is dealing but your are checking ...
How to add checkbox and radio button in Profile Page
wordpress
I'm using add_action('the_content', 'myFunction', 10) to append data to the end of the content. How can I place content at the beginning of the content?
the_content is also a filter, into which the content is passed as an argument. You simply prepend your content and then return like so. add_filter('the_content','prepend_this'); <code> function prepend_this($content) { $content = "string to prepend" . $content; return $content } </code>
Add something to beginning of content with add_action('the_content')?
wordpress
i install the Roots Theme and then convert my installation to multisite... so that wordpress add some code into the previous .htaccess with root settings. My .htaccess now looks like this and i'm becoming something redirection errors Is there a conflict into my .htaccess? <code> ##### Multisite Htaccess ##### RewriteEn...
well, I have both roots and multisite. However, I do not have roots specific rewrite rules. I have the vanilla rewrite rules defined in the docs . I use the ones for subdomains instead of subfolders. <code> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] # uploaded files RewriteRule ^files/(.+) wp-include...
.htaccess on multisite and roots theme?
wordpress
I've been reading about Custom Post Types, Custom Taxonomy and Category but I'm still getting some confusion. I want to build somewhat like an ecommerce site just to understand it better. Say I've a problem like this <code> Products --Computer --Operating System --Linux --Win 7 --RAM --less than 1 GB --1 GB --2 GB --Ca...
I'd say your on exactly the right track. Since you're in the process of reading up on CPTs and such, I'd highly recommend giving this 4-part tutorial series a read: Reusable Custom Meta Boxes, wp|tuts+
Confusion about how to use Custom Post Types, Custom Taxonomy or Category?
wordpress
Four different websites got infected and been blocked by Google, and after a quick look, I've noticed this just before wp_head(): <code> &lt;?php #d93065# echo(gzinflate(base64_decode("tVVNj5swEP0... (edited out) hH5m7L/5+/gM="))); #/d93065# wp_head(); ?&gt; </code> I have cleaned the code but this reappeared after a f...
Sorry to hear. You may want to look through the steps and suggestions in this WP Answers post: stackexchange-url ("Verifying that I have fully removed a WordPress hack?")
Malware in header.php
wordpress
How do I remove the option to "delete" a theme in the admin dashboard? I built a site for clients with several themes they can choose from and i don't want them to accidentally delete a theme. Thanks!
You need to remove the <code> delete_themes </code> capability from those users. The easiest way would be to stackexchange-url ("create a custom user role, based on the "Administrator" role, but omitting relevant caps"), such as <code> delete_themes </code> .
How To Remove The "Delete" Theme Option In Dashboard
wordpress
Here is what I have I am not having any lucking finding how to simply include a file in the content editor using a shortcode. For Example if I wanted to include form.php inside my Contact Page how would I make this happen using a shortcode? Below is was attempting to work with to no avail. Any help would be appreciated...
I modified some code from an old blog post to do this, and allow for query-strings to be attached to the file as well. Original credit goes to amberpanther.com , and it turns out they made a plug-in out of this, too. <code> //create the shortcode [include] that accepts a filepath and query string //this function was mo...
Include PHP file in Content using [shortcode]
wordpress
I just exported a largish WP blog from MediaTemple to PHPFog. I used the standard WordPress export and import plugins. For some unknown reason all of my media assets have been duplicated. I now have twice as many images per post. If an original file was called "Lot-44-Warrens.jpg" it now has a duplicate called "Lot-44-...
combining the two answer on this page, I found this worked. <code> $args1 = new WP_Query( array('post_type' =&gt; 'post', 'posts_per_page' =&gt; -1)); $loop = new WP_Query($args) while($loop-&gt;have_posts()) { the_post(); $args2 = array( 'order' =&gt; 'ASC', 'post_type' =&gt; 'attachment', 'post_parent' =&gt; $post-&g...
What's the proper way to find and remove duplicate images from posts and the media library?
wordpress
I'm trying to access the following shortcode in a simple page, with [featured/] <code> function mytheme_featured() { $my_query2 = new WP_Query('category_name=featured&amp;showposts=1'); while ($my_query2-&gt;have_posts()) : $my_query2-&gt;the_post(); return '&lt;h3 class="entry-title"&gt;&lt;a href="'.the_permalink().'...
the_title(), the_excerpt() and the_permalink() prints the output at once but the shortcode function is supposed to just return the output. You can use get_the_title(), get_permalink() and get_the_excerpt() instead.
query inside main query order issue
wordpress
As the title says, I've got a multi-site setup with 18 sites and would like to combine the RSS feeds from all sites into the root site's feed. The other feeds can still exists, that's not a problem. Additionally, I'd like a way in the admin (on page/post edit, perhaps), to exclude certain posts from the feeds. In addit...
The bottom line is that you'll need to have all the post content in one place in order to be able to form it into a single feed. (Querying efficiently across 18 different post tables is more or less impossible.) My go-to method is to use the Sitewide Tags plugin https://wordpress.org/extend/plugins/wordpress-mu-sitewid...
Aggregate multisite RSS and restrict certain content
wordpress
I'm getting some 404 errors on image paths in this plugin I'm building. I'm trying to build a plugin that has some Javascript and images (like a close icon and a progress bar) that I want to load on the frontend. I found the proper technique to enqueue jQuery, and then the proper technique to register and enqueue my jQ...
The answer is to use wp_register_style() and wp_enqueue_style() before I do wp_register_script() and wp_enqueue_script() so that I can use relative image paths to the CSS file. I then move the url() stuff from jQuery and into the CSS file with this relative path.
Loading Images from Javascript on the Front End
wordpress
Someone gave me this SQL code to count the number of posts (of post_type 'mixtapes') in the last 7 days. I tried to convert it to 'in the last 24 hours' as well, but it's giving the wrong number. Here's his code which works for 7 day period: <code> $querystr = $wpdb-&gt;get_var("SELECT COUNT(*) FROM $wpdb-&gt;posts WHE...
Personally, I'd generate the date in php using the PHP <code> Date </code> class and then $date-> sub() . With a few more lines of code the query will read: <code> ... WHERE post_date &gt;= ".$date." ... </code>
How do I write this SQL statement for Posts written in last 24 hours?
wordpress
I'm working on creating some text that says 'Login' to users that are not logged in, and the user's username or display name when logged in. It seems like it should be an easy problem to solve, and I've found the following two bits of code on the wordpress codex that each do half of what I am looking for, but I haven't...
This seems to do what you need. <code> &lt;?php global $current_user; get_currentuserinfo(); ?&gt; &lt;?php if ( is_user_logged_in() ) { echo 'Username: ' . $current_user-&gt;user_login . "\n"; echo 'User display name: ' . $current_user-&gt;display_name . "\n"; } else { wp_loginout(); } ?&gt; </code>
How do I display logged-in username IF logged-in?
wordpress
this is probably a confusing title of my question, but it's exactly what's describing my problem best. I want to add the category-slug as classname to my wp_list_categories() output. I found a really simple function that does exactly that it works perfectly. <code> add_filter('wp_list_categories', 'add_slug_css_list_ca...
Wordpress do: <code> apply_filters( 'wp_list_categories', $output, $args ); </code> You can do: <code> function add_slug_css_list_categories($list,$args) { } </code> Then you can use $args to determine what kind of list you have. Not sure if you must do that but when you add the filter there is also a variable for acce...
add filter to wp_list_categories and query if used to list tax-terms?
wordpress
So I had asked (in retrospect a pretty non-question) at stackexchange-url ("A little help/cleanup from a real coder?") and one of the comments was to not use query_posts and instead use WP_Query. So I did a little digging and tried to implement that, now the code isn't working fully. The MultiPostThumbnails isn't pulli...
I'm not familiar with MultiPostThumbnails, but I suspect your problem is: <code> $flexID = $my_posts-&gt;ID; </code> That code appears to be trying to get the ID of the WP_Query object itself. I don't think that exists. Even if it does, it won't do you much good. Rather, use this: <code> $flexID = get_the_ID(); </code>...
switched from query_posts to WP_query, not working now?
wordpress
I have everything ready for publishing a new version of my plugin but one last issue stands... The old version had no naming convention for its key option names. The options grew and I renamed all of them, using prefixes for the sake of good coding practice and my own sanity. I thought of putting a warning in the Descr...
You should store a version number for your plugin in the database (if you don't already, add this pronto), using that you can do this (note that this is pseudocode): <code> if( $db_version &lt; {your desired version} ) { // previous updates and such $db_version = $new_version; //put that in the database } if( $db_versi...
Releasing new plugin version, how to rename old options keys?
wordpress
I've never actually written a Wordpress plugin before, so this is my first crack at it. Basically, the plugin is for multi-author blogs where post authors must submit their post for review. The Editor/Administrator must come in and approve and publish/schedule the post. All of this is good, and built into Wordpress. Th...
Thanks to ericissocial for sending me in the right direction. I decided to go with: <code> if(current_user_can( 'edit_others_posts' )) { //add meta box } </code> This way any custom user role with <code> edit_others_posts </code> can use the function.
Plugin Functionality Only for Editor and Administrator
wordpress
I'm making a request to my plugin's php file via ajax and it's supposed to save some data with update_option(), but php throws an error: <code> Call to undefined function update_option() </code> I'm guessing that when I call my php file with ajax WP doesn't load it's functions... or something? Cheers
Include wp-load.php in your Ajax file
Ajax in a settings page (update_option is undefined)
wordpress
By the time index.php runs, it seems as though there is already a query populated. How can I find out what that query's query string is? eg. <code> new WP_Query([query string is here]) </code>
Take a look at <code> global $query_string; </code> . Or <code> var_dump( $GLOBALS['wp_query'] ); </code> .
get query's query string
wordpress
Which filter if removed allows iframes to be inserted into wordpress posts?
This filter does not. This feature is disabled in the visual editor TinyMCE. <code> function wpse49619_change_mce_options($initArray) { $ext = 'iframe[align|longdesc|name|width|height|frameborder|scrolling|marginheight|marginwidth|src]'; if ( isset( $initArray['extended_valid_elements'] ) ) { $initArray['extended_valid...
How to remove_filter that filters iframes in posts?
wordpress
I want to hide/remove the Personal Options in the Your Profile ( <code> wp-admin/profile.php </code> ) admin page. I am aware that solutions for this exist, but I they use jQuery to do hide this section. This works, but when a user has JavaScript disabled in their browser, it will show up again. Therefore it is not a p...
This should do the trick <code> // removes the `profile.php` admin color scheme options remove_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' ); if ( ! function_exists( 'cor_remove_personal_options' ) ) { /** * Removes the leftover 'Visual Editor', 'Keyboard Shortcuts' and 'Toolbar' options. */ functi...
Remove Personal Options section from Profile
wordpress
I need to check if there is an post to be published in future. I want to use WP functions, no directly access to database via mysql_query. Has anyone some sample of code?
You can use <code> get_post_status() </code> within a query to get <code> future </code> posts. <code> &lt;?php $args = array( 'post_status' =&gt; 'future' ); $my_query = new WP_Query( $args ); while ($my_query-&gt;have_posts()) : $my_query-&gt;the_post(); ?&gt; &lt;!-- Do stuff... --&gt; &lt;?php endwhile; ?&gt; </cod...
Check if there is an post to be published in future
wordpress
I've followed this guide precisely: http://codex.wordpress.org/Creating_Options_Pages However when I do <code> do_settings_fields </code> , it says: <code> Missing argument 2 for do_settings_fields() </code> Even though it says to put only one argument in there. Strangely, the example given on that very same page says ...
The first thing that jumps out at me is your use of <code> register_setting() </code> : <code> register_setting( 'bang-options-group', 'joinform_api_url' ); </code> It is missing a critical, third argument: the sanitization callback . While this parameter programmatically is optional , without it, you cannot validate/s...
How to create a Wordpress options page
wordpress
I'm using the plugin custom post type ui to create a post type says movie. Everything is ok. I create a movie and its viewable at <code> http://localhost/wordpress/movies/test/ </code> however, when i go on http://localhost/wordpress/movies/ I was expecting to see test as a movie in all the list of movies but nothing i...
Simply add <code> has_archive </code> => 'movies' to the arguments array you pass to <code> register_post_type </code> and you should be fine, since by default it is set to false.
Custom Post Type UI
wordpress
I got a client requirement where the editing facilities available in wordpress had to be available for content that was meant to be displayed on the sidebar of a particular post/page. The content to be displayed was implemented originally using metaboxes which contained a single textarea where content was input as raw ...
It works just the same like a regular textarea with the exception of the data being escaped so when you call for the saved data just make sure to decode the html entities using <code> html_entity_decode </code> here is a very simple demo class, take a look at how the field is created. <code> if (!class_exists('wp_edito...
Migrating from metaboxes to wp_editor()
wordpress
I've split my functions.php into multiple files using <code> require_once </code> , which works perfectly. However when I add admin functionality (extra panels) in one of the included files, it doesn't work? It's making me put the code in functions.php which I don't want to do. This is the top of my functions.php <code...
The problem here is that you're not including <code> yourtheme/includes/admin.php </code> , you're actually including <code> wp-admin/includes/admin.php </code> , so pass a full path to the require statement rather than a relative one e.g.: <code> require(get_template_directory().'includes/admin.php'); </code>
PHP files included within functions.php don't work from admin area
wordpress
when using wp_editor, I paste my text in the visual editor. If I switch to HTML editor, all of my tags are there. So far, no problem. When I update the thing, all of my tags appear in my visual editor and in HTML, they become something like : <code> &amp;lt;p&amp;gt;&amp;lt;strong&amp;gt; </code> If I update again, the...
I ran into the same issue when making use of the new wp_editor function on an alchemy powered metabox. I did some searching and turned up a solution that makes use of "html_entity_decode". Take a look at the reference here: https://gist.github.com/1838037
wp_editor and WPAlchemy messes up tags when updating
wordpress
Specifically I would like to change the value of <code> &lt;dc:creator&gt; </code> in the feed items. In order to display the site name instead of the post author. I'm able to hook into <code> the_title_rss </code> , <code> the_excerpt_rss </code> and <code> the_content_feed </code> , but can't find how to change the h...
this value comes from the template <code> tag the_author() </code> . You can also filter this. But it is important, that you check, that the filter only work on the feeds; see the follow example at the check for <code> is_feed() </code> . After this i change the autor name only, if the string has the value 'name_xyz'; ...
How can I modify the header of RSS feed items?
wordpress
I found the following codes to get post details. However, it is not possible to get the posts by content . Does any one has any ideas? get_posts() <code> //// get post //// $args = array( 'numberposts' =&gt; -1, // number of posts to display; display all: -1. 'offset' =&gt; 0, // 'category' =&gt; , // post category ID ...
You have to extend the db query to search in the <code> post_content </code> column. There is a filter: <code> 'posts_where' </code> you can use. I would write a simple wrapper for <code> get_posts() </code> to extends its arguments an run the filter once. Example: <code> class T5_Posts_By_Content { protected static $c...
How to get posts by content?
wordpress
Under Settings-> Discussion there is the following option: [x]Allow link notifications from other blogs (pingbacks and trackbacks) Whats the real benefit for a blog owner to have them enabled? (besides knowing who is linking your content i mean) Is there any downside in turning that off? Thanks a lot
I'm going to go out on a limb here and say they are pretty useless, in fact I would say they are even a nuisance. The idea was novel when it first came out and it was for a brief moment useful, but those days are over. I never enable pingbacks because they seem to actually discourage discussion, and are highly abused b...
Shall i disable pingbacks and trackbacks in my blog?
wordpress
I have this function below that is called with the <code> admin_init </code> Action <code> function my_flush_rewrites() { global $wp_rewrite; $wp_rewrite-&gt;flush_rules(); } </code> Like this <code> add_action('admin_init', 'my_flush_rewrites'); </code> I am curious, when is this called? Is this called on every page l...
From the Codex : admin_init is triggered before any other hook when a user access the admin area. This hook doesn't provide any parameters, so it can only be used to callback a specified function. So yes, it's run on every admin page load.
When is admin_init Action ran?
wordpress
How do I assign CSS to custom post types so it displays different from other Custom Post Types? Example: Custom Post Type 1: Row of 4 Images Custom Post Type 2: a 2 column with an Image in the left column and text in the right column How would I do this?
In your post loop, you could always set a class name that is the equivalent to the slug of the custom post type and then adjust the css accordingly. You'd need to add the post_class() function to the html element containing each post. For this option, you'll want to get the post type first: <code> &lt;?php $post_type =...
CSS for Custom Post Types
wordpress
My function does exactly what I want it to do: I'm trying to add/update meta fields in another post type when an "events" post is saved. Except the post needs to be updated twice for the information to update on the front end. What am I doing wrong? <code> function bam_create_next_show_meta($post_id) { if(get_post_type...
You're doing several things wrong, and they're all silly, avoidable, basic logic mistakes. Firstly, you're not checking if this is an autosave. Autosaves do not save the custom fields, only the original core wordpress fields, like content, so an autosave will giv eyou unset/blank values. Add this to the top of your sav...
Bug: Post needs to be updated twice when adding action for save_post hook
wordpress
I'm working with a custom post type and trying to get a query working that includes 2 genres (a custom taxonomy). I have this, which works for a single genre (I don't want to display the widget currently being viewed in the list, the 'post__not_in' takes care of that). <code> $myposts = new WP_Query( array( 'post_type'...
Something along these lines should work: <code> $myposts = new WP_Query( array( 'post_type' =&gt; 'widgets', 'post__not_in' =&gt; array($wp_query-&gt;post-&gt;ID), 'tax_query' =&gt; array( array( 'taxonomy' =&gt; 'genre', 'field' =&gt; 'slug', 'terms' =&gt; array( 'styleA', 'styleB' ) ) ) ) ); </code> I'm not sure if y...
WP_Query with 2 genres
wordpress
I have many custom post types, including some introduced by plugin such as bbPress or WooCommerce. My standard stylesheet is growing large, so I thought to split it into multiple stylesheets according to post types being viewed in the browser. In this way, when the users is viewing bbpress fourms, he will also load a f...
The issue in your first block of code is syntax: <code> if( get_post_type() == ( 'activity' OR 'dining' OR 'heritage' OR 'hiking' OR 'nightlife' ) ) : </code> this isn't proper use of OR and will evaluate true regardless of what <code> get_post_type() </code> returns. The issue in your second block is again syntax, you...
Use conditionals with wp_enqueue_style to attach stylesheet according to post type displayed
wordpress
due to some reason my hosting company isn't able to fix if i use w3 total cache or w3 super cache for caching my site's sql usage keeps on peaking.... and on high spikes servers gets laggy and down sometimes. For that i have to use hyper cache plugin for cache as it works perfect, but this plugin doesn't support cdn .....
You can parse via regex for images in <code> the_content </code> ; but is always load and slowly. Maybe you change the url of images, after <code> post_save </code> in database or change the current posts inside the database and create an custom CDN. Its the fast way and all caching plugins has the break, that she must...
A way to change image urls in post to cdn image url?
wordpress
I've mimicked stackexchange-url ("Otto's") setup here: http://ottopress.com/2011/creating-a-wordpress-site-using-svn/ and my brief example is below. That tutorial is specific to a single site install, and specifies a single domain. How can I customize the <code> htaccess </code> below to be suitable for multisite? Note...
For now, this is unsolvable according to Mark Jaquith, as noted here . Q : Does this support WordPress in multisite mode? A : No. Not until WordPress supports WordPress-in-a-subdirectory installation for multisite. If you're a WordPress hacker who wants to help with that feature, drop me a line
Multisite htaccess on localhost with WP as an SVN external?
wordpress
I am trying to make a post which will contain several custom fileds. the custom fields should show within jqery tabs. I have already made it in here: http://algodonesdentistreview.com/ahmad/dentists/a-test-dentist-post but the problem is, the tabs aren't dynamic, that is, if I'm adding a field from dashboard, it won't ...
I think the answer is that there is no easy way to achieve what you're looking for because nobody would want that behavior. Custom/meta fields get added to posts for all kinds of reasons, plugins do it all the time to store things you'd never want the public looking at both because it might be private and because it's ...
show custom field content in jquery tabs
wordpress
I am making a custom (quick) registration page in my wordpress site, to let users to register quickly by just filling username-email and choose their password. I have <code> tpl-edit-profile.php </code> , what i need to achieve is to redirect users after they register to that page ( <code> tpl-edit-profile.php </code> ...
You should hook into the user_register action. I did something similar on a recent site (not involving having to fill out profile fields, but involving having to renew a membership). I will propose a multi-part solution (let me know if any of it is confusing, it's been a long day and I might not explain it perfectly). ...
Force users to complete their profile after they register? How to
wordpress
I'm running a web based community using wordpress multi-site and buddypress. All users are invited by existing users so no spam accounts exist on site. Therefore we feel stackexchange-url ("no need to moderate logged in users"). Since doing this we have found that from now on all moderation requests come from spam atte...
I solved this issue in the end without using any plugin. The solution works because this is a multi-site install. The procedure is quite simple and painless. I created a 'contact' subsite on the subdomain 'http://contact.example.com' I moved the contact 'page' from the main site to the sub site. I enabled comments on t...
Get moderation notifications on one post only
wordpress
I have a working plugin with many functions in it. I want to break the plugin into several file. I removed some functions and place it in a file called activate.php k7Course.php. Then in the file k7Couses.php i include as below: <code> /* Plugin Name: k7 Course Management Plugin URI: http://yourdomain.com/ Description:...
It sounds as though your include file activate.php does not have the opening/closing php tags. Be sure to open activate.php and ensure it has the <code> &lt;?php </code> at the beginning of the file, and the <code> ?&gt; </code> at the end.
Include file in plugin file
wordpress
I'm having to design an e-commerce site where users should be able to create a product from front-end. In WordPress, the product will simply be a post with custom fields like Price, Condition,....... Also, from front-end, the user should be able to upload pictures. I just need some advice from you guys. What would be t...
I like mrwweb's suggestion, but if you are trying to do it yourself / for free, you will have to do a few things: 1) Make a new template PHP file with the forms you will need to create a new product, create a new page and assign it the template you created 2) Create your custom post type or decide to use post meta inst...
WordPress Create Post from front-end
wordpress
In short, Im not a master of PHP yet and Im not entirely sure how to place a series of checks (if statements) in my template so that it will know what to display depending on what the client uploads/fills out in the CPT ive created... What Im trying to have it do is: (1) Check to see if there is a URL entered (custom m...
You've got some basic syntax problems. Your <code> elseif </code> statement wasn't actually checking anything and wasn't properly wrapped in parenthesis. The logic more appropriately checks if the first condition is true, then if the second condition is true, and finally if all else fails, display the hard coded image....
Need help with simple "if statement" checks to output particlular CPT data depending on what client uploads/fills out
wordpress
I found that the title of the meta box cannot change via the cctm plugin . It shows "Custom Fields" as default, which is pretty annoying to see. Image So I decided to change it in function.php, here is my code : <code> add_filter('add_meta_boxes', 'change_meta_box_titles'); function change_meta_box_titles() { $wp_meta_...
You need to declare the <code> $wp_meta_boxes </code> array as global: <code> global $wp_meta_boxes; </code> If it still doesn't work try: <code> add_filter('add_meta_boxes', 'change_meta_box_titles'); function change_meta_box_titles() { global $wp_meta_boxes; echo '&lt;pre&gt;'; print_r($wp_meta_boxes); echo '&lt;/pre...
Change Default Custom Fields Metabox Name
wordpress
im kind of a wordpress noob so please excuse my inexperience. so long story short, ive been tasked with creating a WP theme (kinda simple) but, one of the areas, around footer area, has a few things they want, like a 2ndary menu/ bread crumbs etc...maybe even custom html box etc that i can do other things with later on...
You can add additional widgetized sidebars to your theme by adding to your theme's functions.php. If you have not already added widget support in the theme, include: <code> if (function_exists('register_sidebar')) </code> Then add: <code> // Footer Widgets register_sidebar(array( 'id' =&gt; 'footerwidgets', 'name' =&gt...
wordpress custom modules/widget areas on the page? can i make my own?
wordpress
In the admin bar an admin can create a new post by using the add new drop down. In there I want to change the label <code> Post </code> to something else. How can I do this? I just need the code to make the change in the admin bar as I have the code already to change the Post label everywhere else in the admin section....
Found my answer including my full solution: <code> &lt;?php /* Plugin Name: Rename Posts to News Description: Rename built in posts to be called News Version: 1.0 Author: Scott Cariss @ Philosophy Design Author URI: http://www.philosophydesign.com */ // Not a WordPress context? Stop. ! defined( 'ABSPATH' ) and exit; ad...
Change existing label in the admin bar with something else
wordpress
I would like to change the text in the wp media uploader. I managed to find the function at the media.php and i tried to using the filter to change the text like this: <code> function uploader_text() { remove_action('post-html-upload-ui', 'media_upload_html_bypass' ); ?&gt; &lt;p class="upload-html-bypass hide-if-no-js...
This worked for me: <code> function uploader_text() { ?&gt; &lt;p class="upload-html-bypass hide-if-no-js"&gt; &lt;?php _e('mytext here'); ?&gt; &lt;/p&gt; &lt;?php } remove_action('post-html-upload-ui', 'media_upload_html_bypass'); add_action('post-html-upload-ui', 'uploader_text'); </code> You tried to do "remove_act...
How to filter a wordpress core function?
wordpress
I am planning to schedule an hourly task from my wp plugin, as I understand these tasks are triggered by visits to the website. So for an hourly task I will need at least one visitor hourly. Does it matter at what time of the hour the visitor comes? For example if there's a visitor at 1:05, and another at 2:55, the 1 a...
As you've noted, cron jobs are only fired when someone visits your website. WordPress checks if they are any events that have been scheduled before 'now' that have not yet occurred - and runs them. Importantly with events that are recur according to a regularly pattern (say hourly) - their occurrence is relative not ab...
Hourly WP schedule, do I need at least 1 visitor hourly?
wordpress
For the purpose of good HTML structure, accessibility and SEO I'd like to change the site's title and description from H1 and H2 to P when appearing on any page other than the homepage. A conditional statement logic would be something like; when not homepage change site title and description to Site Title and Descripti...
<code> &lt;?php if (is_home() || is_front_page()) { $header_tag = 'h1'; } else { $header_tag = 'h2'; } ?&gt; &lt;&lt;?php echo $header_tag;?&gt;&gt;&lt;?php the_title();?&gt;&lt;/&lt;?php echo $header_tag; ?&gt;&gt; </code> Expanding on what Stephen Harris said, here is a useable example. Lots of different ways to use ...
Change Site Title and Description html tags if not home page
wordpress
I use Markdown in my posts, and the plugin I use for that purpose requires the Visual editor be disabled. The HTML editor is pretty much just a text box. To make writing easier, I would like to enable some custom keyboard shortcuts that allow me to format text in markdown when a key combination is pressed (like Ctrl + ...
The toolbar / editor used on Stack Exchange websites (and in my plug-in WP-MarkDown ) is PageDown . This comes with three JavaScript files: One that handles MarkDown to HTML conversion One that handles sanitization One that handles the editor (the toolbar and previewer) Included in the latter are the MarkDown keyboard ...
Enable / Add Custom Keyboard Shortcuts To Work With WordPress' HTML Editor
wordpress
My theme, Grisaille, currently shows thumbnails in the post preview on the "home" page. How do I make it so that full size images show both on the "home" page and on the individual post? functions.php: <code> &lt;?php if ( ! isset( $content_width ) ) $content_width = '590'; /** * Add Menu Support **/ add_theme_support(...
Here is the relevant code from <code> home.php </code> (the Blog Posts Index): <code> &lt;?php if($grisaillePostCount == 1) { the_post_thumbnail(); } else { the_post_thumbnail('following-post-thumbnails'); } ?&gt; </code> Here is the relevant code from <code> index.php </code> : <code> &lt;?php the_post_thumbnail('foll...
Theme currently showing thumbnails, how to show full size?
wordpress
I am looking to add a new admin menu item from my plugin call "Tickers" under "Post", with the link similar to "Tags", but point to <code> /wp-admin/edit-tags.php?taxonomy=tickers </code> What I have so far is <code> add_action('admin_menu', array($this,'admin_menu')); function admin_menu () { add_options_page(); } </c...
The taxonomy admin page will be handled by WordPress once you register your custom taxonomy. <code> add_action( 'init', 'create_ticker_taxonomies', 0 ); //create two taxonomies, genres and writers for the post type "book" function create_ticker_taxonomies() { // Add new taxonomy, make it non-hierarchical (like 'tags') ...
How to add a new taxonomy link to the admin menu
wordpress
I'm using two plugins that seem to clash: http://wordpress.org/extend/plugins/simply-poll/ http://wordpress.org/extend/plugins/the-events-calendar/ When both activated only the poll plugin shows in the admin menu but when it's deactivated the calendar plugin shows in it's place. Is there a way to get both plugins worki...
It might be due to the position on the admin sidebar in Simply Poll. Go to simply-poll/lib/admin.php and on line 40 remove the <code> , 6 </code> from the end of the <code> add_menu_page() </code> function and see what happens. I'll have a look at the other plugin as well to check what they are doing. Simply Poll devel...
Simply poll & Events Calendar plugins clashing
wordpress
I am using the new vanilla comments on wordpress with my self hosted vanilla forums, but on every page, there is unnecesary iframe space. I was wondering how to fix that. My site is here and my forums are here . Between the submit comment and comments by vanilla link.
UPDATE The frame element has a height of 1000px. I am not sure which file generates the comment form, but the height seems to be in that file. Simply delete <code> height=1000px </code> to remove the space. Also, if you want to remove the Vanilla credit and link, add <code> .vanilla-credit {display:none !important} </c...
How to fix vanilla comments extra iframe space
wordpress
I'm currently working on the admin page of my custom post type, and I got stuck on deciding whether to add a nonce field again for the second metabox or not. I'm very new to custom post types, and searching online about this doesn't really yield that many results. Any thoughts? Thanks.
I would recommend so. You do (and should) have your own nonce with which to check the origin of the data and the intent of the user. If you have just one nonce for a metabox - then you run into problems if that metabox is removed (not the same as hidden). If removed the second metabox will (or at least should) never sa...
Do I need a nonce field for every meta box I add to my custom post type admin?
wordpress
I'm thinking about creating single page portfolio theme, but I'm a little confused on how this would be done based on the different sections on the single page. I'll explain what I would like to do and hopefully someone can help me figure this out. I'm just looking for guidance on what I should do to handle the differe...
In the page editor switch to HTML mode and wrap each section of content around divs you want to be a column. <code> &lt;div class="col2w col2a"&gt;Col 1&lt;/div&gt; &lt;div class="col2w col2b"&gt;Col 2&lt;/div&gt; &lt;div class="col3w col3a"&gt;Col 1&lt;/div&gt; &lt;div class="col3w col3b"&gt;Col 2&lt;/div&gt; &lt;div ...
Custom Single Page Portfolio Theme
wordpress
WordPress nonce is driving me nuts! I had this problem when I started my plugin and removed it but now I have come back to it and still don't know what to do. I have looked all over for a solution. My code is same/similar to other examples. I get an "undefined index 'mrlpt_client_check'" error. I also get the same erro...
The logic here is incorrect: <code> // Verify this came from the our screen and with proper authorization, because save_post can be triggered at other times if ( !isset( $_POST['mrlpt_client_check'] ) &amp;&amp; !wp_verify_nonce( $_POST['mrlpt_client_check'], 'mrlpt_submit_client' ) ) { return; } </code> This reads if ...
Forms and WordPress Nonce
wordpress
Consider this question from the point-of-view of a visitor to a WordPress blog, and not as a WordPress blog admin who can edit those numerous PHP files. How can I see a list of all the posts under a category and a tag? Not clear? Let me explain with an example: I have two categories -- Social Media (social) and Web (we...
Found it! Similar to how you'd do it with RSS feeds, you can do it like this: <code> http://example.com/?cat=6&amp;tag=tips-and-tricks </code> Where <code> 6 </code> is the category ID of Social Media (social) category as per the example.
How to check a list or feed of all posts under a category and tag?
wordpress
Is there an easy way to filter between posts and pages in Google Analytics? Page is listed as a Primary Dimension when I drill down to Content but I'm not sure if that includes posts as well.
It's not tracked by default. Yoast's WordPress SEO plugin allows you to track post types (and categories and authors...) as a custom variable.
Tracking post type in Google Analytics
wordpress
For Posts you can have a preset category where all Posts fall if not specified otherwise (settings &rarr; writing). Can this be done for custom post types that have a custom taxonomy? The <code> register_taxonomy </code> does not seem to offer parameters for that. Thanks again :)
Try hooking into the save_post action to check the custom terms when a post gets saved: <code> add_action( 'save_post', 'set_default_category' ); function set_default_category( $post_id ) { // Get the terms $terms = wp_get_post_terms( $post_id, 'your_custom_taxonomy'); // Only set default if no terms are set yet if (!$...
How to set a Preset category for custom post types?
wordpress
I feel like this should be a simple question, but I can't figure it out. If I have a post_id, how can I remove a particular tag from that post in php?? I know how to update meta information, but tag information is different.
Below is code that works: <code> function untag_posts($post_ids, $tags) { global $wpdb; if(! is_array($post_ids) ) { $post_ids = array($post_ids); } $in_post_ids = implode("','", $post_ids); if(! is_array($tags) ) { $tags = array($tags); } $in_tag_names = "'" . implode("','", $tags) . "'"; $query = "SELECT tt.term_taxo...
remove tags from posts in php
wordpress
Is it possible to get an RSS feed of Facebook status updates from a Page rather than a Profile? I want to use the feed in WP's RSS feed widget. It's easy to pull statuses from a profile page . I did this using an RSS feed widget. I tried doing the same thing for a fan page, but Facebook forces me to switch contexts (fr...
Pretty sure the Facebook fan page RSS feed URL is like this: <code> http://www.facebook.com/feeds/page.php?format=atom10&amp;id=YOURFBFANPAGEID </code> The fan page ID is the string of numbers at the end of the URL when viewing the page, for example, Jon Stewart's fan page id is 193859733506: <code> http://www.facebook...
How can I post Facebook fan page status updates to my WordPress blog?
wordpress
Here is how I am getting the views for one post: <code> function getPostViews($postID){ $count_key = 'post_views_count'; $count = get_post_meta($postID, $count_key, true); if($count==''){ delete_post_meta($postID, $count_key); add_post_meta($postID, $count_key, '0'); return "0 View"; } return $count.' Views'; } </code>...
View this section of the Codex to learn how to create a custom query: http://codex.wordpress.org/Class_Reference/WP_Query Your query will be something like: <code> $query = new WP_Query( array( 'meta_key' =&gt; 'post_views_count', 'orderby' =&gt; 'meta_value_num', 'posts_per_page' =&gt; 5 ) ); </code> By default, the o...
How to query for most viewed posts and show top 5
wordpress
on my theme, i found this script <code> add_image_size( 'slider', 464, 249, true ); add_image_size( 'fmenu', 306, 280, true ); add_image_size( 'teamthumb', 138, 207, true ); add_image_size( 'imlink', 286, 140, true ); add_image_size( 'albmlink', 274, 274, true ); add_image_size( 'fppost', 90, 90, true ); add_image_size...
I believe those are probably generated by the default WordPress sizes - thumbnail, medium and large. (See Appearance > Media for where those sizes are set). If you want to eliminate the extra image sizes the simplest way might be to eliminate some of your theme's custom image sizes and use the defaults instead. OR, you...
How to prevent upload of a multiple sizes of images
wordpress
I get this error due to one of the plugins which I rely on. Notice: wp_enqueue_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or init hooks. What does this error mean and how do you fix it? Mind due that this is not a critical e...
The problem is that the <code> wp_enqueue_style() </code> call is inside of the <code> category_collapse() </code> member function of the <code> CategoryCollapse() </code> class, and the <code> CategoryCollapse() </code> class is being instantiated by a callback hooked into the <code> plugins_loaded </code> action hook...
Notice that the wp_enqueue_style is not being called correctly!
wordpress
Is it possible to backup files from a old hard drive without having access to phpmyadmin? Could someone point me in the right direction?
Don't know if it's the best way but her is a very simple way to do it: Install a new copy of WAMP. Copy the files from the old HD to you newly installed wamp <code> \bin\mysql\mysql...\data </code> folder. Log in to phpmyadmin (that comes with WAMP) and create a dump of the database
Backup localhost (wamp) database (phpmyadmin) from harddrive files on windows? For WordPress?
wordpress
I would like to add a default select box to all widgets placed in the sidebars of my site. This would allow to choose the color of the associated widget. Do you know how i can make this ? I know how to make a custom widget. Thank you
Thanks to Ed Nailor &amp; Kucrut ! http://ednailor.com/2011/01/24/adding-custom-css-classes-to-sidebar-widgets/ // __________________________________________________________ // // CUSTOM CLASS BY WIDGETS function kc_widget_form_extend( $instance, $widget ) { if ( !isset($instance['classes']) ) $instance['classes'] = nu...
Add a select box to all widgets
wordpress
I have no idea why my sortable function does not sort my "events" my a custom post-meta. I have a custom-post-type named <code> wr_event </code> … I have my custom columns set up and my post-meta is shown in the columns, just like I want. The "Event-Date" handle even is already a sortable link! Only thing if I click on...
It's because you are checking <code> 'event_date' == $vars['event_date'] </code> not <code> 'event_date' == $vars['orderby] </code> . But don't use the <code> request </code> filter. Instead: <code> add_action( 'pre_get_posts', 'event_column_orderby' ); function event_column_orderby( $query ) { if( ! is_admin() ) retur...
Custom sortable columns ordered by meta-value?
wordpress
I don't consider myself to be a newb, I've had a loop of all the pages work before, but right now one of my custom loops on my page template (which is used as the index page of the site), will not show a list of 'pages'. <code> &lt;?php get_header(); ?&gt; &lt;?php if ( have_posts() ) while ( have_posts() ) : the_post(...
This is not the place to use query_posts. query_posts should only be used if you need to change the main loop. There is also no need to reset the query and your missing endif on both loops. I would use get_pages instead of running a new WP_Query. <code> $pages = get_pages(); foreach ( $pages as $page ) { ?&gt; &lt;li c...
Custom query does not find pages
wordpress
Exactly what it says on the tin, I am having a few problems with my site after a server upgrade and some of it has started to trip out. A lot of my code has also stopped working, despite it doing nothing fancy, mostly just loops and ifs just wondering if because a lot of it is dependant on WP functions.
Yes, it is. From the requirements page : PHP version 5.2.4 or greater MySQL version 5.0 or greater You don't need an update, try the various debug tools to see what goes wrong.
Is wordpress 3.3.1 compatible with PHP Version 5.2.17?
wordpress
I'm querying the twitter api when I use non secure connection http:// it works fine no wp_error (but twitter exceed limit error) but when I use https:// it works in my browser I can see the json and the xml formats, but there's an error with wp_remote_get, I tried using a second argument array('sslverify' => false) and...
Ok, just noticed that you're wrapping the URL in single quotes, so the <code> $username </code> variable won't get interpreted. Try this instead: <code> wp_remote_get('https://twitter.com/statuses/user_timeline/'. $username .'.json'); </code> Or use double quotes instead of single.
wp_remote_get doesn't work with secure connections https?
wordpress
I'm developing a plugin and upon activation, I get the following error: The plugin generated xxx characters of unexpected output during activation How can I see what <code> unexpected output </code> is generated? I have turned on debugging, but it doesn't help: <code> define('WP_DEBUG', true); if (WP_DEBUG) { define('W...
If a plugin has the error output The plugin generated xxx characters of unexpected output during activation then that only means that there is some error output . Sadly WP can't output anything more than this. Every error output sends a header (as <code> var_dump </code> / <code> var_export </code> / <code> print_r </c...
How can I see the error generated by plugin activation?
wordpress
I'm working on WordPress gallery. I display images with wp_get_attachment_image_src function: <code> foreach($slideshow_data['attachment_ids'] as $attachment_id) { $img_data = wp_get_attachment_image_src( $attachment_id, 'full' ); echo "&lt;img src=\"{$img_data[0]}\" width=\"{$img_data[1]}\" height=\"{$img_data[2]}\"&g...
Usually for gallery post types with lots of attachments, you would do it like this: http://codex.wordpress.org/Template_Tags/get_posts#Show_attachments_for_the_current_post Inside a "Wordpress Loop": <code> &lt;?php $args = array( 'post_type' =&gt; 'attachment', 'numberposts' =&gt; -1, 'post_status' =&gt; null, 'post_p...
Optimizing wp_get_attachment_image_src
wordpress
I have an unusual situation where I need to make the built-in post type 'page' non-hierarchical. I printed the post type object with <code> var_dump(get_post_type_object('page')); die; </code> and I got this: <code> object(stdClass)#164 (26) { ["labels"]=&gt; ... } ["description"]=&gt; string(0) "" ["publicly_queryable...
This is a pretty late answer, but I was looking to do something similar and figured it out. I wanted to get nav_menu_items into an RSS feed, which required changing the built in nav_menu_item post type property publicly_queryable. Anyway, it was actually pretty simple, here's a generic function to do it: <code> functio...
Modify built-in post type properties
wordpress
I read a lot about what is the optimal to translate your website (french and english in my case) I set up a Multi site where I created two site one french mywebsite.com/fr and one in english mywebsite.com/en I am now in the process of translating my theme(in french by default) I added this to my theme function.php: <co...
You have incomplete code. You register your Theme's textdomain, but don't actually tell WordPress to load your translation files. To this: <code> load_theme_textdomain('INTERluminaires', get_template_directory() . '/languages'); </code> Add this: <code> $locale = get_locale(); $locale_file = get_template_directory() . ...
Translated my theme (translation not showing up)
wordpress
I am creating a plugin which has 5 textbox for options. What I need to do is to treat these 5 options as 1 item, and being able to add more items. I've always worked with static hardcoded options for my wordpress plugins, so I am not sure how to do this, but I will try to do my best to explain myself. I want to have a ...
I don't have a plugin to point you to off the top of my head, but my general suggestion is this: Store the relevant plugin settings in a single option, as an array. The crux of the reasoning here is that you're just adding items to a single array, which is auto-keyed, so you can add or subtract at will, without worryin...
Need to add/remove group of options and display them as rows
wordpress