Skip to content

Instantly share code, notes, and snippets.

View sureshkldh's full-sized avatar
🏠
Working from Office

sureshkldh

🏠
Working from Office
View GitHub Profile
@sureshkldh
sureshkldh / Custom Google Map with search
Created June 21, 2017 12:50
How can add google map point in wordpress with search
@sureshkldh
sureshkldh / wordpress comment box Stying with validation
Last active June 22, 2017 05:14
wordpress comment box Stying with validation
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.13.1/jquery.validate.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
var author = "Please enter in your name";
var mail = "Please enter a valid email address";
var comment = "Message box can't be empty!";
$('#commentform').validate({
$next_link = get_permalink(get_adjacent_post(false,'',false));
$next_label = get_next_post()->post_title;
$prev_link = get_permalink(get_adjacent_post(false,'',true));
$prev_label = get_previous_post()->post_title;
$prev_post = get_previous_post();
$next_post = get_next_post();
$prev_thumbnail = get_the_post_thumbnail($prev_post->ID, 'thumbnail', array('class' => 'prev_img_thumbnail') );
$next_thumbnail = get_the_post_thumbnail($next_post->ID, 'thumbnail', array('class' => 'next_img_thumbnail'));
$blogpageID = get_option( 'page_for_posts' );
@sureshkldh
sureshkldh / Search In wordpress with custom fields
Created July 5, 2017 09:21
Search In wordpress with custom fields
function namespace_add_custom_types( $query ) {
if ( $query->is_search )
$query->set( 'post_type', array( 'post','page','country','location','experience','trip-theme') );
return $query;
}
add_filter( 'pre_get_posts', 'namespace_add_custom_types' );
@sureshkldh
sureshkldh / add filter and function to hide method
Created July 13, 2017 10:28
add filter and function to hide method
function my_hide_shipping_when_free_is_available( $rates, $available_methods ) {
/* echo "<pre>";
print_r($rates);
echo "</pre>"; */
$free = array();
foreach ( $rates as $rate_id => $rate ) {
if ( 'extra_shipping' === $rate->method_id ) {
$free[ $rate_id ] = $rate;
break;
@sureshkldh
sureshkldh / Wordpress Shortcode function with script
Created July 14, 2017 10:10
Wordpress Shortcode function with script
add_shortcode('custom-form-script','customFormFunction');
function customFormFunction($atts){
$atts = shortcode_atts(
array(
'repeat' => '',
), $atts, 'repeatself' );
ob_start();
$contentSortcode = ob_get_contents( );
ob_get_clean( );
@sureshkldh
sureshkldh / Blog Post Shortcode with Load More
Created July 14, 2017 12:57
Get Blog Post Shortcode with Load More
/****************** Blog post load more **************************/
add_shortcode('blog-post-load-more','blogpostloadmore');
function blogpostloadmore(){
ob_start();
$postsPerPage =12;
$args = array(
'post_type' => 'post',
@sureshkldh
sureshkldh / Wordpress Search custom post type
Last active July 17, 2017 06:50
Wordpress Search custom post type
function namespace_add_custom_types( $query ) {
if ( $query->is_search )
// example 'post','page','country','location','experience','trip-theme'
$query->set( 'post_type', array( 'post','page','country','location','experience','trip-theme') );
return $query;
}
add_filter( 'pre_get_posts', 'namespace_add_custom_types' );
@sureshkldh
sureshkldh / How to use other shortcodes inside Contact form 7- forms?
Created July 17, 2017 12:53
How to use other shortcodes inside Contact form 7- forms?
add_shortcode('current-page-title', 'currentpagetitle');
function currentpagetitle() {
$currentpagetitle = '';
$currentpagetitle .= '<input name="currentpagetitle" hidden value="'.get_the_title().'">';
return $currentpagetitle;
}
@sureshkldh
sureshkldh / Html Video Autoplay and Onclick Play
Last active September 14, 2017 08:59
Html Video Autoplay and Onclick Play
<video id="video1" autoplay width="420" poster="http://storesafe.resident360.com/wp-content/uploads/2017/07/Screenshot_1-1.png"><source src="http://storesafe.resident360.com/wp-content/uploads/2017/07/Store-Safe.mp4" type="video/mp4"><source src="mov_bbb.ogg" type="video/ogg">Your browser does not support HTML5 video.</video>
<div class="play_button"<button onclick="playPause()">Play/Pause</button></div>
<script>
function playPause()
{
if (myVideo.paused)
myVideo.play();
else
myVideo.pause();