the_widget – paramater variables
-
Hello. I’m creating my own plugin and widget to display my latest work on my portfolio website, except I’m having some issues with the final part – displaying my data.
I’ve created a plugin which allows me to insert new data to my database – this holds information about a new project I’ve finished (Title, subtitle, href and src).
I can echo out all of this data just fine.
The next thing I did was to create a widget which allows me to display all of these bits of data, by calling it as follows:
the_widget( 'soc_latestwork','title=title here.&subtitle=subtitle.&image_src=image src&image_url=image url');And this displays my widget just fine… Expect the issue have is that my data is stored inside an array, which I can access by doing this
$data->Titleetc.
Now, how on earth am I meant to put this data in my widget? Whatever I put inside of it just gets echo’d out as plain text.
Here is my widget code which shows this data:
function widget($args, $instance) { extract($args); echo $before_widget; ?> <div class="col-lg-3 col-sm-3 latest-work-box" data-scrollreveal="enter left after 0.15s over 1s"> <!-- Image box --> <div class="latest-work-box-wrap"> <a href="<?php echo $instance['image_src'] ?>" > <img src="<?php echo $instance['image_url'] ?>" /> </a> <div class="latest-work-box-wrap-bottom"> <h1> <?php echo $instance['title'] ?> </h1> <h2> <?php echo $instance['subtitle'] ?> </h2> </div> </div> </div> <?php echo $after_widget; }Thanks
-
Can someone help with this please?
The topic ‘the_widget – paramater variables’ is closed to new replies.