Last active
May 26, 2017 21:47
-
-
Save rubel306/c6385e3f7036d19675e13e79d60ae625 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//post dynamic | |
<?php while(have_posts()): the_post(); ?> | |
<?php the_title(); ?> --fot post title | |
<?php the_author(); ?> -- for post author | |
<?php the_permalink(); ?> -- for post permalink | |
<?php the_time('F d, Y'); ?> | |
<?php the_contetn();?> | |
<?php comments_popup_link(); ?> | |
<?php endwhile; ?> | |
//services block dynamic and wp-query | |
<?php | |
$servicesblock= new WP_Query(array( | |
'post_type'=>'zboomservices', | |
'posts_per_page' =>4 | |
)); | |
?> | |
<?php while($servicesblock->have_posts()): $servicesblock->the_post(); ?> | |
<?php the_title(); ?> --fot post title | |
<?php the_author(); ?> -- for post author | |
<?php the_permalink(); ?> -- for post permalink | |
<?php the_time('F d, Y'); ?> | |
<?php read_more(10);?> | |
<?php comments_popup_link(); ?> | |
<?php endwhile; ?> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1.(wp bassic code) | |
<?php bloginfo('title'); ?> -- For blog title. | |
<?php bloginfo('description'); ?> -- For Blog Description | |
<?php bloginfo('charset'); ?> -- For UTF-8 Encoding for pages and feeds | |
<?php bloginfo('stylesheet_url'); ?> --Displays the primary CSS (usually style.css) | |
<?php language_attributes(); ?> -- support language from html tag in html: lang="en" . | |
<?php echo esc_url(get_template_directory_uri()); ?> -- for call theme directory to support images, css, js file | |
before end header write: <?php wp_head();?> | |
before end body tag write: <?php wp_footer(); ?> | |
2.(functions.php file) | |
create theme default function like : | |
a. function themename_default_function(){ | |
add_theme_support('title-tag'); -- find dynamicly title and description | |
add_theme_support('post-thumbnails'); | |
add_theme_support('custom-background'); | |
b. load text domain: -- Loads the theme's translated strings. | |
load_theme_textdomain('zboom', get_template_directory_uri()./'language'); | |
// register nav menu | |
register_nav_menu('main-menu', __('Main Menu', 'zboom')); | |
//register read more functon | |
function read_mpre($limit){ | |
$post_content= explode (' ', get_the_contetn()); | |
$less_contetn= array_slice($post_content, 0, $limit); | |
echo implode(" ",$less_contetn); | |
} | |
// regsiter slider | |
register_post_type('zboomslider', array( | |
'labels'=>array( | |
'name'=>'sliders', | |
'add_new_item'=>'Add New Slider' | |
), | |
'public'=>true, | |
'support'=>array('title','editor','thumnail') | |
)); | |
//register services block | |
register_post_type('zboomservices',array( | |
'labels'=>array( | |
'name'=>'services block', | |
'add_new_item'=>__('Add new services', 'zboom'), | |
), | |
'public'=>true, | |
'supports'=>array('title','editor','thumnail') | |
)); | |
} | |
add_action('after_setup_theme)', 'themename_default_function'); | |
// register sidebar widgets | |
function zboom_right_sidebar(){ | |
register_siderbar(array( | |
'name'=>__('Right Sidebar', 'zboom'), | |
'description'=>__('Add your right side bar widgets', 'zboom'), | |
'id'=>'right-sidebar', | |
'before_widgets'=>'<div class="box">', | |
'after_widgets'=>'</div></div>', | |
'before_title'=>'<div class="heading"><h2>', | |
'after_title'=>'</h2></div><div class="content">' | |
)); | |
} | |
add_action('widgets_init', 'zboom_right_sidebar'); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment