From d1e9184e8b93b13c6ef643e98a5f95459d586d31 Mon Sep 17 00:00:00 2001 From: Vasil Kolev Date: Thu, 9 Oct 2014 21:23:38 +0300 Subject: [PATCH 1/7] fixes for pll --- footer.php | 6 +++--- functions.php | 40 ++++++++++++++++++++++++++++------------ header.php | 2 +- 3 files changed, 32 insertions(+), 16 deletions(-) diff --git a/footer.php b/footer.php index 0f8eb4c..580c779 100644 --- a/footer.php +++ b/footer.php @@ -9,19 +9,19 @@

-

+

'footer-schedule', 'items_wrap' => '%3$s
' )); ?>

-

+

'footer-others', 'items_wrap' => '%3$s
' )); ?>

-

+

'footer-followus', 'items_wrap' => '%3$s
' )); ?>

diff --git a/functions.php b/functions.php index d734b26..2f2d521 100644 --- a/functions.php +++ b/functions.php @@ -222,19 +222,35 @@ function openfest_home_page() { return !($wp->query_vars['pagename']=='home' || $wp->query_vars['pagename']=='home-2'); } -add_action( 'init', 'transportation_posttype' ); -pll_register_string('Schedule','Програма'); -pll_register_string('Others','Други'); -pll_register_string('follow','Последвайте ни в:'); -pll_register_string('venue','Интерпред, София, България'); -pll_register_string('venue_w','Място'); -pll_register_string('sponsors_w','Спонсори'); -pll_register_string('time','1-ви и 2-ри ноември 2014 г.'); -pll_register_string('publishedon','Публикувано на'); -pll_register_string('by_w','От'); -pll_register_string('see_whole_news','виж цялата новина'); -pll_register_string('news','Новини'); +function of_get_lang() { + if (function_exists("pll_current_language")) + return pll_current_language('slug'); + else + return 'bg'; +} +function e_($word) { + if (function_exists("pll_e")) + return pll_e($word); + else + echo $word; +} + +add_action( 'init', 'transportation_posttype' ); + +if (function_exists("pll_register_string")) { + pll_register_string('Schedule','Програма'); + pll_register_string('Others','Други'); + pll_register_string('follow','Последвайте ни в:'); + pll_register_string('venue','Интерпред, София, България'); + pll_register_string('venue_w','Място'); + pll_register_string('sponsors_w','Спонсори'); + pll_register_string('time','1-ви и 2-ри ноември 2014 г.'); + pll_register_string('publishedon','Публикувано на'); + pll_register_string('by_w','От'); + pll_register_string('see_whole_news','виж цялата новина'); + pll_register_string('news','Новини'); +} ?> diff --git a/header.php b/header.php index 28b9512..d142a0e 100644 --- a/header.php +++ b/header.php @@ -32,6 +32,6 @@ '; + echo ''; } ?> From 5e67b6886fb0f84ea33b8ad020a602a36f35f30b Mon Sep 17 00:00:00 2001 From: Vasil Kolev Date: Fri, 10 Oct 2014 17:25:34 +0300 Subject: [PATCH 2/7] fix warning, fix news for different languages --- functions.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/functions.php b/functions.php index 2f2d521..ede45ea 100644 --- a/functions.php +++ b/functions.php @@ -34,7 +34,7 @@ function sh_latest_posts($atts){ $result = '

'.$atts['label'].' | '.__('see all', 'initfest').'

