Search Results for 'posts loop'

    No search results were found in Documentation!

Results from the Forum
fbengo
Participant
#0

Hi guys,

I am trying to add a new custom module but I still get the following error:

Fatal error: Class ‘td_module_16’ not found in …/includes/shortcodes/td_block_1.php on line 49

Things I did:

1. created td_module_16.php with the same almost the same content as td_module_4.php:

<?php
class td_module_4 extends td_module {
function __construct($post) {
//run the parrent constructor
parent::__construct($post);
}

function render() {
ob_start();
?>

<div class="<?php echo $this->get_module_classes();?>" <?php echo $this->get_item_scope() ?>>
<div class="td-module-image">
<?php echo $this->get_image('td_300x194'); ?>
<?php if (td_util::get_option('tds_category_module_4') == 'yes') { echo $this->get_category(); }?>
</div>

<?php echo $this->get_title(12); ?>

<div class="meta-info">
<?php //echo $this->get_author();?>
<?php //echo $this->get_date();?>
<?php echo $this->get_comments();?>
</div>

<div class="td-excerpt">
<?php echo $this->get_excerpt(25); ?>
</div>

<?php if(empty(td_global::$is_wordpress_loop)){echo $this->get_quotes_on_blocks();}?>

<?php echo $this->get_item_scope_meta(); ?>

</div>

<?php
return ob_get_clean();
}
}

2. Edited td_block_1.php, because I want to use this custom module inside this block:

function inner($posts, $td_column_number = '') {

$buffy = '';

$td_block_layout = new td_block_layout();

if (empty($td_column_number)) {
$td_column_number = td_util::vc_get_column_number(); // get the column width of the block from the page builder API
}

$td_post_count = 0; // the number of posts rendered

if (!empty($posts)) {
foreach ($posts as $post) {
$td_module_16 = new td_module_16($post);
$td_module_6 = new td_module_6($post);

switch ($td_column_number) {

case '1': //one column layout
$buffy .= $td_block_layout->open12(); //added in 010 theme - span 12 doesn't use rows
if ($td_post_count == 0) { //first post
$buffy .= $td_module_16->render();
} else {
$buffy .= $td_module_6->render();
}
$buffy .= $td_block_layout->close12();
break;

case '2': //two column layout
$buffy .= $td_block_layout->open_row();
if ($td_post_count == 0) { //first post
$buffy .= $td_block_layout->open6();
$buffy .= $td_module_16->render();
$buffy .= $td_block_layout->close6();
} else { //the rest
$buffy .= $td_block_layout->open6();
$buffy .= $td_module_6->render();
}
break;

case '3': //three column layout
$buffy .= $td_block_layout->open_row();
if ($td_post_count == 0) { //first post
$buffy .= $td_block_layout->open4();
$buffy .= $td_module_16->render();
$buffy .= $td_block_layout->close4();
} else { //2-3 cols
$buffy .= $td_block_layout->open4();
$buffy .= $td_module_6->render();

if ($td_post_count == 4) { //make new column
$buffy .= $td_block_layout->close4();
}
}
break;
}
$td_post_count++;
}

}
$buffy .= $td_block_layout->close_all_tags();
return $buffy;
}

3. I added the following code to td_config.php:

'td_module_16' => array (
'text' => 'Module 4 custom',
'img' => get_template_directory_uri() . '/includes/wp_booster/wp-admin/images/panel/module-4.png',
'used_on_blocks' => array ('td_block_1', 'td_block_2'),
'excerpt_title' => 12,
'excerpt_content' => 25,
'enabled_on_more_articles_box' => true,
'enabled_on_loops' => true,
'uses_columns' => true, // if the module uses columns on the page template + loop
'category_label' => true
),

What did I forget to do?

Lucian
tagDiv Staff

Hi,

Not sure how you would one this but if you would want them inside the posts’s content then I’m afraid that in that case you would need custom modification to the get_content() function and should get someone to do it for you if you don;t know how to do it. You can find the function in this file: http://screencast.com/t/RnsV0HzYkfN
In case you want them after the content you can just edit the loop-single template file and add the code after the get_content() function: http://screencast.com/t/SsJ0yRLV
Hope this helps!

Thanks

Solari
tagDiv Member

…and changed files:

Newsmag theme
Here is a list of all the changes between v 1.2 and v 1.3
Modified files – 44 files
• footer.php
• functions.php
• includes\less_files\comments.less
• includes\less_files\header.less
• includes\less_files\pagebuilder\modules\module_14.less
• includes\less_files\pagebuilder\modules\module_mx3.less
• includes\less_files\pagebuilder\modules\td-slide.less
• includes\less_files\post-templates.less
• includes\less_files\post.less
• includes\less_files\retina.less
• includes\less_files\woocommerce.less
• includes\modules\td_module_14.php
• includes\modules\td_module_8.php
• includes\modules\td_module_mega_menu.php
• includes\modules\td_module_mx1.php
• includes\modules\td_module_related_posts.php
• includes\modules\td_module_single.php
• includes\modules\td_module_slide.php
• includes\plugins\revslider.zip
• includes\plugins\td-social-counter.zip
• includes\td_config.php
• includes\td_css_generator.php
• includes\wp_booster\td_fonts.php
• includes\wp_booster\td_global.php
• includes\wp_booster\td_module.php
• includes\wp_booster\td_page_generator.php
• includes\wp_booster\td_review.php
• includes\wp_booster\td_translate.php
• includes\wp_booster\td_util.php
• includes\wp_booster\td_wp_booster_functions.php
• includes\wp_booster\wp-admin\content-metaboxes\td_set_homepage_loop.php
• includes\wp_booster\wp-admin\content-metaboxes\td_set_post_settings.php
• includes\wp_booster\wp-admin\content-metaboxes\td_set_reviews.php
• includes\wp_booster\wp-admin\content-metaboxes\td_set_smart_list.php
• includes\wp_booster\wp-admin\panel\ajax_views\td_category.php
• includes\wp_booster\wp-admin\panel\td_panel_generator.php
• includes\wp_booster\wp-admin\panel\td_view_import_theme_styles.php
• includes\wp_booster\wp-admin\panel\views\panel_block_settings.php
• includes\wp_booster\wp-admin\panel\views\panel_excerpts.php
• includes\wp_booster\wp-admin\panel\views\panel_post_settings.php
• includes\wp_booster\wp-admin\panel\views\panel_template_settings.php
• includes\wp_booster\wp-admin\panel\views\panel_theme_fonts.php
loop.php
• style.css
New files – 9 files
• includes\panel\views\ajax_views\td_theme_fonts.php
• includes\panel\views\panel_theme_colors.php
• includes\stacks\classic_blog.txt
• includes\stacks\fashion.txt
• includes\stacks\sport.txt
• includes\stacks\tech.txt
• includes\stacks\video.txt
• includes\wp_booster\wp-admin\panel\td_panel.php
• includes\wp_booster\wp-admin\panel\td_view_panel.php
Deleted files – 32 files
• images\icons\social\sprite\style1-16.png
• images\icons\social\sprite\style1-16@2x.png
• images\icons\social\sprite\style1-32.png
• images\icons\social\sprite\style1-32@2x.png
• images\icons\social\sprite\style1-64.png
• images\icons\social\sprite\style1-64@2x.png
• images\icons\social\sprite\style2-16.png
• images\icons\social\sprite\style2-16@2x.png
• images\icons\social\sprite\style2-32.png
• images\icons\social\sprite\style2-32@2x.png
• images\icons\social\sprite\style2-64.png
• images\icons\social\sprite\style2-64@2x.png
• images\icons\social\sprite\style3-16.png
• images\icons\social\sprite\style3-16@2x.png
• images\icons\social\sprite\style3-32.png
• images\icons\social\sprite\style3-32@2x.png
• images\icons\social\sprite\style3-64.png
• images\icons\social\sprite\style3-64@2x.png
• images\icons\social\sprite\style4-16.png
• images\icons\social\sprite\style4-16@2x.png
• images\icons\social\sprite\style4-32.png
• images\icons\social\sprite\style4-32@2x.png
• images\icons\social\sprite\style4-64.png
• images\icons\social\sprite\style4-64@2x.png
• includes\stacks\demo_classic_blog.txt
• includes\stacks\demo_fashion.txt
• includes\stacks\demo_sport.txt
• includes\stacks\demo_tech.txt
• includes\stacks\demo_video.txt
• includes\wp_booster\wp-admin\panel\td_panel_start.php
• includes\wp_booster\wp-admin\panel\td_view.php
• includes\wp_booster\wp-admin\panel\td_view_import_category.php
by tagDiv 2014 🙂 | http://tagdiv.com | Our portfolio

