INSTRUCTION
stringlengths 11
999
| RESPONSE
stringlengths 0
999
| SOURCE
stringlengths 16
38
| METADATA
dict |
---|---|---|---|
How to migrate a WordPress installation from one site to another, including all images?
I need to move a WordPress site hosted on Dream Host to the companies servers. To do so I used the built in import and export feature that comes with WordPress (using a WordPress export file). However, it did not copy over images from the site, and didn't preserve the featured images.
Using import/export, is it possible to copy over the images and featured images as well? If not, is there another method I could use?
|
1. Ensure that the NEW site is already running the same Theme, and all appropriate Plugins.
2. Generate your export file from your OLD site, ensuring that you export "all content".
3. Import the file into the NEW site, ensuring that you enable/check the option to download/import all attachments. (It is on the same import step during which you assign Post authors.)
Notes:
1. If your NEW site isn't running a Theme that has Post Thumbnail support enabled, you might not get your "featured image" post meta exactly as expected.
2. (Likewise, if your OLD site has Custom Post Types, Custom Taxonomies, or Post Format support enabled, you will need to ensure that these features are enabled on the NEW site, in order to ensure a proper import of these data.)
3. If you don't enable the option (disabled by default) to download/import attachments, then attachments will be instead linked to the OLD site.
|
stackexchange-wordpress
|
{
"answer_score": 2,
"question_score": 3,
"tags": "import, migration, export"
}
|
content gets scrambled
Every time someone edits our blog the content is displaying all wrong.
It looks perfect in the wysiwyg editor but when you publish the page the content is completely wrong (pictures displayed next to each other etc.
How to prevent this?
example link
|
This is because the images are defined as floating to the left.
To solve this, you can add a `clear: both` to the `<h4>` elements (it probably won't hurt to do this in the stylesheet - will there be a situation where you need a title that exists next to a float?).
|
stackexchange-wordpress
|
{
"answer_score": 3,
"question_score": 1,
"tags": "content, wysiwyg, text"
}
|
eaccelerator PHP error
I installed a Wordpress plugin and I'm getting the following error. The weird thing is I checked the plugins' source and I really don't understand why it would need those scripts.
> [30-May-2011 11:10:03] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so' - /usr/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so: cannot open shared object file: No such file or directory in Unknown on line 0 [30-May-2011 11:10:03] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20060613/ffmpeg.so' - /usr/lib/php/extensions/no-debug-non-zts-20060613/ffmpeg.so: cannot open shared object file: No such file or directory in Unknown on line 0
This is the plugin: <
|
Those messages have nothing to do with your plugins or WordPress. Those are from you PHP.ini file trying to load extensions that are either not there or in the wrong directory. Usually caused when you upgrade version of PHP and don't change the extension directory.
If you have shell access run `$ php -V` to get more info. If your on managed hosting call your host they can and will fix for you.
|
stackexchange-wordpress
|
{
"answer_score": 1,
"question_score": 0,
"tags": "plugins, php"
}
|
how to attach an image to a custom post type in wordpress using just code
I'm dynamically creating a custom post type in code (not in the editor) and I have an image I want to attach to my custom post type as a post thumbnail, and have it resized, etc. How do I do that. I'm successfully creating the custom post type using wp_insert_post().
I've looked at wp_save_image(), wp_save_image_file(), load_image_to_edit(), get_attached_file() and others, but they all seem to require an image in $_POST. I also looked at wp_insert_attachment() and update_attached_file() which seemed promising, but were not image centric.
|
WP 3.1 introduces `set_post_thumbnail()` function, that sets attachment (that you will need to create first, you seem to be on right track with `wp_insert_atachment()`) as thumbnail for the post.
|
stackexchange-wordpress
|
{
"answer_score": 2,
"question_score": 1,
"tags": "images, code"
}
|
Wordpress doesn't show all posts in database
I have around 140 post in database but wordpress admin page shows just 50 post. How could I let wordpress shows all the posts in database?
Thanks
|
Are you sure those aren't pages, drafts, trashed, revisions or attachments? To make sure that those aren't such, run the following in
* phpMyAdmin (Query tab - field "SQL query on database [database name]:")
* Adminer
* In the terminal
* …
and see how many results you get:
select * from wp_posts where post_status='publish'
|
stackexchange-wordpress
|
{
"answer_score": 3,
"question_score": 1,
"tags": "database"
}
|
Anything I can add to functions.php to make text widgets accept PHP?
Is there a way I can make text widgets accept PHP? Perhaps something I can add in to functions.php? I'm redesigning my site, and I was wondering why I didn't use widgets at all in my current design, but then I realized it was because I use a lot of PHP in there.
For example, one of the "widgets" is a tabbed content area, so I've got the HTML and JavaScript shell for the tabs, but then inside the tabs, I've got PHP calls for the most popular posts, the most recent posts, and the most recent comments. I can't do that with existing widgets.
Obviously I could use a plugin, but I'm trying to go light on plugins where possible. Is there something I can just add to functions.php?
|
PHP in text widgets involves using eval(), which is evil.
If you know PHP, stick with static sidebars.
|
stackexchange-wordpress
|
{
"answer_score": 3,
"question_score": 2,
"tags": "php, widgets"
}
|
handling templates and widgets for custom content types
I have created a custom content type (and taxonomy) for my theme that will mostly replace the default post type. I know as for singles, i can create a template single-customtype.php to handle this but what about for everything else?
what about < (is my only option forcing my theme user to create a page and select a template?)
what about search, 404, archive and widgets? Would i have to customize them all. I can tell i am missing something huge here but i cant put my finger on it
|
* for search you might need to adjust query to include your custom post type, `search.php` template or around that;
* 404 page is completely unrelated to post types;
* for archive you use `archive-customtype.php` template;
* sidebars/widgets are completely unrelated to post types.
|
stackexchange-wordpress
|
{
"answer_score": 1,
"question_score": 0,
"tags": "custom post types, templates"
}
|
Turn off image captions in gallery view?
I've set up my loop-attachment.php to show the gallery of thumbnails above the main, selected image using this code from the WordPress Codex:
<?php
$gallery_shortcode = '[gallery id="' . intval( $post->post_parent ) . '" size="mini-thumbnail" columns="10"]';
print apply_filters( 'the_content', $gallery_shortcode );
?>
However, if the image has a caption, it shows up underneath its image, throwing off my neat little grid of images. I don't want to turn captions completely off or not use them at all, because after the grid and below the main 960x540 image, I want to do an "Image Summary" kind of section, with the filename, original size, caption, description, etc.
Is there a way to turn off captions in the above code? The gallery shortcode section of the WordPress Codex doesn't have anything on it.
|
you can always just set a css tag `display:none` to the caption element
|
stackexchange-wordpress
|
{
"answer_score": 1,
"question_score": 1,
"tags": "images, shortcode, gallery, captions"
}
|
Add extra field when admin create user
I have created extra field that user can edit on their 'Your Profile' page. The extra field also available on WordPress register page. What I want to ask is, how to add the field to User > Add new page ? So, when admin creates a user, admin also input the user's extra field
|
With no hooks on that page (User > Add new page) other then `user_new_form_tag` its not possible to add new fields unless you hack the core file `wp-admin/user-new.php` .
You could try adding that extra field by adding in in JQuery and processing it when the `$_post['action'] == 'adduser'` but that wont be very good practice.
|
stackexchange-wordpress
|
{
"answer_score": 1,
"question_score": 3,
"tags": "admin, users"
}
|
querying with custom meta field with meta_query
How do we get posts where the meta key does not exist in a post. I have created a meta_key video. and i want to be able to get some posts with WP_Query where custom field video does not exist or is blank.
$fsquery = new WP_Query(
array (
'posts_per_page' => 1,
'featured' => 'yes',
'meta_key'=>'video',
'meta_value'=>''
)
);
this is not working.
|
There's actually a better solution that will (hopefully) be rolling out in WordPress 3.4 -- you can run the patch as a hotfix now if you'd like, but here's the TRAC link for the patch:
<
With this, you can do ...
$my_query = new WP_Query(
array(
'meta_query' => array(
array(
'key' => 'foo',
'compare' => 'NOT EXISTS'
)
)
)
);
or, swap it out for 'compare' => 'EXISTS' instead if you like.
-George
|
stackexchange-wordpress
|
{
"answer_score": 2,
"question_score": 3,
"tags": "wp query, custom field, meta query"
}
|
Does WordPress send a 301 header message when you change permalink structures?
I have a super old blog that I upgraded from 2.0.7 to 3.1 by upgrading over multiple versions. One of my biggest concerns was losing all the link juice from my legacy URLs but they were clearly made at a time when I hadn't considered how the URLs would need to change.
To my surprise I found that changing my permalink structure from
/articles/%category%/%postname%/
to
/id/%post_id%/%postname%/
went really smoothly as WordPress automatically looked up the appropriate URL -- which is great.
But I'm wanting to know since Ive changed link structures, does it send 301 header messages so I dont lose link juice from 5+ year old links, or is there a way for me to force WordPress to do this for old URLs?
Thanks!
|
Yes, WordPress will do a "301: Moved Permanently" to the "real" URL. WordPress calls this "canonical". When it hits a 404, WordPress will do a lookup on the URL fragments and attempt to find a post / page with that slug. If it finds one - it will do a `wp_redirect()` to the proper permalink of the post.
|
stackexchange-wordpress
|
{
"answer_score": 3,
"question_score": 2,
"tags": "permalinks, redirect, wp redirect"
}
|
Hide update messages from non-admin users?
Is it possible to hide the update messages for any users other than the main admin?
We use WP as a CMS for clients and it's a bit annoying that a normal user has to read something like:
> WordPress 3.1.3 is available! Please update now.
|
Hide Update reminder \- this hides update messages for all non-admin users
|
stackexchange-wordpress
|
{
"answer_score": 4,
"question_score": 3,
"tags": "admin, users, cms, updates"
}
|
Link submission website (ala Reddit)?
Pligg sucks, Hotaru CMS is dead and I'm not sure if the Nominate theme is what I want. Basically I'm trying to create a link submission website like Reddit with WordPress, this would basically mean:
* Voting
* Easy link submission
* Member creation and restriction of groups
* oEmbed support (optional)
I looked at BuddyPress but it appears it's trying to be more of a social networking site (Facebook) instead of a social link submission site (Reddit).
|
These can be nicely done with WordPress using custom post type for link submission, so then the rest becomes very easy using a few plugins:
* Voting - CMS Vote Up Social CMS News will handle the voting.
* Easy link submission - simple custom front end post form would do the job (ex: here or you can use plugins like Mini TDO, Gravity forms...
* Member creation and restriction of groups - this is build in with WordPress, users and roles
* oEmbed support - here is the only part i can think of that you would have a lot of work with unless you mean giving users ability to oEmbed there links like youtube in which case you can use the built in oEmbed support.
|
stackexchange-wordpress
|
{
"answer_score": 6,
"question_score": 2,
"tags": "plugin recommendation, links"
}
|
Why my theme option not working?
I am looking for the bugs about an hour but i can't find anything. Can you look and say why my theme option is not working?
**Problem:** The theme option not saving. Even the default option is also blank. I checked the value via php my admin.
Check the code in pastebin. And also how i can debug this kinds of problem?
<
Thanks in advance.
|
A little tricky to say by looking at code alone.
The first thing you need to check in such cases - if your validation function receives data from submitted form. `var_dump()` input and `die;` right after that to stop execution and prevent redirect back.
Depending on what you get there (if anything) check back through Settings API functions. There are a lot of arguments to juggle with those and it is easy to mix then up.
|
stackexchange-wordpress
|
{
"answer_score": 1,
"question_score": 0,
"tags": "theme development, theme options, troubleshooting"
}
|
Creating an online account & ordering system
Is it possible to create an account & ordering system with online payment (via paypal) for WP? Are there any kind of plugins for this?
We'd require some basket functionality so products can be added, an account area that could include order history and online payment to pay via paypal.
|
Most of the new and updated Cart/E-commerce plugins offer that functionality for ex:
* **TheCartPress, E-Commerce for WordPress Stores** (long name for a plugin)
* **wpStoreCart**
* **DukaPress**
|
stackexchange-wordpress
|
{
"answer_score": 3,
"question_score": 0,
"tags": "plugins, paypal, account"
}
|
How to organize products by collections with collections description?
I have products in my store sorted by categories. (Braslets; Rings; Earrings) It was not difficult to adapt my theme for listing products by categories. But now I need to organize my products by collections. I have collections for example 'Spring surprise', 'Smoky winter' etc. First time I thought to assign tags to products, but I also need to show collections description, this means to show tag's description.
How can you advice me to organize products by collections? Does wp-e-commerce allow to set up a tag description?
PS. I'm newbie in wp-e-commerce and it seems to be hard for understanding.
|
There's a description field available for the `product_tag` taxonomy that can be used in your template. You could also add an additional "collections" custom taxonomy for use with the `wpsc-product` custom post type.
|
stackexchange-wordpress
|
{
"answer_score": 0,
"question_score": 0,
"tags": "plugin wp e commerce"
}
|
Creating your own widgets: using cache?
I'm in the process of making my own widget but I don't like it to fully generate the content each time since the process is quite lenghty. I can easily create my own caching mechanism but I'm wondering if there is something that already exists in the wordpress core when it come to caching widgets.
Ideas?
Thanks! Dennis
|
take a look at WordPress Transients API
> which offers a simple and standardized way of storing cached data in the database temporarily by giving it a custom name and a timeframe after which it will expire and be deleted.
>
> The transients API is very similar to the Options API but with the added feature of an expiration time, which simplifies the process of using the wp_options database table to store cached information.
|
stackexchange-wordpress
|
{
"answer_score": 4,
"question_score": 2,
"tags": "widgets, cache"
}
|
Anyway to hide a Category in the Categories section when adding/editing a post in WP Admin?
I have a Category that I would like to hide in the WP Admin so the author can never check it when adding or editing a post. Is there anyway I can prevent it from showing up by modifying my function.php file?
|
a simple way to hide it would be to find the ID of the category `li` and use css to set it to display:none.
function hide_the_category(){
?>
<style type="text/css">
li#category-4{
display:none;
}
</style>
<?php
}
add_action( "admin_head", "hide_the_category" );
|
stackexchange-wordpress
|
{
"answer_score": 0,
"question_score": 0,
"tags": "categories, wp admin"
}
|
Tag selector like stackexchange?
I'm creating my own form based on this and I'd like to have a tag selector which is similar to the one on StackExchange. I can roll my own but I was wondering if something similar already exists.
Thanks!
|
you can do that using **JQuery autocomplete plugin**
and once you have included all of the needed JS files just add this code after your new post form
$terms = get_terms("post_tag");
$tags = '';
$count = count($terms);
if ( $count > 0 ){
foreach ( $terms as $term ) {
$tags .= '"'.$term->name.'", ';
}
$tags = substr($tags,0,-2);
}
echo ' <script>
JQuery("#post_tags").autocomplete(['.$tags.'], {
width: 320,
max: 4,
highlight: true,
multiple: true,
multipleSeparator: ", ",
scroll: true,
scrollHeight: 300
});
</script>';
**note:** Now this is good if you only have a small number of tags, but if you have hundreds or thousands of tags then using an ajax solution is a must.
|
stackexchange-wordpress
|
{
"answer_score": 3,
"question_score": 3,
"tags": "plugins, tags, select"
}
|
JavaScript and images files are not recognized
It might be the simplest question but I can't find why my JavaScript files and images are not recognized by WordPress. I put all my JS files and images in my theme's folder, so I created a folder "word" inside "theme", with all the content and then I added my files. But the website doesn't recognize the path to the JavaScript or the images. Could you please tell me what i'm doing wrong?
I used it like that in the header page :
<script src="jquery.js" type="text/javascript"></script>
|
You need to give the full path to your theme files. To get the URL of your theme, use the WordPress function `bloginfo( 'template_directory' );` so at a minimum you would need:
<script src="<?php bloginfo( 'template_directory' ) ?>/jquery.js" type="text/javascript"></script>
However, scripts / styles should really be "enqueued" using `wp_enqueue_script();` (see <
I would recommend taking a look at some other themes to see how they include thetheme files like this. Also the Codex page on Theme Development is a good place to start: <
|
stackexchange-wordpress
|
{
"answer_score": 4,
"question_score": 1,
"tags": "images, javascript"
}
|
My post titles is getting mashed up with my blog title
I installed the all in one seo pack plugin and after enabling it my post titles get "stuck" with my blog title without a space in the title.
As you can see the post title is: `******.blogg.no` And my blog title is: `Sp**set Blogg`
The title is now `*******.blogg.noSp**set Blogg,` I can't figure out how I can get these to separated.
My all in one seo pack settings is`%post_title%` on the posts.
|
Its documented.. **heres a fix**
|
stackexchange-wordpress
|
{
"answer_score": -1,
"question_score": 0,
"tags": "title, plugin all in one seo"
}
|
wp_mail script with jQuery post
I need to send an email from a page when a form is submitted.
I thought I'd use jQuery post but I'm not really sure where to start. Would I use `wp_mail()`? And if so how could it be called?
Sorry if that seems vague. Just trying to send an email to the client before a form posts its data to another site;
$('#donationForm').submit(function() {
// send email to client before moving onto worldpay payment form
// send data to worldpay....
this.submit();
});
|
Basically, you can use JavaScript to post to a WordPress function, then the WordPress function can invoke `wp_mail()` to send the message.
A great place to start would be the useful AJAX in Plugins article on the Codex. It walks you through all the steps required to add your JavaScript on the front-end, your PHP on the back-end, and everything you need to do to tie the two together.
|
stackexchange-wordpress
|
{
"answer_score": 2,
"question_score": 4,
"tags": "jquery, ajax, email, wp mail"
}
|
Including custom fields in search?
I use custom fields for lots of my content on both Posts and Pages, so that half of the text will be in the main post body and the other half in a custom field.
Unfortunately, when doing this only the text in the post body is searchable.
I want to have all the custom fields included in the search (just joined together as one). Preferably without installing a plugin, as all the plugins I have seen do not seem to be able to do this or they add loads of options I don't need.
I just would like one search box, that uses WordPress's default search but finds words in custom fields as well as those in the main body.
Is this possible?
|
In the end I used the Relevanssi plugin which lets you include custom fields in the search quite easily, you can either include all the fields or choose which fields to include.
|
stackexchange-wordpress
|
{
"answer_score": 0,
"question_score": 6,
"tags": "custom field, search"
}
|
Theme Options Panels, What are some good examples from Frameworks or Premium Themes?
I really like <
Does anyone know any other good implementations of an options panel from a Framework or from another premium Theme? I think its a major factor in deciding whether to use a theme. I'd like to get a good list of whats being done out there. Wordpress StackExchange Community, what are your thoughts in general this?
|
Of the few I've seen, I think that most "premium" Themes _way_ over-complicate Theme Settings pages. I generally prefer Theme Settings pages that maintain the style/layout of the rest of the WP-Admin UI. So, these would be my rules of thumb:
1. Incorporate meaningful settings, and not necessarily every possible setting under the sun.
2. Organize settings logically.
3. Maintain consistent layout/style with the rest of the WP-Admin UI, including Settings fields, sections, and page tabs. _Note: use of the Settings API makes this dead-simple._
|
stackexchange-wordpress
|
{
"answer_score": 3,
"question_score": 4,
"tags": "theme options, framework, user interface"
}
|
conditional function to change post-meta background image
I have this CSS setup for my blog posts meta information. But there are certain categories where I would like to use another image in the same spot and not display the meta information. I'm not quite sure how to do it.
.entry-meta {
background: url("images/dish_blogtitle.png") no-repeat scroll center center transparent;
color: #666666;
float: left;
font-size: 13px;
font-style: italic;
height: 100px;
line-height: 18px;
margin-left: -125px;
margin-top: 5px;
position: relative;
text-align: center;
top: -80px;
width: 100px;
}
|
**Have you checked the classes on your`<body>` element?**
It depends on the theme but WordPress has a function body_class() that dynamically adds a bunch of useful classes in there. It may look like this:
<body class="archive category category-news category-2 two-column content-sidebar">
As you can see it is a powerful helper as you can easily accomplish complex style changes by prepending your definitions with these classes. In your case it could be:
.category-something .entry-meta {
/* whatever style changes you need */
}
If there is no such awesomeness in your `<body>` element then you can add it there yourself very easily:
<body <?php body_class(); ?>>
The answer provided by @xLRDxREVENGEx is certainly valid and points in the right direction. It's certainly worth (re)thinking what approach is the right one for your use case.
Hope this helps!
|
stackexchange-wordpress
|
{
"answer_score": 3,
"question_score": 1,
"tags": "post meta"
}
|
Meta keywords and descriptions plugin for manually editing meta for each page/post
Can anyone recommend a simple plugin that allows me to add/edit meta tags for keywords and description on each page of my wordpress site? Just something that adds the fields to the page editor would be ideal. Not looking for SEO megapack or whatever.
Thanks, John.
|
the simple solution would be to paste this snippet of code in your theme's functions.php file :
add_action('wp_head','keywords_and_desc');
function keywords_and_desc(){
global $post;
if (is_single()||is_page()){
if(get_post_meta($post->ID,'my_keywords',true) != '')
echo '<meta content="'.get_post_meta($post->ID,'my_keywords',true).'" name="keywords">';
if(get_post_meta($post->ID,'my_description',true) != '')
echo '<meta content="'.get_post_meta($post->ID,'my_description',true).'" name="description">';
}
}
And the just add keywords and description using the built in custom fields on a new/edit post/page screen, name the keywords field `my_keywords` and the description field `my_description`.
or you can use a very lightweight and simple plugin called **Simple Meta Tags**
|
stackexchange-wordpress
|
{
"answer_score": 4,
"question_score": 3,
"tags": "custom field, customization, post meta"
}
|
Prevent authors from creating new posts of specific custom-post-type
The way I'm set up currently, I create a post for each user of the site, custom-post-type, Agent, then assign it to a user, and they can edit it however they like. What I want to remove or disable is in the admin side, Agents/Add New.
Currently all users are set to Author, so if I could make it so if the user is an Author they can't create new posts of custom-post-type, Agent.
I'd also like to remove the ability of the author to create standard wordpress posts.
The caveat to all this is I need to allow authors to create as many posts as they like as custom-post-type, Property.
Here is a pic of what I want to remove (in red) for agents custom-post-type, if the user is an author.
!enter image description here
|
try my plugin **Posts Creation Limits** which was made for that same reason.
|
stackexchange-wordpress
|
{
"answer_score": 1,
"question_score": 2,
"tags": "custom post types, user roles"
}
|
Differentiate between posts and pages in search results
How can one differentiate between posts and pages in search results?
What I need to do is show a `the_time` div for posts but not show it for pages, as it's irrelevant.
With a function? `<?php if (!is_page()) }` in the loop below doesn't help.
<?php if (have_posts()) : ?><?php while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink() ?>"><?php the_title(); ?></a>
//prevent this div from displaying for pages:
<div class="searchdate"><?php the_time('F jS, Y') ?></div>
<?php the_excerpt(); ?>
<?php endwhile; ?><?php else : ?><?php endif; ?>
|
Try this...
<?php //prevent this div from displaying for pages:
if ( get_post_type() != 'page' ) : ?>
<div class="searchdate"><?php the_time('F jS, Y') ?></div>
<?php endif; ?>
The `is_page()` conditional tag only checks if currently displayed content is a single page view. Nothing for you at this point. See <
|
stackexchange-wordpress
|
{
"answer_score": 3,
"question_score": 1,
"tags": "posts, loop, search, pages"
}
|
What hook should be used to programmatically create a post only when master post is updated?
Pippin and Jean-Baptiste Jung have very good tutorials on how to programmatically create content when a new post is published using these four actions hooks...
* publish{post_type}
* add_action('new_to_publish_{post_type},
* add_action('draft_to_publish_{post_type},
* add_action('pending_to_publish_{post_type}
... to run this script...
global $user_ID;
$new_post = array(
'post_title' => 'My New Post',
'post_content' => 'Lorem ipsum dolor sit amet...',
'post_status' => 'publish',
'post_date' => date('Y-m-d H:i:s'),
'post_author' => $user_ID,
'post_type' => 'post',
'post_category' => array(0)
);
$post_id = wp_insert_post($new_post);
What hook should I be using to do this function **only** when a post is updated? Thank you!
|
you can use `pre_post_update` action hook like so:
add_action('pre_post_update','post_updating_callback');
function post_updating_callback($post_id){
global $post;
// verify if this is an auto save routine.
// If it is our form has not been submitted, so we dont want to do anything
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
return;
if ($post->post_status == "publish"){
//do update stuff here.
}
}
Update:
instead of `wp_insert_post()` use `wp_update_post` like this:
//first get the original post
$postarr = get_post($post_id,'ARRAY_A');
//then set the fields you want to update
$postarr['post_title'] = "new title";
$postarr['post_content'] = "new edited content";
$post_id = wp_update_post($postarr);
this way you only need to specify the fields that were updated and never worry about stuff like what was the original post type.
|
stackexchange-wordpress
|
{
"answer_score": 8,
"question_score": 2,
"tags": "custom post types, hooks, actions, updates, wp insert post"
}
|
How to override Category rendering mechanism
Currently for every category there is a separate template ( _category-1.php, category-2.php_ , etc..), in my case there is over a hundred of them. I want refactor it to 4, so for instance if $cat is in range 1..20, render "first_category.php", if in range 21..50, render "second_category.php" and so on.
Thanks!
|
if you can use `template_redirect` hook and a simple function to set the template to use
add_action( 'template_redirect', 'category_set_redirect' );
function category_set_redirect(){
//create the sets of categories
$first_set= array("1","2","3","4","5","6");
$second_set= array("7","8","9","10","11","12");
if (is_category()){
if (in_array(get_query_var('cat'),$first_set)){
include(TEMPLATEPATH . "/first_category.php"); // include the corresponding template
die();
}
if (in_array(get_query_var('cat'),$second_set)){
include(TEMPLATEPATH . "/second_category.php"); // include the corresponding template
die();
}
}
}
|
stackexchange-wordpress
|
{
"answer_score": 3,
"question_score": 2,
"tags": "categories, templates, page template"
}
|
Excluding a page with a certain name from wp_page_menu
A client of mine has a WP multisite network of sites which all use the same template. This template uses wp_page_menu. I just added a mobile version of the template by using a certain plugin. It will use the same pages as the desktop version of the website, but the client has requested a different landing page.
The problem is that if I create a new page to facilitate this landing page, it will show up in the code generated by wp_page_menu. Since all sites in this network uses the same template and the page will have different page IDs on different sites, I cannot exclude it manually in the wp_page_menu function.
I was thinking that if I could exclude the post by title or category name instead of by ID, this might work. But I don't know how to do that. Please help?
|
How about using `get_page_by_path()`, then using the ID from the returned object in an exclude filter?
add_filter('wp_page_menu_args','my_nav_exclude_pages');
function my_nav_exclude_pages( $args = array() ) {
$homepage = get_page_by_path('my-page-slug');
$args['exclude'] = join( ',', array( $args['exclude'], $homepage->ID ) );
return $args;
}
|
stackexchange-wordpress
|
{
"answer_score": 1,
"question_score": 2,
"tags": "theme development, multisite"
}
|
Should I use custom post types for a front page video feature (vimeo)?
I'd like to create a front page video feature that embeds a vimeo video of the users choosing. I'd like the user to only have to input the video code. For instance, for < \- I'd like them only to have to input "24474320".
Should I use custom post types for this? If so, how do I set this up so that it limits the field size? I'm just getting started, and I'm relatively new at wordpress, so I don't need to get into specific code necessarily - it's more of a strategic question. How would you tackle this?
Thanks,
Tim
\-----------------------EDIT (Monday, June 6)
It would be awesome if all the user (backend) saw was this:
**FRONT PAGE VIDEO FEATURE**
**Vimeo URL:** [ ** ___ __ ___ __ ___ __ ___ __ ___ __ ___ __ ___ __ ___ __ ___ __ ___** ]
[Save] [Cancel]
Then I would call that video into the front page feature.
|
With oEmbed support in both WordPress and on Vimeo's end, why not just use the `[embed]` shortcode?
[embed]
This is easy to explain, and users are generally pretty comfortable with just copy-and-pasting a URL directly, rather than having to extract just the ID out of it.
You can also turn on the option to just use the URL on a line by itself in a post, without the `[embed]` shortcode. Personally, I prefer the explicit shortcode, because it always works, and there's less chance of other plugins interfering.
|
stackexchange-wordpress
|
{
"answer_score": 2,
"question_score": 2,
"tags": "custom post types, media, videos, embed, frontpage"
}
|
How to check plugin compatibility before upgrading Wordpress
When you're upgrading a plugin you can quickly check if the plugin version you are about to upgrade to works with your current version of Wordpress. Is there a way of checking that your current plugins will work with the version of Wordpress you are about it upgrade to without searching for each one in the directory?
|
Have a glance at Better Plugin Compatibility Control. I just found this out this morning. I think this does what you're after.
|
stackexchange-wordpress
|
{
"answer_score": 3,
"question_score": 5,
"tags": "plugins, upgrade"
}
|
How to tell if plugin has been network activated
I have the following lines of code that add the settings link and setup for my plugin:
add_action('admin_menu', array(&$this, 'admin_settings_menu')); // Add menu to options
add_action('admin_init', array(&$this, 'admin_settings_init')); // Add admin init functions
Now because of the nature of my plugin if the plugin is _Network Installed_ then the settings should only be available to the network admin not the individual site admins.
Is there a way to check if the plugin is Network Installed so I can wrap an if statement round it?
|
You can use `is_plugin_active_for_network( $plugin )`
|
stackexchange-wordpress
|
{
"answer_score": 7,
"question_score": 4,
"tags": "plugins, multisite, options"
}
|
Wrong WordPress language?
I'm a bit confused now.
I've installed Wordpress for my Polish friend from here:
<
On my local machine everything works fine and is in Polish, but installing it on the web server looks like default English Wordpress ("Recent posts", "Archives" etc.).
Why?
Every language file I found is polish (in themes/twentyten/languages AND wp-content/languages), also wp-config is set to `define('WPLANG', 'pl_PL');`.
Thanks.
|
Woah, default Polish WordPress package is corrupted.
Change `define('WPLANG', 'pl_PL');` to `define('WPLANG', 'pl_pl');` or download older version.
|
stackexchange-wordpress
|
{
"answer_score": 1,
"question_score": 0,
"tags": "multi language, wp config, language"
}
|
Wordpress site is sloooow, but admin is fast....any ideas?
I have a Linode VPS running a single Wordpress blog. It has been running just fine until today. The admin panel is snappy, but the site is very slow. I am still finishing the site, so there shouldn't be any traffic.
When I go to mydomain.com it takes 45+ seconds to load, then each click on the link takes about the same amount of time. I didn't update any WP plugins (or WP), but I did add a google analytics plugin a week ago, but seemed fine. I disabled that and no difference either.
I tried rebooting nginx, and then rebooted the whole machine... still slow. My "free -m" output is:
user@myserver~ $ free -m
total used free shared buffers cached
Mem: 469 147 321 0 3 45
-/+ buffers/cache: 98 370
Swap: 511 0 511
The weird part is nothing has changed in the last few days....Any ideas?
|
Not much information to go on... Start with elimination - disable the plugins, switch to default (or better - blank) theme. If it gets better - just find code at fault. If you are down to the bare and clean WP core and still having the issue - likely you have some server configuration issue.
Since you have considerable control over server you can also hook up some PHP profiler and try to make a dump of what is going on.
|
stackexchange-wordpress
|
{
"answer_score": 3,
"question_score": 1,
"tags": "performance, vps"
}
|
Custom Taxonomy Tag Cloud?
I found that I can do `<?php wp_tag_cloud( array( 'taxonomy' => 'name', 'format' => 'list' ) ); ?>`
But I want the list to be seperated by the letter. Alphabeticaly is what I want. So it would display the letter A then all names with that letter and the letter B with all of the b's and so on.
Any ideas?
|
What exactly do you mean by separated?
If you want multiple tags clouds you will probably need to:
* fetch full list of terms;
* split it into groups by your criteria;
* call `wp_tag_cloud()` for each group, using `include` argument to use specific subset of terms.
|
stackexchange-wordpress
|
{
"answer_score": 0,
"question_score": 1,
"tags": "custom taxonomy"
}
|
Plain-text tag list?
I'm looking for a way to display a plain-text list of tags to use as classes on my post elements, I've been trying
$tags = get_tags();
$tag_list = "";
foreach($tags as $tag){
$tag_list .= $tag->name . " ";
}
echo "<li class=\"$tag_list\">";
in the loop but it seems to output all the tags instead of just the current post's tags, so if I have tags `x`, `y`, and `z`, and I'm viewing a post with tag `x` I still get `<li class="x y z">` anybody have any ideas as to how to show a plain-text list of tags or what I'm doing wrong?
|
You can play with arguments to only fetch what you need and get rid of loop:
$classes = implode(' ', wp_get_post_tags( get_the_ID(), array('fields' => 'names') ) );
|
stackexchange-wordpress
|
{
"answer_score": 5,
"question_score": 3,
"tags": "posts, tags"
}
|
Limitations when adding new users
I began adding new users to my site tonight, all as authors. Is there a limitation to the number of users or how quickly they are added, after adding the 50th user there seems to be a minute or two delay before wordpress will allow me to add the next user.
|
Wordpress doesn't have any real limitation to that although your `wp_users` table may not be optimized and the queries to it become slow. Try doing this:
1. **Repair and optimize** your tables
2. **Add Indexes** to frequently used columns such as `user_login` or `user_nicename` and play around until it speeds everything up a bit
You may also try **disabling plugins** one by one just in case there is a badly coded WP hook/action.
As a final solution, I would add a huge list of users **directly through a SQL query** , that way you can add thousands of them in less than a second.
|
stackexchange-wordpress
|
{
"answer_score": 0,
"question_score": 1,
"tags": "users"
}
|
do_shortcode() doesn't do shortcodes ;)
Imagine this basic shortcode in your functions.php file:
function div_shortcode( $atts ) {
return '<div class="div"></div>';
}
add_shortcode('div', 'div_shortcode');
So every `[div]` in Wordpress editor gives `<div class="div"></div>`.
Everything looks and works fine, right?
Now here comes the trouble.
I need to use my shortcode in PHP file (not putting it via WP Text Editor).
Luckily there's a function for that:
<?php do_shortcode('[div]'); ?>
But, wait, it shows... nothing?
<?php do_shortcode('[gallery]'); ?>
Even this one doesn't work.
Why is that happening? Any ideas?
|
The shortcode functions just return a value, you need to echo or assign it to something.
<?php echo do_shortcode('[div]'); ?>
|
stackexchange-wordpress
|
{
"answer_score": 11,
"question_score": 5,
"tags": "theme development, shortcode"
}
|
Unable to select image using custom image field type
I'm using the advanced custom field plugin and having a bit of trouble when using the image field type. (I'm not sure if this relates to the plugin that much actually!).
When inserting an image instead of the option to select it I only have the option to insert it into post, which tries to insert the image into a wysiwyg. I only get the option to select image if I first insert it into post then delete it from the wysiwyg, then click choose image again and find it in the media gallery.
Is there any workarounds/plugins to allow me to select the image straight away?
|
Try Verve Meta Boxes plugin of if you are up to coding yourself a metabox then you can use **this class** which does most of the work for you.
|
stackexchange-wordpress
|
{
"answer_score": 0,
"question_score": 1,
"tags": "plugins, custom field"
}
|
How can I build a query that returns all attachments of a page and it's children pages?
I'm using this query to return attachments of a page.
$args = array(
'post_parent' => $post->ID,
'post_status' => 'inherit',
'post_type' => 'attachment'
);
Is there a way to adapt this in order to return attachments for the current page _and_ the attachments of all child pages ?
|
The posts query is not recursive by nature. And I don't think that `post_parent` accepts multiple IDs, so you will likely need to loop and run this for multiple pages or play with query filters to do this in less requests (if performance becomes an issue).
|
stackexchange-wordpress
|
{
"answer_score": 1,
"question_score": 0,
"tags": "wp query, attachments, children"
}
|
Remove li from wp_nav_menu
How can I remove the li from wp_nav_menu? I know I can remove ul but is it also possible to remove the li? I would want to do this on just one menu not all the menus on my site.
|
You could use a custom walker.
|
stackexchange-wordpress
|
{
"answer_score": 4,
"question_score": 1,
"tags": "menus, navigation"
}
|
How can I transition a site from using the Beta Tester plugin to a "normal" install?
I'm currently using the WordPress Beta Tester plugin on a site. Is there a "best" way to transition the site to a "normal" WordPress install? The plugin includes this notice:
> Please note: Once you have switched your blog to one of these beta versions of software it will not always be possible to downgrade as the database structure maybe updated during the development of a major release.
|
It seems that one way is to simply manually upload the wp-admin and wp-includes directories, as the normal upgrade instructions state. I did this, and it worked. I'm still curious if there's a better way, to avoid any database issues.
|
stackexchange-wordpress
|
{
"answer_score": 0,
"question_score": 1,
"tags": "database, upgrade"
}
|
Jquery UI Google CSS, from where?
Here's the site I'm having problems with:
<
For some reason, my custom theme I created for the Jquery UI is being overridden by the google hosted stylesheet, and I have no idea where in my theme it is referencing the stylesheet. Wherever it is, I need to get rid of it. I'm trying to style the progress bars in the sidebar so that they are 20px high. I have done this in my custom theme stylesheet but it just keeps being overridden.
Any suggestions?
Thanks,
|
try and use the correct syntax in the stylesheet:
`/* jQuery UI Progressbar 1.8.13*/ /* Progress bars on about page*/ .ui-progressbar.ui-widget.ui-widget-content.ui-corner-all { height:20px; text-align: left; }`
(i don't know where the google css comes from. and excuse the way the code is presented; the 'code' button seems to be out-of-order)
|
stackexchange-wordpress
|
{
"answer_score": 1,
"question_score": 0,
"tags": "jquery, jquery ui"
}
|
What's the easiest way of adding more options in the Theme Options of the twenty eleven theme?
Wordpress 3.2 beta comes with twenty eleven. It has a Theme Option panel in the Appearance section:
 way of adding more options to that panel. For instance, changing the color of other elements?
|
As you can see in source theme makes some use of Settings API, but doesn't include calls like `do_settings_fileds()` that would allow you to use add settings.
I would probably try to unhook `twentyeleven_theme_options_add_page()` call and fork that and `theme_options_render_page()` to extend it with additional options.
Also I think that unlike core Twenty Eleven wasn't declared to be ready yet. Things might change.
|
stackexchange-wordpress
|
{
"answer_score": 1,
"question_score": 0,
"tags": "themes, options"
}
|
WP disobeys disabling of the posts revision feature
I disabled the posts revision feature according to this codex by placing this code in the wp-config.php:
`define('WP_POST_REVISIONS', false );`
But revions are still being saved by the WP. Why?
I am using wp3.1.3 and Twenty Ten theme. I have couple of plugins, and disabling them does not resolve the issue.
|
`wp-config.php` is suggested place for such definitions, because at any point later they might get replaced by default values during loading.
See Editing wp-config.php in Codex for thorough instructions.
Also worth noting that it's commonly said like _add to the end_ , but really definitions should go above this line:
/* That's all, stop editing! Happy blogging. */
Or, if it was removed for some reason, above:
require_once(ABSPATH . 'wp-settings.php');
|
stackexchange-wordpress
|
{
"answer_score": 0,
"question_score": 2,
"tags": "functions, wp config"
}
|
Is there a way to exclude posts based on meta_values?
I have a need to exclude posts based on a custom field type. It will probably be a field such as "legacy" or "depricated". I searched for an example on how this would be done but I haven't found anything worth while. Any help would be appreciated.
<?php
$software = array('post_type' => 'software', 'category_name' => $model);
query_posts( $software );
get_template_part( 'loop', 'software' );
wp_reset_query();
?>
|
I met the same problem before. I tried to use `meta_query` parameter in the query argument, but didn't succeed. The code I tried to use looks like this:
$software = array(
'post_type' => 'software',
'meta_query' => array('key' => 'legacy', 'value' => 1, 'compare' => '!=')
);
query_posts($software);
But the problem is this query also excludes posts that don't have that meta key.
So I had to use a custom query, that gets all posts with `legacy` meta key, and then excludes them:
global $wpdb;
$legacy = $wpdb->get_col("SELECT ID FROM $wpdb->postmeta WHERE meta_key='legacy'");
$software = array(
'post_type' => 'software',
'post__not_in' => $legacy
);
query_posts($software);
Hope this can help you.
|
stackexchange-wordpress
|
{
"answer_score": 3,
"question_score": 0,
"tags": "custom post types, post meta"
}
|
How to get Recent Post From Each Category with Thumbnail?
For Example,Now I have 3 Categories Like Food,Transport,Technology.Under These Categories I have Many Posts.Now I Want To Show the Latest Post From Each Category.{How to get Recent Post From Each Category with Thumbnail?}Is This is Possible?
I Think No Plugin for This One.If You have a Great Knowledge in Plugin Creation, this is the Greatest Challenge for you.Just try to Found New Things and Become a Great Founder.
My Question is Not Clear Means Ask Me or Edit ...
Thanks All...
|
I'm the developer of the List Category Posts WordPress plugin. The plugin uses a short code to get posts from a category and you can include thumbnails too.
Give it a try and hopefully you'll find it useful.
|
stackexchange-wordpress
|
{
"answer_score": 3,
"question_score": 0,
"tags": "plugins, plugin development, posts, categories, plugin recommendation"
}
|
How to Show Category List With Corresponding Links?
i want to do a research in Category List Area. I'll Explain Here... Now I have 4 Categories Like 1,2,3,4. First of all it needs to show in the category pages Horizontally.Next is, While Clicking on Any Category it will show the articles from only that category in this thumbnail format, this also should be in a format that allows for 40 or 50 potential articles to be shown this way.
|
In the category link URL, add he category ID.
Then when you click the link, the page reads the `$_GET` variable and use this to fetch posts with that category.
You can use `get_posts`.
|
stackexchange-wordpress
|
{
"answer_score": 1,
"question_score": 0,
"tags": "plugin development, posts, categories, plugin list category post"
}
|
What happened to WP No Category Base?
What happened to the plugin in Wordpress plugin repository?
The link doesn't work: <
and search for this plugin doesn't list it.
Yes, I know I can download it from author's page, but I am intrigued why would folks at wordpress.org remove it from their list?
|
I am the author of the plugin. Try again, its back now.
|
stackexchange-wordpress
|
{
"answer_score": 0,
"question_score": 0,
"tags": "plugins, categories"
}
|
CSV Import Tables
Hi I would like to import tables through CSV, any particular plugins or functions that can help me do that? I would like to have them stand in their own table and then the user would be able to include them via shortcode and id e.g. [table id=1] Thanks
|
I know there are a few but the one that stands out is **WP-Table Reloaded** plugin which answers your requirements and has endless of customization options and features.
|
stackexchange-wordpress
|
{
"answer_score": 1,
"question_score": 0,
"tags": "import"
}
|
Pick out specific menu item from code
I'm using this bit of code to generate a menu:
<div id="menu">
<?php $args = array(
'depth' => 1,
'show_date' => '',
'date_format' => get_option('date_format'),
'child_of' => 0,
'exclude' => '426, 508',
'include' => '',
'title_li' => __(''),
'echo' => 1,
'authors' => '',
'sort_column' => 'menu_order, post_title',
'link_before' => '',
'link_after' => '',
'walker' => '' ); ?>
<ul><div class="menu-button"><?php wp_list_pages( $args, 'sort_column=menu_order' ); ?></div></ul>
</div>
It's generating the menu fine but one of the links I need it to goto another page.
Is it possible to pick out that page by ID and tell it to goto a different address? If so, how can I do it?
|
I'm now using the Page Links To plugin to achieve this.
!enter image description here
|
stackexchange-wordpress
|
{
"answer_score": 0,
"question_score": 0,
"tags": "menus"
}
|
Can anyone identify this like plugin (not facebook like)?
Almost all divs say **wpl** but can't find which plugin is. For example, `#wpl-likebox`.
Here is a page that is using it:
<
|
It is a custom Plugin for WordPress.com.
|
stackexchange-wordpress
|
{
"answer_score": 2,
"question_score": 2,
"tags": "plugins"
}
|
Wp-minify doesn't seem to minify my JS code
I've added to the theme (twenty ten) a php template file in which I've written some javascript code.
I then created a new page and set it to use that template.
Then I installed and activated the 'wp-minify' plugin hoping for it to drop the blanks and comments.
But when I look at the page's source code in the browser I see the code regularly.
Your advice will be appreciated.
|
As far as i understand WP Minify plugin works on scripts and styles that are included in your page `<head>` tag as external files and not scripts and style that are in the `<body>` tag.
if you are inserting scripts and style in the `<body>` tag manully you should insert it after you minify it and you can use many of the free **online minify tools**
|
stackexchange-wordpress
|
{
"answer_score": 1,
"question_score": 0,
"tags": "plugins, templates, javascript"
}
|
Using Pages to handle calls for custom post types
I have created a page on which I would like to run queries exlusively for one custom post type in the same way I'm using Category.php, Author.php and index.php to run queries for regular posts. I can't seem to get anything to appear when I edit the page that is associated with the template I've created for this page, so I've edited the actual page template itself. This may or may not be related to the fact that I can't get this page to behave like index.php does, i.e. providing a running list of posts until someone does a more refined search such as by Category.
I'm stumped - how can I get a page template to work just like index.php does, but for the custom post type only?
|
You want to use the template file `archive-{posttype}.php` to output an archive index of your Custom Post Type, and the template file `single-{posttype}.php` to output a single Custom Post.
Refer to the Codex entry for Template Hierarchy.
|
stackexchange-wordpress
|
{
"answer_score": 1,
"question_score": 1,
"tags": "pages, templates"
}
|
Where should I update_options in a theme?
I am designing a theme where the home page (i.e. `is_home()`) should only display the latest blog post. I want to do something like `$wp_query->update_option('posts_per_page', 1)` every time I am on the home page. All other pages that display posts (like archives) should just follow the user defined option.
This seems a bit unnecessary to do every single time since the option should just be set once, right? Is it possible within The Loop to just ignore the user-set option of `posts_per_page` and force `have_posts()` to just be set to one post?
In general, where should this kind of "set-it-once" stuff go? I don't really think it should be a plug-in because it is theme specific. I also don't want to mess with the user's options which is why `update_option` isn't the best choice for this problem.
|
Alternate approach (if you want/need to keep this in functions.php and go via hooks instead of modifying template) would be something like this:
add_action( 'pre_get_posts', 'pre_get_posts_home' );
function pre_get_posts_home( $query ) {
global $wp_query;
if( $wp_query == $query && $query->is_home )
$query->set( 'posts_per_page', 1 );
}
|
stackexchange-wordpress
|
{
"answer_score": 1,
"question_score": 1,
"tags": "theme development, customization, options"
}
|
Different Main Navigation per category
I have a client who has the categories listed in the right-hand sidebar. He came to me today requesting a different "navigation" in the header for each category.
So basically, if you click on Category 1, the navigation changes to a set of pages (that he has set) and so on.
Is this even possible? I already have the built in menu feature activated, but I am really at a loss for this one.
|
You could set this in your theme using conditionals. Create a separate menu for each category using the WordPress menu feature (Appearances > Menus). Then in your theme, where you want the menu to display, determine which menu to display using the is_category('category-slug') and/or in_category('category-slug') conditionals and the wp_nav_menu function (
For instance:
<?php
if(is_category('first-category') || in_category('first-category)) {
wp_nav_menu( array('menu' => 'First Category Nav' ));
} else {
wp_nav_menu( array('menu' => 'Default Nav' ));
}
?>
That said, from a user-experience standpoint I'd recommend against switching out the main menu on a section-by-section basis. That will be very confusing for visitors. I'd recommend an additional category-specific menu instead, with consistent main navigation.
Hope this helps!
|
stackexchange-wordpress
|
{
"answer_score": 1,
"question_score": 0,
"tags": "query, navigation"
}
|
How to add the time of a post to the list of posts on the administration page?
This seems like a simple thing to do, but I haven't been able to figure it out. What I'd like to do is add the time a post is scheduled to the date stamp on the list of posts. I know this means modifying the columns, and there's a way to do it that seems fairly simple. Has anyone done this, and can you suggest some code?
|
Try this:
add_filter('manage_posts_columns', 'posts_columns', 5);
add_action('manage_posts_custom_column', 'posts_custom_columns', 5, 2);
function posts_columns($defaults){
$defaults['your_date_col'] = __('Date');
return $defaults;
}
function posts_custom_columns($column_name, $id){
if($column_name === 'your_date_col'){
echo the_date();
}
}
|
stackexchange-wordpress
|
{
"answer_score": 2,
"question_score": 0,
"tags": "posts, admin"
}
|
How to remove a column from the Posts page
In a previous question I asked how to add a column to the Posts page in the Administration section, and got a working answer. But now I need to know how to delete an existing column (e.g. the Date column) so that my customized Date column replaces it.
|
function my_manage_columns( $columns ) {
unset($columns['date']);
return $columns;
}
function my_column_init() {
add_filter( 'manage_posts_columns' , 'my_manage_columns' );
}
add_action( 'admin_init' , 'my_column_init' );
|
stackexchange-wordpress
|
{
"answer_score": 32,
"question_score": 12,
"tags": "posts, admin"
}
|
Is there a way to change the color of a row in Post Administration based on the type of post?
What I'd like to do is have the entire row be a different color - for example, a light blue for draft posts. That way I can visually see at a glance what's a draft, what's scheduled, and what's published on a given time period (I am working on a system for scheduling posts out weeks in advance).
It would seem the logical way to do this is to alter the row color, since there is a CSS class ("status-draft") for example. However, it appears that altering the row color doesn't work since the individual cells as well have overriding colors.
Thoughts?
|
you mean something like this?
!enter image description here
then here you go:
add_action('admin_footer','style_posts_list');
function style_posts_list(){
?>
<style>
.status-draft{background-color: #008866 !important;}
.status-pending{background-color: #F53162 !important;}
.status-publish{background-color: #FFF700 !important;}
<?php
}
|
stackexchange-wordpress
|
{
"answer_score": 3,
"question_score": 2,
"tags": "posts, admin"
}
|
What is the best practice to style archive page 2,3,etc differently than archive.php?
I have a custom post-type 'videos' and on the first page I have the first video styled differently than the next videos on the page. Basically I show the first video in a large format, while the rest of the videos on the page are small.
Question:
On page 2, 3, etc of the video post-type, I do not want to have a large video on the top of the page, but rather follow my standard styling.
What would be the best way to do this?
Currently I am using rewrite rules to allow me a second template page for my 'paged' for the post-type. I would rather not use this approach anymore as it is more to maintain.
If I used a check like if_paged.. then I find that I have to replicate a ton of code on my template. Hoping there is a simple way to identify the first post in the loop, style that, and then continue... open to any ideas
thanks
|
In response to your comment, `$wp_query->current_post` in action. Note that it's zero-indexed:
<?php
if (have_posts()) :
while (have_posts()) : the_post();
if($wp_query->current_post==0):
echo "this is the first post";
else:
echo "this is post number " . ($wp_query->current_post + 1);
endif;
endwhile;
endif;
?>
|
stackexchange-wordpress
|
{
"answer_score": 1,
"question_score": 0,
"tags": "templates, archives"
}
|
What is the canonical way to link to pages?
I can easily link to my archives page by creating a link: `<a href=" As I was editing my WP template, I noticed that there are a number of functions that WP uses to link to other pages. For example `get_the_category_list` returns a list of links. If I want to make my template more general, it would be nice not to hardcode the URL of my archives page and to use a WP function instead.
In general, how should template designers create links to WP generated pages?
|
This link Wordpress Codex: Linking... provides detailed information on how to link different types of content. One nice feature that solves the above problem is to use a link of the form `/wordpress/archives.php`. This will transfer nicely (in most cases) to any particular server deployment.
Further, looking in `wp-includes/link-template.php` gives you more insight to what kinds of tools are already available for creating links. Particularly helpful is `home_url()` which allows you to try to be as server agnostic as possible.
|
stackexchange-wordpress
|
{
"answer_score": 0,
"question_score": 3,
"tags": "links, customization"
}
|
How can I make a login just like on wordpress.org?
The page I am talking about is this: < It is simple and perfect in my opinion. Can anyone help me?
|
this should give you the same look unless your theme's css overwrites it:
<form name="loginformfooter" class="loginform" id="loginformfooter" action="<?php bloginfo('url'); ?>/wp-login.php" method="post">
<p><label>Username <input type="text" value="" maxlength="40" size="13" id="user_login" name="user_login" class="text">
</label>
<label>Password <input type="password" maxlength="40" size="13" id="password" name="password" class="text">
</label>
<input type="hidden" value="" name="re">
<input type="submit" value="Log in" id="submit" name="Submit" class="button-secondary">
(<a href="<?php bloginfo('url'); ?>/wp-login.php?action=lostpassword">forgot?</a>) or <a href="<?php bloginfo('url'); ?>/wp-login.php?action=register">Register</a></p>
</form>
|
stackexchange-wordpress
|
{
"answer_score": 2,
"question_score": 0,
"tags": "login"
}
|
How to translate month names in "Archives"
How can I modify month names in "Archives" in my blog? I would like to translate english month names into my mother tongue. I'm using the english version of wordpress 3.1.3
|
if the translation is only for the archive widget, a filter function might work (to be added to functions.php of the theme):
add_filter('get_archives_link', 'translate_archive_month');
function translate_archive_month($list) {
$patterns = array(
'/January/', '/February/', '/March/', '/April/', '/May/', '/June/',
'/July/', '/August/', '/September/', '/October/', '/November/', '/December/'
);
$replacements = array(
'jan', 'feb', 'mar', 'apr', 'may', 'jun',
'jul', 'aug', 'sep', 'oct', 'nov', 'dec'
);
$list = preg_replace($patterns, $replacements, $list);
return $list;
}
|
stackexchange-wordpress
|
{
"answer_score": 7,
"question_score": 3,
"tags": "customization, sidebar, archives, translation"
}
|
How I can add blog in my magento site?
I have to add a blog in my magento site.Is it possible to integrate wordpress into magento by which we are able to post blog in the wordpress and then display in the magento site.
Thanks in advance
Pramod
|
Here is an extension for this..that you can use
<
or you can go with ...
<
|
stackexchange-wordpress
|
{
"answer_score": 2,
"question_score": -1,
"tags": "customization, magento"
}
|
Featured Posts for Category Pages
I was wondering if anyone knew how to have a different "featured post" based on it's category per category page? For example, if you are on the medical category page, you would see a medical post featured in a special div and so on.
|
assign the additional category 'featured' to the post in the category 'medical'.
in your category template, use a query with `'category__and' => array(3, 27)`
example (assuming 'medical' is cat 3, and 'featured' is cat 27):
<?php $args = array(
'category__and' => array(3, 27),
'posts_per_page' => 1
);
$feature = new WP_Query( $args );
if( $feature->have_posts() ) : while( $feature->have_posts() ) : $feature->the_post(); ?>
<div class="featured">
ANY POST OUTPUT <?php the_title(); ?>
</div>
<?php endwhile; endif; ?>
|
stackexchange-wordpress
|
{
"answer_score": 3,
"question_score": 2,
"tags": "posts, categories, query posts"
}
|
How do I acquire all the meta-information for a particular page I am on?
I am trying to customize behavior for different displays of pages; I know I can use the Template Hierarchy and Conditional Tags to accomplish this. In the process of debugging, though, I'd like to be able to access all the meta-information about a page without having to iterate through all the `is_*` functions.
Is there a way to access this meta-information without rolling my own function (which would basically iterate through all the `is_*` functions). It would also be nice if this function had other information in it as well such as page-id, author, category, etc.
|
you can inspect $wp_query to see the query vars and returned data, including all of those conditionals:
<pre><?php print_r($wp_query); ?></pre>
|
stackexchange-wordpress
|
{
"answer_score": 2,
"question_score": 0,
"tags": "debug"
}
|
Site Rss not seen by browser
We have a site < built with WP 3.1.2. Its RSS address should be < but nothing shows up there. I can see the feed in the View Source, but not in the browser, and not in one of our other applications, that reads the RSS from this site.
What could be the problem, and how can I fix it?
|
The problem is an invalid UTF-8 character in the excerpt `<description>`. The text is cut off in the middle of a multi-byte character, rendering your complete feed invalid. You get a slightly hint when you look at it in Opera.
Do you filter `'bloginfo_rss'` or `'get_bloginfo_rss'`? Disable all plugins and look if the feed is still broken.
|
stackexchange-wordpress
|
{
"answer_score": 2,
"question_score": 2,
"tags": "rss, encoding"
}
|
Is WP feature image function cropping images? WP Content Slideshow
I am using WP Content Slideshow. I like the plugin, but am having an issue with it. I mailed the creator, but no response, so I am trying to troubleshoot what is causing the problem. You can see the issue on the homepage of elyconnect.com.
The plugin uses the featured image for the image in the slideshow. I set the resolution for each image size correctly, but the images are "cropping" and I dont know why.
I'm open to suggestions, or a recommendation for a better plugin if one exists.
|
I think on your example is the picture to small for crooping; if the image is smaller as the config on mediathek in WP, than it is not possible to crop the image. Your theme use the image from 300px width for this view and the css style defined 447px.
|
stackexchange-wordpress
|
{
"answer_score": 1,
"question_score": 1,
"tags": "plugins, slideshow"
}
|
List Recent Post Titles from Custom Taxonomies?
I'm managing a movie related site.. I'm using yoast's simple taxonomies plugin to classify my content with Artists, Genre (action, horror, comedy, drama etc..), Director, Writer etc...
On a specific page (template), I want to pull last 5 posts with only their titles from custom taxonomies.. how can I pull last 5 titles from Action, Comedy or Horror taxonomies as list?
I will try to get an output like <
Thanks
|
create additional loops in your template, selecting the taxonomy and term you'd like to limit display to for each. for instance, this will pull the last 5 posts from taxonomy "genre", term "action":
<?php
$args = array( 'taxonomy'=>'genre','term'=>'action','posts_per_page'=>5 );
$action_films = new WP_Query( $args );
while( $action_films->have_posts() ) : $action_films->the_post();
echo '<li>';
the_title();
echo '</li>';
endwhile;
?>
|
stackexchange-wordpress
|
{
"answer_score": 1,
"question_score": 1,
"tags": "custom taxonomy, customization"
}
|
Any Good WordPress Themes Compatible With The BBPress Plugin?
Does anyone know of any good wordpress themes that are compatible with the bbpress _plugin_? I'm looking for something with a good layout, preferably a magazine/news type theme.
Thanks :)
|
Best would be if you modify the bbpress theme a bit.Copy the entire folder "/bbpress/bbp-themes/bbp-twentyten" folder into your themes folder, rename it to something else, and modify your style.css to make it a custom child theme of whatever your current theme is.
Now you can modify as you you wish.
Another way :Copy all files of that folder inside ur theme.
In your theme's function.php add the following line.
> add_theme_support( 'bbpress' );
Now you have your theme compatible with ur own bbpress page structure which you can modify as you wish. Hope that helps
|
stackexchange-wordpress
|
{
"answer_score": 0,
"question_score": 0,
"tags": "themes, bbpress"
}
|
What are the package and subpackage comment for?
This is included in themes and plugins.
/*
* @package WordPress
* @subpackage Twenty_Ten
* @since Twenty Ten 1.0
*/
What are they for? I've read that they are standard and so on, but what is the practical use for it?
|
These are PHPDoc tags - used to generate meaningful (and automated) code documentation
|
stackexchange-wordpress
|
{
"answer_score": 7,
"question_score": 9,
"tags": "plugins, themes, comments"
}
|
db query for retrieving comments without any reply
what is a query for selecting a list of comment id's that have not had a reply yet so I can use it to iterate though each comment id and echo out the post it is on and the excerpt of the comment along with the author name, url and how many comments?
|
this should work...
<?php
global $wpdb;
$sql = "SELECT comment_ID FROM ". $wpdb->prefix ."comments WHERE comment_parent = 0 AND comment_ID NOT IN(SELECT comment_parent FROM ". $wpdb->prefix ."comments);";
$results = $wpdb->get_results($sql);
?>
|
stackexchange-wordpress
|
{
"answer_score": 0,
"question_score": 0,
"tags": "comments, query, wpdb"
}
|
Do all files in child theme override the parent?
I'm curious if other PHP code files besides functions.php, WP template files and style.css in a child theme actually override the same file in a parent them?
I am working with a client that has a theme with child theme support, however, there are no hooks or actions to unload for the functions that I wish to override. Looking for a clean way to perform this override whith customized code that won't be overwrote on upgrade.
|
It depends entirely on a) what functions and template files you're talking about, and b) how those functions are defined, or template files are called, in the Parent Theme.
If the Parent Theme uses `get_template_part()`, then you're golden. If the Parent Theme uses `get_stylesheet_directory_uri()` or `STYLESHEETPATH`, then you can override, with caveats. If the Parent Theme uses `get_template_directory_uri()` or `TEMPLATEPATH`, then you're going to have a difficult time.
With functions, if the Parent Theme wraps the functions in a `function_exists()` conditional, then you can simply override such functions by declaring them in the Child Theme. With hooks, you can simply `remove_action` or `remove_filter`.
|
stackexchange-wordpress
|
{
"answer_score": 5,
"question_score": 3,
"tags": "child theme, pluggable, parent theme"
}
|
Why was my blog post inserted lot's of ad links by others?
I found that my blog posts are inserted lot's of ad links, I'm using WordPress 2.9.2, is there a known security vulnerability in it?
A screenshot : I post some codes on my blog, the ad links are inserted into them.
!enter image description here
I delete them by hand several days ago, and I found that they're back again!
|
Looks like you've been hacked. In all fairness, you're running a version that is over a year old \- it's always best practice to upgrade as soon as you can.
I would advise reading through the FAQ on the codex. I also stumbled across this rather concise step-by-step, though I would advise it's for the intermediate user (use of SQL and FTP is required).
|
stackexchange-wordpress
|
{
"answer_score": 5,
"question_score": 1,
"tags": "security, hacks"
}
|
How to Call a static page in WordPress
Hi I created a template within my theme files, just for displaying a map in a lightbox. I need to call this template page from a normal wordpress post, how can I do it?
Say in my theme files I have a file called map-template.php From within my post I would like to call that map-template.php file and also pass the ID of the current post as a parameter.
Thanks
|
So long as you have a standard page template header in your `map-template.php`, you can use the Custom Post Template plugin (which essentially allows you use templates on posts in the same way you do with pages).
**Update** : Perhaps you might be better off using shortcode.
For example;
This is my post content in the editor. And here is a map;
[my-map]
And in `functions.php`;
function __my_map_shortcode()
{
// output map
}
add_shortcode( 'my-map', '__my_map_shortcode' );
|
stackexchange-wordpress
|
{
"answer_score": 1,
"question_score": 1,
"tags": "customization"
}
|
Recent comments on author page?
I'm creating an author.php page and I'd like to show comments as well as posts from a custom post type. I already have the list of posts but I'm looking into an efficient way of displaying the most recent comments from that author as well. So far I haven't found anything except widget and bloated plugins.
I'd like to do that particularly in one stream (posts/comments) but I can understand if this is too challenging :)
Thanks! Dennis
|
This function calls all comments by an author and strips every comment to a max-length. Adjust the comment excerpt length when calling the function in your template like `wpse19316_author_comments( 100 );`.
function wpse19316_author_comments( $length )
{
$final_length = (int) $length;
$author_comments = get_comments( array( 'ID' => $GLOBALS['authordata']->ID ) );
foreach ( $author_comments as $comment )
{
$comment_length = sublen( $comment->comment_content );
$comment_excerpt = $comment->comment_content;
if ( $comment_length > $final_length )
$comment_excerpt = substr( $comment->comment_content, $final_length );
echo $comment_excerpt.'<br />';
}
}
|
stackexchange-wordpress
|
{
"answer_score": 1,
"question_score": 1,
"tags": "custom post types, comments, author"
}
|
wp_nav_menu log in/out link?
I have a wp_nav_menu showing pages, but I'd also like to include a log in/out link, based on the current state of the user, which will redirect them to the home page.
I've looked far and wide, but how can I implement this in a wp_nav_menu?
Thanks, Dennis
|
Use the `wp_nav_menu_items` hook to add a filter which will allow you to add your login / logout link.
Use `wp_loginout()` to display a status aware login / logout link. Codex page.
|
stackexchange-wordpress
|
{
"answer_score": 5,
"question_score": 2,
"tags": "menus, login, logout"
}
|
What does this mean: Object of class WP_Error could not be converted to string
When I click on preview a post, I get the following error:
Catchable fatal error: Object of class WP_Error could not be converted to string in functions.php on line 288
The line 288 is as follows
echo get_category_parents($cat, TRUE, '' . $delimiter . '');
Any ideas on this please?
|
The only way that function returns an instance of `WP_Error` is if `$cat` (in your example) has an empty value. You need to check the return before doing anything with it. Replacing that line with this should fix the problem:
echo is_wp_error( $cat_parents = get_category_parents($cat, TRUE, '' . $delimiter . '') ) ? '' : $cat_parents;
|
stackexchange-wordpress
|
{
"answer_score": 5,
"question_score": 1,
"tags": "fatal error"
}
|
How to unregister a widget from a child theme
I was wondering if there was a way to unregister a widget that gets declared in the functions.php file of a parent theme from a child theme, I understand that the child's function.php file gets loaded first so I don't know how to unregister it when it hasn't been created yet.
Thanks all in advance!
|
Assuming the Parent Theme's Widget is registered at the `widgets_init` hook, all you need to do is wrap your `unregister_widget()` call inside of a function, hook that function into `widgets_init`, and give your hook a higher **priority number** than the Parent Theme's `widgets_init`-hooked function.
Assuming the Parent Theme hooks into `widgets_init` without giving a priority number, the function will default to `10`. So, just give your hook call a priority of `11` or greater.
|
stackexchange-wordpress
|
{
"answer_score": 6,
"question_score": 2,
"tags": "plugins, widgets"
}
|
Google Chrome CSS issues
I am currently having some CSS problems with Google Chrome. Slider is overlapping with the buttons on the right side.
My theme layout (CSS) works fine with Firefox, and IE but not in google chrome. Something to do with margins and alignments I think.
Here's the link: <
|
Not a WordPress question, but if you remove the width from #slideshow-wrapper on line 4 of gallery-slider.css it sort of fixes rendering.
|
stackexchange-wordpress
|
{
"answer_score": 1,
"question_score": 0,
"tags": "css"
}
|
301 Redirecting posts without %postid% (just %post_name%) in permalink to ones with %post_name%_%postid%
Just wondering if its possible to redirect existing posts which are permalinks of just %post_name% to %post_name%-%postid% ?
Is there a plugin which can pick this up? Dont want to lose rankings on the content so would want it handled with legitimate 301 redirect.
Appreciate any advice if someone has had to deal with this before?
Many thanks :)
|
Have a look at the Redirection plugin.
|
stackexchange-wordpress
|
{
"answer_score": 0,
"question_score": 0,
"tags": "posts, permalinks, redirect"
}
|
How to make a query returning pages from multiple parents
I'd like to make a query that returns the children pages of various parent pages.
Unfortunately the `post_parent` attribute of `WP_Query` accepts only one value.
What do you suggest ?
|
POST does not have parents, but categories. Only PAGE can have parent. So, the question is, what do you want to get?
In case of getting POSTS from different categories, just use `get_posts` and add multiple categories.
As for pages, just use `get_page_children`.
|
stackexchange-wordpress
|
{
"answer_score": 1,
"question_score": 0,
"tags": "wp query, customization, children"
}
|
Custom Fields and performance
My question : how many custom fields or even taxonomies WordPress can handle without affecting performance?
The reason I ask, is because I started building a custom theme and I might need to have around 10 to 20 custom fields, and thinking if this will affect the speed of the site.
I understand that speed also depends on server/hosting and number of visits, cache techniques, etc...
I also expect that a post with one custom field will be faster then one post with ten custom fields.
But, let's say a site that haves around 10,000 visits a day with a post with one custom field will the speed difference be much more different from a site with the same 10 000 visits a day with a post with 10 custom fields.
Just trying to figure it out how much of a difference a custom field can make.
Also in terms of custom searching using wp_query and custom fields parameters will the speed be affected.
Thank you.
|
In the case of custom fields- if you fetch them in a single query to the database, fetching one or ten is not going to differ much, it's the same relatively simple query in both instances. If you were to do a lot of complex meta queries on those fields you'd definitely see a performance hit.
I think same for taxonomy, if you're doing complex taxonomy queries, that's a big hit. Simple queries to fetch terms are relatively cheap.
Searching will certainly tax the server more if you've got ten times as much data, text searches are pretty expensive.
|
stackexchange-wordpress
|
{
"answer_score": 2,
"question_score": 3,
"tags": "custom taxonomy, custom field, customization"
}
|
Can't add text in front of shortcode
Currently I'm using this shortcode within a post
<
which works great, but somehow I can't add any text in front of this shortcode, without posting it the other way around.
In example
some dummy text [etalage]
will always be shown as
[etalage] some dummy text
I've read to gather the value into a variable and return it, but I have to admit, I'm not entirely sure how to accomplish this best
|
Here's your updated shortcode function which puts output in a variable and returns it. Note that you have to use functions that return data rather than output directly, in this case `get_the_post_thumbnail()` is used in place of `the_post_thumbnail()`
function cor_etalage_add_shortcode() {
$output = '<div id="etalage"><ul>';
$the_query = new WP_Query(array(
'post_type' => array(
'portfolio'
)
));
while ($the_query->have_posts()) : $the_query->the_post();
$output .= '<li>'. get_the_post_thumbnail($post->ID,'etalage') .'</li>';
endwhile;
wp_reset_postdata();
$output .= '</ul></div>';
return $output;
}
add_shortcode('etalage', 'cor_etalage_add_shortcode');
**EDIT** oops, forgot to pass the post ID with `get_the_post_thumbnail`, updated.
|
stackexchange-wordpress
|
{
"answer_score": 2,
"question_score": 0,
"tags": "custom post types, slideshow"
}
|
Wordpress disable 'Install Themes' tab
Can someone help me disable the `Install Themes` link from the WordPress back-end?
|
You can essentially 'block' the capability `install_themes` using;
function __block_caps( $caps, $cap )
{
if ( $cap === 'install_themes' )
$caps[] = 'do_not_allow';
return $caps;
}
add_filter( 'map_meta_cap', '__block_caps', 10, 2 );
|
stackexchange-wordpress
|
{
"answer_score": 2,
"question_score": 1,
"tags": "wp admin"
}
|
Default Image Link Removal
Just wondering if there is a way to remove WordPress's default function of adding a tag around an inserted image. I assume its a "remove_filter" function like you can do for WPAutoP, but all my searches only turned up links for gallery plugins, etc.
Thanks in advance, Pete
|
This is not able to be changed through a filter. In WordPress 2.9.2 and lower, the setting can be changed in /wp-admin/options.php. The image_default_link_type field is set to "file" by default. If you set it to "none", then scroll to the bottom and save, it will disable media links.
This option has been removed from options.php in WordPress 3. For versions 3.0 and higher you need to add the following to your theme's functions.php file or write it into a plugin:
update_option('image_default_link_type','none');
Note: Getting rid of the link affects all media. If you upload .zip, .pdf, music or other types of media that you want people to download from your site you will have to manually add links to these. There is currently an open ticket on the trac for this: <
|
stackexchange-wordpress
|
{
"answer_score": 5,
"question_score": 4,
"tags": "images, links, filters"
}
|
Unregister post type from child theme
I'm trying to unregister a post type from a child theme but I haven't been able to do so, the code in the funcions.php file on the parent theme is something like this:
add_action( 'init', 'mc_projects' );
function mc_projects() {
register_post_type( 'project', array(
// Default options....
) );
}
What I tried to do in my child theme was to remove the mc_project action from the init hook like this:
remove_action('init', 'mc_projects', 11);
But it didn't work, even when I set the priority to some higher value, am I doing something wrong?
|
Try the following in your child theme functions file.
add_action( 'init', 'remove_mc_projects' );
function remove_mc_projects() {
remove_action('init', 'mc_projects');
}
|
stackexchange-wordpress
|
{
"answer_score": 4,
"question_score": 5,
"tags": "custom post types, hooks, actions"
}
|
Wordpress Custom File Permalink
Guys i have a custom file that is not part of the wordpress and its not a part of the plugins. How can i add it to the permalink solution? For example:
Custom file name - example123.php Permalink solution - <
|
You should make a template out of your file and then in WP create a page named "Example" to which you assign this template.
|
stackexchange-wordpress
|
{
"answer_score": 0,
"question_score": 1,
"tags": "customization, permalinks"
}
|
Inserting shortcode [stream /] into a Text widget
hi i'm trying to insert a short code into a Text widget but all its doing it showing the code and not processing it.
<?php echo do_shortcode(' [stream embed=false share=false width=500 height=560 dock=true controlbar=bottom bandwidth=high autostart=false playlistfile= config= playlist=bottom repeat=none /] '); ?>
|
the text widget doesn't do php....
Here's my fave solution
<
It's from Otto, so ya know it's good. Based heavily on the text widget, but allows for php
|
stackexchange-wordpress
|
{
"answer_score": 2,
"question_score": 1,
"tags": "widgets, shortcode"
}
|
Is there a way to import terms into Wordpress?
I'm tired of typing in lists of counries in my "Countries" taxonomies. What's a good way to bulk import a long list of terms into Wordpress ?
|
Put list in PHP array, loop through it, use `wp_insert_term()` on each.
|
stackexchange-wordpress
|
{
"answer_score": 10,
"question_score": 3,
"tags": "custom taxonomy, import, terms, bulk import"
}
|
Uninstalling IntenseDebate
I have been using the IntenseDebate Comments plugin, but am unhappy with it and would like to uninstall. Supposedly due to the data synchronization feature, it shouldn't be a problem to just disable and remove it, but of course there's nothing on their support site about how to uninstall...
Does anyone with experience removing it have survival tips for me?
Also, what will I _lose_ in the process of uninstalling (e.g. Gravatar icons)?
|
There is a place to find this out on there site <
|
stackexchange-wordpress
|
{
"answer_score": 1,
"question_score": 0,
"tags": "plugins, uninstallation"
}
|
Is it possible to use pages to apply static content to each taxonomy level?
I'm thinking of using a taxonomy archive template to list out my taxonomies and entries (I'm using a hierarchical structure) and then combining this with the WordPress pages module to apply static content to each taxonomy level.
Each level will essentially have its own page and will list either its children or entries (posts). The idea I had was to create a page with the same slug as my taxonomy and then assign the taxonomy archive template to this page.
Just wondered if anyone had done this before, or if its even possible.
|
Short answer : Yes its posible!
long answer: Not the best way to do waht you are trying to do, when i need static content to go along with taxonomy terms i use the terms description field and in case that i need even more i just add my extra custom fields to the taxonomy term, here is a nice tutorial **add extra fields to WordPress Custom taxonomies**.
this way the creation of the terms archive beacomes much more dynamic.
|
stackexchange-wordpress
|
{
"answer_score": 1,
"question_score": 2,
"tags": "custom post types, custom taxonomy, pages"
}
|
WP can't send newsletters
I'm using ALO EasyMail Newsletter plugin in order to send newsletters to subscribers. I have setup settings which is mainly the email address and try to send an email for subscribers but it doesn't send anything. Is there any special configuration for wordpress to do?
Thanks
|
Sounds like a server config problem. Try looking for a custom SMTP plugin and set it up with that.
|
stackexchange-wordpress
|
{
"answer_score": 1,
"question_score": -2,
"tags": "plugins, email"
}
|
How to retrive Custom Fields as Values for a Form field
I am constructing a theme for Wordpress that uses PAGES for products for sale on a site. This Product will have properties like DESCRIPTION, PRICE that will be stored to custom fields.
I was wondering if it is possible to retrieve the values from the custom fields and forward them to a form which is stored in another wordpress page. This form is a request for quotation form that the user fills out.
Thank you.
|
When generating the form all you need is the post id of the product pages and you can use get_post_meta function to retive the information about that product , so basically you just need to pass the product post id. eg:
$price = get_post_meta($product_post_id,'price',true);
|
stackexchange-wordpress
|
{
"answer_score": 0,
"question_score": 0,
"tags": "custom field"
}
|
I want to create a Visual Recipe site on WordPress, any suggestions or tips on how i can do it?
I would like to create a visual recipe site, which lists how to make a dish in step by step through pictures.. Is it possible to create a custom page template where i can the following fields.
1.Dishname(title) 2.Introduction(Brief info) 3.Ingredients 4.upload photo input.. followed by add more pic
Is it possible in wordpress, you have any effective ideas? please share :)
here is a screenshot of what i have in my mind
|
Short answer, yes Wordpress can do this sort of things.
You could create a custom post type called "Recepies", and a custom taxonomy called "Ingredients". Everything else is already included in the default WP setup, "Dishname" would be your post title, "Introduction" can be the "Excerpt" field, and photos are handled by the media gallery.
|
stackexchange-wordpress
|
{
"answer_score": 0,
"question_score": 0,
"tags": "plugins, multisite"
}
|
Customize Admin Users Screen based on Role
I've added a role of "Customer" and I am working on customizing the Users Screen for that role. What I'd like to do is customize columns based on that particular role.
**Note:**
For example, take a look at the screenshot. How would I remove the reference to the posts column for _only_ the customer role?
!Example of current "Customer" screen
|
Thanks to Mike23 for the tip. Here's the code that I'm using to add a column to _only_ the "customer" role:
if( $_GET['role'] == "customer" ) {
add_filter('manage_users_columns', 'add_ecommerce_column');
add_filter('manage_users_custom_column', 'manage_ecommerce_column', 10, 3);
function add_ecommerce_column($columns) {
$columns['ecommerce'] = 'Ecommerce';
return $columns;
}
function manage_ecommerce_column($empty='', $column_name, $id) {
if( $column_name == 'ecommerce' ) {
return $column_name.$id;
}
}
}
Any ideas or suggestions for improvement are very welcomed.
|
stackexchange-wordpress
|
{
"answer_score": 1,
"question_score": 2,
"tags": "admin, users, user roles"
}
|
Sizing textarea field in custom metabox
Here's the code for a custom metabox. Very simply, how would I resize the textarea box? I'd like to add an expression such as cols="50" rows="5".
// Echo out the field
echo '<p>Enter the location:</p>';
echo '<div class="customEditor"><input type="textarea" name="_location" value="' . $location . '" class="widefat" /></div>';
echo '<p>How Should People Dress?</p>';
echo '<input type="textarea" name="_dresscode" value="' . $dresscode . '" class="widefat" />';
(Source: <
Thanks.
|
You could try styling it with CSS by adding an ID or a class to the textarea and inserting styles into the wp_admin head.
Or, a quick way would be to do something like this :
echo '<textarea name="_dresscode" class="widefat" style="width:400px !important; height:80px !important;" >' . $dresscode . '</textarea>';
If not, have you tried simply :
echo '<textarea name="_dresscode" class="widefat" cols="50" rows="5">' . $dresscode . '</textarea>'
|
stackexchange-wordpress
|
{
"answer_score": 4,
"question_score": 0,
"tags": "custom post types, metabox, input"
}
|
archive-{post_type}.php is defaulting to category.php vs. archive.php on category searches
I am using `archive-{post_type}.php` for queries of a custom post type. I want the system to use `archive.php` for category searches but it is defaulting to `category.php` which I am using for category searches (different categories) for regular posts. Does anyone have an idea of what could be going wrong?
|
I am not sure what you mean by _category searches_?
In `is_category()` branch of template hierarchy `category.php` precedes `archive.php`, it is intended and wanted behavior. If you want to change template behavior for specific category you will need to override that logic, likely in `template_redirect` hook or around that.
|
stackexchange-wordpress
|
{
"answer_score": 0,
"question_score": 0,
"tags": "custom post types"
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.