[Resolved] Display content in single CPT

Home Forums Support [Resolved] Display content in single CPT

Home Forums Support Display content in single CPT

Viewing 15 posts - 31 through 45 (of 46 total)
  • Author
    Posts
  • #696147
    Eva

    Hi Tom,
    Excuse me please, for not getting back to you earlier… I have been working on another web site. Now I finally got back working on this one πŸ™‚
    Actually I am still working on the tags, sorry for that.
    I think most important is showing previous and next post. Do you have any suggestions for css styling?
    By the way, I only use WP Show PostsPRO now to show the portfolio… much better! I have and will post some more questions on the WPSP forum.
    Thank you again!
    Eva

    #696406
    Tom
    Lead Developer
    Lead Developer

    What are you wanting the links to look like? πŸ™‚

    #696454
    Eva

    Well, some space between <<project and project>> for a start πŸ™‚

    #696690
    Tom
    Lead Developer
    Lead Developer

    Can you share what your function looks like now? We’ll need to add some HTML markup to it so we can add CSS πŸ™‚

    #697086
    Eva

    I have send a message via the contact form at WPSP. Hope that’s ok πŸ™‚

    #697582
    Tom
    Lead Developer
    Lead Developer

    Hi Eva,

    I have the link to your site here in the topic, but I wouldn’t mind seeing the functions you’re using to add those elements. That way I can tweak them to include the necessary HTML we need in order to style them.

    As for the other things in your email – any chance you can send an email through our contact form here? Be sure to link to the topics you’re providing information for.

    Thanks!

    #697808
    Eva

    Hi Tom,
    Thanks. I am not sure I understand the questions about the functions, can you be more specific, please? And for the message I send via the other contact form I didn’t keep a copy (stupid)… I will try to remember πŸ™‚
    Thanks,
    Eva

    #698121
    Tom
    Lead Developer
    Lead Developer

    For example, this function I gave you: https://generatepress.com/forums/topic/display-content-in-single-cpt/page/2/#post-687043

    I assume you had to make small changes before it worked for you? If not, I can make the changes to the above function and give it to you πŸ™‚

    #698249
    Eva

    Hey,
    Although it was a lot a work for you to find out how to show, I decided to only use previous and next post for now, and maybe add categories/tags later (sorry!), or add related posts in a different way. So, for now I just used this function:

    add_action( ‘generate_after_content’, function() {
    if ( is_singular( ‘project’ ) ) {
    previous_post_link();
    next_post_link();

    }
    } );

    Is this sufficient info?
    Thanks again for the great support!

    #698350
    Tom
    Lead Developer
    Lead Developer

    Sure, although I’m happy to help style the tags as well πŸ™‚

    So you’d use this function:

    add_action( 'generate_after_content', function() {
        if ( is_singular( 'project' ) ) : ?>
            <div class="project-pagination">
                <span class="previous-project">
                    <?php previous_post_link( '%link' ); ?>
                </span>
    
                <span class="next-project">
                    <?php next_post_link( '%link' ); ?>
                </span>
            </div>
        <?php endif;
    } );

    Then you can use some CSS like this:

    .project-pagination span {
        display: inline-block;
        margin-right: 10px;
    }
    #699043
    Eva

    Yessss! This works just fine. I made it 15px. By the way, could it be buttons too?
    For the time being I stick to just previous and next. If my client wants to show categories and tags, I get back to you.
    Thanks for all the help and support. I don’t know where I would be without you guys πŸ™‚

    #699133
    Tom
    Lead Developer
    Lead Developer

    You would need to remove the arrows, which the updated code above would do: https://generatepress.com/forums/topic/display-content-in-single-cpt/page/3/#post-698350

    Then you could do this:

    .inside-article .project-pagination a {
        display: inline-block;
        padding: 5px 10px;
        background: #222;
        color: #fff;
    }
    #699404
    Eva

    That works just fine!! I changed the CSS a bit for a different background and font-size, more distance between the buttons, and extra margin for the buttons on mobile:

    .inside-article .project-pagination a {
    display: inline-block;
    padding: 5px 5px;
    margin-right: 15px;
    margin-bottom: 15px;
    font-size: 14px;
    background: #999;
    color: #fff;
    }

    To me it looks alright. What do you think?
    Thanks!!!

    #699621
    Tom
    Lead Developer
    Lead Developer

    Looks good! πŸ™‚

    #699771
    Eva

    Thanks Tom, wouldn’t have been possible if you hadn’t been so patient πŸ™‚ Thank you for the great support!

Viewing 15 posts - 31 through 45 (of 46 total)
  • You must be logged in to reply to this topic.