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

[Resolved] Add custom option in WPSP backend

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Add custom option in WPSP backend

  • This topic has 3 replies, 2 voices, and was last updated 8 months ago by Tom.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #13814
    Bas
    Participant

    Hi Tom,

    This might be a long shot but here goes.
    Below a snippet that adds some custom code after the meta.
    I have created a custom field that should show a checkbox to add or not add the custom code.
    On this forum I have seen snippets to use/add custom fields but I’m not sure how to combine them with the my snippet.

    Is it possible to add a custom checkbox to the WPSP meta section in the backend?

    
    add_action( 'after_setup_theme','tu_move_post_meta' );
    function tu_move_post_meta() {
        add_action( 'wpsp_after_title','wpsp_add_custom_meta' );
    }
    function wpsp_add_custom_meta() {
        echo '<ul class="reads-shares-meta">
    	                 <li class="post-reads-info">' . do_shortcode('[post-views]') . '</li>
                         <li class="post-shares-info">' . do_shortcode('[social_warfare buttons="totals"]') . '</li>
                       </ul>';
    }
    
    #13873
    Tom
    Keymaster

    Hi there,

    It’s not possible to extend the options in the plugin at this time.

    However, you can target specific lists inside the hook:

    add_action( 'wpsp_after_title', function( $settings ) {
        if ( '123' == $settings['list_id'] ) {
            // Your code in here.
        }
    } );

    You just need to update 123 with the ID of your list.

    #14293
    Bas
    Participant

    Hi Tom,

    That clears things up.
    Thanks for advising a different approach.

    #14305
    Tom
    Keymaster

    No problem 🙂

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