I created custom post type and child post , i want to add pagination to child post , I've had a basic attempt at this using $paged = (get_query_var('page')) ? get_query_var('page') : 1; and the paged argument in the WP_Query, but my next_posts_link doesn't work.
my code to show child post
<?php
$args = array(
'post_type' => 'programs',
'posts_per_page' => 60,
'post_parent' => $post->ID,
'order' => 'ASC',
);
$parent = new WP_Query( $args );
if ( $parent->have_posts() ) : ?>
<div class="penci-border-arrow penci-homepage-title penci-magazine-title style-5 pcalign-right pciconp-right pcicon-right" style="border-color: #3E68B0">
<h3 class="inner-arrow" style="background:#3E68B0;border-color: #3E68B0">
الحلقات </h3>
</div>
<ul class="penci-wrapper-data penci-grid">
<?php while ( $parent->have_posts() ) : $parent->the_post();
$featured_img_url = get_the_post_thumbnail_url(get_the_ID());
$episode_number = get_field('episode_number', get_the_ID());
?>
<li class="list-post pclist-layout">
<article id="post-<?php the_ID(); ?>" class="item hentry">
<div class="thumbnail child-thumbnail">
<a class="penci-image-holder penci-lazy" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" style="background-image: url(<?php echo $featured_img_url?>);">
</a>
</div>
<div class="content-list-right content-list-center child-content">
<div class="header-list-style">
<div class="episode-details">
<span class=""> <a class="url fn n" href="<?php the_permalink(); ?>"><?php echo $episode_number ?></a></span>
<span style="margin:0 20px"><a>|</a></span>
<span class="featc-date"><time class="entry-date published" datetime="2021-10-31T13:26:29+00:00">2021-10-31</time>
</span>
<span class='program-viewcn'><?php pvc_stats_update( get_the_ID(), 1 ); ?></span>
</div>
<h2 class="grid-title entry-title">
<?php the_title(); ?>
</h2>
</div>
<div class="item-content entry-content">
<p>
<?php the_excerpt();?>
</p>
</div>
</div>
</article>
</li>
<?php endwhile; ?>
</ul>
<?php endif; ?>
Related
I created a custom post type called Programs, Each program contains episodes
Episodes will be Child Post
Some programs contain more than a hundred episodes, so I want to add pagination to my child posts list
I've had a basic attempt at this using $paged = (get_query_var('page')) ? get_query_var('page') : 1; and the paged argument in the WP_Query, but my next_posts_link doesn't work. my code to show child post
<?php
$args = array(
'post_type' => 'programs',
'posts_per_page' => 60,
'post_parent' => $post->ID,
'order' => 'ASC',
);
$parent = new WP_Query( $args );
if ( $parent->have_posts() ) : ?>
<div class="penci-border-arrow penci-homepage-title penci-magazine-title style-5 pcalign-right pciconp-right pcicon-right" style="border-color: #3E68B0">
<h3 class="inner-arrow" style="background:#3E68B0;border-color: #3E68B0">
الحلقات </h3>
</div>
<ul class="penci-wrapper-data penci-grid">
<?php while ( $parent->have_posts() ) : $parent->the_post();
$featured_img_url = get_the_post_thumbnail_url(get_the_ID());
$episode_number = get_field('episode_number', get_the_ID());
?>
<li class="list-post pclist-layout">
<article id="post-<?php the_ID(); ?>" class="item hentry">
<div class="thumbnail child-thumbnail">
<a class="penci-image-holder penci-lazy" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" style="background-image: url(<?php echo $featured_img_url?>);">
</a>
</div>
<div class="content-list-right content-list-center child-content">
<div class="header-list-style">
<div class="episode-details">
<span class=""> <a class="url fn n" href="<?php the_permalink(); ?>"><?php echo $episode_number ?></a></span>
<span style="margin:0 20px"><a>|</a></span>
<span class="featc-date"><time class="entry-date published" datetime="2021-10-31T13:26:29+00:00">2021-10-31</time>
</span>
<span class='program-viewcn'><?php pvc_stats_update( get_the_ID(), 1 ); ?></span>
</div>
<h2 class="grid-title entry-title">
<?php the_title(); ?>
</h2>
</div>
<div class="item-content entry-content">
<p>
<?php the_excerpt();?>
</p>
</div>
</div>
</article>
</li>
<?php endwhile; ?>
</ul>
<?php endif; ?>
I have a nested wordpress loop to generate a two columns layout with the content of two different categories. What is happening is that the content is duplicated, but all the posts are displayed. I've tried using wp_reset_query() and wp_reset_postdata() but with no success. Is there a fix?
<?php
$main = new WP_Query(
array(
'post_type' => 'post',
'category_name' => 'Notizie varie',
'posts_per_page' => 6
)
);
//var_dump( $main );
if( $main->have_posts() ):
while( $main->have_posts() ): $main->the_post();
?>
<div class="col-8 p-4 mt-3">
<img class="card-img-top" src="<?php echo the_post_thumbnail_url(); ?>">
<h4 class="card-title"><?php the_title(); ?></h4>
<p class="card-text"><?php echo get_the_excerpt( get_the_ID() ); ?></p>
<small class="text-muted"><?php echo get_the_date( get_the_ID() ) ?></small>
<small class="text-muted"><?php the_author() ?></small>
<a class="" href="<?php the_permalink(); ?>"><?php _e('Leggi', ''); ?></a>
</div>
<?php
$side = new WP_Query(
array(
'post_type' => 'post',
'category_name' => 'Secondo piano',
'posts_per_page' => 6
)
);
if( $side->have_posts() ):
while( $side->have_posts() ): $side->the_post();
?>
<div class="col-4 p-4 mt-3">
<img class="card-img-top" src="<?php echo the_post_thumbnail_url(); ?>">
<h4 class="card-title"><?php the_title(); ?></h4>
<p class="card-text"><?php echo get_the_excerpt( get_the_ID() ); ?></p>
<small class="text-muted"><?php echo get_the_date( get_the_ID() ) ?></small>
<small class="text-muted"><?php the_author(); ?></small>
<a class="" href="<?php the_permalink(); ?>"><?php _e('Leggi', ''); ?></a>
</div>
<?php
endwhile;
wp_reset_query();
endif;
endwhile;
endif;
wp_reset_postdata();
I created a custom template for the homepage. I want to call the content after the portfolio, but it doesn't work. I can't find where I made a mistake. It works when I call above the portfolio. Anyone know how I could accomplish this?
<section id="portfolio" class="portfolio atop">
<!-- Portfolio Filter -->
<div class="portfolio_filter">
<ul>
<?php $categories = get_categories("taxonomy=categories");
foreach ($categories as $category) : echo '<li><a data-filter=".' . $category->slug . '" href="#">' . $category->name . '</a></li>';
endforeach; ?>
<li><a class="select-cat" data-filter="*" href="#">All Works</a></li>
</ul>
</div>
<div class="container">
<div class="row masonry clearfix">
<!-- a work -->
<?php $args = array(
'post_type' => 'portfolio',
'orderby' => 'date',
'order' => 'ASC',
'posts_per_page' => 100,
);
$wp_query = new WP_Query($args);
while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
<?php $portcolor = get_field('text_color_of_featured_image'); ?>
<?php $taxonomy = 'categories';
$terms = get_the_terms($post->ID, 'categories'); ?>
<?php foreach ($terms as $term) ?>
<a href="<?php echo esc_html(get_permalink()); ?>" class="col-xl-4 col-md-6 grid-item <?php echo esc_html($term->slug); ?> <?php echo esc_attr($portcolor); ?>" data-type="ajax-load">
<figure class="portfolio-item <?php $portfolio_type = get_field('portfolio_type');
echo esc_attr($portfolio_type); ?>">
<div class="image">
<?php $featured_image = get_field('portfolio_featured_image'); ?>
<img src="<?php echo esc_url($featured_image['url']); ?>" alt="<?php echo esc_attr($featured_image['alt']); ?>" />
</div>
<figcaption>
<span><?php echo esc_html($term->name); ?></span>
<h3 class="title"><?php the_title(); ?></h3>
</figcaption>
</figure>
</a>
<?php endwhile; ?>
</div>
</div> <!-- container end -->
</section>
<?php the_content(); ?>
You need to reset the global post after your custom WP_Query with wp_reset_postdata(). See below:
<section id="portfolio" class="portfolio atop">
<!-- Portfolio Filter -->
<div class="portfolio_filter">
<ul>
<?php $categories = get_categories("taxonomy=categories");
foreach ($categories as $category) : echo '<li><a data-filter=".' . $category->slug . '" href="#">' . $category->name . '</a></li>';
endforeach; ?>
<li><a class="select-cat" data-filter="*" href="#">All Works</a></li>
</ul>
</div>
<div class="container">
<div class="row masonry clearfix">
<!-- a work -->
<?php $args = array(
'post_type' => 'portfolio',
'orderby' => 'date',
'order' => 'ASC',
'posts_per_page' => 100,
);
$wp_query = new WP_Query($args);
while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
<?php $portcolor = get_field('text_color_of_featured_image'); ?>
<?php $taxonomy = 'categories';
$terms = get_the_terms($post->ID, 'categories'); ?>
<?php foreach ($terms as $term) ?>
<a href="<?php echo esc_html(get_permalink()); ?>" class="col-xl-4 col-md-6 grid-item <?php echo esc_html($term->slug); ?> <?php echo esc_attr($portcolor); ?>" data-type="ajax-load">
<figure class="portfolio-item <?php $portfolio_type = get_field('portfolio_type');
echo esc_attr($portfolio_type); ?>">
<div class="image">
<?php $featured_image = get_field('portfolio_featured_image'); ?>
<img src="<?php echo esc_url($featured_image['url']); ?>" alt="<?php echo esc_attr($featured_image['alt']); ?>" />
</div>
<figcaption>
<span><?php echo esc_html($term->name); ?></span>
<h3 class="title"><?php the_title(); ?></h3>
</figcaption>
</figure>
</a>
<?php endwhile;
// reset global post data
wp_reset_postdata();?>
</div>
</div> <!-- container end -->
</section>
<?php the_content(); ?>
I'm having an issue trying to get pagination to work on the homepage of a site I'm working on.
Here is the code I'm using, simplified of course:
How to do pagination for this?
<?php $args = array('cat' => '3, 7, 10, 12', 'posts_per_page'=> 3); ?>
<?php query_posts($args); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<article class="col-md-12">
<a href="<?php the_permalink(); ?>" >
<div class="image"><img class="img-responsive" src="<?php echo the_post_thumbnail_url( 'medium' ); ?>"></div></a>
<div class="entry entry-table">
<div class="title">
<?php the_title(); ?></h3>
<span class="cateogry<?php echo get_the_category( $id )[0]->cat_ID; ?>"><?php echo get_the_category( $id )[0]->name; ?></span>
<p><?php echo get_excerpt(228, 'content'); ?>
<a class="linkmore" href="<?php the_permalink() ?>">Czytaj dalej ...</a>
</p>
</div>
</div>
</article>
<?php endwhile; endif; ?>
<?php $args = array('cat' => '3, 7, 10, 12', 'posts_per_page'=> 3); ?>
<?php query_posts($args); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<article class="col-md-12">
<a href="<?php the_permalink(); ?>" >
<div class="image"><img class="img-responsive" src="<?php echo the_post_thumbnail_url( 'medium' ); ?>"></div></a>
<div class="entry entry-table">
<div class="title">
<?php the_title(); ?></h3>
<span class="cateogry<?php echo get_the_category( $id )[0]->cat_ID; ?>"><?php echo get_the_category( $id )[0]->name; ?></span>
<p><?php echo get_excerpt(228, 'content'); ?>
<a class="linkmore" href="<?php the_permalink() ?>">Czytaj dalej ...</a>
</p>
</div>
</div>
</article>
<?php endwhile; ?>
<div class="navigation">
<div class="alignleft"><?php previous_posts_link('« Previous') ?></div>
<div class="alignright"><?php next_posts_link('More »') ?></div>
</div>
<?php endif; ?>
First of all, you must setup properly your query:
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$args = array('cat' => '3, 7, 10, 12', 'posts_per_page'=> 3, 'paged' => $paged);
And second, you need to add pagination links out of the loop
<div class="navigation">
<div class="alignleft"><?php previous_posts_link('« Previous') ?></div>
<div class="alignright"><?php next_posts_link('More »') ?></div>
</div>
Whole code can looks like this:
<?php
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$args = array('cat' => '3, 7, 10, 12', 'posts_per_page'=> 3, 'paged' => $paged);
?>
<?php query_posts($args); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<article class="col-md-12">
<a href="<?php the_permalink(); ?>" >
<div class="image"><img class="img-responsive" src="<?php echo the_post_thumbnail_url( 'medium' ); ?>"></div></a>
<div class="entry entry-table">
<div class="title">
<?php the_title(); ?></h3>
<span class="cateogry<?php echo get_the_category( $id )[0]->cat_ID; ?>"><?php echo get_the_category( $id )[0]->name; ?></span>
<p><?php echo get_excerpt(228, 'content'); ?>
<a class="linkmore" href="<?php the_permalink() ?>">Czytaj dalej ...</a>
</p>
</div>
</div>
</article>
<?php endwhile; ?>
<div class="navigation">
<div class="alignleft"><?php previous_posts_link('« Previous') ?></div>
<div class="alignright"><?php next_posts_link('More »') ?></div>
</div>
<?php endif; ?>
Problem has been solved:
<?php
global $paged, $wp_query, $wp;
$args1 = array('cat' => '3, 7, 10, 12');
$args = wp_parse_args($wp->matched_query);
if ( !empty ( $args['paged'] ) && 0 == $paged ) {
$wp_query->set('paged', $args['paged']);
$paged = $args['paged'];
}
$temp = $wp_query;
$wp_query= null;
$wp_query = new WP_Query();
$wp_query->query('paged='.$paged.'&showposts=3&cat=3,7,10,12');
?>
<?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
<article class="col-md-12">
<a href="<?php the_permalink(); ?>" >
<div class="image"><img class="img-responsive" src="<?php echo the_post_thumbnail_url( 'medium' ); ?>"></div></a>
<div class="entry entry-table">
<div class="title">
<?php the_title(); ?></h3>
<span class="cateogry<?php echo get_the_category( $id )[0]->cat_ID; ?>"><?php echo get_the_category( $id )[0]->name; ?></span>
<p><?php echo get_excerpt(228, 'content'); ?>
<a class="linkmore" href="<?php the_permalink() ?>">Czytaj dalej ...</a>
</p>
</div>
</div>
</article>
<?php endwhile; ?>
<?php wp_pagenavi(); ?>
<?php $wp_query = null; $wp_query = $temp;?>
i'm looking a way to display the-excerpt of post when Sharing on facebook, here is my code, but it doenst show the_exceprt of the post . ..
<a <a target="_blank" href="http://www.facebook.com/sharer.php?u=<?php the_permalink();?>&t= <?php the_excerpt(); ?><?php the_title(); ?>"<i class="fa fa-facebook"></i></a>
If it can help, this is the section with the all code ( it's a grid system, each box of the "grid" has different content)
<div data-ratio="1" class="grid__item grid__item_inline one-half cell tabbed" style="background-color: #ccffff" >
<h1>Press room</h1>
<?php
$query = new WP_Query( array( 'post_type' => 'coverage', 'posts_per_page' => 1 ) );
if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post();
?>
<time class="timestamp"><?php the_date(); ?></time>
<h2 class="h4"><?php the_title(); ?></h2>
<div class="palm--hidden"><?php the_excerpt(); ?><p></p></div>
Read More
<div class="social-icons-2">
<ul class="hl">
<li>Share:</li>
<li><a <a target="_blank" href="http://www.facebook.com/sharer.php?u=<?php the_permalink();?>&t= <?php the_excerpt(); ?><?php the_title(); ?>"<i class="fa fa-facebook"></i></a></li>
<li><i class="fa fa-twitter"></i></li>
<li><i class="fa fa-pinterest"></i></li>
</ul>
</div>
<?php
endwhile; endif;
?>
</div>
</article>
</div>
ANother question related with this facebook share, at the moment it's sharing the logo of the website . . any possiblity to show insterad the picture attach of the post ?
Thank you so much for all your time in advance
EDIT: I put here all the code of the page in case it heelps . ..
<?php get_header(); ?>
<div id="slider-header">
<div class="container">
<div class="row">
<div class="col-sm-4 slider-header-left">
WHAT WE DO
</div>
<div class="col-sm-8 slider-header-right">
texttt
</div>
</div>
</div>
</div>
<div id="main" class="site-main" role="main">
<div id="home-slider">
<div class="container">
<div class="row home-content-slider">
<?php
$services = get_page_by_path('services');
if($services) $parent = $services->ID;
$the_query = new WP_Query( array( 'post_type' => 'page', 'post_per_page' => 5, 'post_parent' => $parent, 'order' => 'ASC' ) );
$service_titles = array();
$service_images = array();
if ( $the_query->have_posts() ) {
$i = 1;
while ( $the_query->have_posts() ) {
$the_query->the_post();
$service_titles[] = '<li id="nav-fragment-'. $i .'" class=""><a href="#fragment-'. $i .'" ><span>'. get_the_title() .'</span></a></li>';
$post_thumbnail_id = get_post_thumbnail_id( $post->ID );
$image = wp_get_attachment_image_src( $post_thumbnail_id, 'full' );
$service_images[] = '<div id="fragment-'. $i .'" class="ui-tabs-panel ui-tabs-hide"><img src="'. $image[0] .'" title="" /><div class="overlay-description">'. get_field('slider_text') .'</div></div>';
$i++;
}
}
wp_reset_postdata();
?>
<div class="col-sm-4 home-slider-left">
<div class="row">
<ul>
<?php echo implode( "\n", $service_titles ); ?>
</ul>
</div>
</div>
<div class="col-sm-8 home-slider-right">
<div class="row">
<?php echo implode( "\n", $service_images ); ?>
</div>
</div>
</div>
</div>
</div>
<div class="container">
<div id="grid_container">
<div class="row">
<div class="col-sm-6 news-post" style="background-color: #ccfff" data-key="newsItem">
<article class="grid row">
<div data-ratio="1" class="grid__item grid__item_inline one-half">
<?php
echo '<div class="flexslider">';
echo '<ul class="slides">';
$query = new WP_Query( array( 'post_type' => 'coverage', 'posts_per_page' => 9 ) );
if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post();
$post_thumbnail_id = get_post_thumbnail_id( $post->ID );
$image = wp_get_attachment_image_src( $post_thumbnail_id, 'homepage-thumb' );
if($image) echo '<li><img class="img-responsive" src="'. $image[0] .'" alt="" /></li>';
endwhile; endif;
echo '</ul>';
echo '</div>';
?>
<?php wp_reset_postdata(); ?>
</div>
<div data-ratio="1" class="grid__item grid__item_inline one-half cell tabbed" style="background-color: #ccffff" >
<h1>Press room</h1>
<?php
$query = new WP_Query( array( 'post_type' => 'coverage', 'posts_per_page' => 1 ) );
if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post();
?>
<time class="timestamp"><?php the_date(); ?></time>
<h2 class="h4"><?php the_title(); ?></h2>
<div class="palm--hidden"><?php the_excerpt(); ?><p></p></div>
Read More
<div class="social-icons-2">
<ul class="hl">
<li>Share:</li>
<li><a <a target="_blank" href="http://www.facebook.com/sharer.php?u=<?php the_permalink();?>&t= <?php the_excerpt(); ?><?php the_title(); ?>"<i class="fa fa-facebook"></i></a></li>
<li><i class="fa fa-twitter"></i></li>
<li><i class="fa fa-pinterest"></i></li>
</ul>
</div>
<?php
endwhile; endif;
?>
</div>
</article>
</div>
<div class="col-sm-6 news-post" style="background-color: #ffcccc" data-key="newsItem">
<article class="grid row">
<?php
$query = new WP_Query( array( 'post_type' => 'news', 'posts_per_page' => 1 ) );
if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post();
?>
<div data-ratio="1" class="grid__item grid__item_inline one-half">
<figure data-ratio="1">
<?php
$post_thumbnail_id = get_post_thumbnail_id( $post->ID );
$image = wp_get_attachment_image_src( $post_thumbnail_id, 'homepage-thumb' );
?>
<img width="640" height="640" class="img-responsive" src="<?php echo $image[0]; ?>" alt="" />
</figure>
</div>
<div data-ratio="1" class="grid__item grid__item_inline one-half cell tabbed" style="background-color: #ffcccc" >
<h1>NEWS</h1>
<time class="timestamp"><?php the_date(); ?></time>
<h2 class="h4"><?php the_title(); ?></h2>
<div class="palm--hidden"><p><?php the_excerpt(); ?></p></div>
Read More
<div class="social-icons-2">
<ul class="hl">
<li>Share:</li>
<li><i class="fa fa-facebook"></i></li>
<li><i class="fa fa-twitter"></i></li>
<li><i class="fa fa-pinterest"></i></li>
</ul>
</div>
</div>
<?php
endwhile; endif;
?>
</article>
</div>
<div class="col-sm-6 news-post" style="background-color: #ffffff" data-key="newsItem">
<article class="grid row">
<div data-ratio="1" class="grid__item one-half">
<figure data-ratio="1">
<!-- SnapWidget -->
<!-- SnapWidget -->
<!-- SnapWidget -->
<iframe src="http://snapwidget.com/sc/?u=aW5fc3BhY2VzfGlufDI4MHwzfDN8fG5vfDV8bm9uZXx8eWVzfG5v&ve=020914" title="Instagram Widget" class="snapwidget-widget" allowTransparency="true" frameborder="0" scrolling="no" style="border:none; overflow:hidden; width:295px; height:295px"></iframe>
</figure>
</div>
<div data-ratio="1" class="grid__item grid__item_inline one-half cell tabbed twitter-widget" style="background-color: #ffffff" >
<a class="twitter-timeline" data-dnt="true" href="sm2" data-widget-id="501148708545638400">Tweets by #In__Spaces</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>
</article>
</div>
<div class="post-1410 post type-post status-publish format-standard has-post-thumbnail hentry category-news col-sm-6 news-post" style="background-color: #ffffcc" data-key="newsItem">
<article class="grid row">
<?php
$query = new WP_Query( array( 'post_type' => 'event', 'posts_per_page' => 1 ) );
if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post();
?>
<div data-ratio="1" class="grid__item grid__item_inline one-half">
<figure data-ratio="1">
<?php
$post_thumbnail_id = get_post_thumbnail_id( $post->ID );
$image = wp_get_attachment_image_src( $post_thumbnail_id, 'homepage-thumb' );
?>
<img width="640" height="640" class="img-responsive" src="<?php echo $image[0]; ?>" alt="" />
</figure>
</div>
<div data-ratio="1" class="grid__item grid__item_inline one-half cell tabbed" style="background-color: #ffffcc" >
<h1>EVENTS</h1>
<time class="timestamp">August 22, 2014</time>
<h2 class="h4"><?php the_title(); ?></h2>
<div class="palm--hidden"><p><?php the_excerpt(); ?></p></div>
Read More
<div class="social-icons-2">
<ul class="hl">
<li>Share:</li>
<li><i class="fa fa-facebook"></i></li>
<li><i class="fa fa-twitter"></i></li>
<li><i class="fa fa-pinterest"></i></li>
</ul>
</div>
</div>
<?php
endwhile; endif;
?>
</article>
</div>
<div class="big-link">
</div>
</div>
</div>
</div>
</div><!-- #main -->
<?php get_footer(); ?>
You need to use Open Graph Tags in the <head> section of your page.
Here's an example:
<meta property="og:title" content="<?=the_title();?>" />
<meta property="og:description" content="<?=the_excerpt();?>" />
<meta property="og:type" content="blog" />
<meta property="og:url" content="<?=the_permalink();?>" />
<meta property="og:site_name" content="YOUR_SITE_NAME" />