Black Friday sale! Get 25% off WPSP Pro! Discount automatically applied at checkout.

[Resolved] Change order of elements

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Change order of elements

Tagged: 

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #6246
    Janek
    Participant

    Good morning,

    Just wondering if there’s a way to simply put the post title (.wp-show-posts-entry-header) below the content (.wp-show-posts-entry-content).

    Would be happy to implement this with PHP or CSS whichever is best.

    Thanks in advance for any help you can lend.

    #6254
    Janek
    Participant

    Alternatively if I could get a list of the filters I can output a custom field after the entry-content myself.

    #6255
    Janek
    Participant

    So I found in one of my old support threads here that I can use wpsp_after_content as a filter so with the following I should be able to output a custom field after the content however I’m finding it doesnt want to work. Something to do with the filter since if I change it to wpsp_before_content it outputs the custom field above fine. Any thoughts?

    add_action( 'wpsp_after_content', 'tu_add_custom_meta_testimonial' );
    function tu_add_custom_meta_testimonial() {
        $meta = get_post_meta( get_the_ID(), 'testimonial_source', true );
        if ( isset( $meta ) && '' !== $meta ) {
            echo '<div class="testimonial-source">' . $meta . '</div>';
        }
    }
    #6256
    Tom
    Keymaster

    Have you tried something like this?:

    add_action( 'wpsp_after_content', function() {
        the_title();
    } );

    Let me know 🙂

    #6257
    Janek
    Participant

    Hey Tom,

    That only appears to display the page title below the content instead of the post title of the WPSP list. It also targets all WPSP lists.

    I’d prefer to implement a custom field as shown above, this way I can ensure it only works on the WPSP that have posts that use the custom field. But as mentioned for some stupid reason it doesnt work with ‘wpsp_after_content’ but it does with ‘wpsp_before_content’.

    #6259
    Tom
    Keymaster

    That’s really strange. Those hooks are very close to each other within the code – they should work the exact same.

    What if you do this?:

    add_action( 'wpsp_after_content', 'tu_add_custom_meta_testimonial' );
    function tu_add_custom_meta_testimonial() {
        global $post;
        $meta = get_post_meta( $post->ID, 'testimonial_source', true );
    
        if ( isset( $meta ) && '' !== $meta ) {
            echo '<div class="testimonial-source">' . $meta . '</div>';
        }
    }
    #6267
    Janek
    Participant

    Ok, I’m really shitty now, cause I’ve wasted your time. I did the old disable all plugins except WP Show Posts and Advanced Custom Fields and it seems that the problem was the Codeit Glossary plugin which somehow is preventing the custom field from appearing. Makes no sense but there you go! I’ll work at fixing this issue by troubleshooting the Glossary plugin with their dev. There plugin is great in theory but it has so many quirks.

    #6281
    Tom
    Keymaster

    Glad you figured it out 🙂

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.