Skip to content

Instantly share code, notes, and snippets.

View rajendra89's full-sized avatar

Rajendra Rijal rajendra89

View GitHub Profile
<div class="modal fade" id="custdetail" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
<h4 class="modal-title" id="myModalLabel">More About Joe</h4>
</div>
<div class="modal-body">
@rajendra89
rajendra89 / my-first-custom-element
Created August 9, 2017 07:17
replace your my-first-custom-element.php with code below.
replace your my-first-custom-element.php with code below.
@rajendra89
rajendra89 / custom-field.php
Created June 1, 2017 05:52
WordPress Custom Fields
<?php
$meta_value=get_post_meta($post->ID,'views',true);
//get_post_meta( int $post_id, string $key = '', bool $single = false ))
if(!empty($meta_value)){
echo $meta_value;
}
?>
@rajendra89
rajendra89 / functions.php
Created May 27, 2017 11:19
Change the Excerpt Length
function excerpt_length_example( $words ) {
return 15;
}
add_filter( 'excerpt_length', 'excerpt_length_example' );
@rajendra89
rajendra89 / display.php
Last active May 26, 2017 06:47
accessing page content through loop
siteURL/wp-admin/post.php?post=37&action=edit
Here, 37 is page ID.
<?php $the_query = new WP_Query( 'page_id=37' );
while ($the_query -> have_posts()) : $the_query -> the_post(); ?>
//Content Area.
@rajendra89
rajendra89 / functions.php
Created May 15, 2017 06:27
Change the Excerpt Length
function excerpt_length_example( $words ) {
return 15;
}
add_filter( 'excerpt_length', 'excerpt_length_example' );
<?php
/*
Template Name: idc_projects
*/
?>
<?php get_header(); ?>
<!-- Get header content -->
<!-- banner-image -->
<div class="banner-image" style="background: linear-gradient(rgba(0,0,0,0.6),rgba(0,0,0,0.6)), url('<?php echo get_field('idc_projects_img')['url']; ?>');">
<div class="container">
$args_blog=array(
'post_type'=>'blog',
'posts_per_page'=>'5', //for getting only 5 posts
'order'=>'ASC', //last input first output
'orderby'=>'menu_order', //according to field
if you want to disply all post then replace 5 by -1
$args_blog=array(
'post_type'=>'blog',
'posts_per_page'=>'5', //for getting only 5 posts
'order'=>'ASC', //last input first output
'orderby'=>'menu_order', //according to field
$args_blog=array(
'post_type'=>'blog',
'posts_per_page'=>'5', //for getting all posts
'order'=>'ASC', //last input first output
'orderby'=>'menu_order', //according to field