示例#1
0
function popup_preview_field_PPS($field)
{
    // Get the current ID
    if (isset($_GET['post'])) {
        $post_id = $_GET['post'];
    } elseif (isset($_POST['post_ID'])) {
        $post_id = $_POST['post_ID'];
    }
    echo '<p style="color:#888; margin: 6px 0 0;">';
    if (!isset($post_id)) {
        echo 'Save to see the preview';
    } else {
        echo do_shortcode('[popuppress id="' . $post_id . '"]');
        echo get_popup_PPS($post_id);
    }
    echo '</p>';
}
示例#2
0
function add_popup_post_PPS($content)
{
    $regexPopuppress = '/\\[popuppress(\\s+)id=(\\"|\')(\\d+)(\\"|\')/i';
    $num_popups = preg_match_all($regexPopuppress, get_the_content(), $shortcodes, PREG_PATTERN_ORDER);
    $popup = '';
    if ($num_popups) {
        $arrayShortcodes = $shortcodes[0];
        foreach ($arrayShortcodes as $shortcode) {
            $popup_id = preg_replace('/[^0-9]/i', '', $shortcode);
            $popup .= get_popup_PPS($popup_id);
        }
    }
    return $content . $popup;
}