fones 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. data/.document +5 -0
  2. data/.rspec +1 -0
  3. data/CHANGELOG.md +8 -0
  4. data/Gemfile +28 -0
  5. data/Gemfile.lock +108 -0
  6. data/LICENSE +20 -0
  7. data/README.md +61 -0
  8. data/Rakefile +54 -0
  9. data/VERSION +1 -0
  10. data/bin/fones +12 -0
  11. data/features/step_definitions/fones_steps.rb +38 -0
  12. data/features/support/env.rb +17 -0
  13. data/fones.gemspec +187 -0
  14. data/layouts/config/config.tt +19 -0
  15. data/layouts/default/css/_1030up.scss.erb +8 -0
  16. data/layouts/default/css/_1240up.scss.erb +8 -0
  17. data/layouts/default/css/_2x.scss.erb +40 -0
  18. data/layouts/default/css/_481up.scss.erb +109 -0
  19. data/layouts/default/css/_768up.scss.erb +280 -0
  20. data/layouts/default/css/_base.scss.erb +836 -0
  21. data/layouts/default/css/_grid.scss.erb +48 -0
  22. data/layouts/default/css/_header.scss.erb +18 -0
  23. data/layouts/default/css/_mixins.scss.erb +248 -0
  24. data/layouts/default/css/_normalize.scss.erb +536 -0
  25. data/layouts/default/css/_print.scss.erb +80 -0
  26. data/layouts/default/css/ie.scss.erb +52 -0
  27. data/layouts/default/css/login.scss.erb +65 -0
  28. data/layouts/default/css/style.css.scss.erb +111 -0
  29. data/layouts/default/functions/functions.php.erb +166 -0
  30. data/layouts/default/functions/library/admin.php.erb +131 -0
  31. data/layouts/default/functions/library/bones.php.erb +397 -0
  32. data/layouts/default/functions/library/custom-post-type.php.erb +122 -0
  33. data/layouts/default/functions/library/translation/README +18 -0
  34. data/layouts/default/functions/library/translation/da_DK.po +374 -0
  35. data/layouts/default/functions/library/translation/de_DE.po +385 -0
  36. data/layouts/default/functions/library/translation/default.po +372 -0
  37. data/layouts/default/functions/library/translation/es_ES.po +380 -0
  38. data/layouts/default/functions/library/translation/fr_FR.po +579 -0
  39. data/layouts/default/functions/library/translation/he_IL.po +382 -0
  40. data/layouts/default/functions/library/translation/hr.po +548 -0
  41. data/layouts/default/functions/library/translation/it_IT.po +376 -0
  42. data/layouts/default/functions/library/translation/ja.po +492 -0
  43. data/layouts/default/functions/library/translation/nb_NO.po +380 -0
  44. data/layouts/default/functions/library/translation/nl_NL.po +376 -0
  45. data/layouts/default/functions/library/translation/pl_PL.po +371 -0
  46. data/layouts/default/functions/library/translation/pt_PT.po +376 -0
  47. data/layouts/default/functions/library/translation/ru_RU.po +358 -0
  48. data/layouts/default/functions/library/translation/sv_SE.po +380 -0
  49. data/layouts/default/functions/library/translation/translation.php.erb +18 -0
  50. data/layouts/default/functions/library/translation/zh_CN.po +382 -0
  51. data/layouts/default/img/apple-icon-touch.png +0 -0
  52. data/layouts/default/img/custom-post-icon.png +0 -0
  53. data/layouts/default/img/favicon.ico +0 -0
  54. data/layouts/default/img/favicon.png +0 -0
  55. data/layouts/default/img/login-logo.png +0 -0
  56. data/layouts/default/img/nothing.gif +0 -0
  57. data/layouts/default/img/nothumb.gif +0 -0
  58. data/layouts/default/img/screenshot.png +0 -0
  59. data/layouts/default/img/win8-tile-icon.png +0 -0
  60. data/layouts/default/js/admin.js +1 -0
  61. data/layouts/default/js/libs/modernizr.custom.min.js +4 -0
  62. data/layouts/default/js/scripts.js +108 -0
  63. data/layouts/default/js/theme.js +2 -0
  64. data/layouts/default/templates/404.php.erb +43 -0
  65. data/layouts/default/templates/archive-custom_type.php.erb +73 -0
  66. data/layouts/default/templates/archive.php.erb +108 -0
  67. data/layouts/default/templates/attachment.php.erb +32 -0
  68. data/layouts/default/templates/comments.php.erb +121 -0
  69. data/layouts/default/templates/footer.php.erb +22 -0
  70. data/layouts/default/templates/header.php.erb +63 -0
  71. data/layouts/default/templates/index.php.erb +72 -0
  72. data/layouts/default/templates/page-custom.php.erb +66 -0
  73. data/layouts/default/templates/page.php.erb +60 -0
  74. data/layouts/default/templates/search.php.erb +71 -0
  75. data/layouts/default/templates/sidebar.php.erb +17 -0
  76. data/layouts/default/templates/single-custom_type.php.erb +78 -0
  77. data/layouts/default/templates/single.php.erb +61 -0
  78. data/layouts/default/templates/taxonomy-custom_cat.php.erb +87 -0
  79. data/lib/fones.rb +11 -0
  80. data/lib/forge/builder.rb +269 -0
  81. data/lib/forge/cli.rb +86 -0
  82. data/lib/forge/config.rb +61 -0
  83. data/lib/forge/engines.rb +12 -0
  84. data/lib/forge/error.rb +8 -0
  85. data/lib/forge/generator.rb +144 -0
  86. data/lib/forge/guard.rb +65 -0
  87. data/lib/forge/project.rb +162 -0
  88. data/lib/forge/version.rb +3 -0
  89. data/lib/guard/forge/assets.rb +31 -0
  90. data/lib/guard/forge/config.rb +34 -0
  91. data/lib/guard/forge/functions.rb +33 -0
  92. data/lib/guard/forge/templates.rb +28 -0
  93. data/pkg/fones-0.1.0.gem +0 -0
  94. data/spec/lib/forge/config_spec.rb +79 -0
  95. data/spec/lib/forge/project_spec.rb +34 -0
  96. data/spec/spec_helper.rb +13 -0
  97. metadata +437 -0
