I've created a custom blog page to go along with my WordPress website. This page is made to show only 1 category form the blog feed. I've added the "AddThis" plugin share buttons and manually coded it in the theme.
The problem is the buttons will not show. I've attempted other share plugins into the page but they will not show either. Now, the buttons do work as they show up on other blog pages and the articles themselves.
Here is the website of the page and the code, am I missing something or do I need to change a line of code?
Page with non-working share buttons
Page with working share buttons
<?php /* Template Name: Page - Online Reviews */ ?>
<div class="main_container">
<div class="page_container">
<h2 style="border-bottom: solid thin #000; line-height: 50px; margin-bottom: 50px;"><?php the_title(); ?></h2>
<?php
$temp = $wp_query;
$wp_query = NULL;
$wp_query = new WP_Query();
$wp_query->query('cat=4&paged='.$paged); $tb_counter = 1;
while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
<div <?php if(function_exists('post_class')) : ?><?php post_class(); ?><?php else : ?>class="post post-<?php the_ID(); ?>"<?php endif; ?>>
<h3><?php the_title(); ?></h3>
<?php the_post_thumbnail(); ?>
<?php the_content(); ?>
<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style ">
<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
<a class="addthis_button_tweet"></a>
<a class="addthis_button_google_plusone" g:plusone:size="medium"></a>
<a class="addthis_button_linkedin_counter"></a>
<a class="addthis_counter addthis_pill_style"></a>
</div>
<script type="text/javascript">var addthis_config = {"data_track_addressbar":true};</script>
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-4dd51ec729a7fec7"></script>
<!-- AddThis Button END -->
<footer class="entry-meta">
<?php the_time(__('M d, Y', 'easycarebath')); ?> | <?php _e('Categories:','easycarebath'); if (the_category(', ')) the_category(); ?> <?php if (get_the_tags()) the_tags(__('| Tags: ','easycarebath')); ?> | <?php comments_popup_link(__('Leave A Comment »', 'easycarebath'), __('1 Comment »', 'easycarebath'),__ngettext('% Comment »', '% Comments »',get_comments_number (),'easycarebath')); ?> <?php edit_post_link(__('Edit','easycarebath'), '| ', ''); ?>
</footer>
<?php $tb_counter++; endwhile; ?>
<nav id="nav-below" class="navigation" role="navigation">
<div class="nav-previous alignright"><?php next_posts_link(__('« Older Entries','easycarebath')); ?></div>
<div class="nav-next alignleft"><?php previous_posts_link(__('Newer Entries »','easycarebath')); ?></div>
</nav>
<?php $wp_query = NULL; $wp_query = $temp;?>
</div>
<?php get_sidebar(); ?>
</div>
I found the problem. It's not the code that was the issue, it was Transmit that was not saving the code properly. After a restart of the program, I was able to save the code and the share buttons were able to show up.
Thanks everyone for your attempt, it was a software problem. :)
Related
I'm having a major issue with trying to render Wordpress pagination. I'm not that good with PHP and I've tried just about every solution I can Google. Some of the queries "work" in that they display a set of page numbers, but they break when I add more variables.
For example, when I told it to display ALL pages, it did just that, but then I couldn't limit it using mid_size or any of that. So it was kind of "display all" (which I don't want), or nothing at all. I'm not sure what's breaking, so any pushes in the right direction would be excellent.
My objective: Create a list of numbered page links that truncate properly so it looks like:
[ 1 2 3 ... 97 98 99 ]
Thanks to anyone who can help me out. I'm running Wordpress 4.9.7.
My code looks like this:
<!-- post loop -->
<div class="auto cell">
<?php
// the query
$wpb_all_query = new WP_Query(array('post_type'=>'review', 'posts_per_page' => 3, 'orderby'=>'name', 'order'=>'ASC')); ?>
<?php if ( $wpb_all_query->have_posts() ) : ?>
<!-- start of main news loop -->
<?php while ( $wpb_all_query->have_posts() ) : $wpb_all_query->the_post(); ?>
<div class="grid-x grid-margin-x">
<div class="cell large-2 small-2">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="thumbnail">
<?php if ( has_post_thumbnail() ) {
the_post_thumbnail();
} else { ?>
<img src="<?php bloginfo('template_directory'); ?>/img/default_thumb.png" alt="<?php the_title(); ?>" />
<?php } ?></a>
</div>
<div class="cell large-10 small-10">
<h2><?php the_title(); ?></h2>
<span class="post-meta"> By <?php the_author_posts_link(); ?> · <?php the_time('F jS, Y, g:i A'); ?> <?php edit_post_link(__('Edit This'), ''); ?></span>
<ul class="list-meta">
<li>Developer: <?php echo(types_render_field( 'game-developer' )); ?></li>
<li>Genre: <?php echo(types_render_field( 'game-genre' )); ?></li>
</ul>
</div>
<div class="post-categories cell"><?php the_category(', '); ?></div>
</div>
<?php endwhile; ?>
<!-- start of pagination -->
<div class="row">
<?php if (function_exists("pagination")) {
pagination($custom_query->max_num_pages);
} ?>
</div>
<!-- end of pagination -->
<!-- end of main news loop -->
I use this plugin for my pagination. It gives you a settings screen in the back end where you can set up how it's numbered. Hope it helps!
I have a website that on the homepage contains images/sliders standard page content etc. Once the page loads, it scrolls nice and smoothly. But I have a section about half way down that queries and displays WordPress Posts (see code below). When I view it in Google Chrome, while scrolling in that section, the website becomes laggy/skips and doesn't smoothy scroll like the rest of the home page.
Is there a way or something to include that will have WordPress query the posts faster or better or is there another reason as to why scrolling in that section becomes laggy?
<?php
$temp = $wp_query;
$wp_query= null;
$wp_query = new WP_Query();
$wp_query->query('no_found_rows=true&showposts=6&post_status=publish' . '&paged='.$paged);
while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
<div class="newspagearticle full">
<div class="newsthumb">
<?php the_post_thumbnail( 'category-thumb' ); ?>
</div>
<div class="homenewsheader">
<div class="newsdate">
<div><?php the_time('M') ?></div>
<?php the_time('d'); ?>
</div>
<h2>
<a class="readmore" href="<?php the_permalink() ?>">
<?php
$thetitle = $post->post_title; /* or you can use get_the_title() */
$getlength = strlen($thetitle);
$thelength = 200;
echo substr($thetitle, 0, $thelength);
if ($getlength > $thelength) echo "...";
?>
</a>
</h2>
</div>
<div style="clear:both;"></div>
<?php the_excerpt(); ?>
</div><!-- /newspagearticle -->
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
I'm trying to use CSS multicolumn to create a masonry layout for the blog index page of a WordPress website I'm building, and I'm having some issues with it. I'm using Bones as the starter theme.
I adjusted the loop in the home.php file to create the masonry effect:
<?php get_header(); ?>
<div id="content">
<div id="inner-content" class="wrap cf">
<main id="main" class="m-all t-2of3 d-5of7 cf" role="main" itemscope itemprop="mainContentOfPage" itemtype="http://schema.org/Blog">
<div class="masonry-container">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="masonry-item">
<article id="post-<?php the_ID(); ?>" <?php post_class( 'cf' ); ?> role="article">
<a href="<?php the_permalink(); ?>">
<section class="entry-content cf">
<h1 class="h2 entry-title"><?php the_title(); ?></h1>
<?php if ( has_post_thumbnail() ) : ?>
<div class="masonry-thumbnail">
<?php the_post_thumbnail('masonry-thumb'); ?>
<span class="caption"><span><?php the_title(); ?></span></span></a>
<?php endif; ?>
</div><!--.masonry-thumbnail-->
</div> <!--.masonry-item-->
<div class="masonry-post-excerpt">
<?php the_excerpt(); ?>
</div><!--.masonry-post-excerpt-->
<div class="blog-index-content"><?php the_content(); ?></div></a>
</section>
</article>
<?php endwhile; ?>
<?php bones_page_navi(); ?>
<?php else : ?>
<article id="post-not-found" class="hentry cf">
<header class="article-header">
<h1><?php _e( 'Oops, Post Not Found!', 'bonestheme' ); ?></h1>
</header>
<section class="entry-content">
<p><?php _e( 'Uh Oh. Something is missing. Try double checking things.', 'bonestheme' ); ?></p>
</section>
<footer class="article-footer">
<p><?php _e( 'This is the error message in the index.php template.', 'bonestheme' ); ?></p>
</footer>
</article>
<?php endif; ?>
</div> <!--.masonry-container-->
</main>
<?php get_sidebar(); ?>
</div>
</div>
<?php get_footer(); ?>
I'm trying to get the image to fill the entire .masonry-item div with the post thumbnail (featured image), and right now, the .masonry-item div is larger that the post thumbnail.
There's also an empty <a> tag that appears under the image and I can't figure out where it's coming from.
I'm also trying to get the post title to appear over the thumbnail image once it, and I haven't figured out how to get it to work.
Here's a link to my test site: http://tippingpointphoto.flywheelsites.com/blog/
Any help would be much appreciated!
Inside your .masonry-thumbnail div there is a <a> link, this is the empty tag. Give it a class name and assign it these style properties:
.link { // for example if you called it link
display:block; // this will wrap it around the image
position:relative; // to position the caption
}
Now update your .caption class and add:
position:absolute;
top:auto;
bottom:0; // to text will start from the bottom of the image
z-index:1; // to position the text above the image
And when i looked at your site the image width appeared to match the div width so I'm assuming you managed to fix that problem? If not change it's css so that width is set to 100%.
I have a problem with my pagination system (wordpress). It's on my search page (display results), currently, the search system include only 2 post types, and the search system works fine, but clearly impossible to create a pagination system. I just want to create a simple previous and next page nav with the number of the current page.
<div class="contenu cont-menu fixed-cont aff">
<div class="page p-spe">Résults :
<span class="blue"><?php the_search_query(); ?></span></div>
<div class="nombre"><?php global $wp_query; echo ' ' .
$wp_query->found_posts . ' Result(s)'; ?></div>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<article class="article-menu">
<div class="article-menu a-m-sp">
<a href="<?php the_permalink(); ?>">
<span class="rollover r2"> </span>
<?php the_post_thumbnail(array(226,150)); ?>
</a>
<div class="right p-special">
<h2 class="h2-article-menu h2-ma"><a href="<?php the_permalink(); ?>">
<?php the_title(); ?></a></h2>
<p class="date"><?php the_time('j F Y'); ?></p>
<?php the_excerpt(); ?>
Know more
</div>
</div>
<div class="sep sp-s"> </div>
</article>
<?php endwhile; ?>
<nav class="nav-pages">
<?php previous_posts_link('« Previous') ?>
<span class="nombre-pages"><?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
echo $paged.' / '.$wp_query->max_num_pages;
?></span>
<?php next_posts_link('Next »') ?>
</nav>
<?php
$wp_query = null;
$wp_query = $temp; // Reset
?>
<?php else : ?>
<div class="aucun-resultat">
<?php _e( 'No results' ); ?>
</div>
<?php endif; ?>
<?php
get_footer();
?>
So i add the pages nav just after the endwhile of the search results. I don't know why my system doesn't work. I'm a wordpress beginner, thank you for your help. Bernard
You don't need a custom query for this. Just add paginate_links() which generates pagination with arrows and numbers (can be configured to display as you wish).
http://codex.wordpress.org/Function_Reference/paginate_links
I update my post, because I made a pagination for 1 post type and It works fine. But now I would like to do a pagination of 2 post types. How i can change this code to make it works ?
<?php
$temp = $wp_query;
$wp_query = null;
$wp_query = new WP_Query();
$wp_query->query('showposts=4&post_type=dossiers'.'&paged='.$paged);
while ($wp_query->have_posts()) : $wp_query->the_post();
?>
I'm working with a theme I paid for a long time ago, customized a bunch graphically and with the CSS and am pulling pieces of it into separate directory via iFrame Fancybox.
BUT, I'm trying to reformat the blog template - as currently it renders and populates when updated as:
Title
etc etc
A few lines of Content here/ then cuts of mid sentence.
Read More , etc // And these links just refresh the page?
So, I'm a bit novice with PHP & am wondering how I'd edit the below 'Blog Template' code to allow full posts text to display, not excerpts that are cut off in the middle:
<?php
/*
Template Name: Blog Template
*/
get_header();
?>
<div id="content">
<?php
//get exclusions for categories
$exclude = get_option($shortname.'_exclude_categories');
$exclude = str_replace(',,','|-',$exclude);
$exclude = str_replace(',','-',$exclude);
$exclude = substr($exclude, 0, -1);
$exclude = str_replace('|',',',$exclude);
query_posts('posts_per_page=&paged='.$paged.'&cat='.$exclude);
if(have_posts()) : while(have_posts()) : the_post();
?>
<div class="entry" id="post-<?php the_ID(); ?>">
<h1><?php the_title(); ?></h1>
<p class="meta">Added by <?php the_author_posts_link() ?> on <?php the_time('F jS, Y') ?>, filed under <?php the_category(', ') ?></p>
<div class="entry-content">
<p><?php the_post_thumbnail('wide'); ?></p>
<?php the_excerpt('Read the rest of this entry »'); ?>
<p><?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?> ~ Add your thoughts | Continue Reading</p>
</div><!-- e: entry content -->
</div><!-- e: entry -->
<?php
endwhile;
//endif;
?>
<div class="paginate">
<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>
</div>
<?php else : ?>
<h2 class="center">Not Found</h2>
<p class="center">Sorry, but you are looking for something that isn't here.</p>
<?php get_search_form(); ?>
<?php endif; ?>
</div><!-- e: content -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
Replace the_excerpt() with the_content(), that's it.