Beste Tweakers,
Ik wil tussen het recente nieuws van mijn website een banner tonen. Laat ik zeggen, na tien berichten moet een banner komen. Met het thema dat ik gebruik gaat het recente nieuws op de homepage via widgets. Ik heb de code hiervan, maar het is voor mij niet heel duidelijk of ik dit zo kan doen. Ook via Google wordt ik niet veel wijzer. Een banner kan een Google Adsense code zijn, maar ook een adverteerder die door de organisatie binnen wordt gehaald.
Is er iemand die mij meer informatie hierover kan geven?
Met vriendelijke groet,
dannyvdb1997
Ik wil tussen het recente nieuws van mijn website een banner tonen. Laat ik zeggen, na tien berichten moet een banner komen. Met het thema dat ik gebruik gaat het recente nieuws op de homepage via widgets. Ik heb de code hiervan, maar het is voor mij niet heel duidelijk of ik dit zo kan doen. Ook via Google wordt ik niet veel wijzer. Een banner kan een Google Adsense code zijn, maar ook een adverteerder die door de organisatie binnen wordt gehaald.
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
| <?php /** * Plugin Name: Home Recent Posts Widget */ add_action( 'widgets_init', 'resport_recent_load_widgets' ); function resport_recent_load_widgets() { register_widget( 'resport_recent_widget' ); } class resport_recent_widget extends WP_Widget { /** * Widget setup. */ function resport_recent_widget() { /* Widget settings. */ $widget_ops = array( 'classname' => 'resport_recent_widget', 'description' => __('A widget that displays a specified number of posts in a list.', 'resport_recent_widget') ); /* Widget control settings. */ $control_ops = array( 'width' => 250, 'height' => 350, 'id_base' => 'resport_recent_widget' ); /* Create the widget. */ $this->WP_Widget( 'resport_recent_widget', __('Resportsive: Home Recent Posts', 'resport_recent_widget'), $widget_ops, $control_ops ); } /** * How to display the widget on the screen. */ function widget( $args, $instance ) { extract( $args ); /* Our variables from the widget settings. */ $title = $instance['title']; $post_num = $instance['post_num']; /* Before widget (defined by themes). */ echo $before_widget; /* Display the widget title if one was input (before and after defined by themes). */ ?> <h2 class="section"><span class="section"><?php echo $title; ?></span></h2> <ul class="recent"> <?php $recent = new WP_Query('showposts=' . $post_num . ' '); while($recent->have_posts()) : $recent->the_post();?> <li> <?php if ( (function_exists('has_post_thumbnail')) && (has_post_thumbnail()) ) { /* if post has a thumbnail */ ?> <div class="home-story-cat"> <div class="img-contain"> <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>" class="img-shadow"><?php the_post_thumbnail('small-thumb'); ?></a> </div><!--img-contain--> <div class="story-text"> <!-- <div class="cat-small"><?php // the_category(); ?></div> --> <h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2> <p><?php echo excerpt(22); ?></p> </div><!--story-text--> </div><!--home-story-cat--> <?php } else { ?> <div class="home-story-cat"> <div class="story-text-noimg"> <div class="cat-small"><?php the_category(); ?></div> <h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2> <p><?php echo excerpt(22); ?></p> </div><!--story-text--> </div> <?php } ?> </li> <?php endwhile; ?> </ul> <?php /* After widget (defined by themes). */ echo $after_widget; } /** * Update the widget settings. */ function update( $new_instance, $old_instance ) { $instance = $old_instance; /* Strip tags for title and name to remove HTML (important for text inputs). */ $instance['title'] = strip_tags( $new_instance['title'] ); $instance['post_num'] = strip_tags( $new_instance['post_num'] ); return $instance; } function form( $instance ) { /* Set up some default widget settings. */ $defaults = array( 'title' => 'More Stories', 'post_num' => 6); $instance = wp_parse_args( (array) $instance, $defaults ); ?> <!-- Widget Title: Text Input --> <p> <label for="<?php echo $this->get_field_id( 'title' ); ?>">Name of category #1:</label> <input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" style="width:90%;" /> </p> <!-- Number of posts --> <p> <label for="<?php echo $this->get_field_id( 'post_num' ); ?>">Number of posts:</label> <input id="<?php echo $this->get_field_id( 'post_num' ); ?>" name="<?php echo $this->get_field_name( 'post_num' ); ?>" value="<?php echo $instance['post_num']; ?>" style="width:90%;" /> </p> <?php } } ?>, |
Is er iemand die mij meer informatie hierover kan geven?
Met vriendelijke groet,
dannyvdb1997