simchris
tagDiv Member

I don’t think the “page navi plugin” will work with the home page when “blocks” are used, as it doesn’t use the latest story “loop” (blog style “latest postsloop), so it can’t figure out what stories to show on second page.

  • This reply was modified 11 years by simchris.
gouravgola
tagDiv Member

@lucian thanks for responding, can you please elaborate this process?
as far from your above point, i understood these things:
1. go to setting>visual composer> myshort codes ? is it how to generate short codes? but what should i add there to generate code there? i want to add content.ad widget php code.

2. then add <?php echo do_shortcode(‘[]’);?> to loop-single.php like this:
<?php echo $td_mod_single->get_social_sharing_bottom();?>
<?php echo $td_mod_single->get_next_prev_posts();?>
<?php echo do_shortcode(‘[]’);?>
<?php echo $td_mod_single->get_author_box();?>
<?php echo $td_mod_single->get_item_scope_meta();?>
</footer>

as i want my widget to show up just below nest prev navigation?

is this the way you are saying?
if yes then please tell me how to generate short codes and how to use them in details, that would be really great help for those who are new to wordpress!

thank you!

Lucian
tagDiv Staff

Hi,

You can edit the loop-single.php file and remove the feature image like this: http://screencast.com/t/ZrBeyueDPv
Do the same for other post types also and leave it enabled just for post template 3.
For the title issue with video posts please use this custom css: http://screencast.com/t/9hplmCY0

.single-format-video.single_template_3 header{
position: relative;
}

.single-format-video.single_template_3 .post header .entry-title {
color: #222222;
margin: 10px 0px 20px 0px !important;
}

.single-format-video.single_template_3 .post .td-image-gradient:before {
display: none;
}
.single-format-video.single_template_3 .td-post-header-full {
background-color: transparent;
}

.single_template_3 .td-post-header-full .meta-info {
margin-left: 0px !important;
}

Thanks

  • This reply was modified 11 years by Lucian.
Emil G
tagDiv Staff

Hi,

You have to edit the loop.php file, add a counter and a condition to place an ad after 2 posts and 10 posts, here is an example – http://pastebin.com/fF410fGD

Result – http://screencast.com/t/f1vjHFTX

Thank you, Emil G.

Lucian
tagDiv Staff

Hi,

You can make a new page using the “homepage – with articles list” template then customize the loop (latest articles) section as you like and also set it to show only the category you want, number of posts, sort order.. etc, like this: http://screencast.com/t/ZwmSWxchDhu then set it as your blog page “WP->Settings->Reading->Posts Page.”

Thanks

ned4spd8874
tagDiv Member

Can someone please clarify how to replace the current share buttons with this one? I disable the themes sharing capabilities, but the only way I can get it to show is to add this to the bottom of the loop-single-1.php, loop-single-2.php, etc. files in the footer section. This puts it just above the comment section. I’d like to to be higher than that, right after the post content. The only way I can find to do this is to edit the post and add it to the bottom.

This won’t work however since I have thousands of posts. Where can I put this so it’s automatically inserted in that location?

rjohansen
Participant
#0

Hi. Does anyone now of the easiest way to shop pages on the front page, on categories and more? Just like normal posts?

I know of the plugin “Page Links To” which can work as a workaround by also posting those pages that I want to be posted as “posts” with the same name etc. However, It takes too much workaround, and I am concerned about SEO effect of that.

What I would like is that when you select what kind of posts you would like to display (like with the Homepage Loop Filter) you could also choose “Children of Page” or something similar. I see that there is an option to choose “Post Type” – but can’t figure out how this would work?

techmarketnow
tagDiv Member

