Address To Map Generator

Tags

, ,

Convert Address Text to Google Map using jQuery

css some styling

iframe{ width:100%; height:300px; }

html element

<address class="setmap">Eiffel Tower, Paris, France</address>

some javascript to do the magic

$("address.setmap").each(function(){
        var embed ="<iframe frameborder='0' scrolling='no'  marginheight='0' marginwidth='0'   src='https://maps.google.com/maps?&amp;q="+ encodeURIComponent( $(this).text() ) +"&amp;output=embed'></iframe>";
        $(this).html(embed);
});

To see working result click here

Advertisements

Custom Pagination in wp

Tags

,

Add custom pagination in wordpress

pagination
Continue reading

Get Id By Slug Or Slug By Id WP

Tags

, , , ,

get id by using slug

paste this function in function.php

function get_id_by_slug($page_slug) {
	$page = get_page_by_path($page_slug);
	if ($page) {
		return $page;
	} else {
		return null;
	}
}

example:
get_id_by_slug(‘about-us’);

get slug by id

global $post;
$slug = get_post( $post )->post_name;
echo $slug;

Floating Form Or Menu

Tags

, , , ,

On Page Scroll Floating Form

floatingform

*: for easing effect you need jquery easing
https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js

Detail:

  • data-skipheader: if you want to show form after user scroll header or banner section add class name here
  • data-easing: add easing name here to implement easing effect *

Continue reading

Create Short Code with Multiple attributes

Tags

,

We are going to add short code and create some of its attribute

We want to call post data on different pages with different categories and number of posts to show
also we can set post type

add this code in function.php


// This is a function for shortcode 
function custom_shortcode() {
     return 'hi i am short code function';
}

add_shortcode( 'shortcode', 'custom_shortcode' );

call this by using [shortcode]

Continue reading