Getting a Post’s Featured Image URL By Post ID

Getting a Post’s Featured Image URL By  Post ID

<?php $feat_image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); ?>

<img src="<?php echo $feat_image; ?>" width="80" height="100" />

If Featured Image else your default image:

check below code:

<?php $feat_image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); ?>

<?php if($feat_image) {?>
<img src="<?php echo $feat_image; ?>" width="80" height="100" />
<?php } else {?>
<img src="default.jpg" width="80" height="100" />
<?php } ?>


Display Child Pages title & content on Parent Page

Display all child and sub child pages using parent ID

This way the page that you are on will show in a post type the child pages of that page


$pages = get_pages('child_of=7&sort_column=post_date&sort_order=desc'); //Replace your parent id with 7
$count = 0;
foreach($pages as $page)
$content = $page->post_content;
<h2><a href="<?php echo get_page_link($page->ID) ?>"><?php echo $page->post_title ?></a></h2>
<p><?php echo $content ?></p>

Back to Top in Html(Jquery)

HTML wise all we need to do is add a “back to top” link at the bottom of the blog post

Below Jquery code add in your header file:

<script src=""></script>
jQuery(document).ready(function() {
    var offset = 820;
    var duration = 700;
    jQuery(window).scroll(function() {
        if (jQuery(this).scrollTop() > offset) {
        } else {

    jQuery('.top').click(function(event) {
        jQuery('html, body').animate({scrollTop: 0}, duration);
        return false;

Below code add in footer file means end of page:
<a href="#" title="Back to Top" >Back to top</a>

Contact form 7 really simple captcha permission

After really simple captcha, if entered captcha correctly when click on submit button it’s take very long time to submit your details, because some of permission reason it is not creat captcha image in temp folder . Add below change in really simple captcha file.

Open really simple captcha folder from plugin folder -wp-content/plugin/really-simple-captcha/really-simple-captcha.php



/* Image type. 'png', 'gif' or 'jpeg' */
        $this->img_type = 'png';

        /* Mode of temporary image files */
        $this->file_mode = 0444;

        /* Mode of temporary answer text files */
        $this->answer_file_mode = 0440;

Change to:

/* Image type. 'png', 'gif' or 'jpeg' */
        $this->img_type = 'png';

        /* Mode of temporary image files */
        $this->file_mode = 0777;

        /* Mode of temporary answer text files */
        $this->answer_file_mode = 0770;

Ajax not working in contact form 7

If ajax validation not woking in your theme, add below code into header.php above close  head [</head>]


<script type='text/javascript' src='/wp-content/plugins/contact-form-7/includes/js/jquery.form.min.js?ver=3.40.0-2013.08.13'></script>
<script type='text/javascript'>
/* <![CDATA[ */
var _wpcf7 = {"loaderUrl":"\/wp-content\/plugins\/contact-form-7\/images\/ajax-loader.gif","sending":"Sending ..."};
/* ]]> */
<script type='text/javascript' src='/wp-content/plugins/contact-form-7/includes/js/scripts.js?ver=3.5.2'></script>