Browse Source

Default title for latest books.

pull/9/head
Ned Zimmerman 7 years ago
parent
commit
98d8bd6dbc
No known key found for this signature in database
GPG Key ID: FF56334A013120CA
  1. 6
      app/admin.php
  2. 7
      app/controllers/FrontPage.php
  3. 2
      resources/views/partials/front-page-catalog.blade.php

6
app/admin.php

@ -20,6 +20,7 @@ add_action('customize_register', function (\WP_Customize_Manager $wp_customize)
]);
$wp_customize->add_setting('pb_network_facebook', [
'type' => 'option',
'sanitize_callback' => 'esc_url_raw',
]);
$wp_customize->add_control('pb_network_facebook', [
'label' => __('Facebook', 'aldine'),
@ -28,6 +29,7 @@ add_action('customize_register', function (\WP_Customize_Manager $wp_customize)
]);
$wp_customize->add_setting('pb_network_twitter', [
'type' => 'option',
'sanitize_callback' => 'esc_url_raw',
]);
$wp_customize->add_control('pb_network_twitter', [
'label' => __('Twitter', 'aldine'),
@ -45,7 +47,9 @@ add_action('customize_register', function (\WP_Customize_Manager $wp_customize)
'settings' => 'pb_front_page_catalog',
'type' => 'checkbox'
]);
$wp_customize->add_setting('pb_front_pa ge_catalog_title');
$wp_customize->add_setting('pb_front_page_catalog_title', [
'sanitize_callback' => 'sanitize_text_field'
]);
$wp_customize->add_control('pb_front_page_catalog_title', [
'label' => __('Front Page Catalog Title', 'aldine'),
'section' => 'pb_network_catalog',

7
app/controllers/FrontPage.php

@ -55,6 +55,13 @@ class FrontPage extends Controller
return (get_query_var('page', 1) < FrontPage::totalPages()) ? get_query_var('page', 1) + 1 : 0;
}
public function latestBooksTitle()
{
return (empty(get_theme_mod('pb_front_page_catalog_title'))) ?
__('Our Latest Titles', 'aldine') :
get_theme_mod('pb_front_page_catalog_title');
}
public static function latestBooks($offset = null)
{
$path = ($offset) ?

2
resources/views/partials/front-page-catalog.blade.php

@ -1,6 +1,6 @@
<div class="block latest-books">
<div class="inside">
<h3>{{ get_theme_mod('pb_front_page_catalog_title') }}</h3>
<h3>{{ $latest_books_title }}</h3>
<div class="books">
@foreach( FrontPage::latestBooks( $current_page ) as $book )
<div class="book">

Loading…
Cancel
Save