- This topic has 16 replies, 3 voices, and was last updated 3 years, 11 months ago by Tom.
-
AuthorPosts
-
May 4, 2020 at 10:56 pm #1269897Matthew
The entry meta appears as below for a regular post, after the content:
https://drive.google.com/open?id=1dM0VASR9gAXDYD67qyekMqyShSXEqqYu
No such luck with a custom post type however.
I have also tried so with and without the below function previously suggested:
add_filter( 'generate_footer_meta_posts_types', function( $types ) { $types[] = 'pictures'; return $types; } );
Any advise appreciated.
thanks,
May 5, 2020 at 9:13 am #1270803LeoStaffCustomer SupportHi there,
Any chance you can link us to the site in question?
You can edit the original topic and use the private URL field.
Let me know π
May 5, 2020 at 9:11 pm #1271417MatthewHi Leo,
I just sent you some site links and my admin login URL with user name and password using your account issue form (as requested by David for previous topics) because you may have trouble reading the U/P in the URL field due to the formatting there.
Code snippets are in my site-specific plugin ‘imjexa-plugin’.
thanks,
May 6, 2020 at 9:10 am #1272305LeoStaffCustomer SupportAny chance you can try the snippets using one of these methods first?
Adding PHP: https://docs.generatepress.com/article/adding-php/May 8, 2020 at 1:52 am #1274954MatthewStill no sausage.
I installed the Code Snippets plug-in and added that function. The site-specific plug-in I use is rarely the source of problems. But Code Snippets looks handy and I will probably use that from now on.
Are the settings on the Customizer meant to also work for custom post types? Currently it’s not, and the template files I copied and used for the CPT are unchanged from the original ones i.e.
single.php
andcontent-single.php
May 8, 2020 at 9:42 am #1275655TomLead DeveloperLead DeveloperHi Matthew,
The “Pictures” section on your site doesn’t seem to be using a custom post type. It looks like a static page which links to the attachment page for an image.
Are you wanting to add entry meta to all of your attachment pages?
Let me know π
May 10, 2020 at 6:09 pm #1278405MatthewThat’s a static page I created to act as a gallery page or point users can access my work. It links to the attachment page for media where I have image galleries set up to show additional images. It’s a related but separate aspect.
So what I’m talking about my custom post type ‘Pictures’. It’s there
https://drive.google.com/open?id=1N9LmZzAAmmZutRvdO3YdkBLyiZMgjZn-
Just getting that post to function like a normal post, and show the entry meta.
A test post (of a regular post):
https://drive.google.com/open?id=1dM0VASR9gAXDYD67qyekMqyShSXEqqYu
That meta at the bottom I cannot get to appear on any post of my CPT.
May 11, 2020 at 9:08 am #1279407TomLead DeveloperLead DeveloperHas the username/password changed for your site? I can’t get in.
Let me know π
May 11, 2020 at 6:01 pm #1280028MatthewChanged from where sorry? I hadn’t put it into this topic.
Could you pls check my last submission from the account issue form which was was only recently, as I send it that way from now on (at David’s recommendation) because it formats unreadable in the URL field of my original topic.
Looking forward to it.
May 11, 2020 at 6:04 pm #1280031MatthewIt’d be awesome if we could keep the login in our profile or if there was a separate user name and password field instead of just the URL field on that original topic so formatting is not jumbled, as it’s regularly the cause for delay.
May 12, 2020 at 10:16 am #1281208TomLead DeveloperLead DeveloperThat would be awesome – I’ll look into that.
I see the issue, your filter is spelled incorrectly.
Try this:
add_filter( 'generate_footer_meta_post_types', function( $types ) { $types[] = 'pictures'; return $types; } );
May 12, 2020 at 8:43 pm #1281865MatthewThat’s now showing the next/previous post navigation but I’m still not getting the categories and tags. See screenshot they should be above the navigation:
https://drive.google.com/open?id=1iMPP_Bxj2wtXZE_KgxbZFGBRipzcyPyR
(Above that is the last of the post content, and below is my template content).
What do you think it is.
The CPT code is in my site-specific plug-in. I have the CPT-UI plug-in installed and I could try setting up the CPT using that instead. But only if you think this is worth it to check. And if I delete my CPT code from my plug-in then re-create it with the same CPT names and taxonomies will all my existing posts be preserved would you know?
thanks,
May 13, 2020 at 8:53 am #1282756TomLead DeveloperLead DeveloperDoes your CPT support the standard category/post tag taxonomies, or does it have custom taxonomies?
The standard GP code will only work with the standard taxonomies, so if you’re using custom ones we’ll need to add functions to output those links.
May 13, 2020 at 5:55 pm #1283429MatthewWhen i set up the CPT ‘Pictures’ yes I thought there should be taxonomies for it as well, so created,
One for categories
function custom_taxonomy_genres()
and one for tags
function custom_taxonomy_words
May 14, 2020 at 9:20 am #1284466TomLead DeveloperLead DeveloperIn that case, you need to do something like this:
add_action( 'generate_post_meta_items', function( $item ) { if ( 'genres' === $item ) { $genres_list = get_the_term_list( get_the_ID(), 'genres', '', ', ' ); if ( $genres_list ) { printf( '<span class="tags-links">%3$s<span class="screen-reader-text">%1$s </span>%2$s</span> ', esc_html_x( 'Genres', 'Used before tag names.', 'generatepress' ), $genres_list, apply_filters( 'generate_inside_post_meta_item_output', '', 'genres' ) ); } } if ( 'words' === $item ) { $words_list = get_the_term_list( get_the_ID(), 'words', '', ', ' ); if ( $words_list ) { printf( '<span class="tags-links">%3$s<span class="screen-reader-text">%1$s </span>%2$s</span> ', esc_html_x( 'Words', 'Used before tag names.', 'generatepress' ), $words_list, apply_filters( 'generate_inside_post_meta_item_output', '', 'words' ) ); } } } ); add_filter( 'generate_footer_entry_meta_items', function( $items ) { if ( 'pictures' === get_post_type() ) { return array( 'genres', 'words', 'comments-link', ); } return $items; } ); add_filter( 'generate_footer_meta_post_types', function( $types ) { $types[] = 'pictures'; return $types; } );
-
AuthorPosts
- You must be logged in to reply to this topic.