Search Results for 'posts loop'

Results from the Forum
aberniz
tagDiv Member

Hi Simion, as I want also to have the option of template 2 for other posts, I tried to duplicate template 2 for building a new template 14.

I just copied these 2 files: single_template_14.php; loop-single-14.php

Then I replaced all mentions in single_template_14.php to loop 2, and changed them to loop 14.

But, it is not showing up my new template 14 in the post editor.

Do you know how can I make show my new template 14 in the post editor?

Thank you so much.

All the best,
Angel

  • This reply was modified 8 years by aberniz.
My925LLC
Participant
#0

Hi there,

I want to show adsence in posts loop on TD Composer created page, you can say after first post or after second post. Here I have created a page with tagdiv composer and I want to show ad after first post in loop which has created with Block 22, please check screenshot: http://prntscr.com/gcs71x

Please help me on this, I will really appreciate your help on this.

Best Regards.

hadharm
tagDiv Member

Most of my traffic are mobile users so i am using the loop ad for mobile users only.

@bogdan-b
i tried playing around the code but no success. Help me on this i want loop ad to show after 4th and 8th post on mobile (i have 10 posts list on each page).

Simion C.
tagDiv Staff

Hi,

I don’t think I understand exactly what is the problem you are having. The category pages can be customized in the theme panel and should display accordingly
https://forum.tagdiv.com/how-category-settings-work/
If you have a Top post grid this will display on top of the category page, and the rest of your articles will be displayed below the grid.
You need to have enough posts in the category to populate the top grid and the bottom loop displaying articles.

Thanks

hadharm
Participant
#0

I set the mobile loop ad to show after 3 posts and it works fine. But I want it to show after 3 posts each e.g. show after 3 posts, show after 6 posts and show after 9 posts.

How can loop ad be set for PC view too???

Ken0929
Participant
#0

Hi,
My function.php (Child-Theme) can not be applied.
What am I missing?

<?php
/* —————————————————————————-
Newspaper V6.3+ Child theme – Please do not use this child theme with older versions of Newspaper Theme

What can be overwritten via the child theme:
– everything from /parts folder
– all the loops (loop.php loop-single-1.php) etc
– please read the child theme documentation: https://forum.tagdiv.com/the-child-theme-support-tutorial/

– the rest of the theme has to be modified via the theme api:
https://forum.tagdiv.com/the-theme-api/

*/

add_action(‘init’,’add_categories_for_pages’);
function add_categories_for_pages(){
register_taxonomy_for_object_type(‘category’, ‘page’);
}
add_action( ‘pre_get_posts’, ‘nobita_merge_page_categories_at_category_archive’ );
function nobita_merge_page_categories_at_category_archive( $query ) {
if ( $query->is_category== true && $query->is_main_query() ) {
$query->set(‘post_type’, array( ‘post’, ‘page’, ‘nav_menu_item’));
}
}

function custom_wp_tag_cloud($args) {
$myargs = array(
‘orderby’ => ‘count’, //使用頻度順
‘order’ => ‘DESC’, // 降順(使用頻度の高い順)
‘number’ => 40 // 表示数
);
$args = wp_parse_args($args, $myargs);
return $args;
}
add_filter( ‘widget_tag_cloud_args’, ‘custom_wp_tag_cloud’ );

// 固定ページにタグを設定
function add_tag_to_page() {
register_taxonomy_for_object_type(‘post_tag’, ‘page’);
}
add_action(‘init’, ‘add_tag_to_page’);
// タグアーカイブに固定ページを含める
function add_page_to_tag_archive( $obj ) {
if ( is_tag() ) {
$obj->query_vars[‘post_type’] = array( ‘post’, ‘page’ );
}
}
add_action( ‘pre_get_posts’, ‘add_page_to_tag_archive’ );

add_theme_support(‘post-thumbnails’);

