- This topic has 45 replies, 3 voices, and was last updated 5 years, 6 months ago by Tom.
-
AuthorPosts
-
October 8, 2018 at 7:47 am #696147Eva
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!
EvaOctober 8, 2018 at 10:40 am #696406TomLead DeveloperLead DeveloperWhat are you wanting the links to look like? π
October 8, 2018 at 11:18 am #696454EvaWell, some space between <<project and project>> for a start π
October 8, 2018 at 6:25 pm #696690TomLead DeveloperLead DeveloperCan you share what your function looks like now? We’ll need to add some HTML markup to it so we can add CSS π
October 9, 2018 at 7:06 am #697086EvaI have send a message via the contact form at WPSP. Hope that’s ok π
October 9, 2018 at 7:36 pm #697582TomLead DeveloperLead DeveloperHi 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!
October 10, 2018 at 5:34 am #697808EvaHi 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,
EvaOctober 10, 2018 at 10:04 am #698121TomLead DeveloperLead DeveloperFor 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 π
October 10, 2018 at 1:21 pm #698249EvaHey,
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!October 10, 2018 at 5:23 pm #698350TomLead DeveloperLead DeveloperSure, 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; }
October 11, 2018 at 2:06 pm #699043EvaYessss! 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 πOctober 11, 2018 at 7:20 pm #699133TomLead DeveloperLead DeveloperYou 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; }
October 12, 2018 at 6:56 am #699404EvaThat 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!!!October 12, 2018 at 10:07 am #699621TomLead DeveloperLead DeveloperLooks good! π
October 12, 2018 at 2:30 pm #699771EvaThanks Tom, wouldn’t have been possible if you hadn’t been so patient π Thank you for the great support!
-
AuthorPosts
- You must be logged in to reply to this topic.