Search code examples
wordpresswordpress-themingdivi

Create a link listing in wordpress


So I've got a little problem with wordpress and divi and I would like to know if any of you would be able to help me. So here is the deal. I have a website where I want to create a custom post type. In the custom post type, there will be only a few details like the title, date and a link. And what I want is when I display the 5 last custom post type as list on the front end with divi, I would like the read more button to go straight to the link inserted in the custom post type (not the permalink of the CPT). I can't seem to find a way to do this if anyone have the answer. In short, I would like to display a link listing on my wordpress website.

Thanks in advance :D


Solution

  • So I found the answer and I let it here if anyone has the same struggle (I doubt it since it was fairly easy finaly but still lol). So what I did is that I created a custom post type with ACF (you can do it manually, still works). I then added a link custom field where I added the link.

    Instead of creating a child theme, I installed WP Code Snippet which allowed me to create a code snippet and display it wherever I want using a short code.

    In the snippet I just called get_post_meta(get_the_ID(), 'custom_link_field_slug', true); to display the link and assign it wherever I want. So thanks for guiding me @Klaassiek