Skip to content

Instantly share code, notes, and snippets.

@syedanam
Last active April 19, 2019 20:50
Show Gist options
  • Save syedanam/07ae6c55491cb10a34d9ce422d6c6bf5 to your computer and use it in GitHub Desktop.
Save syedanam/07ae6c55491cb10a34d9ce422d6c6bf5 to your computer and use it in GitHub Desktop.
wp_head();
wp_footer();
get_header();/*for include header*/
get_footer();/*for include footer*/
get_template_part("path/file_name"); /*for include other file. here, extension not allow*/
echo site_url(); /*for site URL link up (main domain OR homepage)*/
post_class();
the_permalink();
the_title();
the_author();
the_date();
echo get_the_date(); support date format in parameter
bloginfo(‘name’): self echo
bloginfo(‘description’): self echo
echo get_bloginfo() : not self echo
echo get_the_tag_list() : not self echo
get_template_part( "hero");
while (have_posts()) :
the_post();
echo "Print Post Content";
endwhile;
/*for Single page next & prev Post Link*/
next_post_link();
echo "<br/>";
previous_post_link();
/*for Single page next & prev Post Link End*/
if (comments_open()){
comments_template();
}
if (has_post_thumbnail()){
the_post_thumbnail()
}
if (is_single()) {
the_content();
}else{
the_excerpt();
}
the_posts_pagination( array(
'screen_reader_text' => ' ',
'prev_text' => 'prev',
'next_text' => ' next',
) );
<?php if (comments_open()): ?>
<div class="col-md-10 offset-md-1">
<?php comments_template(); ?>
</div>
<?php endif ?>
function sblog_sidebar(){
register_sidebar(
array(
'name' => __( 'Single Post Sidebar', 'alpha' ),
'id' => 'sidebar-1',
'description' => __( 'Right Sidebar', 'alpha' ),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
)
);
}
add_action( "widgets_init", "sblog_sidebar" );
if (is_active_sidebar("sidebar-1")) {
dynamic_sidebar("sidebar-1");
}
/* =========Pssword Protect Post//forr ==========*/
<?php
if(!post_password_required()){
the_excerpt();
}else{
echo get_the_password_form();
}
//OR
if(!post_password_required()){
echo "The post is Protected";
}else{
the_excerpt();
}
//OR
function alpha_the_excerpt( $excerpt ) {
if ( ! post_password_required() ) {
return $excerpt;
} else {
echo get_the_password_form();
}
}
add_filter( "the_excerpt", "alpha_the_excerpt" );
function alpha_protected_title_change() {
return "%s";
}
add_filter( "protected_title_format", "alpha_protected_title_change" );
/* =========Pssword Protect Post End ==========*/
/*========= For Menu register ===========*/
register_nav_menu( "topmenu", __( "Top Menu", "alpha" ) );
register_nav_menu( "footermenu", __( "Footer Menu", "alpha" ) );
// For menu display
<?php
wp_nav_menu(
array(
'theme_location' => 'topmenu',
'menu_id' => 'topmenucontainer',
'menu_class' => 'list-inline text-center',
)
);
?>
/*========= For Menu register End===========*/
/*========= For Image Zomm featherLight Integrate===========*/
<?php
if (has_post_thumbnail()):
$thumbnail_url = get_the_post_thumbnail_url(null, 'large');
// echo '<a href="'.$thumbnail_url.'" data-featherlight="image">';
printf('<a href="%s" data-featherlight="image">', $thumbnail_url);
the_post_thumbnail( 'large', array('class' => 'img-fluid'));
echo "</a>";
?>
/*========= For Image Zomm featherLight Integrate End===========*/
/*for cumtom-header Support */
add_theme_support('custom-header'); /*for only header image*/
add_theme_support('custom-header', $atom_custom_header_details);
$atom_custom_header_details = array(
"header-text" =>true,
"default-text-color" =>"#222",
);
if (is_front_page()){
if (current_theme_supports("custom-header")){
?>
<style>
.header{
background-image: url(<?php echo header_image();?>);
background-size:cover ;
margin-bottom: 50px;
}
.header h1.heading a, h3.tagline{
color: #<?php echo get_header_textcolor();?>;
<?php
if (!display_header_text()){
echo "display:none;";
}
?>
}
</style>
<?php
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment