Last active
June 16, 2021 22:40
-
-
Save thaboklass/f44acf6198a0d933aedc10e948eef23b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Front-end display of widget. | |
* | |
* @see WP_Widget::widget() | |
* | |
* @param array $args Widget arguments. | |
* @param array $instance Saved values from database. | |
*/ | |
public function widget($args, $instance) { | |
// Check any variation of the footer position | |
// because it the label varies depending on | |
// the theme. | |
if (strpos($args['name'], 'Footer') !== false) { | |
$this->robber_baron_tv_is_in_footer = true; | |
} | |
// Check any variation of the footer position | |
// because it the label varies depending on | |
// the theme - in this case, look for the word | |
// 'Bottom' | |
if (strpos($args['name'], 'Bottom') !== false) { | |
$this->robber_baron_tv_is_in_footer = true; | |
} | |
if (($args['name'] == 'Footer 1') || ($args['name'] == 'Footer 2') || | |
($args['name'] == 'Content Bottom 1') || ($args['name'] == 'Content Bottom 2') || | |
($args['name'] == 'Footer 3') || ($args['name'] == 'Footer Widgets') || | |
($this->robber_baron_tv_is_in_footer)) { | |
// If the widget is positioned in the footer, load the footer style | |
// to override the existing style | |
wp_register_style('robber_baron_tv_widget_css_footer', plugins_url('css/style_footer.css', __FILE__)); | |
wp_enqueue_style('robber_baron_tv_widget_css_footer'); | |
} | |
// This points the widget to the user's content | |
if ($this->robber_baron_tv_user_id != '') { | |
$this->robber_baron_tv_widget_url = "https://robberbaron.tv/dashboard-profile/" . $this->robber_baron_tv_user_id; | |
} | |
?> | |
<!-- The HTML code for the front-end wdiget begins here --> | |
<aside id="robber_baron_tv_widget" class="widget"> | |
<div class="robber_barorn_tv_container text-center" id="robber_baron_tv_clickable_logo"> | |
<div class="row"> | |
<div> | |
<a href=<?php echo $this->robber_baron_tv_widget_url; ?> target="_blank" id="robber_baron_tv_add_class"><img alt="Watch Premium Content" class="robber_baron_tv_img" src="<?php echo plugin_dir_url( __FILE__ ) . 'robber_baron_tv_logo.png'; ?>"></a> | |
</div> | |
</div> | |
</div> | |
</aside> | |
<?php | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment