* @license GPL-2.0+ * @link https://github.com/NickCousins/actionpress * @copyright 2016, Nick Cousins * * @wordpress-plugin * Plugin Name: ActionPress * Plugin URI: https://github.com/NickCousins/actionpress * Description: Turn your "More" links into a bespoke call-to-action for each post instead of [...] * Version: 1.0.0 * Author: Nick Cousins * Author URI: https://github.com/NickCousins * Text Domain: actionpress * License: GPL-2.0+ * License URI: http://www.gnu.org/licenses/gpl-2.0.txt * Domain Path: /languages * GitHub Plugin URI: https://github.com/NickCousins/actionpress * GitHub Branch: master */ // If this file is called directly, abort. if ( ! defined( 'WPINC' ) ) { die; } if (is_admin()) { /** * Meta box markup * * @param $post */ function actionpress_metabox_markup( $post ) { wp_nonce_field( basename( __FILE__ ), "meta-box-nonce" ); ?>
"/>

Customise the text of your "read more" link

post_type ) { return $post_id; } $post_action_text = ""; if ( isset( $_POST[ "post_action_text" ] ) ) { $post_action_text = $_POST[ "post_action_text" ]; } update_post_meta( $post_id, "post_action_text", sanitize_text_field( $post_action_text ) ); } add_action( "add_meta_boxes", "actionpress_metabox" ); add_action( "save_post", "actionpress_savepost", 10, 3 ); } /** * Replaces the More link with an ActionPress one * * @param $link * * @return string */ function actionpress_excerptmore( $link ) { global $post; $readMoreText = get_post_meta( $post->ID, "post_action_text", true ); $readMoreText = !empty( $readMoreText ) ? $readMoreText : 'Read more'; return '' . esc_attr( $readMoreText ) . ''; } /** * Enqueue the default stylesheet */ function actionpress_style() { wp_enqueue_style( 'actionpress', plugins_url('actionpress.css', __FILE__) ); } /** * Hook everything into Wordpress */ add_filter( "excerpt_more", "actionpress_excerptmore", 20, 1 ); add_action( 'wp_enqueue_scripts', 'actionpress_style' );