• Hello.
    I need some help.
    I’m using OceanWP.
    
    I created CPT on my site.
    I want to show the meta(date & category) in CPT-blog-entry-page as is the case in regular blog.
    
    I found this topic in below.
    https://www.ads-software.com/support/topic/meta-info-on-custom-posts/
    
    But those codes are seemed for grid-blog-style.
    (I have checked that those codes have worked as expected in the case of grid-style, but not worked in thumbnail-style.)
    
    Is there a way to make it work in thumbnail-style?
    
    Thank you.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Hello @yuko999,

    Please share your query code.
    You can use the “partials” files on the child theme in the same directory.
    So you can copy all files on that folder and then customize it on the child theme.

    
    On the main theme: wp-content\themes\oceanwp\partials\{HERE / COPY}
    On the child theme: wp-content\themes\oceanwp-child\partials\{HERE / PASTE}
    

    Then you can find all snippet codes regarding the categories and date and other meta on the partials files.

    Regarding the grid-blog-style, you can manage it with customization by changing the HTML and other structures.

    Here: https://codex.www.ads-software.com/Function_Reference you can find all WordPress theme functions. You can use the get_ functions: https://i.postimg.cc/y8dj22hT/image.png.

    Would you please read this article regarding the post thumbnails? Please read this article: https://codex.www.ads-software.com/Post_Thumbnails there are many examples for you to add your custom code. Find the “Thumbnail Sizes” section to use the default WordPress thumbnails sizes.

    I hope it helps.

    Best Regards

    Thread Starter yk999

    (@yuko999)

    Hello Shahin.

    Thank you for your kind reply and thank you for sharing the documentation.

    I share my code that added to function.php.(the part after “========”)
    (The second half of that code worked but not the first half.)

    I understand how to customize a child theme.
    I’ll give it a try!

    ========
    function OWP_CPT_entry_meta() {
    global $post;
    if ($post->post_type == ‘post’ || $post->post_type == ‘myCPT’) {
    ?>
    <ul class=”meta clr”>
    <li class=”meta-date”<?php oceanwp_schema_markup( ‘publish_date’ ); ?>><i class=”icon-clock”></i><?php echo get_the_date(); ?>
    <li class=”meta-cat”><i class=”icon-folder”></i><?php the_category( ‘ / ‘, get_the_ID() ); ?>

    <?php
    }
    }
    add_filter(‘ocean_blog_entry_meta’,’OWP_CPT_entry_meta’);

    function OWP_CPT_single_meta() {
    global $post;
    if ($post->post_type == ‘post’ || $post->post_type == ‘myCPT’) {
    ?>
    <ul class=”meta clr”>
    <li class=”meta-date”<?php oceanwp_schema_markup( ‘publish_date’ ); ?>><i class=”icon-clock”></i><?php echo get_the_date(); ?>
    <li class=”meta-cat”><i class=”icon-folder”></i><?php the_category( ‘ / ‘, get_the_ID() ); ?>

    <?php
    }
    }
    add_filter(‘ocean_blog_single_meta’,’OWP_CPT_single_meta’);`
    ========

    Thank you for everything.

    Hello @yuko999,

    Sorry for the late reply,

    Your code is working fine, but please check the plugins conflicts:

    Please check these screenshots:
    https://postimg.cc/gallery/zrq2J2L

    function OWP_CPT_entry_meta() {
        global $post;
        if ($post->post_type == 'post' || $post->post_type == 'gallery') {
        ?>
            <ul class="meta clr">
            <li class="meta-date"<?php oceanwp_schema_markup( 'publish_date' ); ?>><i class="icon-clock"></i><?php echo get_the_date(); ?>
            <li class="meta-cat"><i class="icon-folder"></i><?php the_category( ' / ', get_the_ID() ); ?>
        <?php
        }
    }
    add_filter('ocean_blog_entry_meta','OWP_CPT_entry_meta');
    
    function OWP_CPT_single_meta() {
        global $post;
        if ($post->post_type == 'post' || $post->post_type == 'gallery') {
        ?>
            <ul class="meta clr">
            <li class="meta-date"<?php oceanwp_schema_markup( 'publish_date' ); ?>><i class="icon-clock"></i><?php echo get_the_date(); ?>
            <li class="meta-cat"><i class="icon-folder"></i><?php the_category( ' / ', get_the_ID() ); ?>
        <?php
        }
    }
    add_filter('ocean_blog_single_meta','OWP_CPT_single_meta');

    For troubleshooting, please do the following steps and let me the results:

    1- Head over to WP Dashboard > Plugin.
    2- Deactivate all plugins.
    3- Then, first activate the Ocean Extra plugin.
    4- Check your issue.
    5- Then, activate your plugins one by one
    6- After activation of any plugins, check your issue

    Note: if you have a cache plugin or server cache. You need to clear its cache contents or disable them.

    Update: If you use the custom post type, it’s better to create a new file as an archive page. e.g., archive-gallery.php and include it into the child theme root: https://docs.oceanwp.org/article/90-sample-child-theme.

    Best Regards

    • This reply was modified 3 years, 3 months ago by Shahin.
    Thread Starter yk999

    (@yuko999)

    Hello Shahin.
    Thank you for your reply.

    I tell you about the troubleshooting results.
    (It is the result of not creating a new archive file.)
    The result was the same.
    I made CPT with the plugin “Custom Post Type UI”, but when I Deactivate this plugin, CPT disappears, and when I activate it, it is displayed, but the result did not change.

    Certainly I didn’t create a new archive file.
    Is it okay to copy from parent>partials>edd folder and use it ?

    I’m really sorry to ask such a basic question.

    Hello @yuko999,

    Sorry for the late reply,

    Yes, you can add the partials folder on the child theme and customize the templates.
    Regarding applying the changes, can you please share your CPT codes(create a zip file and send it to us)?
    Also, please share your website child theme and screenshots that you want to make it.

    You can upload your files to one of the following online services:

    Best Regards

    Thread Starter yk999

    (@yuko999)

    Hello Shahin.
    Thank you for your kind reply.

    I share my CPT-codes and screen-shot images.
    (I took CPT-codes from “Custom Post Type UI”.)

    https://drive.google.com/drive/folders/1zYtvxceQwOKAw0OnqPkbTnut_r2rdUGk?usp=sharing

    Thank you so much.

    Hello @yuko999,

    I’ve checked your code, and I didn’t see any issue: https://i.postimg.cc/T3yLh8fF/image.png even without customization.

    Please use the inspect element and make sure all elements are display block and visible?

    Please check your issue in fresh WordPress. Maybe on your customization website, you have conflicts in PHP codes.

    Also, you can check that issue with this child theme: https://drive.google.com/file/d/1MVGac1QJC3NfTzOYon69eHWGIdbwBVG_/view?usp=sharing.

    Best Regards

    Thread Starter yk999

    (@yuko999)

    Hello Shahin.

    Sorry for the late reply,
    (I had sent the reply 2days ago, but it didn’t seem to have been sent.)

    I understand the situation.
    Thank you for trying the reproduction check.

    I will try again in fresh WP.
    Also, it seems that I can manage with the style sheet of the child theme.
    So I will close this topic with this.

    Thank you for your kind support so far.
    I’m really thankful to you.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Meta info on custom posts (in the case of blog-style: thumbnail)’ is closed to new replies.