Thanks for this.
Where is the megamenu post order currently from? ie. Newest / ASC? Where in the theme files is this code so I can maybe customise it to ‘rand’ or similar?
Thanks in advance
D’oh! Just didn’t scroll far enough!! Thanks for your patience : )
Hi. Thanks for your reply. Yes, I have that set but it only show excerpts under the top two images. The smaller images below have a title then a blank area where the excerpt should be?
First block HERE
OK. Thanks.
I’ve managed to get pretty much what I wanted out of Flexbox 4.
However, the excerpt only appears under the two main images and not the smaller images below. Is there a way to get the excerpt to appear with all the posts?
Hello.
I’ve think I’ve solved this. Or at least got a good enough workaround.
I set max-height to 500px rather than 100%. This means the sub menus fit to size under 500px height then introduce a scrollbar if the menu items are more than this.
This works OK for me so far.
Thanks all the same
Just as a follow up on this, if anyone else wants to do the same thing:
To ‘fake’ a sticky post in the mega menu (make specific posts always appear first in the mega menu), this is part of my workaround;
Create a post with a far future publish date (I used year 2500) but using the code above in functions.php to publishes it rather than scheduling.
This post then appears first in megamenu in date order.
I then had to place the ‘post masonry grid’ within this post via VC so it acted like a category. The post grid element for VC allows you to select a category for the post grid. Once set, I also had to exclude the main post I created from the grid as it was displaying code in the excerpt; some sort of odd ‘post in a post’ loop.
I actually wanted 4 specific posts to always display in the mega menu so I adjusted the far future date of each by a year so they would always appear first and in order.
Hope this might interest someone else.
Not perfect, but it does what I needed.
Thanks, Simion
That’s exactly what I have done and you’re suggestion worked. Thanks.
I posted another question about having sticky posts in the mega menu.
As this wasn’t possible, this is part of my workaround;
To have a post with a far future publish date but using a plugin that publishes it rather than scheduling. This post then appears first in megamenu in date order. I then had to place the post masonry grid within this post via VC so it acted like a category.
Not perfect, but it does what I needed.
Thanks very much for your help again. Your support is excellent and I’m very grateful.
Perfect : ) Thanks very much
OK. It would be good to have this feature in your theme.
However, I had an idea for a workaround, which was to set the date of the ‘sticky’ post to a date a long time in the future so it’s always the newest.
However, by default, wordpress then makes this a scheduled post.
So, I found this piece of code to over-ride that and publish it now:
//make future post date visible now
function onetarek_prevent_future_type( $post_data ) {
if ( $post_data['post_status'] == 'future' && $post_data['post_type'] == 'post' )#Here I am checking post_type='post' , you may use different post type and if you want it for all post type then remove "&& $post_data['post_type'] == 'post'"
{
$post_data['post_status'] = 'publish';
}
return $post_data;
}
add_filter('wp_insert_post_data', 'onetarek_prevent_future_type');
remove_action('future_post', '_future_post_hook');
This does what I need it to. Thanks all the same
-
This reply was modified 7 years by
3ftDeep.
Thanks for the reply.
What would I need to change in what file. I’m willing to take a look.
Thanks very much in advance.
Thanks. But I don’t have the ‘custom fields’ option to tick?
Hi Simion. Thank you so much for this.
I got it working : )
I couldn’t get your code to work but it was this, from your code, that helped:
,$this->post->ID); ?>
So, this is the code that worked:
<?php $universitylogo = get_field( 'universitylogo',$this->post->ID); ?>
<?php if ( $universitylogo ) { ?>
" alt="<?php echo $universitylogo['alt']; ?>" />
<?php } ?>
The field in ACF was set to ‘image’ then select ‘image array’
In the general ACF field settings it was ‘post type’ equal to ‘post’
Thanks so much for your help. You are a genius : )
Just one more question. You mentioned this in the other post you linked to.
https://www.screencast.com/t/7wBdSz3a9
Where are these custom fields found? I don’t have them on any post page. I’ve also checked the screen options, in case it was hidden but it’s not there either?
Don’t worry about this. I got the custom fields logo working : )
Here: https://forum.tagdiv.com/topic/add-additional-fields-to-posts-in-category-grid/
Is there any other way to force a specific post to always be first?
Are you able to test acf with this theme at all? I’m sure my code is OK. It’s just not registering the field.
Maybe try to get an image added in an acf field in a post to display in td_module_flex_1.php like I’m trying to do?
It would really help if you can confirm it works or not. Or add any field and let me know how you did it.
Alternatively, it is possible to add my own custom fields to the theme and include them in flex_1? Like you have ‘source’ or ‘via’ ?
Thanks again in advance.
OK. Thanks. But, from what you see I’m trying to do, it should work, right? I’ve not used custom fields before. I just need to know I’m going in the right direction.
Sorry. The link above has changed to this:
http://whystudyhere-com.sites.stackstaging.com/wsh-homepage/
-
This reply was modified 7 years by
3ftDeep.
Hi again. I’m having trouble getting this to work. Are you able to help at all?
I’ve created a custom filed in ACF for adding an image.
I’ve then opened the module I’m using – td_module_flex_1.php
Then added the field code like this:
<?php
class td_module_flex_1 extends td_module {
function __construct($post, $module_atts = array()) {
//run the parrent constructor
parent::__construct($post, $module_atts);
}
function render() {
ob_start();
$hide_image = $this->get_shortcode_att('hide_image');
$image_size = $this->get_shortcode_att('image_size');
$category_position = $this->get_shortcode_att('modules_category');
$btn_title = $this->get_shortcode_att('btn_title');
$title_length = $this->get_shortcode_att('mc1_tl');
$author_photo = $this->get_shortcode_att('author_photo');
$excerpt_length = $this->get_shortcode_att('mc1_el');
$excerpt_position = $this->get_shortcode_att('excerpt_middle');
if (empty($image_size)) {
$image_size = 'td_696x0';
}
if (empty($btn_title)) {
$btn_title = 'Read more';
}
$excerpt = '<div class="td-excerpt">';
$excerpt .= $this->get_excerpt($excerpt_length);
$excerpt .= '</div>';
?>
<div class="<?php echo $this->get_module_classes();?>">
<div class="td-module-container td-category-pos-<?php echo $category_position; ?>">
<?php if( $hide_image == '' ) { ?>
<div class="td-image-container">
<?php if ($category_position == 'image') { echo $this->get_category(); }?>
<?php echo $this->get_image($image_size, true);?>
</div>
<?php } ?>
<div class="td-module-meta-info">
<?php if ($category_position == 'above') { echo $this->get_category(); }?>
<?php echo $this->get_title($title_length);?>
<?php if ($excerpt_position == 'yes') { echo $excerpt; } ?>
<div class="td-editor-date">
<?php if ($category_position == '') { echo $this->get_category(); }?>
<span class="td-author-date">
<?php if( $author_photo != '' ) { echo $this->get_author_photo(); } ?>
<?php echo $this->get_author();?>
<?php echo $this->get_date();?>
<?php echo $this->get_comments();?>
</span>
</div>
<?php if ($excerpt_position == '') { echo $excerpt; } ?>
<div class="td-read-more">
href;?>"><?php echo __td($btn_title, TD_THEME_NAME);?>
</div>
cat<div class="uni-logo"><?php $uni_logo = get_field( 'uni_logo' ); ?>
<?php if ( $uni_logo ) { ?>
" alt="<?php echo $uni_logo['alt']; ?>" />
<?php } ?></div>dog
</div>
</div>
</div>
<?php return ob_get_clean();
}
}
I’ve added the text ‘cat / dog’ before and after my code so i could see where it is supposed to appear.
You can see the result here:
http://whystudyhere-com.sites.stackstaging.com/block-14-full-2/
Any help gratefully appreciated.
Great. Thanks very much : )
OK. Thanks.
So, I’m using Flexbox 1. Can I copy / rename this and edit it or add it to my child theme?
Or can I only edit the original file?
An example of what I mean could be used here:
https://demo.tagdiv.com/newspaper_travel/
To add a logo underneath each of the posts, which can be added in a custom field on each post page and displays on each of the post excerpts on this page.
OK. Thanks anyway.
Thanks. I can see an option for infinite loading + load more pagination from Loop Settings?
My template is set to ‘pagebuilder + latest articles + pagination’ with M6. The loop settings only have filters for the categories.
I just need 9 posts on the homepage then infinite scroll on page 2 rather than another grid of 9 and 83 more pages.
Thanks in advance
Thanks
Great. Settings / reading fixed this. I’ve used WP for years and didn’t know this. Thanks : )
Hi again, Calin.
Can I edit the template I’m using (style 6) or do I need to edit one from the cloud? The closest to it seems to be simple post template 12.
If i can edit the current template, how to I load it into the tagdiv editor?
Or if I have to edit template 12, how do I use that as the default?