Hi
I have modified a Module 8 child to pull through custom fields. The code is –
<?php
class td_module_8 extends td_module {
function __construct($post, $module_atts = array()) {
//run the parrent constructor
parent::__construct($post, $module_atts);
}
function render() {
ob_start();
$title_length = $this->get_shortcode_att(‘m8_tl’);
$modified_date = $this->get_shortcode_att(‘show_modified_date’);
///print_r($this->post->ID);
$choosen_post_functionality = get_field( “choose_post_functionality”, $this->post->ID );
// For Element One
$title_lo = get_field( “title_lo”, $this->post->ID );
$title_link_lo = get_field( “title_link_lo”, $this->post->ID );
$media_name_lo = get_field( “media_name_lo”, $this->post->ID );
$media_link_lo = get_field( “media_link_lo”, $this->post->ID );
$publish_date_lo = get_field( “publish_date_lo”, $this->post->ID );
//$abstract_excerpt_lo = get_field( “abstract_excerpt_lo”, $this->post->ID );
$abstract_excerpt = get_post_field(‘post_content’, $this->post->ID);
// For Element Two
$title_lt = get_field( “title_lt”, $this->post->ID );
$title_link_lt = get_field( “title_link_lt”, $this->post->ID );
$author_name_lt = get_field( “author_name_lt”, $this->post->ID );
$media_name_lt = get_field( “media_name_lt”, $this->post->ID );
$publish_date_lt = get_field( “publish_date_lt”, $this->post->ID );
$citations_title_lt = get_field( “citations_title_lt”, $this->post->ID );
$citations_link_lt = get_field( “citations_link_lt”, $this->post->ID );
//$abstract_excerpt_lt = get_field( “abstract_excerpt_lt”, $this->post->ID );
?>
<div class=”<?php echo $this->get_module_classes();?>”>
<?php if($choosen_post_functionality == “ext_lo_one”) { ?>
<div class=”item-details”>
<?php //echo $this->get_title($title_length);?>
<h3 class=”entry-title td-module-title”>” rel=”bookmark” title=”<?php echo get_the_title( $this->post->ID );//$title_lo; ?>”><?php echo get_the_title( $this->post->ID ); //$title_lo; ?></h3>
<div class=”td-module-meta-info”>
<?php //if (td_util::get_option(‘tds_category_module_8’) == ‘yes’) { echo $this->get_category(); }?>
<?php //echo $this->get_author();?>
<span class=”td-post-author-name”>“><?php echo $media_name_lo; ?> <span>-</span> </span>
<?php //echo $this->get_date($modified_date);?>
<span class=”td-post-date”><time class=”entry-date updated td-module-date”><?php echo $publish_date_lo; ?></time></span>
<div class=”td-post-content” style=” margin-top: 5px; “><?php echo $abstract_excerpt; //$abstract_excerpt_lo; ?> </div>
<?php //echo $this->get_comments();?>
</div>
</div>
<?php } elseif($choosen_post_functionality == “ext_lo_two”) { ?>
<div class=”item-details”>
<?php //echo $this->get_title($title_length);?>
<h3 class=”entry-title td-module-title”>” rel=”bookmark” title=”<?php echo get_the_title( $this->post->ID ); ?>”><?php echo get_the_title( $this->post->ID ); ?></h3>
<div class=”td-module-meta-info”>
<?php //if (td_util::get_option(‘tds_category_module_8’) == ‘yes’) { echo $this->get_category(); }?>
<?php //echo $this->get_author();?>
<span class=”td-post-author-name”><?php echo $author_name_lt; ?> <span>-</span> </span><br /><br />
<span class=”td-post-author-name”><?php echo $media_name_lt; ?> <span>-</span> </span>
<?php //echo $this->get_date($modified_date);?>
<span class=”td-post-date”><time class=”entry-date updated td-module-date”><?php echo $publish_date_lt; ?></time></span>
<span style=” display: block;margin-top: 5px; margin-bottom: 5px;” class=”td-post-author-name”>“><?php echo $citations_title_lt; ?> <span>-</span> </span>
<div class=”td-post-content” style=” margin-top:5px; “><?php echo $abstract_excerpt; ?> </div>
<?php //echo $this->get_comments();?>
</div>
</div>
<?php }else { ?>
<div class=”item-details”>
<?php echo $this->get_title($title_length);?>
<div class=”td-module-meta-info”>
<?php if (td_util::get_option(‘tds_category_module_8’) == ‘yes’) { echo $this->get_category(); }?>
<?php echo $this->get_author();?>
<?php echo $this->get_date($modified_date);?>
<?php echo $this->get_comments();?>
</div>
</div>
<?php } ?>
<?php echo $this->get_quotes_on_blocks();?>
</div>
<?php return ob_get_clean();
}
}
However, the gap between the repeating modules is too large as is the columns, see https://www.infowebpublishing.com/home-2/. Also I would like the dividing line to be solid and black.
Any guidance/help appreciated.
Thanks
Gary
Hi,
I think that you can use a custom css -> https://tagdiv.com/how-to-create-custom-code-in-newspaper-theme/
Unfortunately I do not have access to your website -> https://www.screencast.com/t/lK8jo04eqAvQ
Thank you!
Hi Calin
Apologies about the web site but it’s all sorted now. However, I am confused about the new Envato-compliant version of Newspaper 9.7.2 and the use of child themes.
Given I have modified module 8 and the corresponding CSS where does this now sit in terms if a child theme, as the related block/module includes has moved to a “legacy” folder within wp-content>plugins etc.
This seems to me that I cannot create a child and my customised block will be overwritten each time their is an update.
Is this the case? If so, how do you recommend getting around this?
Thanks
Best
Gary
Hi,
Most of the theme files were moved into the tagdiv composer plugin as per the requirements of envato: https://help.author.envato.com/hc/en-us/articles/360000472383-WordPress-Theme-Requirements.
We wrote an article on the subject here: https://tagdiv.com/updating-the-core-of-tagdiv-themes/
Moving forward with such requirements, a child theme will only work with functions.php, and style.css as there are very few files left in the main theme as envato requires all functionality to be added through plugins.
What you can do is to make pages using flex blocks in this way you can achieve what you make in child theme (
and is no more need to use child theme ), because flex blocks have more options and customization.
Sorry for the inconvenience and thank you for understanding.
Hi Calin
Thanks for getting back to me. I would indeed prefer to use Flex Blocks.
If you go here now, https://www.infowebpublishing.com/ you will see where I have got to with the Block 9/Module 8 combination but I can’t work out where to place the above custom php/CSS into a Flex Block. I think Flex 4 is the best option.
Any help would be appreciated. Happy to give you Admin access.
Have a good International Workers Day.
Best wishes
Gary
Hi,
All you need to do is to play a little with the settings that the flex blocks have, for example
-> https://www.screencast.com/t/PHx3wmK6H
-> https://www.screencast.com/t/ThVhyKXZmw
-> https://www.screencast.com/t/fnn0oXF1Hnq6
For hover -> https://www.screencast.com/t/amqclEUt
-> https://www.screencast.com/t/Qg3bv2DPk3
After you do all those settings you can save the flex block as an element -> https://www.screencast.com/t/xx2lqyMe after that you can reuse that block with the settings you made.
Hope this will help you!
Thank you!