1: <?php
2: /**
3: * Hook for Read More Button useful to add to loop templates
4: *
5: * @package EPL
6: * @subpackage Hooks/ReadMore
7: * @copyright Copyright (c) 2020, Merv Barrett
8: * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9: * @since 1.0.0
10: */
11:
12: // Exit if accessed directly.
13: if ( ! defined( 'ABSPATH' ) ) {
14: exit;
15: }
16:
17: /**
18: * Outputs a Read More button on the loop listing templates
19: *
20: * @param string $label Pass a custom label from the template hook.
21: *
22: * @since 1.0.0
23: * @since 3.4.23 Added epl_button_read_more hook to output button on templates.
24: */
25: function epl_button_read_more( $label ) {
26: if ( empty( $label ) ) {
27: $label = __( 'Read More ', 'easy-property-listings' );
28: }
29: $label = apply_filters( 'epl_button_label_read_more', $label );
30: ?>
31: <button type="button" class="epl-button epl-read-more"
32: onclick="location.href='<?php the_permalink(); ?>'"><?php echo esc_html( $label ); ?></button>
33: <?php
34: }
35:
36: add_action( 'epl_button_read_more', 'epl_button_read_more', 10, 1 );
37: