Plugin Development – Functions or Hooks?

Below I’ve included two hooks you could use. There may be better hooks depending on what you’re trying to accomplish exactly but this is what you’ve asked for. At the bottom I’ve listed some helpful resources: Publish Post Hook http://codex.wordpress.org/Plugin_API/Action_Reference/publish_post function published_post( $ID, $post ) { if( $post->post_type == ‘post’ ) { … } if( … Read more

Create a post builder skin in a plugin

You cannot insert the do_action() inside the class like that, it’s gonna give you a fatal error. Instead you could use an array $skins to store all the skin functions (as closures), and the magic method _call() to call them: class skinclass { private $skins = array(); function __construct() { $this->skins = apply_filters( ‘add_skin’, $this->skins … Read more

Generate payment URL in custom email [closed]

The correct method for generating a payment URL is: get_checkout_payment_url() So my code changed to to: $payment_page = $order->get_checkout_payment_url(); Which generates the following URL: http://www.example.co.za/checkout/order-pay/[order-number]?pay_for_order=true&key=order_[order-key] Which is what I was looking for. Note that the order status must be set to unpaid or pending in order for the generated link to be valid

Scripts not loading when using the wp_enqueue_scripts action

get_stylesheet_uri() loads the main stylesheet of the theme. If you need to load additional stylesheets, you need to use get_template_directory_uri() for parent themes and get_stylesheet_directory_uri() for child themes. If you have stylesheet called custom.css in the root in a child theme, you will use get_stylesheet_directory_uri()’ . /custom.css’ You should also make sure that you have … Read more

Add a filter to an action [closed]

The action name suggests it is run _after_the_content, not within the the_content itself, so you might have to do something different here like @SamuelElh is suggesting… You would add a function to the action with early priority to buffer, then add a filter to the final output with a late priority: add_action(‘tribe_events_single_event_after_the_content’,’tribe_events_single_event_buffer_start’,0); function tribe_events_single_event_buffer_start() {ob_start();} … Read more