/* —————————————————————————-
add the parent style + style.css from this folder
*/
add_action( ‘wp_enqueue_scripts’, ‘theme_enqueue_styles’, 1001);
function theme_enqueue_styles() {
wp_enqueue_style(‘td-theme’, get_template_directory_uri() . ‘/style.css’, ”, TD_THEME_VERSION, ‘all’ );
wp_enqueue_style(‘td-theme-child’, get_stylesheet_directory_uri() . ‘/style.css’, array(‘td-theme’), TD_THEME_VERSION . ‘c’, ‘all’ );

?>

Catalin
tagDiv Staff

Hello kdannay,

If you want to make these changes, notice that you should edit the theme core files and make move the function which displays the tags in the place you want. For example, if you are using the post template style 1, you should edit the loop-single-1.php and move the following function, like this -> https://www.screencast.com/t/LjPnecET
Also, I have inspected your website and I saw that you are using such a plugin for your Related Articles for posts -> https://www.screencast.com/t/RFiWa9KAKsVF The hint was done and you have to make later changes yourself because we cannot provide custom services at the moment, sorry!

Thanks for your understanding!

Silverheim
Participant
#0

Hello. I dont know why but when i try to create any new page, i cant see the option to customize the “Posts Loop Settings”… When i choose “Pagebuilder + latest articles + pagination”, the “Homepage Latest Articles” simple disapear. Why? I am actually running the version 8 of the Newspaper.

Any solution for this?

thanks

Simion C.
tagDiv Staff

Hi,

That would require modifications to the posts template file. You will have to edit the corresponding loop file to that template. That is the file single_template_7.php located in the main theme folder. Opening that file you can see the post template structure, and the code that displays the categories
https://www.screencast.com/t/LYbH0HTX
Try moving that line of code lower in the post, maybe like this
https://www.screencast.com/t/0L3RmVrkKEwA
The result will be like this
https://www.screencast.com/t/XTE2xR0nrqs
You may position the categories or style them further with some CSS if needed, or just leave them as they are.

Thanks

Simion C.
tagDiv Staff

Hi,

For the category pages there is no option to display ads between posts in the loop. You could maybe try to search for ad plugins that may be able to do that, for the moment. The category pages consist of a category template, top posts and then the post loop
https://www.screencast.com/t/Yck1ZYxldW
Regarding ad sizes, you can leave the ad size on Auto for automatic results
https://forum.tagdiv.com/ads-adsense-overview/

Thanks

Devs-Lab
Participant
#0

I have been experimenting with different loop.php, single.php, mobile/single.php but not able to get the RevContent Ads above the Related posts in Mobile theme. Can you please mention the file & changes I should make to get the Ads?

I have successfully added the Ads in Desktop UI. Here’s the Ad Code

<div id="rcjsload_591893"></div>
<script type="text/javascript">
(function() {
var referer="";try{if(referer=document.referrer,"undefined"==typeof referer)throw"undefined"}catch(exception){referer=document.location.href,(""==referer||"undefined"==typeof referer)&&(referer=document.URL)}referer=referer.substr(0,700);
var rcel = document.createElement("script");
rcel.id = 'rc_' + Math.floor(Math.random() * 1000);
rcel.type = 'text/javascript';
rcel.src = "https://trends.revcontent.com/serve.js.php?w=46290&t="+rcel.id+"&c="+(new Date()).getTime()+"&width="+(window.outerWidth || document.documentElement.clientWidth)+"&referer="+referer;
rcel.async = true;
var rcds = document.getElementById("rcjsload_591893"); rcds.appendChild(rcel);
})();
</script>

Gil Poulsen
tagDiv Member

OK, got it. I still don’t understand why you replaced an established builder with over 2 million users with something you apparently spent a lot of time creating yourself, which meant you could not spend as much time adding features to the theme itself, like enabling the controlling of ads by category or any of the other things paid users have been asking for. No one really needed or wanted a new builder and there are plenty of other builders out there besides VC that are far more capable than the builder you guys have created. One of the things about this theme that I always liked was the fact that it DID integrate with VC quite well, which also allows us access to the hundreds of free and paid VC add-ons available out there. I feel that you have not taken into account that even though we users are a newspaper or magazine, and many pages of our sites are used to present groups of articles, article loops, individual posts, etc. there are many other aspects of a publication that have nothing to do with “news” content (about us, customer service info, submitting news/ads, historical info, etc. etc.) Now we are stuck with a limited builder that does not have the power of VC and cannot be extended, and that breaks the theme upon upgrading. I had been hoping that at least some of the features users had been asking for would be part of the 8 upgrade but it turns out there are no new features ;-( It seems like you guys have taken what, at least according to my research, was by far the BEST newspaper/magazine theme out there and you’ve actually limited its capabilities and functionality for the sake of implementing a more customized builder. Having the builder work on the front end is nice, but there was nothing WRONG with the combination of v. 7 and VC at all. You have removed a great deal of functionality in terms of the builder component of this theme, and given back almost nothing to the users. I wish you would reconsider this, and allow the theme to work as before with VC OR with your new builder and give us the option to choose one or the other, or forget about the new composer and instead work on adding truly useful new features to the next version.

truth
tagDiv Member

Dear Simon,
I am talking about the loop which generates the “related articles” section in the mobile theme. Not the posts.

Nano
Participant
#0

Hi Tagdiv,

With the help of a tutorial written here – https://forum.tagdiv.com/topic/implement-infinite-scroll-on-single-posts/ and by using some common sense, I was able to apply infinite post scrolling on a single post.

Here is the step I took for this:

1. I am using TagDiv composer for the pages but to be able to use infinite scrolling on a single post, I have to enable Visual Composer for posts.

2. I wanted block-3 design and my default post type is: Style-1 so, I edited loop-single-1.php, I added the required code

Here is the code that you need to add under loop-single-1.php after <?php echo $td_mod_single->related_posts();?>

<?php $category_detail=get_the_category($td_mod_single->post->ID);//$post->ID

foreach($category_detail as $cd){ $cat_name = $cd->cat_ID; } $exclude_current_post = $td_mod_single->post->ID; echo do_shortcode('[vc_row][vc_column][td_block_3 custom_title="All LATEST STUFF" separator="" post_ids="'. -$exclude_current_post .'" category_id="' . $cat_name . '" limit="6" td_ajax_preloading="preload" ajax_pagination="infinite" ajax_pagination_infinite_stop="3" tdc_css=""][/vc_column][/vc_row]'); ?>

Though it worked properly, but I face two main issues.

1. I am using smart sidebars on each post and usually, it works great. With this infinite scrolling. I noticed that ‘The smart sidebar’ keep scrolling even above the full width infinite scrolling post blocks, and hence it overlaps.
( Here is the snapshot of overlapping – http://i.imgur.com/WCZfHcN.jpg )
How to make smart scroll stops once infinite scrolling starts? I noticed that this site ( http://www.storypick.com/short-film-affair/ ) is successfully able to use infinite scrolling and smart sidebar both. Please help me with this.

Overall, I want to to have a function like this: http://darnkid.com/illustrations-show-the-unique-bond-between-dads-and-daughters/ ( created by tagdiv user Darnkid )

2. Is there any way to have this feature without enabling visual composer for posts? Can we use TagDiv composer for this?

3. While trying for many solutions, I looked at a thread which suggested to el_class=”td-ss-row” for this. I tried using it in the above code. Well, though it stopped the overlapping of sidebar with infinite post blocks, it also disables the smart sticky property of Sidebar. What am I missing here?

Kindly help me with this.

Thank you.

Bogdan B.
tagDiv Staff

Hi,

Unfortunately the theme does not have such a feature. If the link leads to the category page, the category templates will not show a list of your sub-categories. The category template uses a loop to show posts, not a list of categories. Sorry. You can maybe redirect your category page to a standard static page where you can create a list of your sub-categories.

Thanks.

Lauri
Participant
#0

Hi,

I’m having problems with Newspaper theme and more specifically with “replacing” post authors. Could you please help me?

I’m building a site which is based on user submitted posts. I use USP Pro which should enable to show the posts author. So every time when a person fills the form and as a result there’s a user submitted post, the name he/she filled in the form should appear as the post author.

(Basic info can be found here: https://plugin-planet.com/usp-pro-replace-author/)

I’m not that good with PHP but the problem seems to be that while USP Pro should do that when the theme is using any of these four codes (the_author_meta(‘display_name’); – get_the_author_meta(); – get_the_author(); – the_author();), Newspaper theme seems to be using a bit more complex coding on authors.

I quickly noticed that slight changes in e.g. loop-single.php (get_author -> get_the_author) won’t do the trick and the rest of the coding is just too much for me considering my newbie PHP skills… I either get the site’s admin-name as the post author or manage to make a mess of the whole post (only the title appears on post etc.).

So is there a way I could make this replacing of the author work and if so, how should it be done? Any help would be hugely appreciated.

Simion C.
tagDiv Staff

Hi,

Each post template style has a corresponding loop single file. For example if you are using Post template 2 for your posts, you must edit loop-single-2.php file
https://www.screencast.com/t/xdMATbc12Y
These post template files are found in the main theme folder.

Thanks

Simion C.
tagDiv Staff

Hi,

That would require modifications to the theme files. This is where the related section is defined in the theme
https://www.screencast.com/t/P28HIhuW
You could try the solution from this topic and specify a category from which the posts will be displayed
https://forum.tagdiv.com/topic/related-articles-3/
Or disable the default Related section (through the theme panel, or comment the code in the post template) and insert a block through a shortcode, with the filtering you want
https://forum.tagdiv.com/topic/add-content-after-post-items-after-related-articles/
You could try it like this. Configure the block how you want it and use the code in te corresponding loop file with the post template used
https://www.screencast.com/t/HbCMxRAii
https://www.screencast.com/t/Rhu2nkHDNwIf
https://www.screencast.com/t/d8V5PwrCIv
https://www.screencast.com/t/pPx3KIirtQh6

<?php echo do_shortcode ('your shortcode here'); ?>

Thanks

Bogdan B.
tagDiv Staff

Hello,

The author templates uses the loop.php template by wp default so the post limit for the author tempalte is the same as the one on categories and blog roll template: https://www.screencast.com/t/YJt16TVETSb
There is however a method to override this. Here is an example:
http://www.wpbeginner.com/wp-themes/how-to-display-any-number-of-posts-in-a-wordpress-loop/

Thanks.

sil2
tagDiv Member

Thank you, Catalin for your answer, but this is not a case.
You create all those copys for EVERY uploaded image. Some of my posts have up to 50 images! Should youy just do it for feautured image ONLY? Should it be generated only on post save not any file upload? I was thinking to add a hook to rename futured images on post save. Add, let say, “FUTURED_” to the file name. And loop over all files in “upload” folder ones a day (cron job) and delete all thumbs for files where name <> “FUTURED_”. But this is quite complicated. I cannot just rename, I will have to recreate all thumbs again….. oh….
This is a big issue for us. “upload” folder becomes really heavy!
Any help? Onece again, I already disabled all posible blocks. There are only a few left but anyway, wordpress creates 3 copys and your theme still creates 5 more for EVERY image.

  • This reply was modified 9 years by sil2.
Bogdan B.
tagDiv Staff

Hello,

You can try to call it on posts but it depends on the implementation method. All of the functions called in the loop-single are located either in td_module_single_base/php or in td_module_single.php
You can try the implementation used for the related articles: https://www.screencast.com/t/YWBOdftvRIo
https://www.screencast.com/t/qAT109XVch

Thank you!

Bogdan B.
tagDiv Staff

Hello,
Sorry but in order to do this you would have to change the implementation for both the top post grid and the post loop on the category for one to show the featured posts and for the other to prevent showing the posts marked as featured. Unfortunately this is not an available option in our themes. It can only be done with customization. Unfortuantly it will not be an easy modification to make. You can hire a freelancer to help out with this task if you need to implement it.

Thanks.

dj_savage
Participant
#0

How do I edit LATEST POSTS near the bottom section on http://www.davidsavage.co.uk, from what I have read I need to go in to POST LOOPS setting in Visual Editior but don’t seem to have that option?

angal
tagDiv Member

Hi, thanks a lot.

It’s working, but it affects all the queries. I want to add a second loop in category.php to show posts not included in first loop. For example, in the main loop show posts with tag_id 32, and second loop show posts without tag_id 32.

When i add your action to functions php…only filtered posts are loaded.

Could it be possible?

My code in category.php is:
$args1 = array(
'cat' => $current_category_id,
'tag_id' => 32
);

$query1 = new WP_Query($args1);

while ( $query1->have_posts() ) {
$query1->the_post();
echo '

  • ' . get_the_title() . '
  • ';
    }

    Thanks a lot!

    angal
    Participant
    #0

    Hi, i’ve some categories created and i can view post from them loading them page (category.php)

    I want to exlude some posts (for example with some tags) from default category view. Is it possible? (changing loop.php?)

    I can compose a specific page for each category…but i have enough of them.

    Thanks a lot!

    Viewing 25 results - 1,351 through 1,375 (of 1,749 total)