Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Testimonials in WordPress with Custom Post Types

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #39359
    Kralle
    Participant

    Hello guys!

    I’m working on a site where I’d like to add some testimonials and list them all in a page. It should be fairly simple, I don’t have any need for a widget, carousel or anything like that, just a plain list of testimonials. I wish to add each testimonial via Custom Post Types, and so far I can see/add/edit/delete each testimonial with this in my functions.php file:

    add_action( 'init', 'kundeudtalelse_post_type' );
    function kundeudtalelse_post_type() {
    register_post_type( 'kundeudtalelse',
    array(
    'labels' => array(
    'name' => __( 'Kundeudtalelser' ),
    'singular_name' => __( 'Kundeudtalelse' ),
    'add_new' => __( 'Tilføj ny' ),
    'add_new_item' => __( 'Tilføj ny kundeudtalelse' ),
    'edit' => __( 'Rediger' ),
    'edit_item' => __( 'Rediger kundeudtalelse' ),
    'new_item' => __( 'Ny kundeudtalelse' ),
    'view' => __( 'Se kundeudtalelse' ),
    'view_item' => __( 'Se kundeudtalelse' ),
    'search_items' => __( 'Søg kundeudtalelse' ),
    'not_found' => __( 'Ingen kundeudtalelse fundet' ),
    'not_found_in_trash' => __( 'Ingen kundeudtalelser fundet i papirkurven' ),
    'parent' => __( 'Forældre til kundeudtalelse' ),
    ),
    'public' => true,
    'has_archive' => true,
    'public' => true,
    'show_ui' => true,
    'capability_type' => 'post',
    'hierarchical' => false,
    'rewrite' => array('slug' => 'kundeudtalelser'),
    'query_var' => true,
    )
    );
    }

    What I would like to have is a few custom fields in each post, where I can put name of the contact person, company name and perhaps the website URL for the company. Could anybody show me how that would be done?

    Furthermore I was wondering if it’s possible to list all these testimonial in a page with a shortcode or a page template. I’ll be forever grateful, if somebody could help me with this.

    I’m using the latest WordPress version, and it would be great if I could avoid using a plugin. Thanks in advance.

    Best regards.

    #107854
    TheDoc
    Member

    I’ve always used this plugin: http://advancedcustomfields.com/

    I think it’s fantastic.

    #107906
    Kralle
    Participant

    I really did not want to use a plugin, but that one is doing amazingly well! Thanks a bunch, TheDoc.

    Could you or someone else tell me how to list the custom post types in a page via a short code or a page template?

    Thanks in advance.

    #107948
    Kralle
    Participant

    Thanks a lot, jamy_za. I think that snippet is quite easy to grasp.

    Although, when I put this in my page template-file (and make the page use this template in the admin panel), it’s not using that template – instead it shows the index.php content. What am I doing wrong?

    I’m sorry for all these questions, but I can’t seem to figure it out. Thanks in advance.

    #107951
    Kralle
    Participant

    I found out that the slug I’m using in the custom post type is causing problems with the page, since they’re using the same. Case solved! Thanks a lot guys, you saved me from a complete headache.

    #108033

    Hey Kralle,
    I just released a plugin for this called PostTypeFactory. I haven’t looked at the advanced custom fields plugin (which I will do now) but in my plugin, I have a built in short code to generate a list of whatever post types you create. Im working on the documentation now but you can check out the site and get the plugin here –

    http://posttypefactory.com

    Let me know if it works for you.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘Back End’ is closed to new topics and replies.