Today we will learn a simple trick to show random articles on your website or blog powered by WordPress.
Simply create a new page and in code editor paste the below code and it will start showing random blog posts. This is a wonderful way on how to keep your visitors glued to your website, may be they have visited for a particular article, seeing this “stumble upon kinda” page they could learn more on your blog or niche and this might interest them to subscribe to your blog or stay more on your blog.
How to Display Random WordPress Posts on a Page<?php
query_posts(array(‘orderby’ => ‘rand’, ‘showposts’ => 1));
if (have_posts()) :
while (have_posts()) : the_post(); ?><h1><a href=”<?php the_permalink() ?>”><?php the_title(); ?></a></h1>
Its very frustrating to see that your blog images are used by other not so good blogs or spam blogs by hotlinking your images, this has 2 main disadvantages.
So to avoid this there are 2 methods, 1st is a difficult one for newbies, its writing a htaccess code and protecting images, but could affect images in your feeds, second is to use the below plugin.
How to Protect your wordpress blog from Image TheftA simple tip that would enable you to help your WordPress users to submit Blog posts or their own articles from the Front-end of the WordPress blog itself. Usually this is one challenge that ll blog owners have : User managment. I Have to agree that for a normal internet user to browse a wordpress blog, Register him/her self and then post and article with Tags, SEO filelds and images are very very complex.
Here is how you can make blog post submission for users from frontend a cakewalk! : TOdo-Mini Plugin. Simply install this plugin and activate it from your wordpress control panel, Add a page with the Todomini form that enables yours to directly add post by filling up the form.
This plugin allows you to add highly customisable forms that work with your WordPress Theme to your website that allows non-registered users and/or subscribers (also configurable) to submit and edit posts and pages. New posts are kept in “draft” until an admin can publish them (also configurable). Likewise edits can be kept be automatically kept as revisions until an admin approves them. It can optionally use Akismet to check if submissions and contributions are spam. TDO Mini Forms can be used to create “outside-the-box” uses for WordPress, from Contact Managers, Ad Managers, Collaborate Image Sites, Submit Links, etc.
How can users submit Posts from Frontend in WordPress?Hey friends,
Here is a simple tip to back up your entire WordPress blog, users, posts, and Images.
Firstly Backup the Text content
Go to your blogs admin section, Manage > Export to download it in XML format, further this can be used to import to your latest wordpress version.
Then Backup the images
Download and install the Firefox extension DownThemAll, then login to your your WordPress blog’s admin section
Manage > Media Library page & set DownThemAll to download all your image links on the page, you are done with it. Isnt that simple.
How to backup your wordpress blog including imagesHello all, Today we would discuss a short But very useful wordpress Trick. If you have ever thought of disabling your wordpress Feeds, then here is the solution and its really simple.
Just place this below code in your wp-content/themes/*selected theme*/functions.php file.
How to Disable WordPress Blog Feeds?<?
function fb_disable_feed() {wp_die( __(‘No feed available, please visit our <a href=”’.get_bloginfo(‘url’) .’”>homepage</a>!’) );}
add_action(‘do_feed’, ‘fb_disable_feed’, 1);
add_action(‘do_feed_rdf’, ‘fb_disable_feed’, 1);
add_action(‘do_feed_rss’, ‘fb_disable_feed’, 1);
add_action(‘do_feed_rss2′, ‘fb_disable_feed’, 1);
add_action(‘do_feed_atom’, ‘fb_disable_feed’, 1);
?>
About: How to modify the WordPress comment Form, modify wordpress comment form, edit wordpress comment, delete wordpress comment, remove website entry from wordpress comment, remove name from wp comment form, remove name from wordpress comment.
Code Of the comment.php that i had in my theme, here the section marked in red is the “Form” section that needs to be edited.
<!– You can start editing here. –>
<?php if ( have_comments() ) : ?>
<h3 id=”comments”><?php comments_number(‘No Responses’, ‘One Response’, ‘% Responses’ );?> to “<?php the_title(); ?>”</h3>
<ol>
<?php wp_list_comments(‘avatar_size=60′); ?>
</ol>
<div>
<div>
<?php previous_comments_link() ?>
</div>
<div>
<?php next_comments_link() ?>
</div>
</div>
<?php else : // this is displayed if there are no comments so far ?>
<?php if (‘open’ == $post->comment_status) : ?>
<!– If comments are open, but there are no comments. –>
<?php else : // comments are closed ?>
<!– If comments are closed. –>
<p>Comments are closed.</p>
<?php endif; ?>
<?php endif; ?>
<?php if (‘open’ == $post->comment_status) : ?>
<div id=”respond”>
<h3>
<?php comment_form_title( ‘Leave a Reply’, ‘Leave a Reply to %s’ ); ?>
</h3>
<div> <small>
<?php cancel_comment_reply_link(); ?>
</small> </div>
<?php if ( get_option(‘comment_registration’) && !$user_ID ) : ?>
<p>You must be <a href=”<?php echo get_option(‘siteurl’); ?>/wp-login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>”>logged in</a> to post a comment.</p>
<?php else : ?>
<form action=”<?php echo get_option(‘siteurl’); ?>/wp-comments-post.php” method=”post” id=”commentform”>
<?php if ( $user_ID ) : ?>
<p>Logged in as <a href=”<?php echo get_option(‘siteurl’); ?>/wp-admin/profile.php”><?php echo $user_identity; ?></a>. <a href=”<?php echo wp_logout_url(get_permalink()); ?>” title=”Log out of this account”>Log out »</a></p>
<?php else : ?>
<p>
<input type=”text” name=”author” id=”author” value=”<?php echo $comment_author; ?>” size=”22″ tabindex=”1″ <?php if ($req) echo “aria-required=’true’”; ?> />
<label for=”author”><small>Name
<?php if ($req) echo “(required)”; ?>
</small></label>
</p>
<p>
<input type=”text” name=”email” id=”email” value=”<?php echo $comment_author_email; ?>” size=”22″ tabindex=”2″ <?php if ($req) echo “aria-required=’true’”; ?> />
<label for=”email”><small>Mail (will not be published)
<?php if ($req) echo “(required)”; ?>
</small></label>
</p>
<p>
<input type=”text” name=”url” id=”url” value=”<?php echo $comment_author_url; ?>” size=”22″ tabindex=”3″ />
<label for=”url”><small>Website</small></label>
</p>
<?php endif; ?>
<!–<p><small><strong>XHTML:</strong> You can use these tags: <code><?php echo allowed_tags(); ?></code></small></p>–>
<p>
<textarea name=”comment” id=”comment” cols=”100%” rows=”10″ tabindex=”4″></textarea>
</p>
<p>
<input name=”submit” type=”submit” id=”submit” tabindex=”5″ value=”Submit Comment” />
<?php comment_id_fields(); ?>
</p>
<?php do_action(‘comment_form’, $post->ID); ?>
</form>
<?php endif; // If registration required and not logged in ?>
</div>
<?php endif; // if you delete this the sky will fall on your head ?>
<div style=”clear: both;”></div>
How to: Remove the “Comments are closed Notice” So the Form part is the part of the wordpress comment code that is of our interest to edit. so what all modifications could be made to this comments section. usually when comments are disabled it shows a message on the page as ” <p>Comments are closed.</p> This looks a bit unprofessional, so this needs to be removed, do a ctrl + F and find the section and remove part <p>Comments are closed.</p> and replace with <p> </p>
How to: Edit the Comment Form . Some websites would be of a kind where in the comment form would only require website and name, while some require only name and email, while some wanted to make it simple and just require the name only. Here is the form part and i will break up the highlighted part into 3 name, email and website. Just remove the section from the code that you dont want. simple as that.
How to modify the WordPress comment FormThe tutorial covers, How to Mass delete autosaved posts or Post revisions in WordPress, how to delete the post revisions at one go using PHPMYADMIN and SQL query.
Step 1: Open your phpMyAdmin Control panel
Step 2: Click on the SQL tab to open the sql query text box
Step 3: Type the blow query made by Andrei Neculau
Note that if your WordPress DB Prefix is other than the default WP, Change that in the query. And execute the below query, you are Done !
DELETE a,b,c FROM wp_posts a LEFT JOIN wp_term_relationships b ON (a.ID=b.object_id) LEFT JOIN wp_postmeta c ON (a.ID=c.post_id) WHERE a.post_type=’revision’;
NOTE: This method will delete all revisions from every post including all of its meta data.
How to Mass delete autosaved posts or Post revisions in WordPress