Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Commit

Permalink
Fixes to people and courses
Browse files Browse the repository at this point in the history
  • Loading branch information
andriiryzhkov committed Feb 3, 2015
1 parent 28822db commit 7ee9530
Show file tree
Hide file tree
Showing 20 changed files with 316 additions and 156 deletions.
9 changes: 8 additions & 1 deletion assets/css/main.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/css/main.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/main.min.css

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions assets/js/plugins/add-courses.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* Add Courses button in Editor
*/
jQuery(function($) {
$(document).ready(function(){
$('#insert-courses').click(open_courses_window);
});

function open_courses_window() {
}
});
11 changes: 11 additions & 0 deletions assets/js/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -13778,6 +13778,17 @@ return jQuery;
}
};
})(jQuery);
;/**
* Add Courses button in Editor
*/
jQuery(function($) {
$(document).ready(function(){
$('#insert-courses').click(open_courses_window);
});

function open_courses_window() {
}
});
;/*
* Back to top script
*/
Expand Down
2 changes: 1 addition & 1 deletion assets/js/scripts.min.js

Large diffs are not rendered by default.

17 changes: 16 additions & 1 deletion assets/less/components/_people-course.less
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

.type-people.hentry {
.entry-title {
font-size: ceil((@font-size-base * 1.6));
font-size: ceil((@font-size-base * 1.3));
}

.wp-post-image {
Expand Down Expand Up @@ -53,6 +53,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
}
}

.people-social {
font-size: ceil((@font-size-base * 1.8));;
margin-right: 10px;
}

.course-info {

td {
Expand All @@ -64,4 +69,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
font-weight: bold;
}
}
}



.wp-media-buttons {
.add-courses {
span.wp-media-buttons-icon:before {
content: "\f118";
}
}
}
4 changes: 2 additions & 2 deletions assets/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"querystring": true,
"assets/css/main.min.css": {
"path": "assets/css/main.min.css",
"hash": "0b464751a704a3d8be9588dbab5fd917",
"hash": "f39004eaa58aef304c5de16eb8d43e24",
"handle": "tsatu_css"
},
"assets/js/scripts.min.js": {
"path": "assets/js/scripts.min.js",
"hash": "e30d6773921f59c6f1fac7f9d211f91b",
"hash": "0b1bba0fef1bdecba9df0582d1db32ba",
"handle": "tsatu_js"
}
}
2 changes: 2 additions & 0 deletions content-people.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
?>

<!-- People -->
<div class="col-md-6">
<article <?php post_class(); ?>>
<div class="row">
<div class="col-md-4 entry-image <?php echo get_post_format(); ?>">
Expand All @@ -40,3 +41,4 @@
</div>
</div>
</article>
</div>
18 changes: 17 additions & 1 deletion includes/customizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
function tsatu_customize_register($wp_customize) {

//Abbreviation
//Site title
$wp_customize->add_setting('abbr', array(
'default' => '',
));
Expand All @@ -29,6 +29,22 @@ function tsatu_customize_register($wp_customize) {
'type' => 'text'
));

$wp_customize->add_setting('type', array(
'default' => '',
));

$wp_customize->add_control('type', array(
'label' => __('Division type', 'tsatu'),
'section' => 'title_tagline',
'type' => 'select',
'choices' => array(
'none' => __('&mdash; Select &mdash;', 'tsatu'),
'department' => __('Department', 'tsatu'),
'faculty' => __('Faculty', 'tsatu'),
'office' => __('Office', 'tsatu'),
),
));

