Skip to content
Newer
Older
100644 864 lines (682 sloc) 22.7 KB
6b38c83 @Cais * Adjusted various CSS elements and properties to display TUT data mo…
authored Jul 14, 2013
1 <?php
2 /**
3 * Functions
4 * The secret sauce and other funky flavors
5 *
6 * @package Desk_Mess_Mirrored
7 * @since 1.0
8 *
9 * @link http://buynowshop.com/themes/desk-mess-mirrored/
10 * @link https://github.com/Cais/desk-mess-mirrored/
29cd3fa @Cais * Update copyright years and miscellaneous comment cleanup
authored May 15, 2015
11 * @link https://wordpress.org/themes/desk-mess-mirrored/
6b38c83 @Cais * Adjusted various CSS elements and properties to display TUT data mo…
authored Jul 15, 2013
12 *
13 * @author Edward Caissie <edward.caissie@gmail.com>
68b8909 @Cais * Updated copyright year in all files
authored Feb 21, 2016
14 * @copyright Copyright (c) 2009-2016, Edward Caissie
6b38c83 @Cais * Adjusted various CSS elements and properties to display TUT data mo…
authored Jul 15, 2013
15 *
e6a4416 @Cais * Added `dmm_featured_image_view` function to display vertical aspect…
authored Feb 21, 2016
16 * @version 2.4
17 * @date May 16, 2015
5fe3af3 @Cais * Cleaned up i18n implementation - "symbol" characters are a design c…
authored May 16, 2015
18 * Cleaned up i18n implementation - "symbol" characters are a design choice
24b8096 @Cais * Removed `wip` folder and reference to `extra.css` file
authored Feb 21, 2016
19 *
20 * @version 2.5
21 * @date February 21, 2016
22 * Added sanity check for 'DMM_SHOW_PAGE_PERMALINK' being defined
23 * Removed reference to `wip` folder and `extra.css` file
6b38c83 @Cais * Adjusted various CSS elements and properties to display TUT data mo…
authored Jul 15, 2013
24 */
25
26 /** Define Desk Mess Mirrored "Home" domain */
27 define( 'DMM_HOME_DOMAIN', 'BuyNowShop.com' );
28
40fbd49 @Cais * Added DMM_SHOW_PAGE_PERMALINK constant
authored Nov 16, 2013
29 /** Define Show Page Permalink Constant - default: false */
24b8096 @Cais * Removed `wip` folder and reference to `extra.css` file
authored Feb 21, 2016
30 if ( ! defined( 'DMM_SHOW_PAGE_PERMALINK' ) ) {
31 define( 'DMM_SHOW_PAGE_PERMALINK', false );
32 }
40fbd49 @Cais * Added DMM_SHOW_PAGE_PERMALINK constant
authored Nov 16, 2013
33
6b38c83 @Cais * Adjusted various CSS elements and properties to display TUT data mo…
authored Jul 15, 2013
34 /**
35 * Enqueue Comment Reply Script
36 *
37 * If the page being viewed is a single post/page; and, comments are open; and,
38 * threaded comments are turned on then enqueue the built-in comment-reply
39 * script.
40 *
41 * @package Desk_Mess_Mirrored
42 * @since 1.9.1
43 *
44 * @return void
45 *
46 * @version 2.0.4
47 * @date August 21, 2012
48 * No change to function code; changed related action hook to 'comment_form_before'
49 */
50 if ( ! function_exists( 'dmm_enqueue_comment_reply' ) ) {
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
51
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
52 function dmm_enqueue_comment_reply() {
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
53
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
54 if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
55 wp_enqueue_script( 'comment-reply' );
56 }
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
57
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
58 }
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
59
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
60 }
6b38c83 @Cais * Adjusted various CSS elements and properties to display TUT data mo…
authored Jul 15, 2013
61 add_action( 'comment_form_before', 'dmm_enqueue_comment_reply' );
62
63
64 if ( ! function_exists( 'dmm_wp_title' ) ) {
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
65 /**
66 * DMM WP Title
67 * Utilizes the `wp_title` filter to add text to the default output
68 *
69 * @link http://codex.wordpress.org/Plugin_API/Filter_Reference/wp_title
70 *
71 * @package Desk_Mess_Mirrored
72 * @since 2.0
73 *
89b13e3 @Cais * Dropped backward compatibility for `wp_title` with Desk Mess Mirror…
authored Oct 13, 2014
74 * @param string $old_title - default title text
75 * @param string $sep - separator character
76 *
77 * @return string - new title text
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
78 *
79 * @version 2.2.3
80 * @date November 16, 2013
81 * Removed unused $sep_location parameter
89b13e3 @Cais * Dropped backward compatibility for `wp_title` with Desk Mess Mirror…
authored Oct 14, 2014
82 *
83 * @version 2.3
84 * @date October 13, 2014
85 * Drop backward compatibility with Desk Mess Mirrored v2.1 and earlier (due to WPTRT requirements)
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
86 */
89b13e3 @Cais * Dropped backward compatibility for `wp_title` with Desk Mess Mirror…
authored Oct 14, 2014
87 function dmm_wp_title( $old_title, $sep ) {
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
88
89b13e3 @Cais * Dropped backward compatibility for `wp_title` with Desk Mess Mirror…
authored Oct 14, 2014
89 global $page, $paged;
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
90
89b13e3 @Cais * Dropped backward compatibility for `wp_title` with Desk Mess Mirror…
authored Oct 14, 2014
91 /** Set initial title text */
92 $dmm_title_text = $old_title . get_bloginfo( 'name' );
93 /** Add wrapping spaces to separator character */
94 $sep = ' ' . $sep . ' ';
95
96 /** Add the blog description (tagline) for the home/front page */
97 $site_tagline = get_bloginfo( 'description', 'display' );
98 if ( $site_tagline && ( is_home() || is_front_page() ) ) {
99 $dmm_title_text .= "$sep$site_tagline";
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
100 }
101
89b13e3 @Cais * Dropped backward compatibility for `wp_title` with Desk Mess Mirror…
authored Oct 14, 2014
102 /** Add a page number if necessary */
103 if ( $paged >= 2 || $page >= 2 ) {
104 $dmm_title_text .= $sep . sprintf( __( 'Page %s', 'desk-mess-mirrored' ), max( $paged, $page ) );
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
105 }
106
89b13e3 @Cais * Dropped backward compatibility for `wp_title` with Desk Mess Mirror…
authored Oct 14, 2014
107 return $dmm_title_text;
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
108
109 }
89b13e3 @Cais * Dropped backward compatibility for `wp_title` with Desk Mess Mirror…
authored Oct 14, 2014
110
111 add_filter( 'wp_title', 'dmm_wp_title', 10, 2 );
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
112
113 }
6b38c83 @Cais * Adjusted various CSS elements and properties to display TUT data mo…
authored Jul 15, 2013
114
115
116 /**
117 * Register Widget Areas
118 *
119 * @package Desk_Mess_Mirrored
120 * @since 1.0
121 *
89b13e3 @Cais * Dropped backward compatibility for `wp_title` with Desk Mess Mirror…
authored Oct 14, 2014
122 * @uses __
123 * @uses register_sidebar
124 *
125 * @version 2.3
126 * @date October 13, 2014
127 * Wrap `register_sidebar` calls in a function that is used as a callback for the `widgets_init` hook
57035ad @Cais * Refactored sidebar parameters to use already defined WordPress defa…
authored May 15, 2015
128 *
129 * @version 2.4
130 * @date May 15, 2015
131 * Refactored sidebar parameters to use already defined WordPress defaults
6b38c83 @Cais * Adjusted various CSS elements and properties to display TUT data mo…
authored Jul 15, 2013
132 */
89b13e3 @Cais * Dropped backward compatibility for `wp_title` with Desk Mess Mirror…
authored Oct 14, 2014
133 function dmm_register_widget_areas() {
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
134
89b13e3 @Cais * Dropped backward compatibility for `wp_title` with Desk Mess Mirror…
authored Oct 14, 2014
135 register_sidebar(
136 array(
57035ad @Cais * Refactored sidebar parameters to use already defined WordPress defa…
authored May 15, 2015
137 'name' => __( 'Widget Area 1', 'desk-mess-mirrored' ),
138 'id' => 'sidebar-1',
139 'description' => __( 'Widget area 1 located in right sidebar. All default Desk Mess Mirrored theme sidebar content is placed here. If you drag and drop a new widget into this area you will replace *all* of the default sidebar content.', 'desk-mess-mirrored' ),
89b13e3 @Cais * Dropped backward compatibility for `wp_title` with Desk Mess Mirror…
authored Oct 14, 2014
140 )
141 );
142 register_sidebar(
143 array(
57035ad @Cais * Refactored sidebar parameters to use already defined WordPress defa…
authored May 15, 2015
144 'name' => __( 'Widget Area 2', 'desk-mess-mirrored' ),
145 'id' => 'sidebar-2',
146 'description' => __( 'Widget area 2 located in the middle of the right sidebar beneath Sidebar 1. This area is empty by default', 'desk-mess-mirrored' ),
89b13e3 @Cais * Dropped backward compatibility for `wp_title` with Desk Mess Mirror…
authored Oct 14, 2014
147 )
148 );
149 register_sidebar(
150 array(
57035ad @Cais * Refactored sidebar parameters to use already defined WordPress defa…
authored May 15, 2015
151 'name' => __( 'Widget Area 3', 'desk-mess-mirrored' ),
152 'id' => 'sidebar-3',
153 'description' => __( 'Widget area 3 located at the bottom of the right sidebar beneath Sidebar 2. This are is empty by default', 'desk-mess-mirrored' ),
89b13e3 @Cais * Dropped backward compatibility for `wp_title` with Desk Mess Mirror…
authored Oct 14, 2014
154 )
155 );
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
156
89b13e3 @Cais * Dropped backward compatibility for `wp_title` with Desk Mess Mirror…
authored Oct 14, 2014
157 }
158
159 add_action( 'widgets_init', 'dmm_register_widget_areas' );
6b38c83 @Cais * Adjusted various CSS elements and properties to display TUT data mo…
authored Jul 15, 2013
160
161
162 /**
163 * DMM Widget Title
164 *
165 * Fixes display issue when widget_title is empty by adding a space if it is.
166 *
167 * @package Desk_Mess_Mirrored
168 * @since 2.0.1
169 *
170 * @param $title
171 *
172 * @return string
173 */
174 function dmm_widget_title( $title ) {
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
175
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
176 if ( '' == $title ) {
177 return ' ';
178 } else {
179 return $title;
180 }
181
182 }
6b38c83 @Cais * Adjusted various CSS elements and properties to display TUT data mo…
authored Jul 15, 2013
183
184 add_filter( 'widget_title', 'dmm_widget_title', 10, 1 );
185
186
187 /**
188 * DMM Dynamic Copyright
189 *
190 * Displays a generic copyright statement in the theme footer area with
191 * parameters usable for customization.
192 *
a56cd7f @Cais * Added transient to only check first post approximately once a month
authored May 15, 2015
193 * @package Desk_Mess_Mirrored
194 * @since 1.4.6
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
195 *
a56cd7f @Cais * Added transient to only check first post approximately once a month
authored May 15, 2015
196 * @param $args ['start'] => default: Copyright
197 * @param $args ['copy_years'] => default: from the first publicly viewable post year to the most current publicly viewable post year
198 * @param $args ['url'] => default: value associated with the `home_url` function
199 * @param $args ['end'] => default: All rights reserved.
200 * @param $args ['transient_refresh'] => time in seconds before first post is checked again
6b38c83 @Cais * Adjusted various CSS elements and properties to display TUT data mo…
authored Jul 15, 2013
201 *
a56cd7f @Cais * Added transient to only check first post approximately once a month
authored May 15, 2015
202 * @version 2.0
203 * @date December 6, 2011
6b38c83 @Cais * Adjusted various CSS elements and properties to display TUT data mo…
authored Jul 15, 2013
204 * Updated documentation to clarify function parameters
205 * Renamed `BNS Dynamic Copyright` to `DMM Dynamic Copyright`
a56cd7f @Cais * Added transient to only check first post approximately once a month
authored May 15, 2015
206 *
c9ffe17 @Cais * Extracted out code for `dmm_single_view_author_link` function for a…
authored May 16, 2015
207 * @version 2.4
208 * @date May 15, 2015
a56cd7f @Cais * Added transient to only check first post approximately once a month
authored May 15, 2015
209 * Added transient to only check first post approximately once a month
6b38c83 @Cais * Adjusted various CSS elements and properties to display TUT data mo…
authored Jul 15, 2013
210 */
211 if ( ! function_exists( 'dmm_dynamic_copyright' ) ) {
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
212
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
213 function dmm_dynamic_copyright( $args = '' ) {
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
214
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
215 $initialize_values = array(
a56cd7f @Cais * Added transient to only check first post approximately once a month
authored May 15, 2015
216 'start' => '',
217 'copy_years' => '',
218 'url' => '',
219 'end' => '',
220 'transient_refresh' => 2592000
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
221 );
a56cd7f @Cais * Added transient to only check first post approximately once a month
authored May 15, 2015
222
223 /** @var array $args - function parameters */
224 $args = wp_parse_args( $args, $initialize_values );
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
225
226 /* Initialize the output variable to empty */
227 $output = '';
228
229 /**
230 * Start common copyright notice
231 * @example Copyright
232 */
233 empty( $args['start'] )
234 ? $output .= sprintf( __( 'Copyright', 'desk-mess-mirrored' ) )
235 : $output .= $args['start'];
236
237 /**
238 * Calculate Copyright Years; and, prefix with Copyright Symbol
239 * @example © 2009-2011
240 */
241 if ( empty( $args['copy_years'] ) ) {
242
a56cd7f @Cais * Added transient to only check first post approximately once a month
authored May 15, 2015
243
244 /** Take some of the load off with a transient of the first post */
245 if ( ! get_transient( 'dmm_copyright_first_post' ) ) {
246
247 /** @var $all_posts - retrieve all published posts in ascending order */
248 $all_posts = get_posts( 'post_status=publish&order=ASC' );
249
250 /** @var $first_post - get the first post */
251 $first_post = $all_posts[0];
252
253 /** Set the transient (default: one month) */
254 set_transient( 'dmm_copyright_first_post', $first_post, $args['transient_refresh'] );
255
256 }
257
258 /** @var $first_date - get the date in a standardized format */
259 $first_date = get_transient( 'dmm_copyright_first_post' )->post_date_gmt;
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
260
261 /** First post year versus current year */
262 $first_year = substr( $first_date, 0, 4 );
263 if ( $first_year == '' ) {
264 $first_year = date( 'Y' );
265 }
266
267 /** Add to output string */
268 if ( $first_year == date( 'Y' ) ) {
269 /** Only use current year if no posts in previous years */
270 $output .= ' &copy; ' . date( 'Y' );
271 } else {
272 $output .= ' &copy; ' . $first_year . "-" . date( 'Y' );
273 }
274
275 } else {
276
277 $output .= ' &copy; ' . $args['copy_years'];
278
279 }
280
281 /**
282 * Create URL to link back to home of website using the site name for the anchor text
283 * @example <a href="http://example.com" title="Your Blog Name">Your Blog Name</a>
284 */
285 empty( $args['url'] )
286 ? $output .= ' <a href="' . home_url( '/' ) . '" title="' . esc_attr( get_bloginfo( 'name', 'display' ) ) . '" rel="home">' . get_bloginfo( 'name', 'display' ) . '</a> '
287 : $output .= ' ' . $args['url'];
288
289 /**
290 * End common copyright notice
291 * @example All rights reserved.
292 */
293 empty( $args['end'] )
294 ? $output .= ' ' . sprintf( __( 'All rights reserved.', 'desk-mess-mirrored' ) )
295 : $output .= ' ' . $args['end'];
296
297 /** Display the copyright notice */
298 $output = sprintf( __( '<span id="dmm-dynamic-copyright"> %1$s </span><!-- #bns-dynamic-copyright -->', 'desk-mess-mirrored' ), $output );
299 $output = apply_filters( 'dmm_dynamic_copyright', $output, $args );
300
301 echo $output;
302
303 }
304
305 }
6b38c83 @Cais * Adjusted various CSS elements and properties to display TUT data mo…
authored Jul 15, 2013
306
307
308 /**
309 * DMM Theme Version
310 *
311 * Displays the theme version including the Child-Theme version (if properly
312 * noted in the Child-Theme details) in the footer area of the theme.
313 *
314 * @package Desk_Mess_Mirrored
315 * @since 1.4.5
316 *
317 * @version 2.0.3
318 * @date April 6, 2012
319 * Replaced deprecated `get_theme_data` at WordPress version 3.4-beta1
320 *
321 * @version 2.1
322 * @date December 3, 2012
323 * Make compatible with current WordPress versions (3.4+)
324 */
325 if ( ! function_exists( 'dmm_theme_version' ) ) {
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
326
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
327 function dmm_theme_version() {
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
328
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
329 /** @var $active_theme_data - array object containing the current theme's data */
330 $active_theme_data = wp_get_theme();
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
331
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
332 if ( is_child_theme() ) {
6b38c83 @Cais * Adjusted various CSS elements and properties to display TUT data mo…
authored Jul 15, 2013
333
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
334 /** @var $parent_theme_data - array object containing the Parent Theme's data */
335 $parent_theme_data = $active_theme_data->parent();
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
336
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
337 printf(
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
338 '<br /><span id="dmm-theme-version">'
339 . __( 'This site is using the %1$s Child-Theme, v%2$s, on top of', 'desk-mess-mirrored' ) . '<br />' . __( 'the Parent-Theme %3$s, v%4$s, from %5$s', 'desk-mess-mirrored' )
340 . '</span>',
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
341 '<a href="' . $active_theme_data->get( 'ThemeURI' ) . '">' . $active_theme_data->get( 'Name' ) . '</a>',
342 $active_theme_data->get( 'Version' ),
343 $parent_theme_data->get( 'Name' ),
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
344 $parent_theme_data->get( 'Version' ),
345 '<a href="http://' . DMM_HOME_DOMAIN . '" title="' . DMM_HOME_DOMAIN . '">' . DMM_HOME_DOMAIN . '</a>'
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
346 );
6b38c83 @Cais * Adjusted various CSS elements and properties to display TUT data mo…
authored Jul 15, 2013
347
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
348 } else {
6b38c83 @Cais * Adjusted various CSS elements and properties to display TUT data mo…
authored Jul 15, 2013
349
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
350 printf(
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
351 '<br /><span id="dmm-theme-version">'
352 . __( 'This site is using the %1$s theme, v%2$s, from %3$s', 'desk-mess-mirrored' )
353 . '.</span>',
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
354 $active_theme_data->get( 'Name' ),
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
355 $active_theme_data->get( 'Version' ),
356 '<a href="http://' . DMM_HOME_DOMAIN . '" title="' . DMM_HOME_DOMAIN . '">' . DMM_HOME_DOMAIN . '</a>'
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
357 );
6b38c83 @Cais * Adjusted various CSS elements and properties to display TUT data mo…
authored Jul 15, 2013
358
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
359 }
6b38c83 @Cais * Adjusted various CSS elements and properties to display TUT data mo…
authored Jul 15, 2013
360
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
361 }
6b38c83 @Cais * Adjusted various CSS elements and properties to display TUT data mo…
authored Jul 15, 2013
362
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
363 }
6b38c83 @Cais * Adjusted various CSS elements and properties to display TUT data mo…
authored Jul 15, 2013
364
365
366 if ( ! function_exists( 'desk_mess_mirrored_setup' ) ) {
c76fad4 @Cais * Removed `wp_title()` call reference, theme requires WordPress 4.1+ …
authored Feb 21, 2016
367 /**
368 * Desk Mess Mirrored Setup
369 *
370 * Tell WordPress to run desk_mess_mirrored_setup() when the 'after_setup_theme'
371 * hook is run.
372 *
373 * @package Desk_Mess_Mirrored
374 * @since 1.5
375 *
376 * @internal "glyphs" do not need to be translated as they are design elements
377 *
378 * @version 2.2.3
379 * @date October 27, 2013
380 * Added support for post format 'link'
381 *
382 * @version 2.4
383 * @date May 15, 2015
384 * Added support for the `title` tag
385 * Added `dmm-post-formats` filter to extend which post-formats support
386 * Moved `$content_width` definition into theme setup function
387 */
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
388 function desk_mess_mirrored_setup() {
389
390 /** This theme uses post thumbnails */
391 add_theme_support( 'post-thumbnails', array( 'post', 'page' ) );
392 /** Add default posts and comments RSS feed links to head */
393 add_theme_support( 'automatic-feed-links' );
394 /** Add theme support for editor-style */
395 add_editor_style();
396
397 /**
398 * This theme allows users to set a custom background
399 * NB: Child-Themes will need to over-load this functionality to use a
400 * different default background image.
401 */
402 add_theme_support(
403 'custom-background', array(
404 'default-color' => '848484',
405 'default-image' => get_template_directory_uri() . '/images/marble-bg.png'
406 )
407 );
408
6a05a77 @Cais * Add support for the `title` tag
authored May 15, 2015
409 /** Add support for the `<title />` tag */
410 add_theme_support( 'title-tag' );
411
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
412 /** Add post-formats support for aside, link, quote, and status */
413 add_theme_support(
e6a4416 @Cais * Added `dmm_featured_image_view` function to display vertical aspect…
authored Feb 21, 2016
414 'post-formats', apply_filters(
415 'dmm-post-formats', array(
416 'aside',
417 'link',
418 'quote',
419 'status'
420 )
421 )
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
422 );
423
424 /**
425 * Assign unique aside glyph that can be over-written; also will be
426 * used as the anchor text if no title exists for the post
427 *
428 * @package Desk_Mess_Mirrored
429 * @since 2.0
430 */
431 if ( ! function_exists( 'dmm_aside_glyph' ) ) {
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
432
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
433 function dmm_aside_glyph() {
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
434
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
435 $dmm_no_title = get_the_title();
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
436
437 $aside_glyph = '<span class="aside-glyph">';
438
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
439 empty( $dmm_no_title )
5fe3af3 @Cais * Cleaned up i18n implementation - "symbol" characters are a design c…
authored May 16, 2015
440 ? $aside_glyph .= '<a href="' . get_permalink() . '" title="' . get_the_excerpt() . '"><span class="no-title">' . '*' /** default: asterisk */ . '</span></a>'
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
441 : $aside_glyph .= '*';
442
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
443 $aside_glyph .= '</span>';
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
444
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
445 echo apply_filters( 'dmm_aside_glyph', $aside_glyph );
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
446
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
447 }
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
448
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
449 }
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
450
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
451
452 /**
453 * Assign unique quote glyph that can be over-written; also will be
454 * used as the anchor text if no title exists for the post
455 *
456 * @package Desk_Mess_Mirrored
457 * @since 2.0
458 */
459 if ( ! function_exists( 'dmm_quote_glyph' ) ) {
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
460
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
461 function dmm_quote_glyph() {
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
462
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
463 $dmm_no_title = get_the_title();
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
464
465 $quote_glyph = '<span class="quote-glyph">';
466
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
467 empty( $dmm_no_title )
5fe3af3 @Cais * Cleaned up i18n implementation - "symbol" characters are a design c…
authored May 16, 2015
468 ? $quote_glyph .= '<a href="' . get_permalink() . '" title="' . get_the_excerpt() . '"><span class="no-title">' . '"' /** default: double-quote */ . '</span></a>'
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
469 : $quote_glyph .= '"';
470
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
471 $quote_glyph .= '</span>';
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
472
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
473 echo apply_filters( 'dmm_quote_glyph', $quote_glyph );
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
474
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
475 }
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
476
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
477 }
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
478
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
479
480 /**
481 * Assign unique status glyph that can be over-written; also will be
482 * used as the anchor text if no title exists for the post
483 *
484 * @package Desk_Mess_Mirrored
485 * @since 2.0
486 *
487 * @param $status_glyph string - constructed
488 */
489 if ( ! function_exists( 'dmm_status_glyph' ) ) {
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
490
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
491 function dmm_status_glyph() {
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
492
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
493 $dmm_no_title = get_the_title();
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
494
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
495 $status_glyph = '<span class="status-glyph">';
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
496
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
497 empty( $dmm_no_title )
5fe3af3 @Cais * Cleaned up i18n implementation - "symbol" characters are a design c…
authored May 16, 2015
498 ? $status_glyph .= '<a href="' . get_permalink() . '" title="' . get_the_excerpt() . '"><span class="no-title">' . '@' /** default: at symbol */ . '</span></a>'
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
499 : $status_glyph .= '@';
500
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
501 $status_glyph .= '</span>';
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
502
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
503 echo apply_filters( 'dmm_status_glyph', $status_glyph );
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
504
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
505 }
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
506
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
507 }
508
509
510 /**
511 * Assign unique link glyph that can be over-written; also will be
512 * used as the anchor text if no title exists for the post
513 *
514 * @package Desk_Mess_Mirrored
515 * @since 2.2.3
516 */
517 if ( ! function_exists( 'dmm_link_glyph' ) ) {
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
518
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
519 function dmm_link_glyph() {
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
520
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
521 $dmm_no_title = get_the_title();
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
522
523 $link_glyph = '<span class="link-glyph">';
524
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
525 empty( $dmm_no_title )
5fe3af3 @Cais * Cleaned up i18n implementation - "symbol" characters are a design c…
authored May 16, 2015
526 ? $link_glyph .= '<a href="' . get_permalink() . '" title="' . get_the_excerpt() . '"><span class="no-title">' . '&infin;' /** default: infinity symbol */ . '</span></a>'
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
527 : $link_glyph .= '&infin;';
528
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
529 $link_glyph .= '</span>';
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
530
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
531 echo apply_filters( 'dmm_link_glyph', $link_glyph );
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
532
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
533 }
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
534
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
535 }
536
537
538 /**
539 * Add wp_nav_menu() custom menu support
540 *
541 * @package Desk_Mess_Mirrored
542 * @since 1.5
543 *
544 * @version 2.0.4
545 * @date July 6, 2012
546 * Removed backward compatibility check for wp_nav_menu
547 */
548 if ( ! function_exists( 'dmm_nav_menu' ) ) {
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
549
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
550 function dmm_nav_menu() {
551 wp_nav_menu(
552 array(
553 'menu_class' => 'nav-menu',
554 'theme_location' => 'top-menu',
555 'fallback_cb' => 'dmm_list_pages'
556 )
557 );
558 }
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
559
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
560 }
561
562 if ( ! function_exists( 'dmm_list_pages' ) ) {
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
563
564 function dmm_list_pages() { ?>
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
565 <ul class="nav-menu"><?php wp_list_pages( 'title_li=' ); ?></ul>
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
566 <?php }
567
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
568 }
569 register_nav_menu( 'top-menu', __( 'Top Menu', 'desk-mess-mirrored' ) );
570
571 /**
572 * Make theme available for translation
573 * Translations can be filed in the /languages/ directory
574 *
575 * @package Desk_Mess_Mirrored
576 * @since 1.0.7
577 *
578 * @version 2.0.4
579 * @date August 18, 2012
580 * Corrected parameter to use `get_template_directory`
581 */
582 load_theme_textdomain( 'desk-mess-mirrored', get_template_directory() . '/languages' );
583 $locale = get_locale();
584 $locale_file = get_template_directory() . "/languages/$locale.php";
585 if ( is_readable( $locale_file ) ) {
c76fad4 @Cais * Removed `wp_title()` call reference, theme requires WordPress 4.1+ …
authored Feb 21, 2016
586 /** @noinspection PhpIncludeInspection */
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
587 require_once( $locale_file );
588 }
589
ac0db25 @Cais * Moved `$content_width` definition into theme setup function
authored May 15, 2015
590 /**
591 * Set `content_width` based on the theme design and stylesheet to keep images,
592 * videos, etc. within the confines of the post block.
593 *
594 * @internal see #main-blog element in style.css
595 */
596 global $content_width;
597 if ( ! isset( $content_width ) ) {
598 $content_width = 580;
599 }
600
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
601 }
602
603 }
6b38c83 @Cais * Adjusted various CSS elements and properties to display TUT data mo…
authored Jul 15, 2013
604 add_action( 'after_setup_theme', 'desk_mess_mirrored_setup' );
605
606
607 /**
608 * DMM Use Posted
609 *
610 * This returns a URL to the post using the anchor text 'Posted' in the meta
611 * details with the post excerpt as the URL title; or, returns the word 'Posted'
612 * if the post title exists
613 *
614 * @package Desk_Mess_Mirrored
615 * @since 2.0
616 *
617 * @return string - URL|Posted
618 */
619 if ( ! function_exists( 'dmm_use_posted' ) ) {
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
620
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
621 function dmm_use_posted() {
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
622
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
623 $dmm_no_title = get_the_title();
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
624
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
625 empty( $dmm_no_title )
626 ? $dmm_no_title = '<span class="no-title"><a href="' . get_permalink() . '" title="' . get_the_excerpt() . '">' . __( 'Posted', 'desk-mess-mirrored' ) . '</span></a>'
627 : $dmm_no_title = __( 'Posted', 'desk-mess-mirrored' );
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
628
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
629 $dmm_no_title = apply_filters( 'dmm_use_posted', $dmm_no_title );
630
631 return $dmm_no_title;
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
632
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
633 }
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
634
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
635 }
6b38c83 @Cais * Adjusted various CSS elements and properties to display TUT data mo…
authored Jul 15, 2013
636
637
638 /**
639 * DMM Modified Post
640 *
641 * Checks if the last modification made to the post/page is different than
642 * the date the post/page was written; if so, it displays a message showing
643 * the modifying author and the date the post/page was modified
644 *
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
645 * @package Desk_Mess_Mirrored
646 * @since 1.8.5
6b38c83 @Cais * Adjusted various CSS elements and properties to display TUT data mo…
authored Jul 15, 2013
647 *
648 * @internal used in 'desk-mess-mirrored-status'
649 *
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
650 * @version 2.0.3
651 * @date July 5, 2012
6b38c83 @Cais * Adjusted various CSS elements and properties to display TUT data mo…
authored Jul 15, 2013
652 * If modified author exists link to their archive.
653 */
654 if ( ! function_exists( 'dmm_modified_post' ) ) {
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
655 function dmm_modified_post() {
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
656
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
657 global $post;
658
659 /** @var $last_user - establish the last user */
660 $last_user = '';
661 if ( $last_id = get_post_meta( $post->ID, '_edit_last', true ) ) {
662 $last_user = get_userdata( $last_id );
663 }
664
665 /** @var $line_height - set value for use with `get_avatar` */
666 $line_height = 16;
667
668 /** @var string $mod_author_phrase - create the "mod_author_phrase" */
669 $mod_author_phrase = ' ';
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
670
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
671 /** Check last_user ID exists in database. */
672 if ( ! empty( $last_user ) ) {
673 $mod_author_phrase .= __( 'Last modified by %1$s %2$s on %3$s at %4$s.', 'desk-mess-mirrored' );
674 $mod_author_avatar = get_avatar( $last_user->user_email, $line_height );
675
676 if ( get_the_date() <> get_the_modified_date() ) {
677 printf(
678 '<h5><span class="bns-modified-post">' . $mod_author_phrase . '</span></h5>',
679 $mod_author_avatar,
680 '<a href="' . home_url( '?author=' . $last_user->ID ) . '">' . $last_user->display_name . '</a>',
681 get_the_modified_date( get_option( 'date_format' ) ),
682 get_the_modified_time( get_option( 'time_format' ) )
683 );
684 }
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
685
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
686 }
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
687
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
688 }
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
689
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
690 }
6b38c83 @Cais * Adjusted various CSS elements and properties to display TUT data mo…
authored Jul 15, 2013
691
692
693 /**
694 * DMM No Posts Found
695 * Displayed if there are no posts found in the query
696 *
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
697 * @package Desk_Mess_Mirrored
698 * @since 2.1
6b38c83 @Cais * Adjusted various CSS elements and properties to display TUT data mo…
authored Jul 15, 2013
699 *
700 * @internal Used simply for "DRY" efficiency
701 *
369ec80 @Cais * Take into account what happens on the 404 page when returning no posts
authored Oct 13, 2014
702 * @uses __
703 * @uses _e
704 * @uses esc_html
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
705 * @uses get_search_form
706 * @uses get_search_query
369ec80 @Cais * Take into account what happens on the 404 page when returning no posts
authored Oct 14, 2014
707 *
708 * @version 2.3
709 * @date October 13, 2014
710 * Take into account what happens on the 404 page when returning no posts
6b38c83 @Cais * Adjusted various CSS elements and properties to display TUT data mo…
authored Jul 15, 2013
711 */
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
712 if ( ! function_exists( 'dmm_no_posts_found' ) ) {
713
714 function dmm_no_posts_found() {
715
716 if ( get_search_query() ) {
717 printf( '<h2>' . __( 'Search Results for: "%s"', 'desk-mess-mirrored' ) . '</h2>', '<span>' . esc_html( get_search_query() ) . '</span>' );
718 } else {
719 echo '<h2>' . __( 'There was no search performed.', 'desk-mess-mirrored' ) . '</h2>';
720 }
721
722 if ( get_search_query() ) {
723 _e( 'Would you like to search again?', 'desk-mess-mirrored' );
724 }
725
726 get_search_form();
369ec80 @Cais * Take into account what happens on the 404 page when returning no posts
authored Oct 14, 2014
727
728 }
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
729
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
730 }
6b38c83 @Cais * Adjusted various CSS elements and properties to display TUT data mo…
authored Jul 15, 2013
731
732
733 /**
734 * DMM Page Link
735 * Displays a shortlink on pages
736 *
737 * @package Desk_Mess_Mirrored
738 * @since 2.2
739 *
740 * @uses is_page
741 * @uses the_shortlink
742 *
743 * @param $text string - Shortlink anchor text
744 */
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
745 if ( function_exists( 'dmm_page_link' ) ) {
0c9fffe @Cais * Code reformatted to better meet the WordPress Coding Standards
authored Apr 13, 2014
746
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
747 function dmm_page_link( $text ) {
6b38c83 @Cais * Adjusted various CSS elements and properties to display TUT data mo…
authored Jul 15, 2013
748
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
749 if ( '' == $text ) {
750 return;
751 }
752
753 if ( is_page() ) {
754 the_shortlink( $text, '', '<div class="page-shortlink">&raquo', '&laquo</div>' );
755 }
6b38c83 @Cais * Adjusted various CSS elements and properties to display TUT data mo…
authored Jul 15, 2013
756
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
757 }
758 }
6b38c83 @Cais * Adjusted various CSS elements and properties to display TUT data mo…
authored Jul 15, 2013
759
760
761 /**
b08739d @Cais * Added `dmm_post_meta_link_edit()` function with filter hooks for DR…
authored Apr 13, 2014
762 * Post Meta Link and Edit Texts
763 *
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
764 * @package Desk_Mess_Mirrored
765 * @since 2.2.4
b08739d @Cais * Added `dmm_post_meta_link_edit()` function with filter hooks for DR…
authored Apr 13, 2014
766 *
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
767 * @uses __
768 * @uses apply_filters
769 * @uses edit_post_link
770 * @uses the_short_link
771 *
772 * @internal Separators do not need to be translated as they are design elements
b08739d @Cais * Added `dmm_post_meta_link_edit()` function with filter hooks for DR…
authored Apr 13, 2014
773 */
ac0db25 @Cais * Moved `$content_width` definition into theme setup function
authored May 15, 2015
774 if ( ! function_exists( 'dmm_post_meta_link_edit' ) ) {
b08739d @Cais * Added `dmm_post_meta_link_edit()` function with filter hooks for DR…
authored Apr 13, 2014
775
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
776 function dmm_post_meta_link_edit() {
777
778 the_shortlink( apply_filters( 'dmm_post_permalink_text', '&infin;' ), '', ' | ', '' );
779 edit_post_link( apply_filters( 'dmm_post_edit_text', __( 'Edit', 'desk-mess-mirrored' ) ), ' | ', '' );
780
781 }
782
783 }
b08739d @Cais * Added `dmm_post_meta_link_edit()` function with filter hooks for DR…
authored Apr 13, 2014
784
c9ffe17 @Cais * Extracted out code for `dmm_single_view_author_link` function for a…
authored May 16, 2015
785 /**
786 * Single View Author Link
787 *
788 * @package Desk_Mess_Mirrored
789 * @since 2.4
790 *
791 * @uses __
792 * @uses get_author_posts_url
793 * @uses get_the_author_meta
794 * @uses is_single
795 */
796 if ( ! function_exists( 'dmm_single_view_author_link' ) ) {
797
798 function dmm_single_view_author_link() {
799
800 if ( is_single() ) {
801
802 $dmm_author_link_url = get_author_posts_url( get_the_author_meta( 'ID' ) );
803 $dmm_author_link = '<a href="' . $dmm_author_link_url . '">' . get_the_author_meta( 'nickname' ) . '</a>'; ?>
804
805 <div id="author_link">
806 <?php printf( '%1$s %2$s', __( '... other posts by', 'desk-mess-mirrored' ), $dmm_author_link ); ?>
807 </div>
808
809 <?php }
810
811 }
812
813 }
814
e6a4416 @Cais * Added `dmm_featured_image_view` function to display vertical aspect…
authored Feb 21, 2016
815
816 /**
817 * Featured Image View
818 *
819 * Displays the featured image based on if it has a portrait or landscape aspect
820 * ratio. If in portrait, the image is aligned to the right of the post while in
821 * lanscape the image is centered above the post.
822 *
823 * @package Desk_Mess_Mirrored
824 * @since 2.5
825 * @date February 21, 2016
826 *
827 * @uses (GLOBAL) $post
828 * @uses get_post_thumbnail_id
829 * @uses has_post_thumbnail
830 * @uses the_post_thumbnail
831 * @uses wp_get_attachment_metadata
832 */
833 if ( ! function_exists( 'dmm_featured_image_view' ) ) {
834 function dmm_featured_image_view() {
835
836 global $post;
837
838 if ( has_post_thumbnail() && ( $post->post_type == 'post' ) ) {
839
840 $featured_image_metadata = wp_get_attachment_metadata( get_post_thumbnail_id() );
841
842 if ( isset( $featured_image_metadata['height'] ) && isset( $featured_image_metadata['width'] ) ) {
843
844 if ( $featured_image_metadata['height'] > $featured_image_metadata['width'] ) {
845 the_post_thumbnail( 'full', array( 'class' => 'alignright' ) );
846 } else {
847 the_post_thumbnail( 'full', array( 'class' => 'aligncenter' ) );
848 }
849
850 }
851
852 }
853 }
854 }
855
856
e99e569 @Cais * Added BNS Login "Compatibility Code" to use dashicons instead of text
authored Oct 19, 2014
857 /** Compatibility Code ------------------------------------------------------ */
858
859 /** Call the wp-admin plugin code */
860 require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
861
862 if ( is_plugin_active( 'bns-login/bns-login.php' ) ) {
863 add_filter( 'bns_login_dashed_set', '__return_true' );
46fb971 @Cais * i18n updates to better enable translations
authored Apr 15, 2015
864 }
Something went wrong with that request. Please try again.