- NewspaperPosts Loop Element
- NewspaperFlex Block Builder and Flex Loop Builder
- NewspaperBookmark – Save For Later
- NewspaperModules Builder in Newspaper Theme
- NewspaperFilters and sorting for taxonomies
- NewspaperPage templates
- NewspaperSmart Sidebar
- NewspaperChild Theme Support
Hello,
Our theme category pages use the loop.php file to populate the page with posts. This is where you will have to modify the code.
There is an alternative though. You could try to use a block from Visual Composer. There you can use the block settings to sort your posts to your preferred sorting option.
After the block is set use do_shortcode function to echo out the shortcode on that category page. The code must be added in category.php page here: http://screencast.com/t/mIrs3SDaaFez
I hope this helps.
Hello alpsbox,
Yes, if you want to achieve the time ago for your date for modules/blocks you should edit the structure of the module which creates the block. In you case, if the module is 15, you should remove the get_date function and replace it with the human_time_diff. Also, if you want to achieve inside the posts the similar behaviour for your date, you should edit the loop-single core files which correspond with the post template used by you. For example, if you are using the post template style 1 you should edit the loo-single-1.php, like this -> http://screencast.com/t/HaBa7OtR0A
Thanks for the message!
For those that find this thread.
I made a custom template from the page.php where I instead of the
<?php the_content(); ?>
used this code (it’s looking like the block 11 and have 2 sidebars, you can customise that after your needs)
<div class="td-pb-row">
<div class="td-pb-span6 td-main-content" role="main">
<div class="td-ss-main-content">
<div class="td_block_wrap td_block_11 td_uid_2_58086a26d405d_rand td-pb-border-top" data-td-block-uid="td_uid_2_58086a26d405d">
<div class="td-block-title-wrap">
<h4 class="block-title">
<span style="margin-right: 0px;">
<?php echo $page_path; ?>
</span>
</h4>
</div>
<div class="td_block_inner">
<div class="td-block-span12">
<?php
$page_path = end(explode('/', trim($_SERVER['REQUEST_URI'], '/')));
if (stristr($_SERVER['REQUEST_URI'], '/PAGE URL/')):
query_posts( array( 'post_type' => 'CUSTOM POST NAME', 'CUSTOM POST TAXANOMY NAME' => $page_path ) );
elseif (stristr($_SERVER['REQUEST_URI'], '/PAGE URL/')):
query_posts( array( 'post_type' => 'CUSTOM POST NAME', 'CUSTOM POST TAXANOMY NAME' => $page_path ) );
else:
query_posts( array( 'post_type' => 'CUSTOM POST NAME', 'CUSTOM POST TAXANOMY NAME' => 'TAXANOMY NAME' ) );
endif;
//the loop start here
if ( have_posts() ) : while ( have_posts() ) : the_post();
?>
<div class="td_module_10 td_module_wrap td-animation-stack td-meta-info-hide">
<div class="td-module-thumb">
<a class="td-admin-edit" href="/wp-admin/post.php?post= <?php echo get_the_id(); ?> &action=edit">
edit
</a>
<a href="<?php echo get_permalink();?>" rel="bookmark" title="<?php the_title(); ?>">
<?php echo get_the_post_thumbnail(); ?>
</a>
</div>
<div class="item-details">
<h3 class="entry-title td-module-title">
<a href="<?php echo get_permalink();?>" rel="bookmark" title="<?php the_title(); ?>">
<?php the_title(); ?></a>
</h3>
<div class="td-module-meta-info">
</div>
<div class="td-excerpt">
<?php the_excerpt(); ?>
</div>
</div>
</div>
<?php endwhile; else: echo 'Det finns inga artiklar kopplade till ämnet "' .$page_path .'".';endif; wp_reset_query(); ?>
</div>
<!-- ./td-block-span12 -->
</div>
</div>
</div>
</div>
<div class="td-pb-span2 td-main-sidebar" role="complementary">
<div class="td-ss-main-sidebar">
<?php dynamic_sidebar( 'mittenspalten' ); ?>
</div>
</div>
<div class="td-pb-span4 td-main-sidebar" role="complementary">
<div class="td-ss-main-sidebar">
<?php dynamic_sidebar('hogerspalten'); ?>
</div>
</div>
</div>
Thanks Andrei! I will fix this.
For the other issues. This is how i solved it (when other people run into the same problems).
1) In logo.php and logo_h1.php I added this code
if(ICL_LANGUAGE_CODE=='es'){
$td_customLogo = 'URL TO SPANISH LOGO';
$td_customLogoR = 'URL TO SPANISH LOGO RETINA';
}
elseif(ICL_LANGUAGE_CODE=='en'){
$td_customLogo = td_util::get_option('tds_logo_upload');
$td_customLogoR = td_util::get_option('tds_logo_upload_r');
}
2) Still working on this one
3) In the header.php file I added the Facebook snippet, but made some variables. As you can see I made the URL in de script part variable with 2 variables. One for the app ID and one for the language.
<?php
if(ICL_LANGUAGE_CODE=='es'){
$td_comments_language = 'YOUR SPAIN FACEBOOK APP ID';
$language = 'es_ES';
}
elseif(ICL_LANGUAGE_CODE=='en'){
$td_comments_language = 'YOUR EN FACEBOOK APP ID';
$language = 'en_US';
}
?>
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/<?php echo $language ?>/sdk.js#xfbml=1&version=v2.8&appId=<?php echo $td_comments_language ?>";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
In the loop-single files I added where needed this part. You can see a get_permalink here. This is so the comments on each blogpost are unique on the specific URL.
<div class="fb-comments" data-href="<?php echo get_permalink( $post->ID ); ?>" data-width="100%" data-numposts="5"></div>
Hi Guys, is there anyway to exclude one or more categories from the main blog page loop i.e. the main ‘posts page’ as set in the WP Dashboard?
Thanks
Matt
Hi,
Sorry but the category is implemented differently if you remove the top post, your latest 3 posts will be missing from the category page. There is no simple way of removing it as it;s tied to the post loop, not a separate block like the one on the front page.
Thanks.
Hello nasaboy,
1)If you want to change the author box position of your posts, please notice that you should edit core file and change the order of this, like this -> http://screencast.com/t/eArYBtT8pV For example, if you are using the post template style 1, you will have to edit the loop-single-1.php and move this snippet of the code like ->
<?php echo $td_mod_single->get_author_box();?> where you want to look on your post page.
2)This is not a simple task and it involves some custom modification in order to achieve this. If you are not aware of the steps which are needed to take in this regard, please consider hiring a freelancer/developer to help you because we cannot provide custom work at the moment, sorry!
3)For more information about creating menus with our theme you can find reading our documentation here -> https://forum.tagdiv.com/main-menu/
Thanks for your understanding!
I am trying to get Facebook comments to show BELOW the social share buttons.
I followed a post on this forum that explained how to achieve this and I managed to get them to work using:
<div class=”fb-comments” data-href=“http://positivetruenews.com/” data-width=”100%” data-numposts=”10″></div>
which was added to the loop-single.php file.
However, when I change it to :
<div class=”fb-comments” data-href=“<?php the_permalink(); ?>” data-width=”100%” data-numposts=”10″></div>
it doesn’t show at all.
My client insists that the comments must go below the social sharing so I need to make it work.
Any ideas where I am going wrong?
This is what is pasted into the header.php :
<div id=”fb-root”></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = “//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.7&appId=601231266704215”;
fjs.parentNode.insertBefore(js, fjs);
}(document, ‘script’, ‘facebook-jssdk’));</script>
I think there is some problem with loop function. Some row only has one post instead three posts like others. More details here: https://tipdohoa.vn/kham-pha/infinity-pixel/
Hi @nairolf
Thank you for trying to help me. That’s kind of you. I hope you’ve eaten something by now 🙂
What I would like to happen is, for the updated date to show on the categories and the “latest articles” sections too.
It would also be great if when an article gets updated that it will move to the top of the “latest articles”
I think the above code shows the updated date in the search engine results?
Adding the codes to loop-single.php doesn’t show the updated date on all types of posts. Example: I have a post with post template 5 that includes a review on it that doesn’t show the updated date but only the published date.
Hi
Theme’s blocks we’re designed to work on 1/1, 1/3 and 23 columns: http://screencast.com/t/fN3T2xPSwV We didn’t tested 1/2 or 1/4 layout and there is no implementation for it, sorry.
You can filter posts by tag using wither post loop settings if you’re using page-builder+latest as page template: http://screencast.com/t/5otlX0agNtVp or from block settings for the content displayed with Visual Composer: http://screencast.com/t/FhVMFdsdoo
For more detail about page templates and block settings please refer to our documentation:
https://forum.tagdiv.com/page-templates-2/ – https://forum.tagdiv.com/block-settings-tutorial/
You can use the embed code and change the values for width and height as you want, here is an example: http://screencast.com/t/izfEUcYf296Y – http://screencast.com/t/ERGYIvyrF
Thanks!
this is a copy of the Front page.
So … at the very bottom there’s a Programs & Features post grid, which shows 25 posts – showing 6 posts per screen … the last screen shows one … by itself … i thought selected the ‘loop’ options would randomize and repeat them if necessary.
HI
Thanks @Chris S for your help!
@billiehillier if you use blocks to display posts then you can use the available filters: http://screencast.com/t/s86oZbazX0F Those filters can also be used for post loop settings: http://screencast.com/t/v1ZjWdEVwq
Hope this helps!
Thanks!
Either turn off the option for showing categories on posts from theme panel. Done. Or, you need to move that in your templates if wanted.
If you want to move that to footer, as I do, then you would need to move that block in the post template(s) you’re using from the loop file to bottom — I move my category block down to the tag block area with certain layouts.
Simplest thing is to just disable showing the “categories” elements on post, as not strictly needed since those same categories are in your menu(s) and in sitemap(s) for Google, et al.
-
This reply was modified 9 years by
simchris.
Hi
I can’t point exactly to a solution but I assume that the issue is related with the usage of query_posts() function after the loop. You can try to use pre_get_posts hook to alter the query as it’s a beater approach in this regard: https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts
Hope this helps!
Thanks!
Hi
Each post template is built from two files: single-template-x.php and loop-single-x.php. Depending by post template each file have its own role, but as an overall view the single files are the main, they start the single pages and they also end the page, I mean the html for posts. Loop files in most cases prepare the article’s content, the one added in wordpress editor.
Hope this helps!
Thanks!
I’m trying to add a “Time to Read” just above every post and I can’t, for the life of me, get it to work.
I’ve already created the folder under Newsmag’s “js” folder and the readingTime.js file is in there. I also added the necessary “script” code into “footer.php”.
Where I’m stumbling is that I can’t figure out how I need to change the code and where to put it so that “Time to Read: XX (XX Words)” appears in a line just above the body of every post.
Here’s the code I’m working with:
(Added to “functions.php”)
function readingtime_posts() {
if (is_single() && wp_script_is('readingtimejs','done')) {
?><script type="text/javascript">jQuery(document).ready(function($) {
$('.td-post-content').readingTime({
readingTimeTarget: '.reading-eta',
wordCountTarget: '.word-count',
wordsPerMinute: 180,
round: true,
prependTimeString: 'Time to Read: '
});
});</script><?php
}}
add_action('wp_footer','readingtime_posts',100);
(Added into “loop-single.php”)
<?php if (is_single()) {
echo '<div style="clear:both;"><span class="reading-eta"></span> (<span class="word-count"></span> Words)</div>';
}
?>
Here’s a screenshot of where the loop-single.php code is located: https://s10.postimg.org/raid1n9vd/Screen_Shot_2016_09_12_at_7_09_16_PM.png
Please tell me what I’m doing wrong!!!
Hello GlanceCompany,
Unfortunately, our theme does not have such an option for this for the posts, but only for the pages if you are using the Visual Composer. So, please notice that you can try to use the do_shortcode method, after you create the button from your Visual Composer, like this -> http://screencast.com/t/Neag3pRJ From there you can customize your button as you like and then, to see the shortcode for it, you will have to switch the Visual Composer to the classic mode, like this -> http://screencast.com/t/rCjQdy5P0RRA In this case, the snippet of the code which you will have to add to your core file, is that ->
<?php echo do_shortcode('[vc_row][vc_column][vc_btn title="Push the button" link="url:https%3A%2F%2Fwww.google.ro%2F|||"][/vc_column][/vc_row]'); ?>
So, please notice that this type of code should added in the coresponding loop single on what post template you are using. For my example, I just use the post template style 1 and the code will have to be added in loop-single-1.php, like this -> http://screencast.com/t/ePJyJxass4 and the result you should see here -> http://screencast.com/t/fc0uQsBVfW0
Hope this helps!
Thanks for your understanding!
Hi @rida
You can use blocks to sort posts from each page. For example in page 1 you add block 1 and choose in filters category1; http://screencast.com/t/BzaQQ74DhD9e For page 2 you can do the same, just change the category: http://screencast.com/t/8PwvC4KCIz2 You can also use page-builder+latest as a page template and choose the category from post loop settings: http://screencast.com/t/F2b8jkN9LXy
For more details about how to use visual Composer and how to built pages please check these links: https://forum.tagdiv.com/newsmag-how-to-use-visual-composer/ – https://forum.tagdiv.com/newsmag-block-settings-tutorial/ – https://forum.tagdiv.com/newsmag-homepage-how-to-build-and-set-it/ – https://forum.tagdiv.com/newsmag-page-templates/
Hope this helps.
Thanks!
Or you can copy <?php echo $td_mod_single->related_posts();?> in loop-single-11 but the block is not the same as the related posts in the other post templates.
Is there anyway to achieve exactly the same look moving the related posts to the botton in template 11?
Hi,
After reading various threads here, I have successfully added the Facebook comments. For example. Have a look at this link: https://tomatoheart.com/aditi-singh/open-letter-to-friends-cast-indian-teen/
Right now it appears just after the end of the post (even before the share button) but I want it to appear before the “real WordPress comment section” and after the related post section. I have shown the desired location here .

