- NewspaperWP Rocket and Newspaper Theme: Optimization Guide
- TutorialsFrom WPBakery to tagDiv Composer
- TutorialsOffset Feature
- TutorialsWhat is Ajax preloading?
- TutorialstagDiv Social Counter Tutorial
Hello,
i have created two custom blocks. I want to use them inside a “Module cloud template” to render items in a “Flex Loop Builder”
I used de td-api-plugin. I can drag and Drop de block inside de tag div editor but something is not working. I can save de “module template” the first time but when i edit again it returns an ERROR “Errors at columns elements: 1(models) : 0(dom). The model does not match the content Current state has involved an issue. You could try an UNDO operation (CTRL+Z / CTRL+SHIFT+Z)”
What i am doing wrong?
This is how i add the api block (it has no parameters, all is coded into de file that renders the module -> td_video_empresa.php):
td_api_block::add('td_video_empresa',
array(
'map_in_visual_composer' => false,
'map_in_td_composer' => true,
"name" => 'Mòdul Video Empresa',
"base" => "td_video_empresa",
'tdc_category' => 'Modules elements',
'file' => $this->plugin_path . '/modules/td_video_empresa.php',
"params" =>
array_merge(
td_config::get_map_block_general_array()
)
)
);
This is the file that renders the block -> td_video_empresa.php
class td_video_empresa extends tdb_module_template_part {
function render( $atts, $content = null ) {
/* -- Call the parent render method -- */
parent::render($atts);
/* -- Retrieve the module post data -- */
$post_obj = self::$post_obj;
$post_type = null;
$postID=$post_obj->ID;
$url_video=get_field("url_video_empresa",$postID);
$video_extern=get_field("link_finestra_nova",$postID);
$logo=get_post_thumbnail_id($postID);
$linkEmpresa=get_permalink($postID);
$tituloEmpresa=$post_obj->post_title;
$string="";
$string.=renderVideo($url_video,220,$tituloEmpresa,$postID);
$string.='<div class="modul-caixa" >';
$string.='<h3 style="margin:0px;">'.$post_obj->post_title.'</h3>';
$string.='</div>';
return $string;
}
}
Two questions:
1) Is there a way to set one photo as the featured image, which, when clicked, shows a different photo? I have an upcoming article that will include a graphic image, so I’m looking for a non-graphic image with a statement giving a graphic warning, and to click if the viewer wants to see it.
2) Is there a way that if there is no featured image, to not show any kind of image in the flex grids?
Hi,
That element is a posts loop (https://prnt.sc/JkGvT-YJ4lwx), and it’s a special element different from the rest of the blocks. This one has an automatic filter—there are no manual filters like on the other elements. So, if you want a filter that you can set yourself, you’ll need to use a Flex Block 1, which can be configured for the exact layout you want.
I’ve just set up the Flex Block 1 for you. You can check it and set the filters as you need.
I’m using the WP Obituary plug-in but I can’t edit the page the way I want. I’ve read this plug-in generates an obituaries page dynamically but I thought there might be a shortcode or something I could use. Is there a shortcode for it?
I want to be able to control the number of obituaries on each row, enable pagination and of course be able to customize the page with some contact information should someone wish to place an obituary on our site. I added a Flex Block 4 but when there doesn’t seem to be a category that corresponds to obituaries. Please help. Thank you.
Hi,
The post loop elements are special blocks that are used on pages for layouts and on cloud templates. Those are special because on cloud templates those are displaying the articles related to teh template where we are set. For example, if it is set on a cloud category template, even if the post loop element does not have a filter, it will automatically filter the correct output for each category in the part using that cloud category template.
If you like the liberty to set teh filter, use the flex blocks and grids, not the post loop element.
Thank you!
Hi,
Thank you for screenhost.
1. You have a flex block and you have set a negative top margin for meta info https://webccenter.com/ruralnet/wp-content/uploads/temp/bottom-align.jpg so all info from meta will startfrom the position you have set it (-265px). What I will recommend is to replace the element with a grid, use the big grid flex 1 – https://prnt.sc/x790b8oOr1wJ
2. https://webccenter.com/ruralnet/wp-content/uploads/temp/carousel_scrool.jpg There is only the option for load more button https://prnt.sc/UvVDdHcAcOS5
3. The problem with the next prev icons is related to some css that is apply onver the theme icons https://prnt.sc/t29087sxYucr if is not a custom css added to set the font family, then check the seeting relate dto teh pagination on that block with tagDiv Composer.
Hi,
If you are referring to this section – https://prnt.sc/jYhWE0YHJwiC, then you need to know that it is not coming from the theme, which is added by an extra plugin, I think it is from the Jetpack plugin – https://jetpack.com/support/related-posts/
You can also use the theme option for this, edit the single post template with tagDiv Composer, add a flex block and in the filter set it to filter the articles after single-related by category https://prnt.sc/On9kJ6e0-1Zs
Hi,
Yes, this is possible, but it will be need to create your own module with the module builder and set it on pages using teh Flex Block Builder. Create the layout as you want for your module and use the element Module Categories/Taxonomies, this element can display categories, taxonomies, and tags.
Hi,
If there is no offset set on the block and it is set to display the latest articles from all categories, then the remaining option that should be checked is if the page has the option for unique articles enabled https://forum.tagdiv.com/unique-articles/ –
Thank you!
Hi,
I understand. What I propose is to provide a link to your website where the created module (the one you already have) is used, and, if possible, another link where the results appear without the featured image. I will then create a JS code that will apply to the Flex Builder. This approach will be better because, right now, the featured image element has a placeholder thumbnail that is used if no image is set. As a result, this placeholder is displayed even when there is no featured image for the article.
Hi,
You need to edit the homepage with tagDiv Composer – https://prnt.sc/b_HRIcEh7iFn select the block https://prnt.sc/tkOC0pBivvni if the first block has the offset 1, this means the second block should have the offset 2, not 1 like the previous block – https://prnt.sc/R-2I3tG3Uf2I (I made the settings for that block, so now it is no longer repeating the article).
You can check how the offset option is working in our guide – https://prnt.sc/tVmyfeYot-M9 https://forum.tagdiv.com/flex-block-settings-guide/ https://prnt.sc/sm1RPzboyr5o
Hi,
If you are referring to the css like this one https://prnt.sc/sxZwwzUPfeqM, thsi si teh css set for the block to have the current layout. Each flex block has a style code. If you want, you can use the theme panel settings for inline css https://prnt.sc/ZzPfXCamqePY
Thank you!
Hi,
For this, you can use the offset option, for the second block, set the offset 1 https://prnt.sc/yH09rsqZE-61 -> https://prnt.sc/tVmyfeYot-M9 https://forum.tagdiv.com/flex-block-settings-guide/ https://prnt.sc/sm1RPzboyr5o
Hi,
Right now, I see that you have the tagDiv Mobile theme plugin and the mobile design looks like this – https://prnt.sc/b6LFUiQXd6Pa. To have the layout from your image, please disable the tagDiv Mobile Theme plugin and delete it, the responsive version will be used.
Now using tagDiv Composer, you can edit teh template and select the mobile viewport. There, you can adjust the flex block layout per viewport – https://prnt.sc/rgELtvkC6oPS
Thank you!
NEWSPAPER – VERSION: 12.7.5
new: External image support for Image info box;
new: Load more option(ajax) to Categories/tags list shortcode;
new: Custom no post message on all Flex blocks;
new: Popular taxonomy option to Popular category shortcode;
new: Category siblings option to hide all the categories when no siblings;
You rock, team. Such a welcome addition, already implemented and working great.
Have a lovely weekend!
Dear Calin,
I have a question about the mobile template:
On the website, we have the category Interview https://aafpress.ge/?cat=16 (template Z Category – Interview), we use 2 “Flex box 1” with post number 1 and 2.
Here are the screenshots: for desktop https://prnt.sc/iTaOTd-IF7mo and for mobile https://prnt.sc/Z1_CP0PB_qh2
For another category aaf-media https://aafpress.ge/?cat=15 (Z Category – media), we use only one “Flex box 1” with post number 3.
Here are the screenshots: for desktop https://prnt.sc/u6zlTZt0VkUw and for mobile https://prnt.sc/Ua3fH2LPaSj_
I don’t like the last one for the mobile version (with 3 posts) and would like to change it, as in the Interview category https://prnt.sc/Z1_CP0PB_qh2 , but keep the desktop templates for both categories.
What should I change? May I keeping the design, use two “Flex box 1” with post numbers 1 and 2, instead of one “Flex box 1” with post number 3.
How may I do it?
Or what could you recommend to me?
Best regards
Hi,
If you want to display the articles from subcategories of a parent category, there are 2 methods:
1. Display articles from all subcategories except the main category, set the main category in the filter of the flex block and exclude the parent category – https://prnt.sc/0ME1PVUO-2gT
2. Display only articles from desired subcategories, for this use the Multiple terms filter: and set the subcategories ID separated by commas – https://prnt.sc/JyPa2vpPzJBu
– https://forum.tagdiv.com/flex-block-settings-guide/
Hi,
This can be done, but it is not entirely automatic. Our team uses cloud templates from tagDiv Cloud Library, and those can be edited using tagDiv Composer so you can add and remove elements from templates and pages.
Now, if you want to create a gallery that can be displayed instead of featutred image in blocks on pages, categories and/or inside the arrtocle then you can use the gallery article option from the article added by the theme – https://prnt.sc/2fFad7Cl5Qpz on the single post template use tagDiv Composer to edit it and replace the featured image with the gallery element https://prnt.sc/eTe7lwwEyMQN https://prnt.sc/OyfMaAWxeAhX
To display the gallery on blocks, you need to create a module and use the gallery element instead of the featured image. Then, where you want it to be displayed, use the flex block builder and select that module
Hi,
Unfortunately, I can’t see the site; it is in construction mode.
What I recommend is to check the following settings:
– make sure you have articles in the new categories
– check on the block to not have set an offset to skip a number of articles – https://prnt.sc/RMeb1xUgzhh2 https://forum.tagdiv.com/flex-block-settings-guide/
– another option that should be checked is the unique article option https://forum.tagdiv.com/unique-articles/
Thank you!
Hi,
This depends on the elements used there, I think it is the flex block with title template 15, so you can try this css:
.page-id-5100 .td_block_template_15 .td-block-title {
margin-bottom: 12px;
}
If you need it apply on global you can use this will apply on all elements taht have the title template 15
body .td_block_template_15 .td-block-title {
margin-bottom: 12px;
}
Thank you!
yeah i tried by deactivating the litespeed plugin. after that everything was working fine. thanks
One more question. can we reduce this space? – https://prnt.sc/0Jj-_E2ioNqI
using flex block 1
Hi,
The mentioned theme files are free and are provided with the theme. Those can be installed from Newsapper > plugins > dedicated plugins for prebuilt websites (those were made for a few demos we provided before the theme compatibility with the ACF plugin to be at the level it is today – https://forum.tagdiv.com/introduction-cpt-acf-newspaper-theme/ , using those plugins means to make the edits inside the plugin’s files – https://forum.tagdiv.com/edit-modules-flex-block-x/).
Now my recommendation is that you can use the acf plugin to create the CPT’s, taxonomies, and custom fields you want to have, then you can use the module builder to create the blocks you want to have and Cloud templates to create the templates for your taxonomies and CPTs – https://forum.tagdiv.com/custom-post-type-support/
Thank you!
Hi,
You need to use tagDiv Composer, edit the homepage, then select the block you want to edit. In the filter tab, you’ll have the options to set a category or the IDs of the categories you want to display. Also, you have the option to sort the results. In the general tab, you’ll have the option to set the number of results – https://forum.tagdiv.com/flex-block-settings-guide/
Now checking your site, it appears that you have the flex block 2, and this is using next prev ajax pagination, so this is not quite a slide, so the next prev pagination can not be set. How many times can it be used /load articles, it will be used as normal pagination until all articles that are set in the filter will be loaded.
Hi,
What you should check is the offset from the blocks. When an offset is set, this will skip that number of articles – https://prnt.sc/f1ngsuJAHQPR. If you have a number set and you do not want any offset to apply to that block, just remove the number and let the field be empty. For more details you can check our guide – https://forum.tagdiv.com/flex-block-settings-guide/ https://prnt.sc/Ewxgk6ZSvnvk
Hi Alex,
I see so in the end the problem is related to the Rocket option that remoe teh unused CSS. Without this option is possible that the pagespeed to get lower with a few points
You can contact us via email at contact@tagdiv.com and we’ll do our best to help you.
What I can recommend is to use those exclusions for Remove Unused CSS:
(.*)#td-mobile-nav(.*)
(.*).td-mobile-container(.*)
.td-mobile-close
.td-mobile-content(.*)
(.*).td-menu-background(.*)
(.*).td-search-background(.*)
(.*).td-search-wrap-mob(.*)
.td-search-close
.td-ajax-search-flex(.*)
(.*).td_module_flex_1(.*)
Another thing that can be used with that option is the plugin WP Rocket | Exclude Inline Styles from Remove Unused CSS plugin.
I hope this will help you!