Add unique css to each post layout

Ticket for: Post Grid
0
Add unique css to each post layout 1
Vincent
Oct 22, 2020 04:23 PM 1 Answers
Member Since Sep 2020
Subscribed Subscribe Not subscribe
Flag(0)

Hello.

Im trying to use ACF to give each post-item a custom margin. So every post has 4 meta items for all values of margin.

Im trying to get post grid to add the margin\'s to each post individually with a function.

<code>
add_action(\'post_grid_layout_element_css_excerpt\', \'custom_css\', 10);
function custom_css()
{
$post_id = $layout_args[\'post_id\'];
?>

.item-{
margin-top: the_field(\'margin-top\')px !important;
margin-bottom: the_field(\'margin-bottom\')px !important;
margin-right: the_field(\'margin-right\')px !important;
margin-left: the_field(\'margin-left\')px !important;
}

?>
<?php
}
</code>

But can\'t get it to work.

2 Subscribers
Add unique css to each post layout 1
Add unique css to each post layout 3
Submit Answer
Please login to submit answer.
1 Answers
Sort By:
Best Answer
1
Add unique css to each post layout 4
PickPlugins
Oct 22, 2020
Flag(0)

Welcome to our forum.

Unfortunately sorry to say, don't understand the issue clearly, could you please send me your post grid page url to see what are you trying to do.

If possible please send me some screenshots.

Regards

Add unique css to each post layout 5
PickPlugins
- Oct 29, 2020 02:58 PM
Flag (0)
0

Please note filterable style grid doesn't support masonry style right now,

There might be wrong with the code, could you please share your code via https://gist.github.com/
Regards

Add unique css to each post layout 6
Vincent
- Oct 29, 2020 01:23 PM
Flag (0)
0

Hi, are you still working on a reply?

Add unique css to each post layout 6
Vincent
- Oct 23, 2020 02:14 PM
Flag (0)
0

With ACF i made 4 input fields on the post page.
-> Margin-left, margin-right, margin-top, margin-bottom
https://imgur.com/a/eclXuJ6

Im trying to create some kind of masonry effect with filterable but with more control.

With the code i posted i tried to add the ACF margins to the .item-[ID] class. So each item on the grid has unique margins. But i don't get it working.

https://www.maxmei.nl/

Sign in to Reply
Replying as Submit