where should I put the code to get it right? Currently the FB comment has been inserted in all the loop-single.php files like this:
<?php echo $td_mod_single->get_content();?>
<div class="fb">
<div class="fb-page" data-href="https://www.facebook.com/page" data-width="180" data-height="70" data-small-header="true" data-adapt-container-width="false" data-hide-cover="true" data-show-facepile="false">
</div>
<div class="fb-comments" data-href="<?php echo get_permalink($td_mod_single->post->ID); ?>" data-width="100%" data-numposts="10" data-order-by="social" data-colorscheme="light"></div> </div>
</div>
Please tell me the right location to get it after the related post section. Thank you.
PS: Do we need to modify any single.php etc. file too to get these results? ( Because under various threads I have seen the mentioning of single.php files too but in my case, I am able to get the FB comment section just by adding codes under loop-single.php files.
I mean that an Author wont be able to change this part of code, since it will be on PHP files, and not on a widget, neither inside visual composer, which can be changed with ease of access. The method that you describe is good for an administrator that wants to place the code there and forget it, but its not good for code which needs to be managed and updated regularly by a member with Author access.
I already edited the post and provided steps for people that want to do the same, so they will be able to manage this part of the website easily.
I didnt want to have content added below posts loop, i wanted to be able to add and organize EVERY content of homepage through visual composer, like on every other theme, but anyway, i used this as an alternative.
I did the changes on my own and edited my previous post (obviously you read the first revision of it) in order to make it easier for another purchaser, in case he wants to apply the same customization. As an appreciation of your work and your theme, I shared this publically.
Its a pity that your theme (which provides a really wide variety of functions) is having such a restriction, but anyway, thanks for your overall support.
-
This reply was modified 9 years by
themesic.
Ok.
So there is no way to do what I want to achieve, except if I set this in a static way (shortcode) inside php file.
Is there any other way? I.E vice versa one. Adding a module that will list posts’ loop, and having it cancelled from ‘Post’s loop settings’ ??
Hi Bogdan,
thanks for your help. I figured that changing the condition should do it. Unfortunately it didn’t work on my end.
On the tag page it returns [td_ad_box spot_id=”custom_ad_6″] after the specified post exerpt.
Here is the code in the loop.php:
if (have_posts()) {
while ( have_posts() ) : the_post();
$adcounter++;
echo $td_template_layout->layout_open_element();
if (class_exists($td_module_class)) {
$td_mod = new $td_module_class($post);
echo $td_mod->render();
} else {
td_util::error(__FILE__, ‘Missing module: ‘ . $td_module_class);
}
echo $td_template_layout->layout_close_element();
$td_template_layout->layout_next();
if (is_tag() && ($adcounter == 2)) {
echo do_shortcode(‘[td_ad_box spot_id=”custom_ad_6″]’);
}
endwhile; //end loop
echo $td_template_layout->close_all_tags();
I just added custom ad 6 & 7 but tried it with custom ad 5 too. Also tried it with the Ad inserter plugin which didn’t work either. Their support told me to try it with a php function.
Can you find what’s wrong? Why doesn’t it work? Is there another way?
Really appreciate your help on this.
I simply want to be able to add content via visual composer (not static coding) at the end of the homepage!! ( after posts loop! )
wherever and whenever I add code in the visual composer, posts loop is always being displayed last.