-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
78 lines (71 loc) · 2.6 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
<?php
/* * Zenon Theme Functions
* @version 1
*/
if (!isset($content_width) )
{ $content_width = 645 ;}
function zenon_setup() {
load_theme_textdomain ( 'zenon!', get_template_directory() . '/languages');
add_theme_support('automatic-feed-links');
add_theme_support('post-formats', array('aside') );
add_theme_support( 'html5', array( 'search-form' ) );
add_theme_support( 'post-thumbnails' );
};
function create_custom_post() {
$labels = array(
'name' => _x( 'Members', 'post type general name' ),
'singular_name' => _x( 'Member', 'post type singular name' ),
'add_new' => _x( 'Add New', 'member' ),
'add_new_item' => __( 'Add New Member' ),
'edit_item' => __( 'Edit Member' ),
'new_item' => __( 'New Member' ),
'all_items' => __( 'All Members' ),
'view_item' => __( 'View Member' ),
'search_items' => __( 'Search Members' ),
'not_found' => __( 'No Members found' ),
'not_found_in_trash' => __( 'No Members found in the Trash' ),
'parent_item_colon' => '',
'menu_name' => 'Members',
);
$args = array(
'labels' => $labels,
'description' => 'Holds our Members and Member specific data',
'rewrite' => array( 'slug' => 'members', 'with_front' => false ),
'public' => true,
'menu_position' => 5,
'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt'),
'has_archive' => true
);
register_post_type('members', $args );
}
function get_all_members_posts( $query ) {
if( !is_admin() && $query->is_main_query() && is_post_type_archive( 'members' ) ) {
$query->set( 'posts_per_page', '-1' );
}
}
add_action( 'pre_get_posts', 'get_all_members_posts' );
add_action( 'after_setup_theme', 'zenon_setup' );
add_action( 'init', 'register_my_menus' );
add_action( 'init', 'create_custom_post' );
function register_my_menus() {
register_nav_menus(
array(
'primary-menu' => __( 'Primary Menu' ),
'secondary-menu' => __( 'Secondary Menu' ),
'tertiary-menu' => __( 'Tertiary Menu' )
)
);
};
function recent_posts($atts,$content = null) {
extract(shortcode_atts(array(
'posts' => 1,
), $atts));
query_posts(array('orderby' => 'date',
'order' => 'DESC', 'showposts' => $posts ));
while (have_posts()) : the_post() ;
$rstr= '<span id="stcode"><br>Do not Miss our Recent Post : <br><a
href="'.get_permalink().'">'.get_the_title().'</a><br> <br></span>'.$content;
endwhile;
wp_reset_query();
return $rstr;
};