summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/modules/minileven/theme/pub/minileven/functions.php')
-rw-r--r--plugins/jetpack/modules/minileven/theme/pub/minileven/functions.php75
1 files changed, 64 insertions, 11 deletions
diff --git a/plugins/jetpack/modules/minileven/theme/pub/minileven/functions.php b/plugins/jetpack/modules/minileven/theme/pub/minileven/functions.php
index b33de783..5904a0ae 100644
--- a/plugins/jetpack/modules/minileven/theme/pub/minileven/functions.php
+++ b/plugins/jetpack/modules/minileven/theme/pub/minileven/functions.php
@@ -50,7 +50,9 @@ function minileven_setup() {
* If you're building a theme based on Minileven, use a find and replace
* to change 'minileven' to the name of your theme in all the template files.
*/
- load_theme_textdomain( 'minileven', TEMPLATEPATH . '/languages' );
+/* Don't load a minileven textdomain, as it uses the Jetpack textdomain.
+ load_theme_textdomain( 'minileven', get_template_directory() . '/languages' );
+*/
// Add default posts and comments RSS feed links to <head>.
add_theme_support( 'automatic-feed-links' );
@@ -62,10 +64,7 @@ function minileven_setup() {
add_theme_support( 'post-formats', array( 'gallery' ) );
// Add support for custom backgrounds
- if ( version_compare( $wp_version, '3.4', '>=' ) )
- add_theme_support( 'custom-background' );
- else
- add_custom_background();
+ add_theme_support( 'custom-background' );
// Add support for post thumbnails
add_theme_support( 'post-thumbnails' );
@@ -93,13 +92,13 @@ function minileven_fonts() {
/* translators: If there are characters in your language that are not supported
by Open Sans, translate this to 'off'. Do not translate into your own language. */
- if ( 'off' !== _x( 'on', 'Open Sans font: on or off', 'minileven' ) ) {
+ if ( 'off' !== _x( 'on', 'Open Sans font: on or off', 'jetpack' ) ) {
$opensans_subsets = 'latin,latin-ext';
/* translators: To add an additional Open Sans character subset specific to your language, translate
this to 'greek', 'cyrillic' or 'vietnamese'. Do not translate into your own language. */
- $opensans_subset = _x( 'no-subset', 'Open Sans font: add new subset (greek, cyrillic, vietnamese)', 'minileven' );
+ $opensans_subset = _x( 'no-subset', 'Open Sans font: add new subset (greek, cyrillic, vietnamese)', 'jetpack' );
if ( 'cyrillic' == $opensans_subset )
$opensans_subsets .= ',cyrillic,cyrillic-ext';
@@ -108,13 +107,11 @@ function minileven_fonts() {
elseif ( 'vietnamese' == $opensans_subset )
$opensans_subsets .= ',vietnamese';
- $protocol = is_ssl() ? 'https' : 'http';
-
$opensans_query_args = array(
'family' => 'Open+Sans:200,200italic,300,300italic,400,400italic,600,600italic,700,700italic',
'subset' => $opensans_subsets,
);
- wp_register_style( 'minileven-open-sans', add_query_arg( $opensans_query_args, "$protocol://fonts.googleapis.com/css" ), array(), null );
+ wp_register_style( 'minileven-open-sans', add_query_arg( $opensans_query_args, "//fonts.googleapis.com/css" ), array(), null );
}
}
add_action( 'init', 'minileven_fonts' );
@@ -158,6 +155,10 @@ function minileven_get_menu_location() {
$theme_slug = minileven_actual_current_theme();
$mods = get_option( "theme_mods_{$theme_slug}" );
+ if ( has_filter( 'jetpack_mobile_theme_menu' ) ) {
+ return array( 'primary' => apply_filters( 'jetpack_mobile_theme_menu', $menu_id ) );
+ }
+
if ( isset( $mods['nav_menu_locations'] ) && ! empty( $mods['nav_menu_locations'] ) )
return $mods['nav_menu_locations'];
@@ -185,4 +186,56 @@ function minileven_get_background() {
* If the user has set a static front page, show all posts on the front page, instead of a static page.
*/
if ( '1' == get_option( 'wp_mobile_static_front_page' ) )
- add_filter( 'pre_option_page_on_front', '__return_zero' ); \ No newline at end of file
+ add_filter( 'pre_option_page_on_front', '__return_zero' );
+
+/**
+ * Retrieves the IDs for images in a gallery.
+ *
+ * @uses get_post_galleries() first, if available. Falls back to shortcode parsing,
+ * then as last option uses a get_posts() call.
+ *
+ * @return array List of image IDs from the post gallery.
+ */
+function minileven_get_gallery_images() {
+ $images = array();
+
+ if ( function_exists( 'get_post_galleries' ) ) {
+ $galleries = get_post_galleries( get_the_ID(), false );
+ if ( isset( $galleries[0]['ids'] ) )
+ $images = explode( ',', $galleries[0]['ids'] );
+ } else {
+ $pattern = get_shortcode_regex();
+ preg_match( "/$pattern/s", get_the_content(), $match );
+ $atts = shortcode_parse_atts( $match[3] );
+ if ( isset( $atts['ids'] ) )
+ $images = explode( ',', $atts['ids'] );
+ }
+
+ if ( ! $images ) {
+ $images = get_posts( array(
+ 'fields' => 'ids',
+ 'numberposts' => 999,
+ 'order' => 'ASC',
+ 'orderby' => 'menu_order',
+ 'post_mime_type' => 'image',
+ 'post_parent' => get_the_ID(),
+ 'post_type' => 'attachment',
+ ) );
+ }
+
+ return $images;
+}
+
+/**
+ * Allow plugins to filter where Featured Images are displayed.
+ * Default has Featured Images disabled on single view and pages.
+ *
+ * @uses is_search()
+ * @uses apply_filters()
+ * @return bool
+ */
+function minileven_show_featured_images() {
+ $enabled = ( is_home() || is_search() || is_archive() ) ? true : false;
+
+ return (bool) apply_filters( 'minileven_show_featured_images', $enabled );
+}