• Resolved padventium

    (@padventium)


    i was wanting to add a WAS and IS price to my posts . Im not selling anything on the site so I do not need a ecommerce theme or anything.

    WOuld this be created with a custom post type or something similar ?

    Thanks for replying, love the plugin.

    The page I need help with: [log in to see the link]

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Tom

    (@edge22)

    Hi there,

    Where within the posts are you wanting to display this data?

    You’d need custom fields with the WAS and IS data.

    So for example, if you want it to show up before the content, you’d do this:

    add_action( 'wpsp_before_content', function( $settings ) {
        if ( 123 === $settings['list_id'] ) {
            $was = get_post_meta( get_the_ID(), 'was_field', true );
            $is = get_post_meta( get_the_ID(), 'is_field', true );
    
            if ( $was ) {
                echo 'WAS: ' . $was;
            }
    
            if ( $is ) {
                echo 'IS: ' . $is;
            }
        }
    } );

    So this will only display within your list with the ID: 123

    You’d need to change that to whatever your list ID is.

    Then you’d obviously need to change the field names in the get_post_meta calls to whatever you add them as.

    Thread Starter padventium

    (@padventium)

    will this then show up on the custom fields on the specific page so I can call them in ?

    i want to put them after the content so like they are layed out on this page

    Plugin Author Tom

    (@edge22)

    You can create your own custom fields on each page. You just need to name them all the same, and use those names in the code above. I used was_field and is_field as examples.

    If you want them to display after the content, you’d replace wpsp_before_content with wpsp_after_content.

    Thread Starter padventium

    (@padventium)

    my apologies sorry, i am wanting to use posts and have the posts diplayed like they are under guided tours and 4wd tours

    Plugin Author Tom

    (@edge22)

    Looks like that code got you pretty close? If you remove the margin from the first paragraph (WAS), and add more to the second paragraph (IS), it should be pretty much identical.

    Let me know 🙂

    Thread Starter padventium

    (@padventium)

    thank you.

    One last thing because this will be used on different lists am i able to just copy and paste that code for the other listing ids or is there a better way to do it ?

    Plugin Author Tom

    (@edge22)

    Yep, you can even combine them all in the same function:

    if ( 123 === $settings['list_id'] || 456 === $settings['list_id'] || 789 === $settings['list_id'] ) {
    
    }
    Thread Starter padventium

    (@padventium)

    is there is a way to get these all the same height for the buttons regardless how big the title text is character wise ?

    I can see there is flex: 1 set on the inner-posts but it just doesnt seem to be working as desired ?

    Thank you

    https://staging.fraserisland.com.au/project-test/

    Plugin Author Tom

    (@edge22)

    Give this a shot:

    .wp-show-posts-columns .wp-show-posts-inner {
        display: flex;
        flex-direction: column;
    }
    
    .wpsp-read-more {
        margin-top: auto;
        padding-top: 1.5em;
    }
    Thread Starter padventium

    (@padventium)

    great thank you

    Plugin Author Tom

    (@edge22)

    You’re welcome 🙂

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Adding custom meta titles’ is closed to new replies.