question
stringlengths
0
34.8k
answer
stringlengths
0
28.3k
title
stringlengths
7
150
forum_tag
stringclasses
12 values
On some installations of Wordpress, all updates performed through the administrative web interface require the FTP username and password to be entered before they take place. Others update and install themes/plugins just fine without needing FTP information. I'd like to test some permissions hunches by forcing the web ...
The problem with WordPress not being able to install plugins or update itself is because WordPress uses the Apache 'user' for all its processes. In the case of Ubuntu / Linux the Apache user and group is www-data:www-data. By doing <code> sudo chown www-data:www-data /wordpress </code> your changing the ownership of al...
How to cause the Wordpress web interface to update via FTP
wordpress
Hoping someone can assist but I am using the Satoshi WordPress theme (see:> http://www.vooshthemes.com/wordpress-theme/satoshi-2/ ) but I am having issues with creating a standalone page for my Portfolio page. Basically, I have created a page called “Portfolio” and changed the template type to “Portfolio” and publish. ...
I managed to solve my problem by reading the instructions much more carefully, that comes with the theme. FYI, my issue is clearly stated in the instructions under the heading of "Porfolio". All good now.
Satoshi WordPress Theme - Portfolio SetUp Issues
wordpress
I have seen on some wordpress themes that if the browser width is less, the normal menu becomes a select menu. Can someone tell me how it is done? I know there is a plugin for that, but I want to know how to implement it in the theme without plugin. Thanks
I think the plugin you mention is the one I wrote so if you're looking for answer on how to do it take a look at the code. http://wordpress.org/extend/plugins/dropdown-menus/ Essentially all I did was create a stackexchange-url ("custom menu walker class") so I could output the menus created in the backend as a dropdow...
Select menu on browser resize
wordpress
All the documentation I've encountered discusses overriding pluggable function via your plugin. What if you're doing theme development instead? My functions.php requires another file that overrides the <code> get_user_by() </code> function, defined in <code> pluggable.php </code> . If I omit the <code> if( function_exi...
If you are building this for a single client, you should absolutely take advantage of <code> mu-plugins </code> . There are a lot of things in WordPress that you can't do in <code> functions.php </code> . Pluggable functions is one of them, but more obvious, a number of hooks (both actions and filters) fire before <cod...
How to override pluggable function in theme?
wordpress
I want the background-color of the selected box on this page to display gray color once the user lands on the corresponding page. My link is currently setup inside of the page template itself as a traditional link, and is not being displayed under the default Wordpress menu setup. Do I need to add a CSS style to the "a...
Each link would need a unique class. Then you can work from one of the body classes, eg <code> page-id-7 </code> to do this. Your CSS would look like: <code> .page-id-7 .1-products a {color: #333;} </code>
Styling an "active" link outside of Wordpress default menu
wordpress
I am trying to write a query post such that it returns a list fixed list of posts from a category along with any of the one tag associated with it. For eg: <code> &lt;?php $arg = array('cat' =&gt; '1','showposts' =&gt; 10,'offset' =&gt; 0); query_posts($arg); ?&gt; &lt;?php if (have_posts()) : while (have_posts()) : th...
<code> &lt;?php $arg = array('cat' =&gt; '1','showposts' =&gt; 10,'offset' =&gt; 0); query_posts($arg); if (have_posts()) : while (have_posts()) : the_post(); ?&gt; &lt;a class="post-link" title="&lt;?php the_title(); ?&gt;" href="&lt;?php the_permalink(); ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt; &lt;?php if (!$...
Query Posts to fetch Posts with Unique Tag
wordpress
I see in the twentyeleven theme, before most custom functions they check if it exists <code> &lt;?php if ( ! function_exists( 'twentyeleven_comment' ) ) : function twentyeleven_comment( $comment, $args, $depth ) { </code> Why is that?
A child theme may have declared these functions already with a slightly different inner logic. The <code> functions.php </code> from the child theme is loaded before the file from the parent theme. Without this check you would get the Cannot redeclare … error. Plugins can create functions too, so this problem is not re...
Why to check if function doesn't exists in functions.php?
wordpress
My home page feed has a variety of items including a featured post and other features that I'd only like present on the home feed. When a user clicks on pagination to load older posts, I'd like to load up a new page template without all the home page bells and whistles. Is there a WP template file I'm overlooking or is...
Consider using the <code> is_home() </code> conditional tag to check whether or not the home page is being displayed or not. <code> &lt;?php if ( is_home() ) { // This is a homepage // Do your fancy loop here with extra bells and whistles } else { // This is not a homepage (i.e. paginated page) // Do a stripped down ve...
Custom Page Template for "Older Posts" Pages
wordpress
Since WP 3.3, the codex has been updated for both wp_enqueue_script and wp_enqueue_style that you can now enqueue both mid-page (within the HTML body). I see this as an advantage because: It's simpler to do that instead of having to do your logic (whether a widget is active, or a function is run) on an external functio...
Using <code> wp_enqueue_* </code> 'in the body of the page' (by which I really mean inside widget or shortocde callbacks) is an excellent way to ensure that scripts/styles are only loaded when they are needed (i.e. when the shortcode/widget is actually present on the page). Script/Styles Location Scripts and styles are...
Enqueueing Scripts/Styles mid-page
wordpress
I'm developing a theme that will have two recent posts section on the home page- one section for recent portfolio updates and the other for recent blog posts. I'm struggling with implementing these functions in the theme; I know it's something to do with wp_query, I'm just not entirely sure how to go about this. Any an...
If the blog / portfolio items are grouped into categories, you can do this at the top of your template file: <code> &lt;?php $portfolio_query = new WP_Query('posts_per_page=3&amp;category_name=portfolio'); // note 'portfolio' is the category slug $blog_query = new WP_Query('posts_per_page=3&amp;category_name=blog'); //...
recent posts for different categories
wordpress
Is it possible to use <code> wp_list_categories( $args ) </code> several times on a page to list different groups of terms from a taxonomy? The following code displays on term#58 together with a child that says "No Categories". None of the child terms appear on the page. However, if I remove the first use of the tag <c...
In the second set of args, you set both <code> include </code> and <code> child_of </code> to 58, which effectively eliminates any possible return.
Multiple category lists on one page
wordpress
I'm redesigning my website. The blog posts and everything were fairly easy to move to the new wordpress install. The URL of the test site is this: http://www.NathanTornquist.com/wordpress When I go to that URL I have this URL show up in the address bar: http://www.NathanTornquist.com/NathanTornquist/wordpress but when ...
The extra "nathantornquist" in the URL happens when you don't have the trailing slash on <code> http://www.nathantornquist.com/wordpress </code> . What are the contents of your .htaccess file?
Extra Text in URL
wordpress
I've tried a bunch of things but cannot find a solution that works. I want my site to have the structure: <code> mysite.com/ = homepage mysite.com/blogs/ = blog archive mysite.com/blogs/year/ = blog archive (in a specific year) mysite.com/blogs/year/month/ = blog archive (in a specific month) mysite.com/blogs/year/mont...
You can set the author base independently by manipulating the <code> $wp_rewrite </code> global: <code> function wpa55976_author_base() { global $wp_rewrite; $wp_rewrite-&gt;author_base = 'authors'; $wp_rewrite-&gt;author_structure = '/' . $wp_rewrite-&gt;author_base . '/%author%'; // EDIT - rewrite rule to force autho...
How do I prefix blog post urls as mysite.com/blog/%postname%/ but allow authors to still be located at mysite.com/authors/%nicename%?
wordpress
Is there no post AND page parameter for WordPress functions? So would I have to create a custom post type to define post AND page? For example, <code> add_meta_box( $id, $title, $callback, $post_type, $context, $priority, $callback_args ); </code> you need to define what type of <code> $post_type </code> . The options ...
There's no reason you can't call add_meta_box() twice in a row and use the same function to display it both times; just change the <code> $post_type </code> parameter. Example <code> foreach ( array ( 'post', 'page' ) as $post_type ) { add_meta_box( 'your_id', 'your title', 'your_callback', $post_type ); } </code>
Post AND page parameter for WP function
wordpress
I just got a new Macbook Air and I've been manually migrating my files and code over from my old Macbook (instead of using Migration Assistant, to avoid bringing cruft). I had several sites running Wordpress locally (on my old Macbook), as well as several sites running just statically with no CMS. I think I've gotten A...
Turns out the issue was twofold: 1) Although I had updated the mysql default socket location from <code> /var/mysql/mysql.sock </code> to <code> /tmp/mysql.sock </code> , once in <code> php.ini </code> , there were apparently two statements for this in the file (not sure why) and the second was still overwriting the fi...
Getting "Error Establishing a Database Connection" on localhost in new Mac OSX Lion environment
wordpress
wondered if anyone knew the most elegant way to insert some sort of warning message each time someone tries to create a new post, i.e. 'please remember what you publish is your own responsibility', that sort of thing. I'm thinking I'd like to use the error or warning css wordpress uses if it can't find something or the...
<code> function my_admin_notice(){ global $pagenow; if ( $pagenow == 'post-new.php' || $pagenow == 'post.php') { echo '&lt;div class="error"&gt; &lt;p&gt;This notice only appears on the add and edit post &amp; page.&lt;/p&gt; &lt;/div&gt;'; } } add_action('admin_notices', 'my_admin_notice'); </code> http://codex.wordpr...
insert a warning message into post-new.php
wordpress
In my theme's functions.php, I'm calling an add_action in order to gain a measure of control on where jquery is loaded (in the footer along with my theme's other scripts). The problem I'm having is that when I use add_action('wp_enqueue_scripts'), it only appears to fire if no plugins are loaded. However, the add_actio...
A lot of plugin developers don't do things the right way. The right way is to hook on to <code> wp_enqueue_scripts </code> like you're trying to do. However, here's the order of the hooks run in a typical request: muplugins_loaded registered_taxonomy registered_post_type plugins_loaded sanitize_comment_cookies setup_th...
When to use add_action('init') vs add_action('wp_enqueue_scripts')
wordpress
On my main page, I want to show posts from 3 categories, and 1 custom post type. Is there a way to get them together in one <code> pre_get_posts </code> function? Or do I need to query separately - once for the CPT and once for the posts from specific categories?
If you are after on post from category a, one from category b, another form category c and then finally a custom post type - each of these would have to be a separate query. Think of these as 'secondary queries' - (the primary query being what lands you on the home page). So you'll want use seperate instances of <code>...
Showing posts from different categories and from custom post type
wordpress
Before 2 days there was a automatic update for wordpress, which I for my website. When the update was over, I tried to access backend but I always get this message: <code> Fatal error: Call to undefined function wp_is_mobile() in /home/*******/public_html/wp-login.php on line 67 </code> Can you give me any idea what to...
/!\ Before change I suggest, please make a full backup (code + database) of your Wordpress. Deactivate all plugins. If it does not help try next Re-upload all files and folders ( except the wp-content folder ) from a fresh download of WordPress.
can't access backend while frontend works perfect
wordpress
I want to show the last category level of a post for example, I hav a post in category "Course -> resultat -> Trail" I want to show just "trail" Thanks if somenone can help
Try the following. I've used <code> get_the_terms </code> so it is readily extendible to any taxonomy. This will return an array of terms (event if it contains just one). For instance, the post may have terms a,b,c,d,e in the relationship: <code> a &gt; b &gt; c (parent &gt; child) d &gt; e </code> In which case the fo...
Name of last category level for a post
wordpress
I am using a plugin called WP events manager, I would like to add custom functionality so that each event can be 'added' to a 'basket' then at the end the user can go the the 'checkout' and register for these events. I believe this is done by storing the ID of the event when the user clicks add in PHP sessions and then...
It is relatively simple. I've giving you a few steps. User visits your site and hit 'Add to basket' on an event. You need to send this data to server (as you wanted to store in php session). you can submit a form (for simplicity) either in synchronously or asynchronously (ajax). You need to submit a form to your URL wh...
Wordpress & PHP sessions
wordpress
My custom query works, but in debugging mode I get this error: <code> Notice: Undefined offset: 0 in /storage/content/24/150624/mydomain.com/public_html/wp/mysite/wp-includes/query.php on line 2232 </code> This is what my query looks like: <code> &lt;?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_...
<code> get_term_by </code> returns an object, try passing <code> $term-&gt;slug </code> to your query instead.
Custom query, works, but I get a "Notice: Undefined offset: 0..."
wordpress
I registered my menu in functions.php, called it from header.php and set it all up in the Appearances > Menus backend. The problem is, I need to manually insert a div surrounding <code> &lt;ul class="sub-menu"&gt; ... &lt;/ul&gt; </code> where my drop-down menu is. There is no way around it like adding the div's class ...
Update: The question was actually how to wrap the submenus, not the whole menu. Here are 2 options: using jQuery: <code> &lt;script type="text/javascript"&gt; // run this before the script that sets up the dropdowns: jQuery(document.ready(function($){ $('.sub-menu').wrap('&lt;div class="dropdown"&gt;&lt;/div&gt;'); }) ...
Edit the (automatic) HTML layout of nav menus
wordpress
I am working on a plugin and would like to know the correct way I go about creating a page that will look like the users page (image attached at the buttom) The fields will be different and will add data(the data is unrelated to user information) to a new table created by the plugin . So it does not seem like the Setti...
If I understand you correctly you want to create a page for your plugin which mimics the look and feel of the WordPress Dashboard and it's option pages? If so then you can use the CSS which is packed with WordPress. The CSS file is located at wp-admin/wp-admin.css If you open that file with your code editor you can ins...
I am trying to make a page in the admin section similar to the appearance of the Profile page for users
wordpress
I have a stylesheet in my theme in the css subdir of the theme dir ( <code> css/style.css </code> ). The question is how to make this .css file appear in the theme editor of the WordPress admin. (I know using the web editor is a bad idea and I never use it, but the client specifically asked for this). Note: the only cs...
I'd say it's impossible... For one, there's no hook inside the file <code> /wp-admin/theme-editor.php </code> . And last but not least, if you try one of this, it dumps an error: <code> /wp-admin/theme-editor.php?file=css%2Fstyle.css&amp;theme=twentyeleven </code> <code> /wp-admin/theme-editor.php?file=css/style.css&am...
how to make stylesheet appear in theme editor?
wordpress
I'm trying to enqueue jQuery UI in a plugin under a class method. I have this so far: <code> class AV_Slider { function slider_load_js(){ wp_register_script('jquery-ui-core', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.5.3/jquery-ui.min.js'); wp_enqueue_script('jquery-ui-core', array('jquery') ); wp_enqueue_script...
First of all - I'm not sure why you are registering <code> jquery-ui-core </code> . WordPress has already registered jQuery UI scripts (see here ). You should use the shipped jquery and jquery-ui scripts rather than registering your own. As for the error - the second argument <code> add_action </code> (and <code> apply...
wp_enqueue_scripts in a plugin's class
wordpress
So I'm trying to enqueue scripts used for some post formats like video and audio and I could find a way to check what post formats are going to be shown on the page. I tried print_r on some global variables but they doesn't seems to have post_format in the post details, I tried $posts and $wp_query and also tried print...
Inside the Loop, try something like the following: <code> &lt;?php if ( get_post_format() &amp;&amp; in_array( get_post_format(), array( 'audio', 'video' ) ) ) { // The current post has either the // audio or video post format; // enqueue a script wp_enqueue_script( $handle, $src ); } ?&gt; </code> Now that WordPress c...
How to enqueue scripts depending on post formats?
wordpress
I have uploaded a binary .war file which is nothing but a .zip file with Java web application extension. When I hit the URL for this file, I see junk characters in browsers. URL: http://www.javaquizmaker.com/QuizGenerator.war Need a way by which I can make the users download this file. By the way, I uploaded using FTP ...
If your webserver is Apache, you'll need to tell apache what kind of mime type your file is, so Apache knows how to handle it. You should be able to use the "application/octet-stream" mime type in your .htaccess, in order for Apache to force a download. Learn more here: http://www.htaccess-guide.com/adding-mime-types/ ...
Need to download uploaded binary file
wordpress
I need to retrieve the id of a role by giving it roles name. For example: <code> if( current_user_can('editor') ) { //here I want to retrieve the id of editor. } </code> How can I do that?
Try buildin function get_users . The code should be like that: <code> $args = array( 'role' =&gt; 'editor' ); $editors = get_users($args); foreach ($editors as $user) { echo '&lt;li&gt;' . $user-&gt;ID . '&lt;/li&gt;'; } </code>
How to get the role id from the role name?
wordpress
dose anyone know how to get this query (or a different query) to preserve the page formatting? Thanks <code> &lt;?php $my_postid = 663;//This is page id or post id $content_post = get_post($my_postid); $content = $content_post-&gt;post_content; $content = apply_filters('the_content', $content); $content = str_replace('...
You're comparing apples to oranges here. Both queries do the exact same thing, but are presented through different code. Your query: <code> &lt;?php $my_postid = 663;//This is page id or post id $content_post = get_post($my_postid); $content = $content_post-&gt;post_content; $content = apply_filters('the_content', $con...
Query page: preserve page formating
wordpress
I get the basic plugin concept. I've read the Codex article on Writing a Plugin That article talks about the "main plugin file". How does Wordpress determine "the main plugin file" ? Q1: Is it legal / supported to have a plugin that is structured like this: pluginname/ pluginname/mainfile.php pluginname/supportingcode-...
How does Wordpress determine "the main plugin file" ? It is the file in your plugin that contains the plugin header comment <code> /** * Plugin Name: A fresh example * Plugin URI: http://example.com * Description: Foo makes a bar * Version: 2012-06-14.1426 * Author: John Doe * Author URI: http://example.com * TextDomai...
How MUST the directory for a plugin be structured?
wordpress
I am using the Mailchimp plugin ( http://wordpress.org/extend/plugins/mailchimp/ )and it has a shortcode that uses output buffering to grab it's widget's code and spit it out in the content. however, the widget code has plenty of white space, so the_content filters are throwing useless linebreaks (like after hidden inp...
You do not need a plugin to do this. Just add 3 lines of code to the end of the <code> functions.php </code> file in your active theme: <code> remove_filter( 'the_content', 'wpautop' ); add_filter( 'the_content', 'wpautop' , 99 ); add_filter( 'the_content', 'shortcode_unautop', 100 ); </code>
Remove wpautop from shortcode content / remove whitespace in buffering
wordpress
I have multiple author accounts on one of my WordPress installs. Often I will create a post, and set the author to be a different account. However, when I upload images into that post, their attachment page lists the author as my account. How can I set the author for posts, and have it carry over to the media associate...
Use this in your theme's <code> functions.php </code> : <code> add_filter( 'add_attachment', 'wpse_55801_attachment_author' ); function wpse_55801_attachment_author( $attachment_ID ) { $attach = get_post( $attachment_ID ); $parent = get_post( $attach-&gt;post_parent ); $the_post = array(); $the_post['ID'] = $attachment...
How to set author for post AND post attachments
wordpress
I want to use an additional, arbitrary post status on one of my custom post types. I'm calling it "limbo", and it's assigned to a post which has been deleted by the user, but one that I still want to keep its data on the database for legacy purposes. I assign it to a post by hijacking the permanent deletion routine, wh...
I'm pretty sure only attachments have post status "enforcement" ("inherit" or "private"), and that's only inside <code> wp_insert_attachment() </code> . Otherwise there's no cron action or routine I'm aware of that'll change stati. I still think you should opt for registering it though. Without any arguments, everythin...
Using arbitrary post status without registering it
wordpress
I'm looking to create a membership-based website and I'm new to WordPress so its been a headache trying to look for free plugins that can creates 3 levels of membership (non-members, members, and premium members) limit access to certain pages/functionality of the site to members/premium members Also can't find a good p...
Did you, by any chance, look up "wordpress membership plugin" on Google? The first link is for the Membership plugin on WordPress.org. You only need 2 levels of membership (members and premium), as regular users will be non-members by default. I suggest you do a Google search for "wordpress custom user registration" as...
Free WordPress plugins for membership?
wordpress
I need to pull out the post publish date in order to make the post post auto expire. The thing is I can't get the right publish date. Here is my code: <code> global $wpdb; $post_ids = $wpdb-&gt;get_results( "SELECT ID FROM $wpdb-&gt;posts WHERE post_status ='publish'" ); foreach($post_ids as $id){ $postdate = get_the_d...
<code> get_the_date </code> must be used inside the Loop. For outside the loop use <code> get_the_time </code> . <code> $posts = get_posts(array('numberposts'=&gt;-1)); //Get all published posts foreach ($posts as $post){ echo get_the_time('Y-m-d', $post-&gt;ID); //Echos date in Y-m-d format. } </code> Consider replaci...
How to get the post publish date outside the loop?
wordpress
I'm trying to find way to enable automatic search in WP. For example, I have a page <code> mysite.com/some-thing </code> . Within that webpage, I also want to display the content of the page <code> mysite.com/?=some+thing </code> . I don't want to use an <code> iframe </code> because I want the content of the second pa...
something like this in your page template, ideally after endwhile (if any) <code> &lt;?php $theQuery = strtolower(trim(get_the_title())); $args = ('s='.$theQuery .'&amp;showposts=5'); $search_query = new WP_Query($args); if ($search_query-&gt;have_posts()) : while ($search_query-&gt;have_posts()) : $search_query-&gt;th...
How to enable automatic search results in WordPress
wordpress
I'm writing a plugin to manage data about open-source projects. I developed an object model and have successfully created all custom post types and taxonomies, as well as implemented the correct capabilities/roles using the <code> Members </code> plugin. The appropriate users can create, modify, and delete their own po...
You need to use the <code> template_include </code> filter which is the generic filter for all template inclusions. <code> add_filter( 'template_include', 'my_plugin_templates' ); function my_plugin_templates( $template ) { $post_types = array( 'project' ); if ( is_post_type_archive( $post_types ) &amp;&amp; ! file_exi...
Is it possible to define a template for a custom post type within a plugin independent of the active theme?
wordpress
Intro: Hello, I am making coupon website and I need an advise. So, the structure at the moment is like this: Coupons ( posts ) Categories of coupons ( categories ) Shops ( tags ) In the near future my database will consist of approximately ~5000 shops ( tags ) and ~20000 coupons ( posts ) and also ~10000 of categories ...
Custom Post Types are more convinient and easy to implement, so I suggest you use them. Also the Posts will be ready to make a blog section in the future. About optimizing. Use some caching plugin, there are lots of them in Wordpress Plugin Directory . Turn off the revisions to save database size: add <code> define ('W...
Organize WordPress site, so it can maintain with huge database
wordpress
Im trying to update into another table the values blogname, blog description options when the user updated them from General Settings page. I use this code, <code> $hook_array = array('update_option_blogname','update_option_admin_email','update_blogdescription','update_option_home','update_option_siteurl'); foreach($ho...
well, i just found that you've error in your query. i've re-written that for you: <code> $wpdb-&gt;query("UPDATE `" . $wp_blogs_info . "` SET `site_title`='".$wpdb-&gt;escape($blogname)."', `site_description` = '".$wpdb-&gt;escape($blogdescr)."' where blog_id = '" . (int)$the_id . "'"); </code>
Insert/Update values to a table after blogname option etc. is updated
wordpress
<code> update_core update_plugins update_themes install_plugins install_themes delete_themes edit_plugins edit_themes </code> Hi, I want to restrict those capabilities to user_id = 1 so other super admins cant edit network files. (Btw if i am missing something, let me know). What is proper way of this? Tried http://wor...
Editing super admin capabilities is a little different from editing the capabilities of every other role, because there is a slight detour in the way WP checks the current user's capabilities. This is what you find on <code> capabilities.php </code> on line 864: <code> function has_cap( $cap ) { // (...) // Multisite s...
Restrict Admin Capabilities in MultiSite
wordpress
Here is the kind of archive page I am trying to reproduce for my client: http://www.catwalkyourself.com/page/ready_to_wear/autumn_winter12-13/rtw12_13.php As you can see, it is a list of alphabetically organized lists. How would I go about creating this in Wordpress?
I'd use the default Links section in the dashboard, then write a custom loop to sort them alphabetically (and with the rad big letters of the alphabet as headings). Throw this in your theme's <code> functions.php </code> file, then use it on any page with the <code> [bookmarks] </code> shortcode: <code> function bookma...
How do I create an alphabetically organized glossary of links?
wordpress
If I visit a page on my WordPress site, WP goes and determines what template file it should use based on the template hierarchy . If I'm doing some logic checking in the hook <code> init </code> and say my conditions are met, how do I tell WordPress to load a template file of my choosing, not the one WordPress would no...
Can you perform the logic on the <code> template_include </code> filter? Else, you could set a global/constant and use that in <code> template_include </code> to serve up the appropriate template. The template_include filter filers the path to the template file to be included. To avoid errors you should check if the te...
Load different template file when condition met?
wordpress
I'm building a site and each post has a PDF file attachment. Is there a way I can access that file outside <code> the_content() </code> on a single post page? I'd like to put the file attachment in a sidebar and not in the body of the post.
I ended up using the WP-Filebase Download plugin . This allowed me to pull the attachments into a shortcode list that I could put in my template file outside `
Accessing Media/Files outside the_content
wordpress
I am trying to put a link in the post meta with this code <code> $authorEmail = get_the_author_meta('user_email'); $authorEmailLink = '&lt;a href ="mailto:'.$authorEmail.'"&gt;'.$authorEmail.'&lt;/a&gt;'; add_post_meta($post-&gt;ID,'Author Email',$authorEmailLink,true); </code> The <code> $authorEmailLink </code> is a ...
I don't think spaces are allowed in <code> $meta_key </code> . Try to change 'Author Email' to 'author_email'. Also, if you don't want 'author_email' to be visible in Custom Fields metabox, prepend it with underscore: '_author_email'. Unfiltered link as custom field value can also mess this metabox.
Is there a way to add a link with add_post_meta?
wordpress
Anyone here ever had the need to add the AJAX add to cart button (the one located on product archives) on a custom query post output? Do you mind sharing the hook? I can't seem to find the correct one.
Digging through the code, it's pretty straight-forward to find. First, look at the template used for product archives - <code> /templates/archive-product.php </code> . Among other things, it sets up the regular queries and begins building the markup of the page. But when it actually starts looping through each product,...
The hook for the AJAX Add to Cart button?
wordpress
<code> $wp_admin_bar-&gt;add_menu( array( 'parent' =&gt; $menu_id, 'id' =&gt; $menu_id . '-example', 'title' =&gt; __( 'Example Menu Item', 'example' ), 'href' =&gt; get_admin_url( $blog-&gt;userblog_id, 'edit.php?post_type=example' ), ) ); </code> Lets say i have a plugin that add a new menu item for an example custom...
Answer remade and now working as per the Question specifications. To add a menu item to each site of the network if an specific plugin is active in that site, I'm using a Must Use plugin. It only runs if <code> is_multisite() </code> and if <code> is_admin_bar_showing() </code> . In this example, the plugin is instanti...
Plugin menu addition in multisite
wordpress
How to remove and disable access to General Settings Page including its link on the Settings Tab and add a new link as General Settings?
There is a plugin called " Admin Menu Editor " that can do just this. I have used it numerous times without issues.
How to remove and disable access to General Settings Page including its link
wordpress
I am looking for ANY plugin which can save custom form(newsletter form, contact form) data to WP database (front-end) and then allow to browse the submitted data in the back-end (WP admin). Any tips much appreciated!
Best solutions would be: Contact Form 7: http://wordpress.org/extend/plugins/contact-form-7/ Contact Form to DB: http://wordpress.org/extend/plugins/contact-form-7-to-database-extension/ Contact Form 7 to Database Extension: export all of the data to DB allows browsing and exporting keeps every form data separate to br...
Form data to wordpress DB
wordpress
I am using WP E-Commerce plugin. In my e-commerce platform, there is two variable for product price. Its based on location (ie. india, usa, canada (not by continent)), and weight also. How can I achieve this, is there any plugin ?
This looks like it might be perfect for you: Region Weight Shipping
Shipping charge by country & product weight?
wordpress
I have an ajax request using wp_ajax sending one variable named "q" what I want to do is after the script get's the request to look inside the db and fetch the title and id of the corresponding posts that have either the title or the content "like" the variable so in other words here is my code : <code> global $wpdb; $...
Dude, no need of the SQL mess! WP allows you to search through the post content or titles alphabetically using the search parameter . So, use this solution instead... <code> global $wpdb; $q = $_REQUEST['q']; $posts = get_posts(array('s' =&gt; $q, 'post_type' =&gt; 'question', 'posts_per_page' =&gt; -1)); echo '&lt;ul&...
SQL query not working in alphabetical post title/content search
wordpress
I have written few functions in the function.php file of the theme. Should I use <code> add_filter </code> function for those functions?
It depends on the things you want to do. you can use add_filter and add_action based on what you want to do. Actions : Actions are the hooks that the WordPress core launches at specific points during execution, or when specific events occur. Your plugin can specify that one or more of its PHP functions are executed at ...
Should I use add_filter for functions in function.php of the theme?
wordpress
The question probably needs some clarification so here I go: I'm building a carousel displaying the titles of the 5 latest articles. However, from a specific category (called schaft in my case) it should only display one post even though the 5 latest posts might have this category in there multiple times. If this is th...
You could do one query for the 4 latest posts excluding the <code> schaft </code> category, then do another query for the latest post in <code> schaft </code> . get the date of the single <code> schaft </code> post and check it against the dates of the other posts as you output them, inserting it in the correct positio...
How to display the 5 latest post titles but allow only 1 in there of a specific category
wordpress
I have a .php page in the theme root to check the data of one CUSTOM form. After receiving this data I need to do a query in a custom mysql table, so I need $wpdb, but I can't use it directly (or doing <code> global $wpdb </code> ) because it is a phisical .php file, so the rewrite rule will not affect the request (the...
First of all you probably created an isolated file that is not under the umbrella of WP files. That's why you are not getting $wpdb. I guess you may not following the general rules/conventions of theme development. my question is now how are you accessing the file? whatever, if you include the wp_config.php in your fil...
How to initialize $wpdb?
wordpress
I'm giving Custom Query Fields a shot for filtering/sorting posts on the front-end of a site. The instructions seem pretty self-explanatory, but I do have another layer that I'm trying to figure out. For one of my custom fields, it is currently storing a fractional number. I am controlling the input so only values like...
What I ended up doing was storing the data I needed in the <code> post_meta </code> table on-save: <code> add_action( 'save_post', 'mouldings_hidden_postmeta' ); function mouldings_hidden_postmeta() { global $post; if (is_admin() &amp;&amp; (get_post_type() == 'moulding_profiles' || get_post_type() == 'moulding_combina...
Custom Query Fields - Altering Meta Value
wordpress
I want to write a select query to return data on only posts which have are associated with the taxonomy term <code> food-and-beverage </code> <code> SELECT wp_postmeta . * , wp_posts.post_name FROM wp_posts, wp_postmeta, wp_terms, wp_term_relationships WHERE wp_posts.post_type = 'projects' AND wp_posts.post_status = 'p...
(I realize you're leaning away from this, but maybe if you can get it working, it's worthwhile. With the recent perfomance improvements in 3.4 for WP_Query, this could be worthwhile.) <code> WP_Query </code> is the right decision if this is a secondary loop. Otherwise, you might look into <code> pre_get_posts </code> ....
How to Query Database for posts with certain Taxonomy Term
wordpress
I am on the lookout for plugins that can help me set a number of banner spaces with custom sizes, then be able to rotate banners within these spaces. So I could guarantee 10% of all impressions to an advertiser when there are 10 banners for a particular spot. Any suggestions for good plugins, I don't mind if they are p...
A quick search on Google will return you numerous solutions some of which will meet your requirements and that's the best place to find answers to your question as WPSE focusses more so on problem related questions, generally involving code of some nature. However, some links to get you started: Ad Management Plug-Ins ...
Banner Advertising plugins for WordPress
wordpress
I found examples adding a class to top level itens, so we can display an arrow in menu itens with subitens, but is seems terrible to cope with the already builtin WordPress classes, can't display the arrow with current and css hover, it just ruins all states. Is there someway to add a <code> &lt;span class="arrow"&gt;&...
You can use the <code> walker_nav_menu_start_el </code> filter: <code> add_filter( 'walker_nav_menu_start_el', 'wpse_add_arrow',10,4); function wpse_add_arrow( $item_output, $item, $depth, $args ){ //Only add class to 'top level' items on the 'primary' menu. if('primary' == $args-&gt;theme_location &amp;&amp; $depth ==...
Add span in top menu item with nested itens
wordpress
I've looked around and can't figure out what happened to my search page. It used to work but then I guess why I added my archives.php and a bunch of other things it stopped working, but I can't tell at what point in the last week it stopped working.I usually test almost everything on the site when I make changes but fo...
You are missing the closing <code> ?&gt; </code> php tag before the <code> &lt;article&gt; </code> tag.
Search page isn't returning any results
wordpress
I am using a .mo file in my language directory of wp-content. But It doesn't trnslate some words and all the numerical contents of the site. How can I add these to the .mo file? Or is there any other way to translate those contents?
If dont use the strings inside the theme or plugin the function for localisation, then it is not possible to add this to the mo/po file. You must change the source of the theme or plugin. But used the theme or plugin the functions, than parse the source via plugin or desktop tools to add the strings to the mo/po files....
wordpress localization extending
wordpress
I am trying to create my own first plugin but I am coding novice so please guide me to the right direction. This plugin is to set the post expiry date based on the user's role. Now I am stuck at the saving data phase. Since I don't want to create a new database table for the inputs. I using the settings api to do the w...
This is the way I like to handle collection of form inputs. Detailed explanation is in the comments. <code> if( isset( $_POST ) ) { // Create an empty array. This is the one we'll eventually store. $arr_store_me = array(); // Create a "whitelist" of posted values (field names) you'd like in your array. // The $_POST ar...
How to save array of datas in option page by setting api?
wordpress
I was looking at the way WordPress uses "Or Link to Existing Content" under the link button in the editor and I am wondering if there is any way I can use that code to allow users to select a page to link to when they create a new custom post. The context I am talking about is that of slides for a slider linking to con...
I've run across this before. What I did was use <code> get_posts() </code> to return a list of the pages in the site and making the pages options in a drop down menu in a meta box. <code> // $your_args is an array that you've previously declared to get all the pages. $pages = get_posts($your_args); foreach( $pages as $...
Is there some way to provide the user a list of existing content in a CPT
wordpress
I have developed a theme for Wordpress and I need to customize login and registrations form. At the moment, as usual, the login and the registration URL are: <code> http://www.example.com/wp-login.php http://www.example.com/wp-login.php?action=register </code> I would like to create INLINE form, with INLINE I mean that...
1. Can you do it without a plugin? Certainly. Anything a plugin can do, you can obviously also implement yourself. 1.1 Should you do it without a plugin? No. This is clearly plugin-territory. Even if you want to write the plugin yourself, this would be a better fit for a custom plugin than to incorporate it in your the...
How to create custom LOGIN and REGISTRATION forms?
wordpress
I never use the WP menu (the logo and its child items) except when I click it accidentally. And it is wasting my time when I navigate per keyboard. Plus, the support page is not our site . How can I remove it? Screenshot of the menu:
This menu is added in <code> WP_Admin_Bar::add_menus() </code> with an action: <code> add_action( 'admin_bar_menu', 'wp_admin_bar_wp_menu', 10 ); </code> To remove it take the same action – just one step later. The following code works as a mu plugin or as a regular plugin: <code> &lt;?php # -*- coding: utf-8 -*- /** *...
How can I remove the WP menu from the admin bar?
wordpress
I'm trying to place a small code in my template <code> header.php </code> file. I want to get a custom field value. I'm trying to call custom fields from current page outside of loop, btw. I have no problem doing this when I need to get custom field values from posts, but I can't seem to do this for pages. Here is my c...
try using <code> get_metadata('post', $postid, 'teaser-text, true); </code> these two actually same. should not make any difference. earlier i gave wrong arguments. var_dump() will show you what it is actually getting. please make sure, the ID is correct, 'teaser-text' exists. You can also try using some other meta nam...
Calling custom fields for pages (not posts)
wordpress
<code> add_filter('example_filter', function(){ return array( 'tax1' ); } ); add_filter('example_filter', function(){ return array( 'tax2' ); } ); add_filter('example_filter', function(){ return array( 'tax3' ); } ); print_r( apply_filters( 'example_filter', array()) ); </code> Result is <code> Array ( [0] =&gt; tax3 )...
Filters work by calling each of the hooked callback functions (in priority order). The value to be filtered is passed to the first callback funtion. The returned value of that callback function is then passed to the second callback, and the returned value from that is passed onto third and so on, until all hooked callb...
Insert new element to array with add_filter
wordpress
I have hosting space at goDaddy that is shared between a couple domains. Originally I had a single wordpress install in a sub folder. Now I also have a wordpress install in the root directory also. The wordpress that was installed first in the sub folder works if you go to the home page, but if you try to go to a diffe...
I'm wondering if you simply copied your files from the sub directory's install into the root directory? That wouldn't be how you want to create a multisite. Check out the instructions here: http://codex.wordpress.org/Create_A_Network Secondly, if you go into your sub directory's install, look at the wp-config.php file ...
Two Wordpress Installs — Failed page on One Defaults to the Other
wordpress
I have search a lot but cannot find any solution for my problem. I when i entered the search term to the search box of my website, it goes to <code> mysite.com/search/search+term </code> . However, the result page does not have meta keywords and meta description. I trying to find way to add these values into the header...
that is relatively easy. you can add this to your theme's functions.php file <code> add_action('wp_head', 'add_meta_tags'); function add_meta_tags(){ if(is_search()){ $search_keyword = get_search_query(); echo '&lt;meta name="META_NAME" content="META TESTING" /&gt;'; } } </code> you may change <code> echo '&lt;meta nam...
How to insert meta keyword to search result page
wordpress
After running the automated upgrade to 3.4, I receive the message Fatal error: Call to undefined function get_option() in /.../wp-admin/admin.php on line 32 I have renamed plugins/ to plugins2/, renamed themes/ to themes2/, created themes/ and placed twentyten in there. Still fails with same error. I have downloaded a ...
The problem was caused by about 8 wordpress files in the root directory with a filesize of 0 bytes. Uploading fresh copies of these files (from the latest version downloaded from wordpress.org) solved the initial problem. The subsequent problem has since cleared without any indication of what steps solved it.
Upgrade to 3.4 error: Call to undefined function get_option()
wordpress
Can I use <code> WP_Query </code> to only query posts less than (or greater than) a given post ID? <code> $filtered_query_args = array( 'post_type' =&gt; 'projects', 'order' =&gt; $prev_next=='next' ? 'DESC' : 'ASC', 'orderby' =&gt; 'ID', // ID &lt;= $post-&gt;ID ); </code> I've been digging around in the codex with no...
I ended up using something like this: <code> function filter_where( $where = '' ) { global $post, $prev_next; $the_ID = $post-&gt;ID; $where .= " AND wp_posts.ID "; $where .= $prev_next=='next' ? "&lt; $the_ID" : "&gt; $the_ID"; return $where; } add_filter( 'posts_where', 'filter_where' ); $nextProjQuery = new WP_Query...
Compare post-IDs within WP_Query? (Less than / Greater than)
wordpress
I'm looking to find a theme foundry (ie. woothemes, elegant themes) that has themes that are very well coded; where "code is poetry". To be more precise, I'm looking for themes coded in "the wordpress way" - similar to how Twenty Ten, Eleven and _s themes are coded. My experience buying and then subsequently modifying ...
I hear you. I've been very disappointed with almost every theme I've ever purchased. That includes multiple Theme Forest themes, one from MOJO, Elegant Themes, and more. The only theme foundry I like is...wait for it, this is so poetic... The Theme Foundry . The quality of their themes is underscored (not to be confuse...
Which theme foundry has clean coded themes, where code is poetry
wordpress
Today milestone 3.3.3 was completed – five days after version 3.4. I have seen the same with milestone 3.2.2 which was never released. WordPress does not offer any long term support as Matt once explained. See also: stackexchange-url ("Will there be security updates for 3.1 once 3.2 is released?") 3.3.3 is a security b...
The only reason why the 3.3.3 milestone was marked as completed is because leaving the milestone open interfered with our ticket reports for 3.4.1. (I forgot that milestone closures are reflected in the timeline.) Generally speaking, we assign tickets to the next minor milestone if they are reporting an immediate regre...
Why are there updates for obsolete WordPress versions?
wordpress
I'm looking to display a list of tags on my archives.php page. Here is the search archives page. I have archives by month <code> &lt;ul&gt; &lt;?php wp_get_archives(); ?&gt; &lt;/ul&gt; </code> Archives by category <code> &lt;ul&gt; &lt;?php wp_list_categories(); ?&gt; &lt;/ul&gt; </code> and now I'm trying to look thr...
You can try using the tag cloud .
Displaying a list of tags in my archives page
wordpress
I am Working on wordpress plugin. and i have a form like this <code> $action_url = WP_PLUGIN_URL .'/demo-url-rewrite/include/test.php'; &lt;form action="&lt;?php echo $action_url; ?&gt;" method="get" name="f1"&gt; Name : &lt;input type="text" name="name" id="name" value=""&gt;&lt;br /&gt; &lt;input type="submit" name="...
Do you actually need the URL? Such URLs are needed only if you want the search to be indexed. Example: Check this . (That 'a' in the url comes from the search form in this page and the homepage) The ideal way for parsing a form is to use the <code> init </code> action hook instead of setting the form action. If you sti...
i want to rewrite my custom plugin url
wordpress
Hopefully this is a reasonably straightforward question! Is it possible to order posts, on the front-end of my WP install, by two meta values? I have a meta key called <code> genus </code> and another called <code> species </code> . I'd like to sort firstly by <code> genus </code> (ASC), then <code> species </code> (AS...
AFAIK, you can't do it using a meta query. Check this example , does what you want.
Is it possible to order posts by two meta values?
wordpress
Quick question, I have a custom options page which posts to options.php, however I have a few sections to my options page where i change the post url like so: <code> &lt;form action='options.php?section=sectionname' ..&gt; </code> when the options page reloads I need to check which section was just saved i.e. get the s...
How about putting the current section in a hidden form field inside each section, and then when you reload the page, check <code> $_POST['section'] </code> ?
retain querystring values when savincustom options in admin
wordpress
I use the custom field plugin http://www.advancedcustomfields.com Is it possible to create and edit custom posts via the front end? I'd need to be able to see all the custom fields and allow those to be edited as well. Users should only be allowed to edit their own posts if they are logged in.
you can do with wp insert post and wp update post
Front-end editing with custom fields?
wordpress
I'm working on a plugin that captures some data from a non-logged-in user (such as a Like Button) and enters it into the database based on post_id. My plugin works fine for logged-in users but non-logged-in users produces a "-1" response in AJAX. I'm guessing this has to do with an authentication barrier for writing to...
The <code> wp_ajax_{action} </code> hook only fires for logged in users. For logged-out users the action <code> wp_ajax_nopriv_{action} </code> is triggered on an ajax request - so you need to hook into that as well.
Ajax for non-logged-in users
wordpress
Currently my homepage is showing my lastest posts but I want to replace it with a page. I wish that all the posts could still be seen in a widget and by clicking on "news" in the menu. I already do that for custom types with <code> http://website.com/customtypename/ </code> which shows all my lastest items. Just by add...
As mentioned in the comments, you want to replace your home page with a static front page under Settings > Reading. Then you'll create a new page and set it as your posts page in the same setting. The slug of that new page then determines the URL of the posts page.
Is there an URL listing latest posts
wordpress
I have created a plugin that creates a table in the database and allows users to add an Item to the table. I would like each item to also create a page for its self so that when the items are listed I can have each one link to there individual pages. Anyone know the proper way of doing this?
You can use <code> wp_insert_post </code> to insert a physical page, though I would suggest creating one page for the plugin and then using a rewrite rule to give all of your items a URL with that single page as the base. EDIT quick rewrite example with added query var: <code> function wpa55546_rewrites(){ $page_slug =...
Making my plugin create a page?
wordpress
I'm using the last update of Wordpress and I'm not using Tiny MCE. I found many posts about it, but each time it was a bug from a previous version (closed) or linked to Tiny MCE. I modify my pages only in HTML because I'm using complicated CSS and DIVs. Each time I update my code lots of <code> $nbsp; </code> are added...
The latest update is out today: wordpress 3.4 and this bug is corrected!
unexpected &nbsp; added in HTML at each update
wordpress
Assume I have a bunch of posts (articles) in two categories: "upcoming events" (cat=1) and "past events" (cat=2). When listing all posts of a specific category out of those two, category 1 shoud be listed in ascending order (first posts first, i.e. earlier upcoming events first), while category 2 should be listed desce...
It's fairly simple to add it manually for your categories, If you want to be able to set and store the sort order from the admin UI, that's a bit more involved. a manual fix can be achieved with a <code> pre_get_posts </code> hook: <code> function wpa55535_pre_get_posts( $query ){ // if this is a category page if( $que...
How to choose a sort order (for posts) per category? (ideally when creating a new category)
wordpress
The title pretty much says it all. The files and folders for my various themes and plugins are all intact in their proper path location under wp-content, but the WordPress install is not seeing them. Additionally, all of the pages within the site are loading a blank white pages (my assumption is that this is a result o...
No longer stumped. wp-content was owned by root. After running <code> chown -R apache:apache wp-content </code> , everything looks to be working correctly.
After a manual update, themes and plugins that were installed (and still in the directory) are not being seen
wordpress
I am using this code to shorting the title: <code> function short_title( $after = '', $length ) { $mytitle = get_the_title(); if( strlen( $mytitle ) &gt; $length ) { $mytitle = substr( $mytitle, 0, $length ); echo $mytitle . $after; } else echo $mytitle; } </code> and i call it with: <code> &lt;?php short_title( '...',...
Use <code> mb_strlen() </code> , not <code> strlen() </code> . The same with <code> mb_substr() </code> and <code> substr() </code> : Your title contains multi-byte characters, but <code> strlen() </code> and <code> substr() </code> do not work on characters, they work on single bytes. For a improved function to shorte...
Short_title character problem
wordpress
This is an example of register sidebar function from codex. My focus is on the <code> before_title </code> argument. What i want is to add a class to the title( <code> &lt;h3&gt; </code> ). From my widget code or may be pass the class name from user input on widget area. <code> &lt;?php $args = array( 'name' =&gt; spri...
Two approaches: Don't bother Just target <code> .widget.{dynamic-class} h3 </code> instead Use <code> %2$s </code> I don't know if this will work, but try: <code> 'before_title' =&gt; '&lt;h3 class="%2$s"&gt;' </code> But personally, I'd go with the former option. You've already got a unique class name; just leverage t...
How to add class on Widget Title
wordpress
I'm writing a WordPress plugin. At the top of the plugin file, I define some constants. Can I leave out the <code> if ( ! defined( 'THE_CONSTANT' ) ) </code> tests? Some other plugins that I've studied includes such <code> if ( ! defined </code> tests, some don't. Personally, I don't know why my plugin file would ever ...
By doing the <code> !defined() </code> check you allow earlier code to define that constant before you. This could be useful, for example, if a user is allowed to define its own values for some constants in a file like <code> wp-config.php </code> . As for code readability, you may consider using the following one-line...
Can I leave out `if ( ! defined ...)` when defining plugin constants?
wordpress
I am working on an e-commerce site in which post and product titles will need to be displayed in fairly narrow divs. I would like to set a specific font size for words which can naturally fit in the space provided, while instructing words which are too long for the parent object's width to scale down automatically, thu...
I’ve done something similar taking the simple approach of adding a CSS class to titles based on their character count. That CSS class then decreases <code> letter-spacing </code> and/or <code> font-size </code> . <code> // Count the characters, taking Unicode into account $chars = mb_strlen($post-&gt;post_title); // Fo...
Automatically decrease font size for long words
wordpress
I would like to display some category archives below whatever the user has typed in on a custom post type. How do I make sure that the user's content displays above mine?
To achieve this, I used <code> add_filter( 'the_content', 'myFunction' ); </code> Then in my function, I echoed <code> the_content() </code> to display the content the user typed in and then echoed the other content I needed.
How do I ensure custom post type information is displayed in correct order?
wordpress
Part of a custom post type that I am building needs to simulate page 1 of a category archive. How can I found out how many posts are displayed per page across the WordPress installation? (I assume it is in <code> wp_options </code> but I cannot find it.) Thank you!
The option is appropriately named <code> posts_per_page </code> . FYI you can see the value of options in your database by visiting <code> wp-admin/options.php </code> .
How to programmatically detect how many posts are displayed per page?
wordpress
I'm currently using Advanced Custom Fields to create a custom field <code> has_the_portrait_sold </code> which will be indicated on my Prettyphoto / Lightbox item. However, when I use PHP from the example (it is true or false): <code> if(get_field('has_the_portrait_sold')){ echo "The item has been sold."; }else{ echo "...
First things first - YOU ARE NOT ON THE RIGHT PATH IF YOU ARE MODIFYING CORE FILES . If it's not in <code> wp-content </code> , DO NOT MODIFY IT , especially if you can honestly say "I just do not have the PHP skills necessary to XXXX". STAY OUT OF CORE FILES, PERIOD . I'm not being mean, I'm saving you the hassle of l...
Adding custom field to Lightbox in header only pulls current page data, not Lightbox item data
wordpress
I have some problems on a admin side: when i try to filter posts according to any category, or when I publish a post, I see a white screen of WP death... The content of <code> debug.log </code> is: <code> [17-Jun-2012 11:49:55 UTC] PHP Warning: include(/home/dinorg/public_html/wp-content/advanced-cache.php) [&lt;a href...
In your <code> /home/dinorg/public_html/wp-content/themes/din/admin/qa_db.php </code> something wrong. It is unusual that first line of a script will print something unless you opened php tag (or php shorttag) and put some codes in same line. So i guess that file may have something like BOM. Please open the file and se...
How can I understand what is the cause of WP death (white screen)?
wordpress
I have several custom post types, which are properly structured as <code> /%post_type%/%postname%/ </code> , however I wish to have the same effect for regular blog entries: <code> /blog/%postname%/ </code> If I prepend the permalink structure with <code> /blog/ </code> it affects the custom post types as well, so curr...
Set the <code> 'with_front' </code> parameter for the post type’s slug to <code> FALSE </code> : <code> 'rewrite' =&gt; array ( 'slug' =&gt; 'posttypeslug', 'with_front' =&gt; FALSE ), </code>
How to prefix post permalinks with /blog/ - without affecting custom post types?
wordpress
I am creating my custom navigation menu with background-images. The menu items have a title from the Page, and that title is displayed above my background image, which is not what I want because the image itself already contains the link text. <code> /* menu items */ function nav_menu_items($classes, $item) { $classes[...
You can do that with CSS text-indent: <code> text-indent:-9000px; </code> . That way your text is still there for accessibility.
Remove "Next Post" in nav_menu
wordpress
I found this plugin very useful stackexchange-url ("ajaxed-status") It was created for post and page, and I want to apply it on media library. so I commented out the line <code> if (is_admin() /*&amp;&amp; ($pagenow=='edit.php' )*/) </code> and added this: <code> add_filter ( "manage_upload_columns", array ($this, 'add...
I think I find the answer-- wp-include/post.php: <code> if ( ! in_array( $post_status, array( 'inherit', 'private' ) ) ) $post_status = 'inherit'; </code> So, whatever status will be saved as "inherit".
Why this plugin doesn't work with media upload page?
wordpress
when i add this script to my post html editor : <code> &lt;div style="text-align:center; width:1100px; margin-left:auto; margin-right:auto;"&gt; &lt;img id="wordlmap" src="http://giftsforfriendsabroad.com/wp-content/uploads/2012/05/worldmap-1024x449.png" usemap="#wordlmap" border="0" width="1100" height="489" alt="" /&...
The post content is filtered by kses , but you can extend the list of allowed tags. A search in the plugin directory for kses shows some useful results. Try Extend KSES , it seems to be exactly what you need (I haven’t tested it): This plugin extends the HTML functionalify of the WordPress kses.php file, which states t...
add image map script to post
wordpress
I use the "Member Access" Plugin to restrict the content of my Blog to registered users only. This works from a PC with no problem. But if I want to login from my Android Phone the login page always displays no matter if I input correct credentials or not. I don't get logged in. I deactivated all other plugins and used...
I had to allow Cookies in my Android Phone Web Browser. After activating Cookies I could log in my Blog and got redirected to its main page.
Login from Mobile Phone
wordpress
I have some functionality I've written in order to post the title and link for the post to twitter whenever a post is published. I'm wondering which wp function to hook this to? save_post has no real reference documentation. Basically I just want to run an action when a post is successfully published. Thanks very much.
You could hook into <code> publish_post </code> like the plugin Inform about Content does. But this hook is fired on updates to published posts too, this may result in many redundant tweets … Try <code> 'draft_to_publish' </code> instead. It is called in <code> wp_transition_post_status() </code> and happens only one t...
which action to hook to in order to perform post-publish action
wordpress
When tracking down WordPress problems, I've had a hard time finding where WordPress sends errors to. Where does WordPress send errors by default? Are there multiple files that different kinds of errors are directed to? (I'm either a terribly ungifted Googler or WordPress's own documentation is hard to sort through.)
Where (or if) errors are logged is dependent on your php configuration. You can control some of this via your WordPress <code> wp-config.php file </code> . See Configure Error Log in Editing wp-config.php .
What log files does a WordPress installation write to?
wordpress
As the title says, I have a problem in functions.php (I assume it's in there) which causes custom fields to not be displayed on the new/edit post page, and when I add the meta box myself and save the data by updating the post, the data disappears. However, if I save the data by clicking the Update button for the meta b...
This has to do with auto saving. You need to check the following before saving your fields: <code> if ( ! isset( $_POST['action'] ) || $_POST['action'] != 'editpost' || 'revision' == $post-&gt;post_type ) return; </code>
Meta boxes not displayed, data isn't being saved
wordpress
I created an audio player in HTML5/Flash with the help of the SoundManager2 API. Now I want to add it to Wordpress as a plugin, so that you don't need programming skills to customize the player. The plugin should just modify a few values in the HTML and the JavaScript and then echo the div with the audio player on the ...
Your plugin just creates a widget, you won't see anything else in the Dashboard. If you drag the widget into a widget area, you'll see all of the options to configure it. one other issue you will potentially have is the way you're including javascript for your widget. if you use this with another plugin that requires j...
Issue with custom plugin
wordpress