Thank you Lucian for your reply. It works. But, only issue I see now is, numbered pagination is gone after I replacing the page-homepage-loop.php code provided by you. Can you please help me to put the numbered pagination under recent posts? Also, is it possible to put the numbered pagination for the page builder content too?
Thank you

Lucian
tagDiv Staff

Hi,

You need to add posts into your featured category as the slider from the “homepage – bg – loop” template which you are also using displays the posts from the featured category.
You can also edit the page-homepage-slider.php file and change this sorting option from there. You can read more about this here: https://forum.tagdiv.com/topic/big-slider-2/
Also noticed that you have some issue with the banner on your homepage, use this css to fix that: http://screencast.com/t/4KjlFgZXs

.header-content-rec .td-g-rec-id-header {
margin-bottom: 45px;
}

Thanks

pierrethenot
tagDiv Member

Hi Lucian,

I finally found the main issue after many experimentations.
It’s related to the new DISQUS comment plugin version, when coupled with the comments above featured articles. https://forum.tagdiv.com/topic/move-comments-above-similar-articles/
I moved the comment section and it worked great for a while, but when I updated the Disqus plugin, I had blank pages on new posts and pages…
It’s weird because it works on older posts. The only way to make it work on the new posts/pages is to delete the comment section I set up in loop-single.php. I can however create a post, then add the new comment section in loop-single.php and it will work as it’s already posted (if that makes sense?).
It’s clearly a problem with Disqus because if I preview a post, it’s giving me the standard comment system, not Disqus. Though it gives me Disqus comment system in preview for older posts
I might need to get an older version of Disqus now.
Do you know if we can change some codes to make it work with the comment section above featured images w/ the updated version of Disqus, as it brings better security feature, I’d like to keep it.

Lucian
tagDiv Staff

Hi,

You need to edit the functions.php file to add that function for category posts.
The category template is category.php file which use the loop.php file.
You can read here more about the default values: http://codex.wordpress.org/Template_Tags/wp_list_categories

Thanks

Lucian
tagDiv Staff

Hi,

You could set the featured image on from theme panel and remove this code from loop-single-2.php file, like this: http://screencast.com/t/EQsQnHXCFt
This will remove the featured image only for posts that use template 2 style.

Thanks

TheMediumUTM
tagDiv Member

This is what my solution in functions.php looks like (adapted from a stackoverflow thread). It looks like this: http://themedium.ca/arts/visual-studies-art-through-snail-mail

I removed the icon code here because you don’t have the assets or the CSS on your end, but if you want it, just ask.

// Show captions on template 4
// adapted from stackoverflow.com/questions/13850313/how-to-add-a-featured-image-caption-in-wordpress

function get_template4_caption($post) {
	$thumbnail_id    = get_post_thumbnail_id($post->ID);
	$thumbnail_image = get_posts(array('p' => $thumbnail_id, 'post_type' => 'attachment'));
	
	if ($thumbnail_image && isset($thumbnail_image[0]) && $thumbnail_image[0]->post_excerpt) {
		return '<div class="template_4_caption"><span class="td-block-author"> . $thumbnail_image[0]->post_excerpt .'</div></span>';
		}
}

