WordPress page content in Modal Pop-Up

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!

Answers


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]


Need Your Help

Checking algorithm with two conditions in ranges

excel algorithm vba excel-vba

I have a problem with checking algorithm with two conditions in ranges...

How do you test against a specific version when you don't have a device with the version?

iphone ios upgrade

I have 3.1.2 device and have used 3.1.2 as minimum iOS requirement for my app.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.