Skip to main content

Posts

Showing posts from November, 2016

Displaying page by calling page number

<?php $args = array(     'sort_order' => 'asc',     'sort_column' => 'post_title',     'hierarchical' => 1,     'exclude' => '',     'include' => '',     'meta_key' => '_thumbnail_id',     'meta_value' => '',     'authors' => '',     'child_of' => 0,     'parent' => 0,     'exclude_tree' => '',     'number' => '',     'offset' => 0,     'post_type' => 'page',     'post_status' => 'publish' ); $mypages = get_pages($args);  //$mypages = get_pages( array( 'child_of' => $post->ID, 'sort_column' => 'post_date', 'sort_order' => 'desc' ) );  foreach( $mypages as $page ) {   $content = $page->post_content;   if ( ! $content ) // Check for empty page    continue;   $content = a...

Displaying all pages in dropdown list

Displaying pages in dropdown list   <select name="page-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'> <option value=""> <?php echo esc_attr( __( 'Select page' ) ); ?></option> <?php $pages = get_pages(); foreach ( $pages as $page ) { $option = '<option value="' . get_page_link( $page->ID ) . '">'; $option .= $page->post_title; $option .= '</option>'; echo $option; } ?> </select>  

Displaying Child pages of the current page

<?php $mypages = get_pages( array( 'child_of' => $post->ID, 'sort_column' => 'post_date', 'sort_order' => 'desc' ) ); foreach( $mypages as $page ) { $content = $page->post_content; if ( ! $content ) // Check for empty page continue; $content = apply_filters( 'the_content', $content ); ?> <h2><a href="<?php echo get_page_link( $page->ID ); ?>"><?php echo $page->post_title; ?></a></h2> <div class="entry"><?php echo $content; ?></div> <?php } ?>

get posts wordpress

    <ul> <?php $the_query = new WP_Query( 'posts_per_page=1' ); ?> <?php //$the_query = new WP_Query( 'showposts=10&offset=1' ); ?> <?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?> <div> <div style="width:104%;"><a href="<?php the_permalink() ?>"><?php the_post_thumbnail();?></a></div><br> <li><div style="font-size: 23px; text-align: center;text-transform: none;"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></div></li> <li><div style="margin-bottom: 92px;text-align: center;"> <?php         //$trimtitle = get_the_title();     style="border:1px solid #dedede;margin-bottom: 35px;width:105%;"         //$shorttitle = wp_trim_words( $trimtitle, $num_words = 4, $more = '… ' );         //ech...

get grid posts in wordpress

<style> .gridcontainer h2 a{color: #333; font-size: 13px;} .gridcontainer .griditemleft{float: left; width: 150px; margin: 0 30px 20px 0;} .gridcontainer .griditemright{float: left; width: 150px;} .gridcontainer .postimage{margin: 0 0 5px 0;} .gridcontainer .postimage-title {text-align: center;} </style> <div class="gridcontainer" style="margin-top: -130px;"> <?php // Grid Parameters $counter = 1; // Start the counter $grids = 2; // Grids per row $titlelength = 30; // Length of the post titles shown below the thumbnails // The Query $args=array (     'post_type' => 'post',     'offset'=> 1 ,     'posts_per_page' => 10     ); $the_query = new WP_Query($args); // The Loop while ( $the_query->have_posts() ) :     $the_query->the_post(); // Show all columns except the right hand side column if($counter != $grids) : ?> <div class="griditemleft" ...

get title content in wordpress

<?php        $trimtitle = get_the_title();            $shorttitle = wp_trim_words( $trimtitle, $num_words = 4, $more = '… ' );         echo '<h6 class="info-title">' . '<a href="' . get_permalink() . '">' . $shorttitle . '</a></h6>';         $trimexcerpt = get_the_excerpt();         $shortexcerpt = wp_trim_words( $trimexcerpt, $num_words = 50, $more = '… ' );         echo '<p>' . $shortexcerpt . '</p>';         ?> <a class="more-link button" href="<?php the_permalink() ?>" style="margin: 23px 0px -24px;">Read More</a>

css 100% responsiveness

  <style> .abc{ normal view } @media screen and (min-width: 767px) {    .abc{ mobile portrait view    } } @media screen and (min-width: 1920px) {    .abc {     above 20 inch displays    }    }     @media only screen   and (min-device-width: 768px)   and (max-device-width: 1024px)   and (-webkit-min-device-pixel-ratio: 1) {     .abc { tablet view }    }     </style> iPad Media Queries (All generations - including iPad mini) iPad in portrait & landscape @media only screen and ( min - device - width : 768px ) and ( max - device - width : 1024px ) { /* STYLES GO HERE */ } iPad in landscape @media only screen and ( min - device - width : 768px ) and ( max - device - width : 1024px ) and ( orientation : landscape ) { /* STYLES GO HERE */ } iPad in portrait @media o...