Skip to content

Commit d432144

Browse files
author
Cosmin
committed
#56 #66 - moved to plugin
1 parent 95510e9 commit d432144

File tree

10 files changed

+267
-303
lines changed

10 files changed

+267
-303
lines changed

archive-jetpack-portfolio.php

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* The template for displaying Jetpack Porfolio archive pages.
44
*
5-
* @link https://codex.wordpress.org/Template_Hierarchy
5+
* @link https://codex.wordpress.org/Template_Hierarchy
66
*
77
* @package Shapely
88
*/
@@ -12,53 +12,54 @@
1212
<div id="primary" class="content-area col-md-12 mb-xs-24">
1313
<main id="main" class="site-main" role="main">
1414

15-
<?php
16-
if ( have_posts() ) : ?>
17-
18-
<header>
15+
<?php
16+
if ( have_posts() ) : ?>
17+
18+
<header>
1919
<?php
20-
echo ( get_theme_mod('portfolio_name') != '') ? '<h1 class="post-title">'.get_theme_mod('portfolio_name').'</h1>' : '';
21-
echo ( get_theme_mod('portfolio_description') != '') ? '<p>'.get_theme_mod('portfolio_description').'</p>' : '';
20+
echo ( get_theme_mod( 'portfolio_name' ) != '' ) ? '<h1 class="post-title">' . esc_html( get_theme_mod( 'portfolio_name' ) ) . '</h1>' : '';
21+
echo ( get_theme_mod( 'portfolio_description' ) != '' ) ? '<p>' . esc_html( get_theme_mod( 'portfolio_description' ) ) . '</p>' : '';
2222
?>
23-
</header><!-- .page-header -->
24-
25-
<div class="masonry-loader fixed-center">
26-
<div class="col-sm-12 text-center">
27-
<div class="spinner"></div>
28-
</div>
29-
</div>
30-
<div class="masonry masonryFlyIn">
31-
<?php
32-
/* Start the Loop */
33-
while ( have_posts() ) : the_post(); ?>
23+
</header><!-- .page-header -->
24+
25+
<div class="masonry-loader fixed-center">
26+
<div class="col-sm-12 text-center">
27+
<div class="spinner"></div>
28+
</div>
29+
</div>
30+
<div class="masonry masonryFlyIn">
31+
<?php
32+
/* Start the Loop */
33+
while ( have_posts() ) : the_post(); ?>
34+
35+
<article
36+
id="post-<?php the_ID(); ?>" <?php post_class( 'post-snippet col-md-3 col-sm-6 masonry-item project' ); ?>>
37+
<div class="image-tile inner-title hover-reveal text-center"><?php
38+
if ( has_post_thumbnail() ) { ?>
39+
<a href="<?php the_permalink(); ?>" title="<?php esc_attr( the_title_attribute() ); ?>">
40+
<?php the_post_thumbnail( 'medium' ); ?>
41+
<div class="title"><?php
42+
the_title( '<h5 class="mb0">', '</h5>' );
3443

35-
<article id="post-<?php the_ID(); ?>" <?php post_class('post-snippet col-md-3 col-sm-6 masonry-item project'); ?>>
36-
<div class="image-tile inner-title hover-reveal text-center"><?php
37-
if( has_post_thumbnail() ){ ?>
38-
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
39-
<?php the_post_thumbnail( 'medium' ); ?>
40-
<div class="title"><?php
41-
the_title('<h5 class="mb0">','</h5>');
42-
43-
$project_types = wp_get_post_terms($post->ID, 'jetpack-portfolio-type', array("fields" => "names"));
44-
if( !empty( $project_types ) ){
45-
echo '<span>'.implode(' / ',$project_types).'</span>';
46-
}?>
47-
</div>
48-
</a><?php
49-
} ?>
50-
</div>
51-
</article><!-- #post-## --><?php
44+
$project_types = wp_get_post_terms( $post->ID, 'jetpack-portfolio-type', array( "fields" => "names" ) );
45+
if ( ! empty( $project_types ) ) {
46+
echo '<span>' . implode( ' / ', esc_html( $project_types ) ) . '</span>';
47+
} ?>
48+
</div>
49+
</a><?php
50+
} ?>
51+
</div>
52+
</article><!-- #post-## --><?php
5253

