Last active
September 18, 2024 12:57
-
-
Save topleague/0ae4e488ce03e01ab58d4bab1f9a3fcc to your computer and use it in GitHub Desktop.
Adding a Link to Genesis Featured CPT Widget Plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//* Create a field for link | |
<p> | |
<label for="<?php echo esc_attr( $this->get_field_id( 'view_all_link' ) ); ?>"> | |
<?php _e( 'View All Links:', 'featured-custom-post-type-widget-for-genesis' ); ?> | |
</label> | |
<input type="text" id="<?php echo esc_attr( $this->get_field_id( 'view_all_link' ) ); ?>" | |
name="<?php echo esc_attr( $this->get_field_name( 'view_all_link' ) ); ?>" | |
value="<?php echo esc_url( $instance['view_all_link'] ); ?>" | |
class="widefat view-all-posts" /> | |
</p> | |
//* Save the link input | |
$instance['view_all_link'] = esc_url_raw( $new_instance['view_all_link'] ); | |
//* Display the hyperlink | |
if ( ! empty( $instance['view_all_link'] ) ) { | |
echo '<a href="' . esc_url( $instance['view_all_link'] ) . '" class="view-all-posts">Browse All Articles →</a>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment