Category — Wordpress

How to Embed a Page inside a Page

The following code allows you to embed a page into another page. Replace **ID** with the ID of the page you wish to embed.

<?php $recent = new WP_Query("page_id=**ID**"); while($recent->have_posts()) : $recent->the_post();?> <h3><?php the_title(); ?></h3> <?php the_content(); ?> <?php endwhile; ?>

Thanks for CSS Tricks for the great tips!

Display Latest Tweets on Your WordPress Blog Without Using Any Plugin

If you have twitter account and want to display latest tweets on your blog, some people will using plugin to display the latest tweets, but you also can use the following code to display latest tweets without using any plugin.

Simply paste the following code anywhere in your theme files, where you want the tweets to be displayed.
Don’t forget to update the code with your username on line 3. Max items to display can be defined on line 4.

<?php
include_once(ABSPATH . WPINC . '/feed.php');
$rss = fetch_feed('https://api.twitter.com/1/statuses/user_timeline.rss?screen_name=catswhocode');
$maxitems = $rss->get_item_quantity(3);
$rss_items = $rss->get_items(0, $maxitems);
?>

<ul>
<?php if ($maxitems == 0) echo '<li>No items.</li>';
else
// Loop through each feed item and display each item as a hyperlink.
foreach ( $rss_items as $item ) : ?>
<li>
<a href='<?php echo $item->get_permalink(); ?>'>
<?php echo $item->get_title(); ?>
</a>
</li>
<?php endforeach; ?>
</ul>

Thanks to Smashing Magazine for this great code!

Free HTML5/CSS3 Theme With Responsive Layout – Yoko

There are lots of free WordPress themes available on the net, but how many of them really can suit your needs and having professional design and look? Today I came across with 2011 new WordPress theme which is designed by talented designers Ellen and Manuel from Elmastudio.

Yoko is a modern and flexible WordPress theme. Check out the features and documentations as below:-

  • for WordPress 3.1 +
  • Cross-browser compatible (tested in Chrome, Firefox, Safari, Internet Explorer 9 and 8 )
  • HTML5 (with fallback for IE responsive layout (CSS3 media queries not supported in IE 9 wordpress post format (aside, gallery, image, video, link and quote)
  • Theme options, individual background, individual header image
  • optional sub-
  • Social Links Widget (for RSS, Twitter, Facebook, Google +, Flickr, Vimeo, LinkedIn and Delicious)
  • Google web fonts (Droid Sans and Droid Serif)
  • Nested comments with Gravatar images
  • full width page template
  • Short codes for multiple columns, info boxes in yellow, green or red and highlighted text

The theme is released under GPL. You can use it for all your projects for free and without any restrictions. It is free for download and check out the live demo here!

How to Add Google+ Button to Your Post Automatically

Google had officially announced their Google+, a new social network that would battle Facebook and the Google Plus button works like the popular Facebook like button. If you are thinking to add Google+ button to your post automatically in order to generate more traffic, then you can try to add the following codes to functions.php file.

add_filter('the_content', 'wpr_google_plusone');
function wpr_google_plusone($content) {
	$content = $content.'<div><g:plusone size="tall" href="'.get_permalink().'"></g:plusone></div>';
	return $content;
}
add_action ('wp_enqueue_scripts','wpr_google_plusone_script');
function wpr_google_plusone_script() {
	wp_enqueue_script('google-plusone', 'https://apis.google.com/js/plusone.js', array(), null);
}

That’s all and thanks Spyre Studios for the great code!

How to Solve 403 Forbidden Error

Last few weeks, I found a 403 Forbidden error when I was trying to enter to my WordPress blog, this made me so worry and headache because I didn’t do any update on my blog, then I suddenly saw this error as below and my blog totally can’t displayed properly.

You don’t have permission to access /index.php on this server. Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

After that I have tried to search some related info from the net to find the solution how to 403 Forbidden Error, they asked:-
- to check any change of the permissions to access that directory.
- to take a look at the .htaccess file in that directory.

Unfortunately the above solutions do not work for me, then I started to think how to solve 403 Forbidden error by myself. This is what I have been done, see below:-

1. I reinstalled WordPress by overriding the existing file
2. Found that /index.php cannot be override, then I checked the File Permissions for index.php and found that the file attributes have been changed, I confirmed that this is the problem caused 403 Forbidden error.
3. I have tried to change the file attribute to 644, unfortunately I can’t changed it directly.
4. I have no choice but to delete /index.php file from that directory and upload the NEW index.php to that directory again.
5. All right, finally my blog is displayed properly and the problem has been solve.

If you have facing this problem in future, perhaps you can try my methond to solve 403 Forbidden error, good luck to you!

How to Display a Thumbnail from a Youtube Using a Shortcode

If you want to display youtube video thumbnail on your website or WordPress blog, below is the code that you can use to do it. First, you need to create a shortcode by copying the code below and paste it into your functions.php file.

/*
    Shortcode to display youtube thumbnail on your wordpress blog.
    Usage:
    [youtube_thumb id="VIDEO_ID" img="0" align="left"]
    VIDEO_ID= Youtube video id
    img=0,1,2 or 3
    align= left,right,center
*/
function wp_youtube_video_thumbnail($atts) {
     extract(shortcode_atts(array(
          'id' => '',
          'img' => '0',
          'align'=>'left'
     ), $atts));
    $align_class='align'.$align;
    return '<img src="<a href="http://img.youtube.com/vi/'.$id.'/'.$img.'.jpg&quot" rel="nofollow">http://img.youtube.com/vi/'.$id.'/'.$img.'.jpg&quot</a>; alt="" />';
}
add_shortcode('youtube_thumb', 'wp_youtube_video_thumbnail');

Once done, you can use this shortcode and it only can accept 3 parameters: The video ID, the image size (0 for 480*360px, 1 for 120*90) and the image alignment.

[youtube_thumb id="rNWeBVBqo2c" img="0" align="center"]

Thanks to Gunay for the code!

Free WordPress Theme – Mini Hyper

It’s been a long time I didn’t share the good and free WordPress theme, and today I found a Free WordPress theme that you will like it a lot. This is Mini Hyper WordPress theme, and it is free for download.

Mini Hyper is a home-made free WordPress theme by WpStyles.org, made with a lot of love and an ambition to serve bloggers world wide. It comes with a basic theme options page where you can add your Analytics tracking code and change the logo. Other than that, Mini Hyper is widget ready and works in all browsers.

Theme Features
- Theme Options Page
- Widget Ready
- WordPress 3.0+ Ready
- Cross browser compatible
- Custom Nav Menus

More Ways to Post Using WordPress Mobile App

Working part time can be a good way of balancing my work and personal commitments, this is why I still make money blogging although I’m full time worker now. After I join a new company, I really don’t have too much time to update my blogs. Luckily I’m working as Sales Executive, and most of the time I will travel outstation to meet and serve my customers. Once I have free time, I will use my iPhone to read some information from Internet and blogging by using WordPress Mobile App.

I believe that many bloggers prefer to use laptop or netbook for the heavy lifting, but sometimes bring laptop or netbook is not allowed and inconvenient like my situation, in this case you can use WordPress Mobile App for your blogging purpose. For those WordPress users who are using Apple iPhone, Android, BlackBerry, Nokia cellphones, you can use WordPress Mobile App for your posting. Whether you’re blogging from your desktop or on the go, make sure to check out these other ways to post to your WordPress blog. I pretty love this mobile app!

Page 2 of 10123456...Last »