Adding a ribbon with the membership name
-
The plugin looks nice I integrated toa new theme that I’m developing the content etc is okay I’m done but I have a question:
I’m trying to add a corner ribbon over the post thumbnail in archives and homepage but I would like to separate it via membership names by dedecting automatically, so I found a function in includes/metaboxes and edited to
function pmpro_corner_ribbon( $term ) { global $post, $wpdb; $membership_levels = pmpro_getAllLevels( true, true ); $membership_levels = pmpro_sort_levels_by_order( $membership_levels ); $page_levels = $wpdb->get_col( "SELECT membership_id FROM {$wpdb->pmpro_memberships_pages} WHERE page_id = '" . intval( $post->ID ) . "'" ); foreach( $membership_levels as $level ) { echo '<div class="ribbon-wrapper"><div class="ribbon level=' . intval( $level->id ) . '">' . esc_html( $level->name ) . '</div></div>'; } } add_action('pmpro_corner_ribbon','pmpro_corner_ribbon');
The output is:
<?php if(has_action('pmpro_corner_ribbon')) { do_action('pmpro_corner_ribbon'); } ?>
it shows the ribbon for all posts including posts without membership is there any way to make it working?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Adding a ribbon with the membership name’ is closed to new replies.