Skip to content

Commit 957eadb

Browse files
Fix: Beautify all files as per WordPress coding standerds.
1 parent b01e419 commit 957eadb

5 files changed

Lines changed: 142 additions & 150 deletions

File tree

assets/css/style.css

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
}
2424

2525
.single-job-wrapper .job-type span {
26-
color: #2667c9;
26+
color: #2667c9;
2727
background-color: #e6f0f6;
2828
padding-left: 10px;
2929
padding-right: 10px;
@@ -38,9 +38,7 @@
3838
}
3939

4040
.job-cat {
41-
color: #2667c9;
41+
color: #2667c9;
4242
text-align: right;
4343
text-transform: capitalize;
44-
}
45-
46-
44+
}

include/plugin-actions.php

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,19 @@
11
<?php
22

3-
function apply_templates($template){
3+
function apply_templates( $template ) {
44
global $post;
5-
$post_type = get_post_type($post);
6-
if($post_type == 'wp_jobs'){
7-
if ( is_single() ){
8-
9-
if ( locate_template(array('single-wp_jobs.php'))) {
10-
11-
$template = locate_template('single-wp_jobs.php',true );
12-
13-
} else {
14-
15-
$template = WP_JOB_DIR_PATH .'templates/single-wp_jobs.php';
16-
17-
}
5+
$post_type = get_post_type( $post );
6+
if ( $post_type == 'wp_jobs' ) {
7+
if ( is_single() ) {
8+
if ( locate_template( array( 'single-wp_jobs.php' ) ) ) {
9+
$template = locate_template( 'single-wp_jobs.php', true );
10+
} else {
11+
$template = WP_JOB_DIR_PATH . 'templates/single-wp_jobs.php';
12+
}
1813
}
19-
2014
}
2115

22-
return $template;
16+
return $template;
2317
}
2418

25-
add_filter( 'template_include', 'apply_templates');
19+
add_filter( 'template_include', 'apply_templates' );

include/shortcode/job-list.php

Lines changed: 34 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,45 @@
1-
<?php
2-
function display_job_list(){
1+
<?php
2+
function display_job_list() {
33
global $post;
44
ob_start();
5-
$args = array('post_type'=>'wp_jobs',
6-
'orderby' => 'date',
7-
'order' => 'DSC',
8-
'numberposts'=> -1,
9-
);
10-
$posts = get_posts($args);
5+
$args = array(
6+
'post_type' => 'wp_jobs',
7+
'orderby' => 'date',
8+
'order' => 'DSC',
9+
'numberposts' => -1,
10+
);
11+
$posts = get_posts( $args );
1112

1213
echo '<div class="sections_group job-wrapper">';
1314
echo '<div class="section_wrapper">';
1415
echo '<div class="vc_row wpb_row vc_row-fluid">';
15-
foreach($posts as $post){
16-
?>
16+
foreach ( $posts as $post ) {
17+
?>
1718
<a class="vc_col-md-6" href="<?php echo get_the_permalink(); ?>">
1819
<div class="single-job-wrapper" id="<?php echo $post->ID; ?>">
19-
<h5 class="title"><?php the_title(); ?></h5>
20-
<div class="info vc_row wpb_row clearfix">
21-
<div class="job-type vc_col-md-6">
22-
<?php
23-
$job_types = wp_get_post_terms( $post->ID, 'wp_job_type', array( 'fields' => 'all' ) );
24-
foreach( $job_types as $job_type ) { ?>
25-
<span><?php echo $job_type->name; ?></span>
26-
<?php } ?>
27-
</div>
28-
<div class="job-cat vc_col-md-6">
29-
<?php
30-
$job_cats = wp_get_post_terms( $post->ID, 'wp_job_cat', array( 'fields' => 'all' ) );
31-
foreach( $job_cats as $job_cat ) { ?>
32-
<span><?php echo $job_cat->name; ?></span>
33-
<?php } ?>
34-
</div>
35-
</div>
36-
</div>
37-
</a>
20+
<h5 class="title"><?php the_title(); ?></h5>
21+
<div class="info vc_row wpb_row clearfix">
22+
<div class="job-type vc_col-md-6">
23+
<?php
24+
$job_types = wp_get_post_terms( $post->ID, 'wp_job_type', array( 'fields' => 'all' ) );
25+
foreach ( $job_types as $job_type ) {
26+
?>
27+
<span><?php echo $job_type->name; ?></span>
28+
<?php } ?>
29+
</div>
30+
<div class="job-cat vc_col-md-6">
31+
<?php
32+
$job_cats = wp_get_post_terms( $post->ID, 'wp_job_cat', array( 'fields' => 'all' ) );
33+
foreach ( $job_cats as $job_cat ) {
34+
?>
35+
<span><?php echo $job_cat->name; ?></span>
36+
<?php } ?>
37+
</div>
38+
</div>
39+
</div>
40+
</a>
3841
<?php
39-
}
42+
}
4043
echo '</div>';
4144
echo '</div>';
4245
echo '</div>';
@@ -46,4 +49,4 @@ function display_job_list(){
4649
return $output;
4750
}
4851

49-
add_shortcode('job-list','display_job_list');
52+
add_shortcode( 'job-list', 'display_job_list' );

templates/single-wp_jobs.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,22 @@
55

66
<div id="Content">
77
<div class="content_wrapper clearfix">
8-
98
<div class="sections_group">
109
<?php
11-
1210
if ( have_posts() ) {
13-
1411
while ( have_posts() ) {
15-
1612
the_post();
17-
1813
the_content();
19-
2014
}
2115
} else {
22-
2316
// template: default
24-
2517
while ( have_posts() ) {
2618
echo 'No job found';
2719
}
2820
}
29-
3021
?>
3122
</div>
32-
3323
<?php get_sidebar(); ?>
34-
3524
</div>
3625
</div>
3726

wp-job.php

Lines changed: 94 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
Author: Team WPgenius
99
Author URI: http://wpgenius.in/
1010
Text Domain: wp-job
11-
*/
11+
*/
1212

1313
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
1414

@@ -25,115 +25,123 @@ function load_plugin_css() {
2525
add_action( 'wp_enqueue_scripts', 'load_plugin_css' );
2626

2727

28-
add_action( 'init', 'create_wp_jobs');
28+
add_action( 'init', 'create_wp_jobs' );
2929
function create_wp_jobs() {
3030

3131
$labels = array(
32-
'name' => _x( 'Jobs', 'Post Type General Name', 'wp-job' ),
33-
'singular_name' => _x( 'Job', 'Post Type Singular Name', 'wp-job' ),
34-
'menu_name' => __( 'Jobs', 'wp-job' ),
35-
'name_admin_bar' => __( 'Jobs', 'wp-job' ),
36-
'all_items' => __( 'All Jobs', 'wp-job' ),
37-
'add_new_item' => __( 'Add New Job', 'wp-job' ),
38-
'new_item' => __( 'New Job', 'wp-job' ),
39-
'edit_item' => __( 'Edit Job', 'wp-job' ),
40-
'update_item' => __( 'Update Job', 'wp-job' ),
41-
'view_item' => __( 'View Job', 'wp-job' ),
42-
'search_items' => __( 'Search Job', 'wp-job' ),
43-
'add_title' => __( 'Add Job Title', 'wp-job' ),
44-
32+
'name' => _x( 'Jobs', 'Post Type General Name', 'wp-job' ),
33+
'singular_name' => _x( 'Job', 'Post Type Singular Name', 'wp-job' ),
34+
'menu_name' => __( 'Jobs', 'wp-job' ),
35+
'name_admin_bar' => __( 'Jobs', 'wp-job' ),
36+
'all_items' => __( 'All Jobs', 'wp-job' ),
37+
'add_new_item' => __( 'Add New Job', 'wp-job' ),
38+
'new_item' => __( 'New Job', 'wp-job' ),
39+
'edit_item' => __( 'Edit Job', 'wp-job' ),
40+
'update_item' => __( 'Update Job', 'wp-job' ),
41+
'view_item' => __( 'View Job', 'wp-job' ),
42+
'search_items' => __( 'Search Job', 'wp-job' ),
43+
'add_title' => __( 'Add Job Title', 'wp-job' ),
44+
4545
);
4646
$args = array(
47-
'labels' => $labels,
48-
'description' => __('Holds jobs and job specific data','wp-job'),
49-
'hierarchical' => false,
50-
'public' => true,
51-
'publicly_queryable' => true,
52-
'show_ui' => true,
53-
'show_in_menu' => true,
54-
'menu_position' => 5,
55-
'menu_icon' => 'dashicons-portfolio',
56-
'show_in_admin_bar' => true,
57-
'show_in_nav_menus' => true,
58-
'can_export' => true,
59-
'has_archive' => true,
60-
'exclude_from_search' => false,
61-
'publicly_queryable' => true,
62-
'rewrite' => array( 'slug' => 'jobs' ),
63-
'capability_type' => 'post',
64-
'supports' => array( 'title', 'editor')
65-
47+
'labels' => $labels,
48+
'description' => __( 'Holds jobs and job specific data', 'wp-job' ),
49+
'hierarchical' => false,
50+
'public' => true,
51+
'publicly_queryable' => true,
52+
'show_ui' => true,
53+
'show_in_menu' => true,
54+
'menu_position' => 5,
55+
'menu_icon' => 'dashicons-portfolio',
56+
'show_in_admin_bar' => true,
57+
'show_in_nav_menus' => true,
58+
'can_export' => true,
59+
'has_archive' => true,
60+
'exclude_from_search' => false,
61+
'publicly_queryable' => true,
62+
'rewrite' => array( 'slug' => 'jobs' ),
63+
'capability_type' => 'post',
64+
'supports' => array( 'title', 'editor' ),
65+
6666
);
67-
register_post_type( 'wp_jobs', $args);
67+
register_post_type( 'wp_jobs', $args );
6868

69-
$singular = 'Job Type';
70-
$plural = 'Job Types';
69+
$singular = 'Job Type';
70+
$plural = 'Job Types';
7171
$tax_labels = array(
72-
'name' => _x( $plural, "taxonomy general name"),
73-
'singular_name' => _x( $singular, "taxonomy singular name"),
74-
'search_items' => __("Search $singular"),
75-
'all_items' => __("All $singular"),
76-
'edit_item' => __("Edit $singular"),
77-
'update_item' => __("Update $singular"),
78-
'add_new_item' => __("Add New $singular"),
79-
'new_item_name' => __("New $singular Name"),
72+
'name' => _x( $plural, 'taxonomy general name' ),
73+
'singular_name' => _x( $singular, 'taxonomy singular name' ),
74+
'search_items' => __( "Search $singular" ),
75+
'all_items' => __( "All $singular" ),
76+
'edit_item' => __( "Edit $singular" ),
77+
'update_item' => __( "Update $singular" ),
78+
'add_new_item' => __( "Add New $singular" ),
79+
'new_item_name' => __( "New $singular Name" ),
8080
);
8181

82-
register_taxonomy( 'wp_job_type', 'wp_jobs', array(
83-
'public' => true,
84-
'publicly_queryable' => true,
85-
'show_ui' => true,
86-
'show_in_nav_menus' => true,
87-
'hierarchical' => false,
88-
'query_var' => true,
89-
'rewrite' => false,
90-
'labels' => $tax_labels
91-
) );
92-
93-
$singular = 'Job Category';
94-
$plural = 'Job Categories';
82+
register_taxonomy(
83+
'wp_job_type',
84+
'wp_jobs',
85+
array(
86+
'public' => true,
87+
'publicly_queryable' => true,
88+
'show_ui' => true,
89+
'show_in_nav_menus' => true,
90+
'hierarchical' => false,
91+
'query_var' => true,
92+
'rewrite' => false,
93+
'labels' => $tax_labels,
94+
)
95+
);
96+
97+
$singular = 'Job Category';
98+
$plural = 'Job Categories';
9599
$tax_labels = array(
96-
'name' => _x( $plural, "taxonomy general name"),
97-
'singular_name' => _x( $singular, "taxonomy singular name"),
98-
'search_items' => __("Search $singular"),
99-
'all_items' => __("All $singular"),
100-
'edit_item' => __("Edit $singular"),
101-
'update_item' => __("Update $singular"),
102-
'add_new_item' => __("Add New $singular"),
103-
'new_item_name' => __("New $singular Name"),
100+
'name' => _x( $plural, 'taxonomy general name' ),
101+
'singular_name' => _x( $singular, 'taxonomy singular name' ),
102+
'search_items' => __( "Search $singular" ),
103+
'all_items' => __( "All $singular" ),
104+
'edit_item' => __( "Edit $singular" ),
105+
'update_item' => __( "Update $singular" ),
106+
'add_new_item' => __( "Add New $singular" ),
107+
'new_item_name' => __( "New $singular Name" ),
104108
);
105109

106-
register_taxonomy( 'wp_job_cat', 'wp_jobs', array(
107-
'public' => true,
108-
'publicly_queryable' => true,
109-
'show_ui' => true,
110-
'show_in_nav_menus' => true,
111-
'hierarchical' => false,
112-
'query_var' => true,
113-
'rewrite' => false,
114-
'labels' => $tax_labels
115-
) );
110+
register_taxonomy(
111+
'wp_job_cat',
112+
'wp_jobs',
113+
array(
114+
'public' => true,
115+
'publicly_queryable' => true,
116+
'show_ui' => true,
117+
'show_in_nav_menus' => true,
118+
'hierarchical' => false,
119+
'query_var' => true,
120+
'rewrite' => false,
121+
'labels' => $tax_labels,
122+
)
123+
);
116124

117125
}
118126

119127
/**
120128
* Activate the plugin.
121129
*/
122-
function plugin_wp_job_activate() {
123-
// Trigger our function that registers the custom post type plugin.
124-
create_wp_jobs();
125-
// Clear the permalinks after the post type has been registered.
126-
flush_rewrite_rules();
130+
function plugin_wp_job_activate() {
131+
// Trigger our function that registers the custom post type plugin.
132+
create_wp_jobs();
133+
// Clear the permalinks after the post type has been registered.
134+
flush_rewrite_rules();
127135
}
128136
register_activation_hook( __FILE__, 'plugin_wp_job_activate' );
129137

130138
/**
131139
* Deactivation hook.
132140
*/
133141
function plugin_wp_job_deactivate() {
134-
// Unregister the post type, so the rules are no longer in memory.
135-
unregister_post_type( 'wp_jobs' );
136-
// Clear the permalinks to remove our post type's rules from the database.
137-
flush_rewrite_rules();
142+
// Unregister the post type, so the rules are no longer in memory.
143+
unregister_post_type( 'wp_jobs' );
144+
// Clear the permalinks to remove our post type's rules from the database.
145+
flush_rewrite_rules();
138146
}
139-
register_deactivation_hook( __FILE__, 'plugin_wp_job_deactivate' );
147+
register_deactivation_hook( __FILE__, 'plugin_wp_job_deactivate' );

0 commit comments

Comments
 (0)