WordPress page content in Modal Pop-Up
modal-dialog, wordpress
Solution
You could use `get_page` to get the page content, and a shortcode to display it in the popup. In the `functions.php` file of your WordPress theme, e.g.:
add_action( 'init', 'greener_shortcode_init', 11 );
function greener_shortcode_init()
{
add_shortcode( 'greener_bio', 'greener_bio_shortcode' );
}
function greener_bio_shortcode( $atts )
{
$page_id = 123; // the ID of the Bio page
$page_data = get_page( $page_id );
$return = '';
$return .= '<h2>' . $page_data->post_title . '</h2>';
$return .= $page_data->post_content;
return $return;
}
Then, in your modal, use the shortcode:
`[greener_bio]`
Problem
I am working on a WordPress gallery website which has only three pages: Home, Gallery, and Bio (http://adamgreener.com/). When you click Bio, the Bio content pops up, powered by Easy Modal plugin (the content is manually typed in HTML in the plugin settings). I also have the exact same HTML content in a WordPress page (which mobile viewers see, rather than a popup). The page is very simple to edit, but the Modal content is not so friendly to the average user. I am seeking a way that I can allow the user to edit only the Bio page, and have that modal content update at the same time. What would be the best route for such an action? Thanks in advance!