tyealia
Forum Replies Created
-
This worked perfectly, thank you so much for this and the return tip!
All 5 of my snippets now work with conditional logic after “Site Wide Header” is selected. May I suggest when PHP snippet is selected and people click conditional logic, perhaps a notice that says Warning: Many PHP snippets only work with location set to site wide header.
Cheers!
Here’s one more example that may be easier.
A simple snippet to change the generate press footer text to say my site’s name. Again no conditional formatting except logged in/logged out works for this one.
add_filter( 'generate_copyright','tu_custom_copyright' ); function tu_custom_copyright() { ?> ? 2022 mysite.com <?php }
Sure, so out of 5 PHP snippets I have going, I tried testing them all, and none of them worked with conditional logic for PHP.
I will give one of the more important ones I want working as an example.
This is a snippet that adds meta like category next to the author’s name on the generate press theme.
I would love to use the functionality to disable this on any post with the “legal pages” tag or category on my site. Unfortunately, with this snippet, no conditional formatting works except for the “logged in” option.
add_filter( 'generate_header_entry_meta_items', function( $items ) { if ( is_single() || is_page() && !is_page( array( 506337)) ) { $items = array( 'date', 'author', 'categories', 'tags' ); } return $items; } ); add_action( 'generate_after_entry_header', 'tu_page_meta' ); function tu_page_meta() { if ( is_singular( 'page' ) && !is_page( array( 506337 )) ) : ?> <div class="entry-meta"> <?php generate_posted_on(); ?> </div><!-- .entry-meta --> <?php endif; }
Issue solved! Thank you!
Forum: Themes and Templates
In reply to: [GeneratePress] Any way to remove post navigation?Thank you so much for the help! Hope to get premium soon, for now this is a nice stopgap.
Forum: Themes and Templates
In reply to: [GeneratePress] Adding tags and categoreis to pagesEDIT* found the issue with multiple pages by googling a bit, I added ( array after ispage and now it works! Thanks again fernando
Hi Fernando, thanks a lot! it works for the first page I input, but any subsequent pages input do not work, have tested and it’s only always the first value # input that triggers. Maybe we used the wrong comma syntax or something?
I appreciate your help thus far!!
ex. of a second page entered in doesn’t remove
add_filter( 'generate_header_entry_meta_items', function( $items ) { if ( is_single() || is_page() && !is_page( 1040, 1042 ) ) { $items = array( 'date', 'author', 'categories', 'tags' ); } return $items; } ); add_action( 'generate_after_entry_header', 'tu_page_meta' ); function tu_page_meta() { if ( is_singular( 'page' ) && !is_page( 1040, 1042 ) ) : ?> <div class="entry-meta"> <?php generate_posted_on(); ?> </div><!-- .entry-meta --> <?php endif; }
- This reply was modified 2 years, 8 months ago by tyealia.
Forum: Themes and Templates
In reply to: [GeneratePress] Adding tags and categoreis to pagesWorks perfectly thank you so so much!
Just one last question. It does this for every page, I have a bunch of privacy policies and about pages I don’t want it to display on. Is there a way to exclude from them? Even if I can exclude all pages tagged with Policies, or under a category like Policies that would work.
Forum: Reviews
In reply to: [Specify Missing Image Dimensions] great little appLittle edit, I had to uninstall this as this was crashing the server on any site I put it on