Category: Php actions

  • pbs_iframe_header

    pbs_iframe_header

    Used within the iframe used by PBS to render its responsive view during editing. This is called right before the <head> tag closes and can be used to add scripts and styles.

    Parameters

    None.

    Example

    add_action( 'pbs_iframe_header', 'change_bg_color' );
    
    function change_bg_color() {
    	?>
    	<style>
    	body {
    		background-color: hotpink;
    	}
    	</style>
    	<?php
    }
  • pbs_pre_save_content

    pbs_pre_save_content

    Called right before the content is saved. This is called when a save was initiated from the PBS editor.

    Parameters

    None

  • pbs_enqueue_scripts

    pbs_enqueue_scripts

    Enqueue a script or style alongside PBS. This is called only when the post is editable with PBS. When the page isn’t editable with PBS, then this isn’t used at all.

    Parameters

    None.

    Example

    When PBS loads, also enqueue my-script.js

    add_action( 'pbs_enqueue_scripts, 'add_my_script' );
    
    function add_my_script() {
    	wp_enqueue_script( 'my-script' , plugins_url( 'js/my-script.js', __FILE__ ) );
    }
    
  • pbs_iframe_footer

    pbs_iframe_footer

    Used within the iframe used by PBS to render its responsive view during editing. This is called right before the <body> tag closes and can be used to add scripts and styles.

    Parameters

    None.

  • pbs_saved_content

    pbs_saved_content

    Called after the content is saved. This is called when a save was initiated from the PBS editor.

    Parameters

    None