WordPress Functions
WordPress Functions
http://www.phpadwordsapi.com/docs/pdf/Quick%20Start.pdf
csv
http://www.eyecon.ro/bootstrap-tabdrop/
http://www.a2zwebhelp.com/export-data-to-csv
http://wordpress.org/plugins/form-lightbox/screenshots/
http://webdesign.myphpmaster.com/form-lightbox-demo/
http://stackoverflow.com/questions/17304420/adding-checkboxes-to-php-post-email-form
<!– call dynamic footer menu with | sign sepration –>
<?php wp_nav_menu(‘menu=Top Menu&after=<span style=”margin-left:5px;”>|</span>’); ?>
<!– How to call first footer widget in template –>
<?php if ( !function_exists(‘dynamic_sidebar’) || !dynamic_sidebar(‘First Footer Widget Area ‘) ) : ?>
<?php endif; ?>
<!– The get_header() tag includes the file header.php –>
<?php get_header(); ?>
<!– Displays the numeric ID of the current post –>
<?php the_ID(); ?>
<!– Displays the URL for the permalink to the post currently being processed –>
<?php the_permalink() ?>
<!–Displays or returns the title of the current post. –>
<?php the_title(); ?>
<!–Display search form using searchform.php Theme file. –>
<?php get_search_form(); ?>
<!– The get_sidebar() tag includes the file sidebar.php –>
<?php get_sidebar(); ?>
<!– The get_footer() tag includes the file footer.php –>
<?php get_footer(); ?>
<!– Displays a list of WordPress Pages as links. –>
<?php wp_list_pages(‘title_li=<h2>Pages</h2>’ ); ?>
<?php wp_list_categories(‘show_count=1&title_li=<h2>Categories</h2>’); ?>
<!– How to get Page in specific area –>
$pageID = 17;
$pageData = get_page($pageID); ?>
<strong><?=$pageData->post_title;?></strong><br/>
<img src=”<? echo bloginfo(‘template_directory’);?>/images/don_young.jpg” alt=”don young” /><?=substr($pageData->post_content,0,130);?>
<span style=”text-align:right”><a href=”<?=$pageData->guid;?>”>Read More : </a></span><br/><br/><br/>
<!– How to get entire post content in specific area à
<?php
$my_id = 7;
$post_id_7 = get_post($my_id);
$title = $post_id_7->post_title;
?>
<— script for search –>
<div>
<div id=”search-form”>
<form method=”get” id=”searchform”>
<input value=”search this site…” name=”s” id=”searchinput” type=”text” onclick=”makeClear(this.id)” onBlur=”makeFill(this.id)” >
<input src=”http://broadview-innovations.com/demo/pressrelease/wp-content/uploads/2011/01/search-btn.png” id=”searchsubmit” type=”image”>
</form>
<script>
function makeClear(val) {
if(document.getElementById(val).value==”search this site…”) {
document.getElementById(val).value = “”;
}
}
function makeFill(val) {
if(document.getElementById(val).value ==””) {
document.getElementById(val).value=”search this site…”;
}
}
</script>
<!— To display more than 1 post in single page –>
<?php wp_reset_query();
query_posts(‘posts_per_page=10&cat=3′);
?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h5 style=”font-size:24px;”><?php the_title(); ?></h5>
<?php the_content(‘<p>Read the rest of this page »</p>’); ?>
<!–reg-area–>
<?php endwhile; endif; ?>
<? wp_reset_query(); ?>
<!– To get subpage content —>
<?php
function homePageSubContents($page_id,$charLimit){
$page_data = get_page($page_id);
$content = $page_data->post_content;
$content = substr($content,0,$charLimit);
echo $content;}
?>
//place this code where you want to call the content (2) is id and 600 is character length
<?php echo homePageSubContents(2,600);?>
<!– How to register widget for wp_menu–>
//register widget for wp_menu
put this code in function.php
register_sidebar(array(
‘name’ => ‘my_mega_menu’,
‘before_widget’ => ‘<div id=”my-mega-menu-widget”>’,
‘after_widget’ => ‘</div>’,
‘before_title’ => ”,
‘after_title’ => ”,
));
//and put this code in header.php
<?php if ( !function_exists(‘dynamic_sidebar’) || !dynamic_sidebar(‘my_mega_menu’) ) : ?><?php endif; ?>
How to remove html text under comment box in wordpress
remove coment_form() and replace it with
<?php comment_form(array(‘comment_notes_after’ => ”)); ?>
<!– How To Create search results paganations –>
Funcation.php
function pagination($pages = ”, $range = 4)
{
$showitems = ($range * 2)+1;
global $paged;
if(empty($paged)) $paged = 1;
if($pages == ”)
{
global $wp_query;
$pages = $wp_query->max_num_pages;
if(!$pages)
{
$pages = 1;
}
}
if(1 != $pages)
{
echo “<div class=\”pagination\”><span>Page “.$paged.” of “.$pages.”</span>”;
if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo “<a href='”.get_pagenum_link(1).”‘>« First</a>”;
if($paged > 1 && $showitems < $pages) echo “<a href='”.get_pagenum_link($paged – 1).”‘>‹ Previous</a>”;
for ($i=1; $i <= $pages; $i++)
{
if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))
{
echo ($paged == $i)? “<span class=\”current\”>”.$i.”</span>”:”<a href='”.get_pagenum_link($i).”‘ class=\”inactive\”>”.$i.”</a>”;
}
}
if ($paged < $pages && $showitems < $pages) echo “<a href=\””.get_pagenum_link($paged + 1).”\”>Next ›</a>”;
if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) echo “<a href='”.get_pagenum_link($pages).”‘>Last »</a>”;
echo “</div>\n”;
}
}
******************
/*Add this code in the loop files where search results show*/
<div id=”nav-below”>
<?php /* Display navigation to next/previous pages when applicable */ ?><?php if (function_exists(“pagination”)) {
pagination($additional_loop->max_num_pages);
} ?></div>