-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
155 lines (124 loc) · 4.25 KB
/
functions.php
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<?php
/**
* Theme functions.
*
* @package WisePressTheme
*/
// Theme futures:
function theme_features() {
add_theme_support('title-tag');
add_theme_support('widgets');
add_theme_support( 'post-thumbnails' );
// Navbar Menu:
register_nav_menu('navbar_menu', 'Heading navbar menu location');
}
add_action('after_setup_theme', 'theme_features');
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
// Unregister unused widgets:
function my_widgets_init() {
unregister_widget( 'WP_Widget_Calendar' );
unregister_widget( 'WP_Widget_Media_Audio' );
unregister_widget( 'WP_Widget_Media_Image' );
unregister_widget( 'WP_Widget_RSS' );
unregister_widget( 'WP_Widget_Media_Gallery' );
unregister_widget( 'WP_Widget_Meta' );
unregister_widget( 'WP_Widget_Recent_Comments' );
unregister_widget( 'WP_Widget_Recent_Comments' );
unregister_widget( 'WP_Widget_Search' );
}
add_action('widgets_init', 'my_widgets_init');
// Register the about widget:
function social_nav_widgets_init() {
$exeple_url_string = htmlspecialchars('<a href="#"><i class="fab fa-instagram"></i></a>');
register_sidebar(
array(
'name' => "Navbar Social Icons",
'id' => 'navbar_social_icons',
'description' => __('Ad here the HTML of just the social icon wraped
insiede an anchor <a></a> tag. Eg:
'.$exeple_url_string ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '<span class="hidde-title" style="display: none;">',
'after_title' => '</span>',
)
);
}
add_action('widgets_init', 'social_nav_widgets_init');
// Register the tag-cloud widget area:
function cloudtag_widgets_init()
{
register_sidebar(
array(
'name' => "Tag Cloud",
'id' => 'sidebar-2',
'description' => __(' Ad here just the tag cloud'),
'before_widget' => '<div class="extra-tags">',
'after_widget' => '</div>',
'before_title' => '<h4 class="extra-title">',
'after_title' => '</h4>',
)
);
}
add_action('widgets_init', 'cloudtag_widgets_init');
// Register the about widget:
function about_widgets_init()
{
register_sidebar(
array(
'name' => "About",
'id' => 'sidebar-3',
'description' => __('Ad here a text description of your site,
use just Costume HTML or Text widgets.'),
'before_widget' => '<div class="extra-about">',
'after_widget' => '</div>',
'before_title' => '<h4 class="extra-title">',
'after_title' => '</h4>',
)
);
}
add_action('widgets_init', 'about_widgets_init');
// Register the footer widget area:
function footer_widgets_init()
{
register_sidebar(
array(
'name' => "Footer",
'id' => 'footer_widget',
'description' => __('Add widgets here to appear in your footer.'),
'before_widget' => '<div class="links-container">',
'after_widget' => '</div>',
'before_title' => '<h5 class="links-container__title">',
'after_title' => '</h5>',
)
);
}
add_action('widgets_init', 'footer_widgets_init');
// Last 3 post:
function latest_post() {
$args = array(
'posts_per_page' => 3, /* how many post you need to display */
'offset' => 0,
'orderby' => 'post_date',
'order' => 'DESC',
'post_type' => 'post', /* your post type name */
'post_status' => 'publish'
);
$query = new WP_Query($args);
if ($query->have_posts()) :
while ($query->have_posts()) : $query->the_post();
?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<?php echo get_the_post_thumbnail('thumbnail'); ?>
<img src="<?php the_post_thumbnail_url(); ?>" alt="Eror">
<!-- here add code what you need to display like above title, image and more -->
<?php
endwhile;
endif;
}
add_shortcode('lastest-post', 'latest_post');
# echo do_shortcode('[lastest-post]');