53-
endwhile;
54+
endwhile;
5455

55-
the_posts_navigation();
56+
the_posts_navigation();
5657

57-
else :
58+
else :
5859

59-
get_template_part( 'template-parts/content', 'none' );
60+
get_template_part( 'template-parts/content', 'none' );
6061

61-
endif; ?>
62+
endif; ?>
6263

6364
</main><!-- #main -->
6465
</div><!-- #primary -->

functions.php

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -247,16 +247,7 @@ function shapely_scripts() {
247247
}
248248

249249
add_action( 'wp_enqueue_scripts', 'shapely_scripts' );
250-
// add admin scripts
251-
function shapely_admin_script( $hook ) {
252-
if ( $hook == 'widgets.php' || $hook == 'customize.php' ) {
253-
wp_enqueue_media();
254-
wp_enqueue_style( 'font-awesome', get_template_directory_uri() . '/inc/css/font-awesome.min.css' );
255250

256-
}
257-
}
258-
259-
add_action( 'admin_enqueue_scripts', 'shapely_admin_script' );
260251
/**
261252
* Implement the Custom Header feature.
262253
*/
@@ -297,13 +288,6 @@ function shapely_admin_script( $hook ) {
297288
*/
298289
require get_template_directory() . '/inc/metaboxes.php';
299290

300-
/* --------------------------------------------------------------
301-
Theme Widgets
302-
-------------------------------------------------------------- */
303-
foreach ( glob( get_template_directory() . '/inc/widgets/*.php' ) as $lib_filename ) {
304-
require_once( $lib_filename );
305-
}
306-
307291
/* Globals */
308292
global $shapely_site_layout;
309293
$shapely_site_layout = array(
@@ -313,12 +297,6 @@ function shapely_admin_script( $hook ) {
313297
'full-width' => esc_html__( 'Full Width', 'shapely' )
314298
);
315299

316-
/**
317-
* WooCoomerce Support
318-
*/
319-
if ( class_exists( 'WooCommerce' ) ) {
320-
require get_stylesheet_directory() . '/inc/woo-setup.php';
321-
}
322300

323301
/**
324302
* Load the system checks ( used for notifications )

inc/extras.php

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -133,31 +133,31 @@ function get_shapely_theme_options() {
133133
echo '<style type="text/css">';
134134

135135
if ( get_theme_mod( 'link_color' ) ) {
136-
echo 'a {color:' . get_theme_mod( 'link_color' ) . '}';
136+
echo 'a {color:' . esc_html( get_theme_mod( 'link_color' ) ) . '}';
137137
}
138138
if ( get_theme_mod( 'link_hover_color' ) ) {
139139
echo 'a:hover, a:active, .post-title a:hover,
140140
.woocommerce nav.woocommerce-pagination ul li a:focus, .woocommerce nav.woocommerce-pagination ul li a:hover,
141-
.woocommerce nav.woocommerce-pagination ul li span.current { color: ' . get_theme_mod( 'link_hover_color' ) . ';}';
141+
.woocommerce nav.woocommerce-pagination ul li span.current { color: ' . esc_html( get_theme_mod( 'link_hover_color' ) ) . ';}';
142142
}
143143

144144
if ( get_theme_mod( 'button_color' ) ) {
145145
echo '.btn-filled, .btn-filled:visited, .woocommerce #respond input#submit.alt,
146146
.woocommerce a.button.alt, .woocommerce button.button.alt,
147147
.woocommerce input.button.alt, .woocommerce #respond input#submit,
148148
.woocommerce a.button, .woocommerce button.button,
149-
.woocommerce input.button { background:' . get_theme_mod( 'button_color' ) . ' !important; border: 2px solid' . get_theme_mod( 'button_color' ) . ' !important;}';
149+
.woocommerce input.button { background:' . esc_html( get_theme_mod( 'button_color' ) ) . ' !important; border: 2px solid' . esc_html( get_theme_mod( 'button_color' ) ) . ' !important;}';
150150
}
151151
if ( get_theme_mod( 'button_hover_color' ) ) {
152152
echo '.btn-filled:hover, .woocommerce #respond input#submit.alt:hover,
153153
.woocommerce a.button.alt:hover, .woocommerce button.button.alt:hover,
154154
.woocommerce input.button.alt:hover, .woocommerce #respond input#submit:hover,
155155
.woocommerce a.button:hover, .woocommerce button.button:hover,
156-
.woocommerce input.button:hover { background: ' . get_theme_mod( 'button_hover_color' ) . ' !important; border: 2px solid' . get_theme_mod( 'button_hover_color' ) . ' !important;}';
156+
.woocommerce input.button:hover { background: ' . esc_html( get_theme_mod( 'button_hover_color' ) ) . ' !important; border: 2px solid' . esc_html( get_theme_mod( 'button_hover_color' ) ) . ' !important;}';
157157
}
158158

159159
if ( get_theme_mod( 'social_color' ) ) {
160-
echo '.social-icons li a {color: ' . get_theme_mod( 'social_color' ) . ' !important ;}';
160+
echo '.social-icons li a {color: ' . esc_html( get_theme_mod( 'social_color' ) ) . ' !important ;}';
161161
}
162162

163163
echo '</style>';
@@ -271,7 +271,7 @@ function shapely_pagination() {
271271
* Search Widget
272272
*/
273273
function shapely_search_form( $form ) {
274-
$form = '<form role="search" method="get" id="searchform" class="search-form" action="' . home_url( '/' ) . '" >
274+
$form = '<form role="search" method="get" id="searchform" class="search-form" action="' . esc_url( home_url( '/' ) ) . '" >
275275
<label class="screen-reader-text" for="s">' . __( 'Search for:', 'shapely' ) . '</label>
276276
<input type="text" placeholder="' . __( 'Type Here', 'shapely' ) . '" type="text" value="' . get_search_query() . '" name="s" id="s" />
277277
<input type="submit" class="btn btn-fillded searchsubmit" id="searchsubmit" value="' . esc_attr__( 'Search', 'shapely' ) . '" />
@@ -283,36 +283,6 @@ function shapely_search_form( $form ) {
283283

284284
add_filter( 'get_search_form', 'shapely_search_form', 100 );
285285

286-
/*
287-
* Admin Css
288-
*/
289-
function shapely_admin_style() {
290-
echo '<style>
291-
#setting-error-tgmpa.notice{ display : block; }
292-
.client-sortable .logo_heading{
293-
background: #f3f3f3;
294-
border: 1px dotted;
295-
cursor: move;
296-
display: block;
297-
font-size: 14px;
298-
padding: 8px 0;
299-
text-align: center;
300-
width: 100%;
301-
}
302-
.client-sortable .logo_heading:hover{
303-
border: 1px solid;
304-
}
305-
.client-sortable .cloneya a.clone,
306-
.client-sortable .cloneya a.delete { display: none; }
307-
308-
.client-sortable .cloneya:last-child a.clone,
309-
.client-sortable .cloneya:last-child a.delete { display: inline-block; }
310-
311-
</style>';
312-
}
313-
314-
add_action( 'admin_head', 'shapely_admin_style' );
315-
add_action( 'customize_controls_print_styles', 'shapely_admin_style' );
316286

317287
/*
318288
* Author bio on single page

0 commit comments

Comments
 (0)