Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Post_Class option to Repeater #562

Open
wplit opened this issue Sep 16, 2019 · 6 comments
Open

Add Post_Class option to Repeater #562

wplit opened this issue Sep 16, 2019 · 6 comments
Labels

Comments

@wplit
Copy link

@wplit wplit commented Sep 16, 2019

Describe the feature you'd like to see included in Oxygen.
Adding dynamic classes (by using post_class() function) to the div which is the direct child of the repeater element. This would allow users to target individual or grouped elements inside loops.

Not all repeaters are going to be from posts, some will be ACF fields etc, where this function doesn't make sense, so this would need to be a checkbox option the user can select if they wish to have more control.

Here is an example tutorial of this function being used with easy posts and the benefits of having dynamically generated classes for each post. The output code, in this example, looks like something like this. Very easy to style based on info about the post.

code-current-post-ru

What are the use cases for this feature?
Without a way of individually targeting, the repeater can only be used for lists and grids. If we want to style posts from a particular category differently, there isn't that option available. If we know the content, we can target individual posts using CSS such as nth-of-type() but with unknown, dynamic content this isn't useful.

With easy posts, we can write in the php function ourselves, but not with the repeater. I think it would be useful to include as an option.

Examples of this feature or functionality.
Most themes use this function. Genesis framework is the example off the top of my head.

@wplit wplit added the enhancement label Sep 16, 2019
@Anticosti

This comment has been minimized.

Copy link

@Anticosti Anticosti commented Sep 17, 2019

+1
I have the feeling that this could be the solution to custom style with CSS, CPTs listed as "sticky"

@Hanleymade

This comment has been minimized.

Copy link

@Hanleymade Hanleymade commented Sep 17, 2019

A big yes to this request. It would be nice to have a built in solution rather than workarounds.

@alpabuz

This comment has been minimized.

Copy link

@alpabuz alpabuz commented Sep 23, 2019

+1

@krstivoja

This comment has been minimized.

Copy link

@krstivoja krstivoja commented Sep 23, 2019

+10

@wplit

This comment has been minimized.

Copy link
Author

@wplit wplit commented Oct 20, 2019

Far from ideal solution, but if you need post classes on a div inside the repeater (not the main div we need, but a child of it) then you can make use of the shortcode wrapper inside the repeater with something like this..

https://gist.github.com/wplit/6430643213641e45e9e2c0ffea881c43

Then you can at least target elements inside the repeater based on some post classes.

Markup would be...

<div class="oxy-dynamic-list">
  <div class="ct-div-block">                   // Where we actually need the classes
    <div class="ct-nestable-shortcode">
      <div class="post classes here"> .    // Where post classes will go with this method.
         STUFF INSIDE REPEATER
     </div>
    </div>
  </div>
</div>
@wplit

This comment has been minimized.

Copy link
Author

@wplit wplit commented Oct 20, 2019

Screen Shot 2019-10-20 at 12 26 08 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.