@@ -0,0 +1,131 @@
1
+ <?php
2
+ /*
3
+ This file handles the admin area and functions.
4
+ You can use this file to make changes to the
5
+ dashboard. Updates to this page are coming soon.
6
+ It's turned off by default, but you can call it
7
+ via the functions file.
8
+
9
+ Developed by: Eddie Machado
10
+ URL: http://themble.com/bones/
11
+
12
+ Special Thanks for code & inspiration to:
13
+ @jackmcconnell - http://www.voltronik.co.uk/
14
+ Digging into WP - http://digwp.com/2010/10/customize-wordpress-dashboard/
15
+
16
+ */
17
+
18
+ /************* DASHBOARD WIDGETS *****************/
19
+
20
+ // disable default dashboard widgets
21
+ function disable_default_dashboard_widgets() {
22
+ // remove_meta_box('dashboard_right_now', 'dashboard', 'core'); // Right Now Widget
23
+ remove_meta_box('dashboard_recent_comments', 'dashboard', 'core'); // Comments Widget
24
+ remove_meta_box('dashboard_incoming_links', 'dashboard', 'core'); // Incoming Links Widget
25
+ remove_meta_box('dashboard_plugins', 'dashboard', 'core'); // Plugins Widget
26
+
27
+ // remove_meta_box('dashboard_quick_press', 'dashboard', 'core'); // Quick Press Widget
28
+ remove_meta_box('dashboard_recent_drafts', 'dashboard', 'core'); // Recent Drafts Widget
29
+ remove_meta_box('dashboard_primary', 'dashboard', 'core'); //
30
+ remove_meta_box('dashboard_secondary', 'dashboard', 'core'); //
31
+
32
+ // removing plugin dashboard boxes
33
+ remove_meta_box('yoast_db_widget', 'dashboard', 'normal'); // Yoast's SEO Plugin Widget
34
+
35
+ /*
36
+ have more plugin widgets you'd like to remove?
37
+ share them with us so we can get a list of
38
+ the most commonly used. :D
39
+ https://github.com/eddiemachado/bones/issues
40
+ */
41
+ }
42
+
43
+ /*
44
+ Now let's talk about adding your own custom Dashboard widget.
45
+ Sometimes you want to show clients feeds relative to their
46
+ site's content. For example, the NBA.com feed for a sports
47
+ site. Here is an example Dashboard Widget that displays recent
48
+ entries from an RSS Feed.
49
+
50
+ For more information on creating Dashboard Widgets, view:
51
+ http://digwp.com/2010/10/customize-wordpress-dashboard/
52
+ */
53
+
54
+ // RSS Dashboard Widget
55
+ function <%= theme_id %>_rss_dashboard_widget() {
56
+ if(function_exists('fetch_feed')) {
57
+ include_once(ABSPATH . WPINC . '/feed.php'); // include the required file
58
+ $feed = fetch_feed('http://themble.com/feed/rss/'); // specify the source feed
59
+ $limit = $feed->get_item_quantity(7); // specify number of items
60
+ $items = $feed->get_items(0, $limit); // create an array of items
61
+ }
62
+ if ($limit == 0) echo '<div>The RSS Feed is either empty or unavailable.</div>'; // fallback message
63
+ else foreach ($items as $item) { ?>
64
+
65
+ <h4 style="margin-bottom: 0;">
66
+ <a href="<?php echo $item->get_permalink(); ?>" title="<?php echo mysql2date(__('j F Y @ g:i a', '<%= theme_id %>theme'), $item->get_date('Y-m-d H:i:s')); ?>" target="_blank">
67
+ <?php echo $item->get_title(); ?>
68
+ </a>
69
+ </h4>
70
+ <p style="margin-top: 0.5em;">
71
+ <?php echo substr($item->get_description(), 0, 200); ?>
72
+ </p>
73
+ <?php }
74
+ }
75
+
76
+ // calling all custom dashboard widgets
77
+ function <%= theme_id %>_custom_dashboard_widgets() {
78
+ wp_add_dashboard_widget('<%= theme_id %>_rss_dashboard_widget', __('Recently on Themble (Customize on admin.php)', '<%= theme_id %>theme'), '<%= theme_id %>_rss_dashboard_widget');
79
+ /*
80
+ Be sure to drop any other created Dashboard Widgets
81
+ in this function and they will all load.
82
+ */
83
+ }
84
+
85
+
86
+ // removing the dashboard widgets
87
+ add_action('admin_menu', 'disable_default_dashboard_widgets');
88
+ // adding any custom widgets
89
+ add_action('wp_dashboard_setup', '<%= theme_id %>_custom_dashboard_widgets');
90
+
91
+
92
+ /************* CUSTOM LOGIN PAGE *****************/
93
+
94
+ // calling your own login css so you can style it
95
+
96
+ //Updated to proper 'enqueue' method
97
+ //http://codex.wordpress.org/Plugin_API/Action_Reference/login_enqueue_scripts
98
+ function <%= theme_id %>_login_css() {
99
+ wp_enqueue_style( '<%= theme_id %>_login_css', get_template_directory_uri() . '/css/login.css', false );
100
+ }
101
+
102
+ // changing the logo link from wordpress.org to your site
103
+ function <%= theme_id %>_login_url() { return home_url(); }
104
+
105
+ // changing the alt text on the logo to show your site name
106
+ function <%= theme_id %>_login_title() { return get_option('blogname'); }
107
+
108
+ // calling it only on the login page
109
+ add_action( 'login_enqueue_scripts', '<%= theme_id %>_login_css', 10 );
110
+ add_filter('login_headerurl', '<%= theme_id %>_login_url');
111
+ add_filter('login_headertitle', '<%= theme_id %>_login_title');
112
+
113
+
114
+ /************* CUSTOMIZE ADMIN *******************/
115
+
116
+ /*
117
+ I don't really recommend editing the admin too much
118
+ as things may get funky if WordPress updates. Here
119
+ are a few funtions which you can choose to use if
120
+ you like.
121
+ */
122
+
123
+ // Custom Backend Footer
124
+ function <%= theme_id %>_custom_admin_footer() {
125
+ _e('<span id="footer-thankyou">Developed by <a href="<%= config[:author_uri] %>" target="_blank"><%= config[:author] %></a></span>.', '<%= theme_id %>theme');
126
+ }
127
+
128
+ // adding it to the admin area
129
+ add_filter('admin_footer_text', '<%= theme_id %>_custom_admin_footer');
130
+
131
+ ?>
@@ -0,0 +1,397 @@
1
+ <?php
2
+ /* Welcome to Bones :)
3
+ This is the core Bones file where most of the
4
+ main functions & features reside. If you have
5
+ any custom functions, it's best to put them
6
+ in the functions.php file.
7
+
8
+ Developed by: Eddie Machado
9
+ URL: http://themble.com/bones/
10
+ */
11
+
12
+ /*********************
13
+ LAUNCH BONES
14
+ Let's fire off all the functions
15
+ and tools. I put it up here so it's
16
+ right up top and clean.
17
+ *********************/
18
+
19
+ // we're firing all out initial functions at the start
20
+ add_action('after_setup_theme','<%= theme_id %>_ahoy', 16);
21
+
22
+ function <%= theme_id %>_ahoy() {
23
+
24
+ // launching operation cleanup
25
+ add_action('init', '<%= theme_id %>_head_cleanup');
26
+ // remove WP version from RSS
27
+ add_filter('the_generator', '<%= theme_id %>_rss_version');
28
+ // remove pesky injected css for recent comments widget
29
+ add_filter( 'wp_head', '<%= theme_id %>_remove_wp_widget_recent_comments_style', 1 );
30
+ // clean up comment styles in the head
31
+ add_action('wp_head', '<%= theme_id %>_remove_recent_comments_style', 1);
32
+ // clean up gallery output in wp
33
+ add_filter('gallery_style', '<%= theme_id %>_gallery_style');
34
+
35
+ // enqueue base scripts and styles
36
+ add_action('wp_enqueue_scripts', '<%= theme_id %>_scripts_and_styles', 999);
37
+ // ie conditional wrapper
38
+
39
+ // launching this stuff after theme setup
40
+ <%= theme_id %>_theme_support();
41
+
42
+ // adding sidebars to Wordpress (these are created in functions.php)
43
+ add_action( 'widgets_init', '<%= theme_id %>_register_sidebars' );
44
+ // adding the <%= theme_id %> search form (created in functions.php)
45
+ add_filter( 'get_search_form', '<%= theme_id %>_wpsearch' );
46
+
47
+ // cleaning up random code around images
48
+ add_filter('the_content', '<%= theme_id %>_filter_ptags_on_images');
49
+ // cleaning up excerpt
50
+ add_filter('excerpt_more', '<%= theme_id %>_excerpt_more');
51
+
52
+ } /* end <%= theme_id %> ahoy */
53
+
54
+ /*********************
55
+ WP_HEAD GOODNESS
56
+ The default wordpress head is
57
+ a mess. Let's clean it up by
58
+ removing all the junk we don't
59
+ need.
60
+ *********************/
61
+
62
+ function <%= theme_id %>_head_cleanup() {
63
+ // category feeds
64
+ // remove_action( 'wp_head', 'feed_links_extra', 3 );
65
+ // post and comment feeds
66
+ // remove_action( 'wp_head', 'feed_links', 2 );
67
+ // EditURI link
68
+ remove_action( 'wp_head', 'rsd_link' );
69
+ // windows live writer
70
+ remove_action( 'wp_head', 'wlwmanifest_link' );
71
+ // index link
72
+ remove_action( 'wp_head', 'index_rel_link' );
73
+ // previous link
74
+ remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 );
75
+ // start link
76
+ remove_action( 'wp_head', 'start_post_rel_link', 10, 0 );
77
+ // links for adjacent posts
78
+ remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );
79
+ // WP version
80
+ remove_action( 'wp_head', 'wp_generator' );
81
+ // remove WP version from css
82
+ add_filter( 'style_loader_src', '<%= theme_id %>_remove_wp_ver_css_js', 9999 );
83
+ // remove Wp version from scripts
84
+ add_filter( 'script_loader_src', '<%= theme_id %>_remove_wp_ver_css_js', 9999 );
85
+
86
+ } /* end <%= theme_id %> head cleanup */
87
+
88
+ // remove WP version from RSS
89
+ function <%= theme_id %>_rss_version() { return ''; }
90
+
91
+ // remove WP version from scripts
92
+ function <%= theme_id %>_remove_wp_ver_css_js( $src ) {
93
+ if ( strpos( $src, 'ver=' ) )
94
+ $src = remove_query_arg( 'ver', $src );
95
+ return $src;
96
+ }
97
+
98
+ // remove injected CSS for recent comments widget
99
+ function <%= theme_id %>_remove_wp_widget_recent_comments_style() {
100
+ if ( has_filter('wp_head', 'wp_widget_recent_comments_style') ) {
101
+ remove_filter('wp_head', 'wp_widget_recent_comments_style' );
102
+ }
103
+ }
104
+
105
+ // remove injected CSS from recent comments widget
106
+ function <%= theme_id %>_remove_recent_comments_style() {
107
+ global $wp_widget_factory;
108
+ if (isset($wp_widget_factory->widgets['WP_Widget_Recent_Comments'])) {
109
+ remove_action('wp_head', array($wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style'));
110
+ }
111
+ }
112
+
113
+ // remove injected CSS from gallery
114
+ function <%= theme_id %>_gallery_style($css) {
115
+ return preg_replace("!<style type='text/css'>(.*?)</style>!s", '', $css);
116
+ }
117
+
118
+
119
+ /*********************
120
+ SCRIPTS & ENQUEUEING
121
+ *********************/
122
+
123
+ // loading modernizr and jquery, and reply script
124
+ function <%= theme_id %>_scripts_and_styles() {
125
+ global $wp_styles; // call global $wp_styles variable to add conditional wrapper around ie stylesheet the WordPress way
126
+ if (!is_admin()) {
127
+
128
+ // register main stylesheet
129
+ wp_register_style( '<%= theme_id %>-stylesheet', get_bloginfo( 'stylesheet_url' ), array(), '', 'all' );
130
+
131
+ // ie-only style sheet
132
+ wp_register_style( '<%= theme_id %>-ie-only', get_stylesheet_directory_uri() . '/css/ie.css', array(), '' );
133
+
134
+ // comment reply script for threaded comments
135
+ if ( is_singular() AND comments_open() AND (get_option('thread_comments') == 1)) {
136
+ wp_enqueue_script( 'comment-reply' );
137
+ }
138
+
139
+ //adding scripts file in the footer
140
+ wp_register_script( '<%= theme_id %>-js', get_stylesheet_directory_uri() . '/js/theme.js', array( 'jquery' ), '', true );
141
+
142
+ // enqueue styles and scripts
143
+ wp_enqueue_style( '<%= theme_id %>-stylesheet' );
144
+ wp_enqueue_style('<%= theme_id %>-ie-only');
145
+
146
+ $wp_styles->add_data( '<%= theme_id %>-ie-only', 'conditional', 'lt IE 9' ); // add conditional wrapper around ie stylesheet
147
+
148
+ /*
149
+ I recommend using a plugin to call jQuery
150
+ using the google cdn. That way it stays cached
151
+ and your site will load faster.
152
+ */
153
+ wp_enqueue_script( 'jquery' );
154
+ wp_enqueue_script( '<%= theme_id %>-js' );
155
+
156
+ }
157
+ }
158
+
159
+ /*********************
160
+ THEME SUPPORT
161
+ *********************/
162
+
163
+ // Adding WP 3+ Functions & Theme Support
164
+ function <%= theme_id %>_theme_support() {
165
+
166
+ // wp thumbnails (sizes handled in functions.php)
167
+ add_theme_support('post-thumbnails');
168
+
169
+ // default thumb size
170
+ set_post_thumbnail_size(125, 125, true);
171
+
172
+ // wp custom background (thx to @bransonwerner for update)
173
+ add_theme_support( 'custom-background',
174
+ array(
175
+ 'default-image' => '', // background image default
176
+ 'default-color' => '', // background color default (dont add the #)
177
+ 'wp-head-callback' => '_custom_background_cb',
178
+ 'admin-head-callback' => '',
179
+ 'admin-preview-callback' => ''
180
+ )
181
+ );
182
+
183
+ // rss thingy
184
+ add_theme_support('automatic-feed-links');
185
+
186
+ // to add header image support go here: http://themble.com/support/adding-header-background-image-support/
187
+
188
+ // adding post format support
189
+ add_theme_support( 'post-formats',
190
+ array(
191
+ 'aside', // title less blurb
192
+ 'gallery', // gallery of images
193
+ 'link', // quick link to other site
194
+ 'image', // an image
195
+ 'quote', // a quick quote
196
+ 'status', // a Facebook like status update
197
+ 'video', // video
198
+ 'audio', // audio
199
+ 'chat' // chat transcript
200
+ )
201
+ );
202
+
203
+ // wp menus
204
+ add_theme_support( 'menus' );
205
+
206
+ // registering wp3+ menus
207
+ register_nav_menus(
208
+ array(
209
+ 'main-nav' => __( 'The Main Menu', '<%= theme_id %>theme' ), // main nav in header
210
+ 'footer-links' => __( 'Footer Links', '<%= theme_id %>theme' ) // secondary nav in footer
211
+ )
212
+ );
213
+ } /* end <%= theme_id %> theme support */
214
+
215
+
216
+ /*********************
217
+ MENUS & NAVIGATION
218
+ *********************/
219
+
220
+ // the main menu
221
+ function <%= theme_id %>_main_nav() {
222
+ // display the wp3 menu if available
223
+ wp_nav_menu(array(
224
+ 'container' => false, // remove nav container
225
+ 'container_class' => 'menu clearfix', // class of container (should you choose to use it)
226
+ 'menu' => __( 'The Main Menu', '<%= theme_id %>theme' ), // nav name
227
+ 'menu_class' => 'nav top-nav clearfix', // adding custom nav class
228
+ 'theme_location' => 'main-nav', // where it's located in the theme
229
+ 'before' => '', // before the menu
230
+ 'after' => '', // after the menu
231
+ 'link_before' => '', // before each link
232
+ 'link_after' => '', // after each link
233
+ 'depth' => 0, // limit the depth of the nav
234
+ 'fallback_cb' => '<%= theme_id %>_main_nav_fallback' // fallback function
235
+ ));
236
+ } /* end <%= theme_id %> main nav */
237
+
238
+ // the footer menu (should you choose to use one)
239
+ function <%= theme_id %>_footer_links() {
240
+ // display the wp3 menu if available
241
+ wp_nav_menu(array(
242
+ 'container' => '', // remove nav container
243
+ 'container_class' => 'footer-links clearfix', // class of container (should you choose to use it)
244
+ 'menu' => __( 'Footer Links', '<%= theme_id %>theme' ), // nav name
245
+ 'menu_class' => 'nav footer-nav clearfix', // adding custom nav class
246
+ 'theme_location' => 'footer-links', // where it's located in the theme
247
+ 'before' => '', // before the menu
248
+ 'after' => '', // after the menu
249
+ 'link_before' => '', // before each link
250
+ 'link_after' => '', // after each link
251
+ 'depth' => 0, // limit the depth of the nav
252
+ 'fallback_cb' => '<%= theme_id %>_footer_links_fallback' // fallback function
253
+ ));
254
+ } /* end <%= theme_id %> footer link */
255
+
256
+ // this is the fallback for header menu
257
+ function <%= theme_id %>_main_nav_fallback() {
258
+ wp_page_menu( array(
259
+ 'show_home' => true,
260
+ 'menu_class' => 'nav top-nav clearfix', // adding custom nav class
261
+ 'include' => '',
262
+ 'exclude' => '',
263
+ 'echo' => true,
264
+ 'link_before' => '', // before each link
265
+ 'link_after' => '' // after each link
266
+ ) );
267
+ }
268
+
269
+ // this is the fallback for footer menu
270
+ function <%= theme_id %>_footer_links_fallback() {
271
+ /* you can put a default here if you like */
272
+ }
273
+
274
+ /*********************
275
+ RELATED POSTS FUNCTION
276
+ *********************/
277
+
278
+ // Related Posts Function (call using <%= theme_id %>_related_posts(); )
279
+ function <%= theme_id %>_related_posts() {
280
+ echo '<ul id="<%= theme_id %>-related-posts">';
281
+ global $post;
282
+ $tags = wp_get_post_tags($post->ID);
283
+ if($tags) {
284
+ foreach($tags as $tag) { $tag_arr .= $tag->slug . ','; }
285
+ $args = array(
286
+ 'tag' => $tag_arr,
287
+ 'numberposts' => 5, /* you can change this to show more */
288
+ 'post__not_in' => array($post->ID)
289
+ );
290
+ $related_posts = get_posts($args);
291
+ if($related_posts) {
292
+ foreach ($related_posts as $post) : setup_postdata($post); ?>
293
+ <li class="related_post"><a class="entry-unrelated" href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
294
+ <?php endforeach; }
295
+ else { ?>
296
+ <?php echo '<li class="no_related_post">' . __( 'No Related Posts Yet!', '<%= theme_id %>theme' ) . '</li>'; ?>
297
+ <?php }
298
+ }
299
+ wp_reset_query();
300
+ echo '</ul>';
301
+ } /* end <%= theme_id %> related posts function */
302
+
303
+ /*********************
304
+ PAGE NAVI
305
+ *********************/
306
+
307
+ // Numeric Page Navi (built into the theme by default)
308
+ function <%= theme_id %>_page_navi($before = '', $after = '') {
309
+ global $wpdb, $wp_query;
310
+ $request = $wp_query->request;
311
+ $posts_per_page = intval(get_query_var('posts_per_page'));
312
+ $paged = intval(get_query_var('paged'));
313
+ $numposts = $wp_query->found_posts;
314
+ $max_page = $wp_query->max_num_pages;
315
+ if ( $numposts <= $posts_per_page ) { return; }
316
+ if(empty($paged) || $paged == 0) {
317
+ $paged = 1;
318
+ }
319
+ $pages_to_show = 7;
320
+ $pages_to_show_minus_1 = $pages_to_show-1;
321
+ $half_page_start = floor($pages_to_show_minus_1/2);
322
+ $half_page_end = ceil($pages_to_show_minus_1/2);
323
+ $start_page = $paged - $half_page_start;
324
+ if($start_page <= 0) {
325
+ $start_page = 1;
326
+ }
327
+ $end_page = $paged + $half_page_end;
328
+ if(($end_page - $start_page) != $pages_to_show_minus_1) {
329
+ $end_page = $start_page + $pages_to_show_minus_1;
330
+ }
331
+ if($end_page > $max_page) {
332
+ $start_page = $max_page - $pages_to_show_minus_1;
333
+ $end_page = $max_page;
334
+ }
335
+ if($start_page <= 0) {
336
+ $start_page = 1;
337
+ }
338
+ echo $before.'<nav class="page-navigation"><ol class="<%= theme_id %>_page_navi clearfix">'."";
339
+ if ($start_page >= 2 && $pages_to_show < $max_page) {
340
+ $first_page_text = __( "First", '<%= theme_id %>theme' );
341
+ echo '<li class="bpn-first-page-link"><a href="'.get_pagenum_link().'" title="'.$first_page_text.'">'.$first_page_text.'</a></li>';
342
+ }
343
+ echo '<li class="bpn-prev-link">';
344
+ previous_posts_link('<<');
345
+ echo '</li>';
346
+ for($i = $start_page; $i <= $end_page; $i++) {
347
+ if($i == $paged) {
348
+ echo '<li class="bpn-current">'.$i.'</li>';
349
+ } else {
350
+ echo '<li><a href="'.get_pagenum_link($i).'">'.$i.'</a></li>';
351
+ }
352
+ }
353
+ echo '<li class="bpn-next-link">';
354
+ next_posts_link('>>');
355
+ echo '</li>';
356
+ if ($end_page < $max_page) {
357
+ $last_page_text = __( "Last", '<%= theme_id %>theme' );
358
+ echo '<li class="bpn-last-page-link"><a href="'.get_pagenum_link($max_page).'" title="'.$last_page_text.'">'.$last_page_text.'</a></li>';
359
+ }
360
+ echo '</ol></nav>'.$after."";
361
+ } /* end page navi */
362
+
363
+ /*********************
364
+ RANDOM CLEANUP ITEMS
365
+ *********************/
366
+
367
+ // remove the p from around imgs (http://css-tricks.com/snippets/wordpress/remove-paragraph-tags-from-around-images/)
368
+ function <%= theme_id %>_filter_ptags_on_images($content){
369
+ return preg_replace('/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU', '\1\2\3', $content);
370
+ }
371
+
372
+ // This removes the annoying […] to a Read More link
373
+ function <%= theme_id %>_excerpt_more($more) {
374
+ global $post;
375
+ // edit here if you like
376
+ return '... <a class="excerpt-read-more" href="'. get_permalink($post->ID) . '" title="'. __('Read', '<%= theme_id %>theme') . get_the_title($post->ID).'">'. __('Read more &raquo;', '<%= theme_id %>theme') .'</a>';
377
+ }
378
+
379
+ /*
380
+ * This is a modified the_author_posts_link() which just returns the link.
381
+ *
382
+ * This is necessary to allow usage of the usual l10n process with printf().
383
+ */
384
+ function <%= theme_id %>_get_the_author_posts_link() {
385
+ global $authordata;
386
+ if ( !is_object( $authordata ) )
387
+ return false;
388
+ $link = sprintf(
389
+ '<a href="%1$s" title="%2$s" rel="author">%3$s</a>',
390
+ get_author_posts_url( $authordata->ID, $authordata->user_nicename ),
391
+ esc_attr( sprintf( __( 'Posts by %s' ), get_the_author() ) ), // No further l10n needed, core will take care of this one
392
+ get_the_author()
393
+ );
394
+ return $link;
395
+ }
396
+
397
+ ?>