In order to have it below the image, the function is called in single_template_4.php in each of the three sidebar cases, e.g. the last line here:

    <?php
    // we check the sidebar position and for each one we have a different case
    switch ($loop_sidebar_position) {
        default: // sidebar right - the default sidebar position
            echo td_page_generator::wrap_start();
            ?>
                <div class="span8 column_container td-post-content" role="main" itemprop="mainContentOfPage">
                <?php echo get_template4_caption($post); ?> <!-- new -->

Note that you might still want to add some CSS styling for template_4_caption or whatever classes you choose to use, e.g. some margin-top to distance it from the image.

If you wanted it on the image like the rest of the meta info, you would have to adjust this placement and the styling.

Lucian
tagDiv Staff

Hi,

You need to edit the single.php file and “cut” this line: comments_template('', true); …form each case and add it in loop-single.php file before the related posts section like this: http://screencast.com/t/SyKDPkfHfV
Result: http://screencast.com/t/5lQWaad4
Note that if you want to have this on other post templates than default you have to make this changes to other templates also.
Is dose the same for the default comments, to which you refer, in the screen from the result it’s the disqus comments plugin that it’s why it looks like that: http://screencast.com/t/uTpHnl8BIDxL

Thanks

Lucian
tagDiv Staff

Hi,

I believe you refer to block 10 spacing between heading, you can use this css to reduce that: http://screencast.com/t/KkA8ndC3
For the comments template you need to edit the single.php file and “cut” this line: comments_template('', true); …form each case and add it in loop-single.php file before the related posts section like this: http://screencast.com/t/SyKDPkfHfV
Result: http://screencast.com/t/5lQWaad4
Note that if you want to have this on other post templates than default you have to make this changes to other templates also.

Thanks

mm-2
tagDiv Member

Thank you for a quick response, but I’m getting only “less than a minute” result on all my posts (see the screenshot). I’ve added the same code to my loop-single.php file and it works just fine there. I’m using the https://wordpress.org/plugins/estimated-post-reading-time/ plugin to output the est. reading time. I’m not using any caching plugins.

Any clue as to why it’s not displaying properly? You can check it out at http://matijaculjak.com

Screenshot: http://i.imgur.com/pxvJb5L.png

Regards,

  • This reply was modified 11 years by mm-2.
  • This reply was modified 11 years by mm-2.
Lucian
tagDiv Staff

Hi,

Please add this function is_home() like this in loop.php file: http://screencast.com/t/YFkhYo7wvH3 This will add the custom ad 1 between latest articles post on homepage also.

Thanks

mm-2
Participant
#0

Hello,

I’m trying to add the following code to my homepage but with no luck:

<?php echo do_shortcode(' | vrijeme čitanja: < [est_time]');?>

So, the idea is to add the estimated reading time to the homepage posts loop right after the post title and date published. I’m using Page Builder – with title template & Block 6 in Visual Composer. Any idea how to get this done?

Regards,

simchris
tagDiv Member

Likely you would go into the loop file for the template you’re using;

e.g., loop-single1.php

comment out or remove this

<?php echo $td_mod_single->get_date(false);?>

Not sure if that is what you want …

dhvanesh
Participant
#0

How can I remove date time stamp from entire theme? I don’t want Google to show date in its search result.

I tried following code in functions.php:

/* Start of Remove Date TimeStamp from blog posts */
function remove_post_dates() {
add_filter(‘the_time’, ‘__return_false’);
add_filter(‘get_the_time’, ‘__return_false’);
add_filter(‘the_modified_time’, ‘__return_false’);
add_filter(‘get_the_modified_time’, ‘__return_false’);
add_filter(‘the_date’, ‘__return_false’);
add_filter(‘get_the_date’, ‘__return_false’);
add_filter(‘the_modified_date’, ‘__return_false’);
add_filter(‘get_the_modified_date’, ‘__return_false’);
add_filter(‘get_comment_date’, ‘__return_false’);
add_filter(‘get_comment_time’, ‘__return_false’);
}
add_action(‘loop_start’, ‘remove_post_dates’);
/* End of Remove Date TimeStamp from blog posts */

However, it resulted in weird Jan 1, 1970 date in Google search snippet as shown in below screenshot:

I want to remove date time stamp as shown below screenshot:

http://www.wpsquare.com/wp-content/uploads/2012/07/remove-date-timestamp-google-search-results.png

Please help.

tenocation
tagDiv Member

Thanks a lot Lucian. It’s really helpful for me but i was looking for a way to add Custom Post type Template only.

A Template that is called by a custom post type only not inside posts. I just need to copy single-loop-1.php for my Custom Post type “phones”. I will then add little shortcodes to that template.

Now if i copy the contents of single-loop-1.php to single-phone.php it’s not working. May be i can add in some different way so that it start working.

Thanks a lot.

monicacortes
Participant
#0

Hello,
We have created a homepage with a slider where we are showing some featured posts. But the posts shown in the featured loop slider are not showed down, in the categories blocks. Is there anyway to show them in the slider but in the blocks too? Maybe some readers don’t pay attention to the slider.

Thank you in advance.

Juan.

Viewing 25 results - 1,651 through 1,675 (of 1,749 total)