// Slider on front page
$wp_customize->add_section( 'slider_section' , array(
'title' => __( 'Slider', 'tsatu' ),
Expand Down
33 changes: 17 additions & 16 deletions includes/extras.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,24 +305,21 @@ function tsatu_taxonomy_filter_restrict_manage_posts()

if (in_array($typenow, $post_types)) {
$filters = get_object_taxonomies($typenow);
$filters = array_diff($filters, array('language'));
$filters = array_diff($filters, array('language', 'post_translations'));

foreach ($filters as $tax_slug) {
$tax_terms = get_terms($tax_slug);
if ( !empty( $tax_terms ) && !is_wp_error( $tax_terms ) ) {
$tax_obj = get_taxonomy($tax_slug);
wp_dropdown_categories(array(
'show_option_all' => sprintf(__('Show All %s', 'tsatu'), $tax_obj->label),
//'show_option_all' => __('Show All ', 'tsatu' ) . $tax_obj->label,
'taxonomy' => $tax_slug,
'name' => $tax_obj->name,
'orderby' => 'name',
'selected' => $_GET[$tax_slug],
'hierarchical' => $tax_obj->hierarchical,
'show_count' => false,
'hide_empty' => true
));
}
$tax_obj = get_taxonomy($tax_slug);
wp_dropdown_categories(array(
'show_option_all' => sprintf(__('Show All %s', 'tsatu'), $tax_obj->label),
'taxonomy' => $tax_slug,
'name' => $tax_obj->name,
'orderby' => 'name',
'selected' => $_GET[$tax_slug],
'hierarchical' => $tax_obj->hierarchical,
'show_count' => false,
'hide_empty' => true,
'hide_if_empty' => true
));
}
}
}
Expand All @@ -340,6 +337,7 @@ function tsatu_taxonomy_filter_post_type_request($query)

if ('edit.php' == $pagenow) {
$filters = get_object_taxonomies($typenow);
$filters = array_diff($filters, array('language', 'post_translations'));
foreach ($filters as $tax_slug) {
$var = &$query->query_vars[$tax_slug];
if (isset($var)) {
Expand Down Expand Up @@ -392,3 +390,6 @@ function tsatu_taxonomy_filter_post_type_request($query)
// }
//}


wp_insert_term('Доктор філософії', 'people_degree');

20 changes: 17 additions & 3 deletions includes/post_types/course_post_type.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function display_course_metabox($course_post)
</tr>
<tr>
<td><?php _e('Links', 'tsatu'); ?>:</td>
<td><input type="text" size="80" name="course_links" value="<?php echo $course_lecture; ?>"/><br/>
<td><input type="text" size="80" name="course_links" value="<?php echo $course_links; ?>"/><br/>
<small><?php _e('Separate links with commas', 'tsatu'); ?></small>
</td>
</tr>
Expand Down Expand Up @@ -131,7 +131,7 @@ function add_course_fields($course_post_id, $course_post)
update_post_meta($course_post_id, 'course_lecture', $_POST['course_lecture']);
}
}
if (isset($_POST['course_links']) && $_POST['course_links'] != '') {
if (isset($_POST['course_links'])) {
update_post_meta($course_post_id, 'course_links', $_POST['course_links']);
}
}
Expand Down Expand Up @@ -277,6 +277,7 @@ function course_year_taxonomy() {
*/
function the_lecture($course_ID) {
$lecture_ID = esc_html( get_post_meta( $course_ID, 'course_lecture', true ) );
if ($lecture_ID == '') return false;
$lecture_post = get_post($lecture_ID);
return '<a href="' . get_permalink($lecture_post->ID) . '" ><div>' . $lecture_post->post_title . '</div></a>' ;
}
Expand All @@ -287,8 +288,10 @@ function the_lecture($course_ID) {
* Get the course links
*/
function the_course_links($course_ID) {
if (esc_html(get_post_meta($course_ID, 'course_links', true )) == '') return false;
$links = explode(',', esc_html( get_post_meta( $course_ID, 'course_links', true ) ) );
if (!empty($links) && !is_wp_error($links)) {
$links_list = '';
foreach ($links as $link) {
$links_list .= '<div><a href="' . $link . '">' . $link . '</a></div>';
}
Expand All @@ -307,7 +310,7 @@ function insert_course($content)

ob_start();

$query = new WP_Query(array('post_type' => 'course', 'order' => 'ASC', 'post_status' => 'publish'));
$query = new WP_Query(array('post_type' => 'course', 'orderby' => 'menu_order title', 'order' => 'ASC', 'post_status' => 'publish'));
if ($query->have_posts()) :
while ($query->have_posts()) : $query->the_post(); ?>
<?php get_template_part('content', 'course'); ?>
Expand Down Expand Up @@ -342,3 +345,14 @@ function course_editor_content($content)
add_filter( 'default_content', 'course_editor_content' );
}

if (!function_exists('courses_media_button')) {
/**
* Set default editor content
*/
function courses_media_button()
{
echo '<a href="#" id="insert-courses" class="button add-courses" data-editor="content"><span class="wp-media-buttons-icon"></span> ' . __('Insert Courses', 'tsatu') . '</a>';
}

add_action('media_buttons', 'courses_media_button', 15);
}
46 changes: 23 additions & 23 deletions includes/post_types/people_post_type.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function display_people_metabox($people_post)
}
}

if (!function_exists('add_people_metabox')) {
if (!function_exists('add_people_fields')) {
/**
* Save people function
*/
Expand All @@ -153,28 +153,28 @@ function add_people_fields($people_post_id, $people_post)
// Check post type for movie reviews
if ($people_post->post_type == 'people') {
// Store data in post meta table if present in post data
if (isset($_POST['people_office']) && $_POST['people_office'] != '') {
if (isset($_POST['people_office'])) {
update_post_meta($people_post_id, 'people_office', $_POST['people_office']);
}
if (isset($_POST['people_phone']) && $_POST['people_phone'] != '') {
if (isset($_POST['people_phone'])) {
update_post_meta($people_post_id, 'people_phone', $_POST['people_phone']);
}
if (isset($_POST['people_email']) && $_POST['people_email'] != '') {
if (isset($_POST['people_email'])) {
update_post_meta($people_post_id, 'people_email', $_POST['people_email']);
}
if (isset($_POST['people_moodle']) && $_POST['people_moodle'] != '') {
if (isset($_POST['people_moodle'])) {
update_post_meta($people_post_id, 'people_moodle', $_POST['people_moodle']);
}
if (isset($_POST['people_facebook']) && $_POST['people_facebook'] != '') {
if (isset($_POST['people_facebook'])) {
update_post_meta($people_post_id, 'people_facebook', $_POST['people_facebook']);
}
if (isset($_POST['people_google']) && $_POST['people_google'] != '') {
if (isset($_POST['people_google'])) {
update_post_meta($people_post_id, 'people_google', $_POST['people_google']);
}
if (isset($_POST['people_twitter']) && $_POST['people_twitter'] != '') {
update_post_meta($people_post_id, 'people_tweeter', $_POST['people_tweeter']);
if (isset($_POST['people_twitter'])) {
update_post_meta($people_post_id, 'people_twitter', $_POST['people_twitter']);
}
if (isset($_POST['people_linkedin']) && $_POST['people_linkedin'] != '') {
if (isset($_POST['people_linkedin'])) {
update_post_meta($people_post_id, 'people_linkedin', $_POST['people_linkedin']);
}
}
Expand Down Expand Up @@ -290,14 +290,10 @@ function people_degree_taxonomy()
}

// Add nonexistent degree terms
if(!term_exists('Доктор філософії', 'people_degree'))
wp_insert_term('Доктор філософії', 'people_degree', array('slug' => 'phd'));
//if(!term_exists('[:uk]Доктор філософії[:en]Doctor of Philosophy', 'people_degree'))
// wp_insert_term('[:uk]Доктор філософії[:en]Doctor of Philosophy', 'people_degree', array('slug' => 'phd'));
if(!term_exists('<!--:uk-->Доктор наук<!--:--><!--:en-->Doctor of Science<!--:-->', 'people_degree'))
wp_insert_term('<!--:uk-->Доктор наук<!--:--><!--:en-->Doctor of Science<!--:-->', 'people_degree', array('slug' => 'dsc'));
if(!term_exists('<!--:uk-->Ступінь<!--:--><!--:en-->Degree<!--:-->', 'people_degree'))
wp_insert_term('<!--:uk-->Ступінь<!--:--><!--:en-->Degree<!--:-->', 'people_degree', array('slug' => 'dsc'));
//if(!term_exists('Доктор філософії', 'people_degree'))
// wp_insert_term('Доктор філософії', 'people_degree', array('slug' => 'phd'));
//if(!term_exists('Доктор наук', 'people_degree'))
// wp_insert_term('Доктор наук', 'people_degree', array('slug' => 'dsc'));

if (!function_exists('people_title_taxonomy')) {
/**
Expand Down Expand Up @@ -348,11 +344,15 @@ function inject_people($content)

ob_start();

$query = new WP_Query(array('post_type' => 'people', 'order' => 'ASC', 'post_status' => 'publish'));
if ($query->have_posts()) :
while ($query->have_posts()) : $query->the_post(); ?>
<?php get_template_part('content', 'people'); ?>
<?php endwhile;
$query = new WP_Query(array('post_type' => 'people', 'orderby' => 'menu_order title', 'order' => 'ASC', 'post_status' => 'publish'));
if ($query->have_posts()) : ?>
<div class="row">
<?php
while ($query->have_posts()) : $query->the_post();
get_template_part('content', 'people');
endwhile; ?>
</div>
<?php
endif;

$content .= ob_get_clean();
Expand Down
Loading

0 comments on commit 7ee9530

Please sign in to comment.