Monday, July 7, 2014

jQuery - Setting dynamic equal height of a floated div

<script>
$(document).ready(function(){
    $('aside').height($("article").height());
});
</script>

Helpful URL: http://tech.pro/tutorial/1262/simplifying-dynamic-positioning-with-jquery-ui

Saturday, May 31, 2014

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>
<script type='text/javascript' src='/wp-content/plugins/contact-form-7/includes/js/scripts.js?ver=3.5.2'></script>

Friday, May 23, 2014

Stick Menu Code

Jquery Code:

<script type="text/javascript">
$(window).scroll(function () {
    var iCurScrollPos = $(this).scrollTop();
    if (iCurScrollPos > 130) {
        $('nav').css('position','fixed');
$('.sticky-logo').css('display','none');
    } else {
        $('nav').css('position','relative');
$('.sticky-logo').css('display','block');
    }
    //iScrollPos = iCurScrollPos;
});
</script>

=====================================


CSS Code:
nav {
background: url(images/menu_bg.png) 0 0 repeat-x;
z-index:99999;
top:0px;
left:0;
width:100%;
}
.menu {
display: inline-block;
min-width: 100%;
list-style:none;
border-top: 1px solid #ccc;
border-left: 1px solid #ccc;
border-bottom: 1px solid #ccc;
position: relative;
background-color:#666;
text-align: center;
z-index:99999999;
}

Adding Dynamic ID through jQuery

function addAddressBar(){
 $("#address-div").children('.address-info:last').clone().appendTo("#address-div");
    $(".address-info:last").find('select').val("");
     var len = $("[class*='address-info']").length;
     $('#address-div .address-info:nth-child('+len+') .one').attr( "id", "country_id_"+len ).attr("onChange","ajx_state('"+""+len+"',this.value)");
    $('#address-div .address-info:nth-child('+len+') .two').attr( "id", "state_id_"+len ).attr("onChange","ajx_city('"+""+len+"',this.value)");
    $('#address-div .address-info:nth-child('+len+') .three').attr( "id", "city_id_"+len );
    $("#count_address").val(len);
    return false;
}

Wednesday, April 30, 2014

WoredPress Contact Form 7 - Additional Header Reply-to?

Add the following in the Additional header to replay addressing to the user eamil id.

Reply-to: [your-name] <[your-email]> 

WordPress Contact Form7 Redirect to Other page

If you want to redirect a form on your website using Contact Form7 WordPress pluing use the below code and place on the Additional Setting box.

................................................................

on_sent_ok: "location = '/Paypal.html';"

................................................................

Wednesday, March 26, 2014

Include pagination in my custom blogs page

<!-- Add the pagination functions here. -->

<div class="nav-previous alignleft"><?php next_posts_link( '&laquo; Older posts' ); ?></div>
<div class="nav-next alignright"><?php previous_posts_link( 'Newer posts &raquo;' ); ?></div>

----------------------------------------

<div id="pagination">
        <?php
// grab the current query parameters
$query_string = $_SERVER['QUERY_STRING'];

// The $base variable stores the complete URL to our page, including the current page arg

// if in the admin, your base should be the admin URL + your page
$base = get_site_url() . '/search-results/?' . remove_query_arg('x', $query_string) . '%_%';

// if on the front end, your base is the current page
//$base = get_permalink( get_the_ID() ) . '?' . remove_query_arg('p', $query_string) . '%_%';

echo paginate_links( array(
'base' => $base, // the base URL, including query arg
'format' => '&x=%#%', // this defines the query parameter that will be used, in this case "p"
'prev_text' => __('&laquo; Previous'), // text for previous page
'next_text' => __('Next &raquo;'), // text for next page
'total' => $total_pages, // the total number of pages we have
'current' => $page, // the current page
'end_size' => 1,
'mid_size' => 5,
));
}
?>
      </div>