• Resolved FriendlyHal

    (@friendlyhal)


    This should be an easy one for someone who knows what they are doing. I feel I am close but I don’t trust myself enough to actually adjust a plug-ins code without having someone else take a look.

    I am using a simple plug-in, basically all it does is cause a random pop-up to appear on-screen when a page loads. What I would like is for all the pop-ups, while differing in content, to have the same format. Right now, I simply copy/paste the formatting individually for each pop-up and then add in the content. However, I know someone out there knows a better way to do this 😉

    Here is the part of the plug-in’s code of which I am pretty sure is relevant to what I’m trying to do. I am aware I could be wrong, so please correct me if that is the case. Below the plug-in code is the formatting code that I would like to include.

    Thank you for taking your time to help me out 🙂

    Plug-in Code

    /*
     * Insert Default Popup
     */
    function epa_html_include() {
    
    	if(get_option('epa_default_id') == 'latest'):
    	$latest_popup = wp_get_recent_posts(array('numberposts' => '1', 'post_type' => 'epapopup'));
    	$popup_content = $latest_popup['0']['post_content'];
    
    	elseif(get_option('epa_default_id') == 'random'):
    	$random_popup = wp_get_recent_posts(array('numberposts' => '1', 'post_type' => 'epapopup', 'orderby' => 'rand'));
    	$popup_content = $random_popup['0']['post_content'];
    
    	else:
    	$default_popup = get_post(get_option('epa_default_id'));
    	$popup_content = $default_popup->post_content;
    	endif;
    
    	//$epa_html = '<button class="my_popup_open">Open popup</button>';
    	$epa_html .= '<div id="my_popup" class="well"><span class="my_popup_close"></span>';
    	//$epa_html .= $default_popup->post_content;
    	$epa_html .= $popup_content;
    	$epa_html .= '</div>';
    
    	if(!isset($_COOKIE['epa_popup'])) {
    
    		echo $epa_html;
    		//echo $latest_popup['0']['post_content'];
    	}
    
    }
    function epa_default_popup() {
    	if(get_option('epa_enable') == 'yes' && get_option('epa_default_id') !== '') epa_html_include();
    }
    add_action( 'wp_footer', 'epa_default_popup' );
    
    /*
     * Generate JQuery Code
     */
    function epa_js_overlay_include() {
    	$epa_js = '<script>jQuery(document).ready(function($) { $(\'#my_popup\').popup({autoopen: true, transition: \'all 0.3s\', blur: true, color: \''.get_option('epa_bgcolor').'\'}); }); </script>';
    
    	echo $epa_js;
    }
    add_action( 'wp_footer', 'epa_js_overlay_include' );

    Formatting Code

    <html>
    <head>
    <style type="text/css">
    p {
        font-size: 14pt;
        color: #2F6432;
    }
    .banner {
        padding-bottom: 16px;
        text-align: center;
        font-family: Comic Sans MS;
        font-size: 20pt;
        font-weight: bold;
        color: blue;
        background-color: #FFD700;
    }
    .big {
        font-size: 18pt;
        font-weight: bold;
        color: #000000;
    }
    .hx {
        font-size: 14pt;
        font-weight: bold;
        color: #E1610C;
    }
    .support {
        text-align: center;
        font-size: 14pt;
        font-weight: bold;
        color: #000000
    }
    </style>
    </head>

    https://ww.wp.xz.cn/plugins/easy-popup-announcement/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Adjusting the default css’ is closed to new replies.