'; - $news_args = array( 'category_name' => $cat, 'numberposts' => 3 ); + $news_args = array( 'category_name' => 'news', 'numberposts' => 3, 'lang' => of_get_lang() ); $news = new WP_Query( $news_args ); ob_start(); @@ -157,7 +157,7 @@ function create_sponsors_posttype() { register_post_type( 'sponsors', $args ); } -add_action( 'init', create_sponsors_posttype ); +add_action( 'init', 'create_sponsors_posttype' ); # Create a custom post type for Speakers @@ -200,7 +200,7 @@ function create_speakers_posttype() { register_post_type( 'speakers', $args ); } -add_action( 'init', create_speakers_posttype ); +add_action( 'init', 'create_speakers_posttype' ); # Create a custom post type for Tranportation @@ -219,6 +219,7 @@ function transportation_posttype() { } function openfest_home_page() { + if (empty($wp)) {return true;} ; return !($wp->query_vars['pagename']=='home' || $wp->query_vars['pagename']=='home-2'); } From c69cca66912458b73996a5b755644d71b7bfad94 Mon Sep 17 00:00:00 2001 From: Vasil Kolev Date: Fri, 10 Oct 2014 17:26:11 +0300 Subject: [PATCH 3/7] icons for team people, fix from Krasimir --- css/styles.css | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/css/styles.css b/css/styles.css index d077c59..ebaa0ed 100644 --- a/css/styles.css +++ b/css/styles.css @@ -539,12 +539,11 @@ footer .content li { list-style: none; } margin: 0 1em 2em 0; } .speaker .icons { - position: absolute; - top: 125px; - left: 0; - font-size: 1.2em; + font-size: 0.8em; width: 122px; text-align: center; + display: inline-block; + margin: 0 0 0 0.1em; } .speaker .icons a { display: inline-block; From 3756bffab23a454397dad458566f80ab9344a2e6 Mon Sep 17 00:00:00 2001 From: Vasil Kolev Date: Sun, 12 Oct 2014 12:59:55 +0300 Subject: [PATCH 4/7] fix for the speakers' icons --- css/styles.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css/styles.css b/css/styles.css index ebaa0ed..ae78d26 100644 --- a/css/styles.css +++ b/css/styles.css @@ -529,7 +529,7 @@ footer .content li { list-style: none; } display: block; } .speaker > img { - width: 100px; +/* width: 100px; */ float: left; padding: 0.3em; background: #FFF; From 521d306513c3a0f06bbd4243f007a09c84012497 Mon Sep 17 00:00:00 2001 From: Vasil Kolev Date: Sun, 12 Oct 2014 13:00:11 +0300 Subject: [PATCH 5/7] stolen func to get id of attachment --- functions.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/functions.php b/functions.php index ede45ea..3177bc8 100644 --- a/functions.php +++ b/functions.php @@ -237,6 +237,34 @@ function e_($word) { echo $word; } +function pn_get_attachment_id_from_url( $attachment_url = '' ) { + + global $wpdb; + $attachment_id = false; + + // If there is no url, return. + if ( '' == $attachment_url ) + return; + + // Get the upload directory paths + $upload_dir_paths = wp_upload_dir(); + + // Make sure the upload path base directory exists in the attachment URL, to verify that we're working with a media library image + if ( false !== strpos( $attachment_url, $upload_dir_paths['baseurl'] ) ) { + + // If this is the URL of an auto-generated thumbnail, get the URL of the original image + $attachment_url = preg_replace( '/-\d+x\d+(?=\.(jpg|jpeg|png|gif)$)/i', '', $attachment_url ); + + // Remove the upload path base directory from the attachment URL + $attachment_url = str_replace( $upload_dir_paths['baseurl'] . '/', '', $attachment_url ); + + // Finally, run a custom database query to get the attachment ID from the modified attachment URL + $attachment_id = $wpdb->get_var( $wpdb->prepare( "SELECT wposts.ID FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = '_wp_attached_file' AND wpostmeta.meta_value = '%s' AND wposts.post_type = 'attachment'", $attachment_url ) ); + + } + + return $attachment_id; +} add_action( 'init', 'transportation_posttype' ); if (function_exists("pll_register_string")) { @@ -255,3 +283,4 @@ if (function_exists("pll_register_string")) { ?> + From e3e1bf23ef3754079de7b21038d8615e448ee978 Mon Sep 17 00:00:00 2001 From: Vasil Kolev Date: Sun, 12 Oct 2014 13:00:46 +0300 Subject: [PATCH 6/7] small fixes --- page-speakers.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/page-speakers.php b/page-speakers.php index 457b79c..abb3d33 100644 --- a/page-speakers.php +++ b/page-speakers.php @@ -1,11 +1,15 @@

Лектори

'speakers' ); + $speakers_args = array( 'post_type' => 'speakers', 'nopaging' => 'true', 'order' => 'ASC' ); $speakers = new WP_Query( $speakers_args ); if ( $speakers->have_posts() ) : @@ -14,10 +18,10 @@ get_header(); ?>
- + From 83878ce184b60858f89bba208104257a622a10d2 Mon Sep 17 00:00:00 2001 From: Vasil Kolev Date: Sun, 12 Oct 2014 13:10:24 +0300 Subject: [PATCH 7/7] make this to have the proper design --- page-speakers.php | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/page-speakers.php b/page-speakers.php index abb3d33..aef4f36 100644 --- a/page-speakers.php +++ b/page-speakers.php @@ -8,6 +8,8 @@ get_header(); ?>

Лектори

+ +
'speakers', 'nopaging' => 'true', 'order' => 'ASC' ); $speakers = new WP_Query( $speakers_args ); @@ -15,7 +17,37 @@ get_header(); ?> if ( $speakers->have_posts() ) : while ( $speakers->have_posts() ) : $speakers->the_post(); ?> -
+ + + +
+ 'speakers', 'nopaging' => 'true', 'order' => 'ASC' ); + $speakers = new WP_Query( $speakers_args ); + + if ( $speakers->have_posts() ) : + while ( $speakers->have_posts() ) : $speakers->the_post(); + ?> +
endif; ?>
- +