コード例 #1
0
ファイル: helper-functions.php プロジェクト: Charitable/Reach
/**
 * Return whether the campaign has a featured image or video to display.
 *
 * @param   int $campaign_id
 * @return  boolean
 * @since   1.0.0
 */
function reach_campaign_has_media($campaign_id)
{
    if ('video_in_summary' == reach_get_theme()->get_theme_setting('campaign_media_placement', 'featured_image_in_summary')) {
        $video = trim(get_post_meta($campaign_id, '_campaign_video', true));
        return strlen($video) > 0;
    }
    return has_post_thumbnail($campaign_id);
}
コード例 #2
0
 /**
  * Constructor.
  *
  * If $args['settings'] is not defined, use the $id as the setting ID.
  *
  * @uses   WP_Customize_Image_Control::__construct()
  * @param  WP_Customize_Manager $manager
  * @param  string $id
  * @param  array $args
  * @since  1.0.0
  */
 public function __construct($manager, $id, $args)
 {
     parent::__construct($manager, $id, $args);
     $this->theme = reach_get_theme();
     /**
      * Usually, this control will be instantiated during the customize_register
      * event, so if that is the current filter, call the method directly.
      */
     if (current_filter() == 'customize_register') {
         $this->customize_register($manager);
     } elseif (!did_action('customize_register')) {
         add_action('customize_register', array($this, 'customize_register'));
     } else {
         wp_die(__('Reach_Customizer_Retina_Image_Control must be instantiated before or during the customize_register action.', 'reach'));
     }
     add_action('customize_save', array($this, 'customize_save'));
     add_action('customize_save_after', array($this, 'customize_save_after'));
 }
コード例 #3
0
ファイル: functions.php プロジェクト: Charitable/Reach
<?php

/**
 * Core functions and definitions for Reach Theme.
 *
 * @package 	Reach
 */
require_once 'inc/class-reach-theme.php';
/**
 * Start the theme.
 */
reach_get_theme();
/**
 * Set the content width based on the theme's design and stylesheet.
 */
if (!isset($content_width)) {
    $content_width = 640;
    /* pixels */
}
/**
 * Define whether we're in debug mode.
 *
 * This is set to false by default. If set to true,
 * scripts and stylesheets are NOT cached or minified
 * to make debugging easier.
 */
if (!defined('REACH_DEBUG')) {
    define('REACH_DEBUG', false);
}
/**
 * Return the one true instance of the Reach_Theme.
コード例 #4
0
        /**
         * Displays the content of the admin page.
         *
         * @return  void
         * @access  public
         * @since   1.0.0
         */
        public function render()
        {
            ?>
	<?php 
            /**
             * Display the Welcome page.
             *
             * @author  Studio 164a
             * @package Charitable/Admin View/Welcome Page
             * @since   1.0.0
             */
            wp_enqueue_style('charitable-admin-pages');
            ?>
	<style>
	.charitable-wrap .recommended-plugins { margin-bottom: 0; padding: 0; background-color: #f1f1f1; }
	.charitable-wrap .recommended-plugins li { margin: 0; padding: 0; }
	.charitable-wrap .recommended-plugins > li { padding: 7px 21px; border-bottom: 1px solid #fff; }
	.charitable-wrap .recommended-plugins li:last-child { margin-bottom: 0; border: none; }
	.charitable-wrap .recommended-plugins .premium { background-color: #fef4e8; }
	.charitable-wrap .recommended-plugins .premium .upgrade-tag { margin-top: 7px; color: #f99d33; text-transform: uppercase; font-weight: bolder; }
	.charitable-wrap .docs li { margin: 0; padding: 7px 0; border-bottom: 1px solid #efefef; }
	</style>
	<div class="wrap about-wrap charitable-wrap">
		<h1>
			<strong>Reach</strong>
			<sup class="version"><?php 
            echo reach_get_theme()->get_theme_version();
            ?>
</sup>
		</h1>
		<div class="intro">
			<?php 
            printf(__('Enjoying Reach? Why not <a href="%s" target="_blank">leave a %s review</a> on WordPress.org? We\'d really appreciate it.', 'reach'), 'https://wordpress.org/support/view/theme-reviews/reach?rate=5#postform', '<span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span>');
            ?>
		</div>
		<hr />
		<div class="column-left">
			<div class="column-inside">
				<h2><?php 
            _e('Built for Fundraising', 'reach');
            ?>
</h2>
				<p><?php 
            _e('We built Reach to help non-profits & social entrepreneurs run beautiful online fundraising campaigns. Install Charitable to start accepting donations today.', 'reach');
            ?>
</p> 
				<p>
				<?php 
            if (class_exists('Charitable')) {
                ?>
					<p style="color: #79ba49; font-weight: bolder;"><span class="dashicons dashicons-yes"></span><?php 
                _e('Charitable is installed', 'reach');
                ?>
</p>
				<?php 
            } else {
                ?>
            
					<p><a href="<?php 
                echo wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=charitable'), 'install-plugin_charitable');
                ?>
" class="button button-primary" title="<?php 
                _e('Install Charitable', 'reach');
                ?>
" alt="<?php 
                _e('Install Charitable', 'reach');
                ?>
"><?php 
                _e('Install Charitable', 'reach');
                ?>
</a></p>
				<?php 
            }
            ?>
				<hr />
				<h3><?php 
            _e('Supported Plugins', 'reach');
            ?>
</h3>
				<p><?php 
            _e('Below are some plugins that can help you get the most out of Reach. They\'re all optional; Reach will work just fine without them.', 'reach');
            ?>
</p>
				<ul class="recommended-plugins">
					<li>
						<p><?php 
            _e('<strong>Charitable</strong> is a free WordPress donation plugin that we created to help you raise money on your website. Supports PayPal & offline donations out of the box.', 'reach');
            ?>
</p>
						<p><a href="https://wordpress.org/plugins/charitable/" title="<?php 
            _e('Charitable WordPress.org page', 'reach');
            ?>
" alt="<?php 
            _e('Charitable WordPress.org page', 'reach');
            ?>
"><?php 
            _e('View Charitable', 'reach');
            ?>
</a></p>
					</li>
					<li>
						<p><?php 
            printf(__('<strong>Easy Digital Downloads</strong> by Pippin Williamson is a plugin that allows you to sell digital downloads through WordPress, for free. An optional add-on is the <a href="%s" title="Charitable Easy Digital Downloads product page" alt="Charitable Easy Digital Downloads product page">Charitable Easy Digital Downloads Connect plugin</a>, which allows you to also accept donations through Easy Digital Downloads.', 'reach'), 'https://www.wpcharitable.com/extensions/charitable-easy-digital-downloads-connect/?utm_source=reach-welcome-page&amp;utm_medium=wordpress-dashboard&amp;utm_campaign=documentation');
            ?>
</p>
						<p><a href="https://wordpress.org/plugins/easy-digital-downloads/" title="<?php 
            _e('Easy Digital Downloads WordPress.org page', 'reach');
            ?>
" alt="<?php 
            _e('Easy Digital Downloads WordPress.org page', 'reach');
            ?>
"><?php 
            _e('View Easy Digital Downloads', 'reach');
            ?>
</a></p>
					</li>
					<li>
						<p><?php 
            _e('<strong>The Events Calendar</strong> by Modern Tribe is a brilliant event management plugin. It\'s available as a free, fully featured plugin, with premium upgrades that allow you to do things like sell tickets, create recurring events and import events from Facebook.', 'reach');
            ?>
</p>
						<p><a href="https://wordpress.org/plugins/the-events-calendar/" title="<?php 
            _e('The Events Calendar WordPress.org page', 'reach');
            ?>
" alt="<?php 
            _e('The Events Calendar WordPress.org page', 'reach');
            ?>
"><?php 
            _e('View The Events Calendar', 'reach');
            ?>
</a></p>
					</li>
					<li>
						<p><?php 
            _e('<strong>Ninja Forms</strong> by the WP Ninjas is a free form plugin. It features a robust form builder to allow you to create powerful forms for your site.', 'reach');
            ?>
</p>
						<p><a href="https://wordpress.org/plugins/ninja-forms/" title="<?php 
            _e('Ninja Forms WordPress.org page', 'reach');
            ?>
" alt="<?php 
            _e('Ninja Forms WordPress.org page', 'reach');
            ?>
"><?php 
            _e('View Ninja Forms', 'reach');
            ?>
</a></p>
					</li>                
					<li class="premium">
						<div class="upgrade-tag"><?php 
            _e('Paid Upgrades', 'reach');
            ?>
</div>
						<ul>
							<li><p><?php 
            printf(__('<a href="%s"><strong>Charitable Ambassadors</strong></a> transforms your website into a peer-to-peer fundraising or crowdfunding platform, with front-end campaign submissions.', 'reach'), 'https://www.wpcharitable.com/extensions/charitable-ambassadors/?utm_source=reach-welcome-page&amp;utm_medium=wordpress-dashboard&amp;utm_campaign=upgrades');
            ?>
</p></li> 
							<li><p><?php 
            printf(__('<a href="%s"><strong>Charitable Stripe</strong></a> allows you to accept credit card donations securely on your website.', 'reach'), 'https://www.wpcharitable.com/extensions/charitable-stripe/?utm_source=reach-welcome-page&amp;utm_medium=wordpress-dashboard&amp;utm_campaign=upgrades');
            ?>
</p></li>
							<li><p><?php 
            printf(__('<a href="%s"><strong>Charitable Authorize.Net</strong></a> allows your to accept donations through your Authorize.Net account, securely on your website.', 'reach'), 'https://www.wpcharitable.com/extensions/charitable-authorize-net/?utm_source=reach-welcome-page&amp;utm_medium=wordpress-dashboard&amp;utm_campaign=upgrades');
            ?>
</p></li>                        
						</ul>
					</li>
				</ul>
			</div>        
		</div>
		<div class="column-right">
			<div class="column-inside">            
				<h2><?php 
            _e('Documentation', 'reach');
            ?>
</h2>
				<ul class="docs">
					<li><a href="http://demo.wpcharitable.com/reach/documentation/customizer-settings/?utm_source=reach-welcome-page&amp;utm_medium=wordpress-dashboard&amp;utm_campaign=documentation"><?php 
            _e('Customizer settings', 'reach');
            ?>
</a></li>
					<li><a href="http://demo.wpcharitable.com/reach/documentation/setting-up-the-homepage/?utm_source=reach-welcome-page&amp;utm_medium=wordpress-dashboard&amp;utm_campaign=documentation"><?php 
            _e('How to set up the homepage', 'reach');
            ?>
</a></li>
					<li><a href="http://demo.wpcharitable.com/reach/documentation/menus/?utm_source=reach-welcome-page&amp;utm_medium=wordpress-dashboard&amp;utm_campaign=documentation"><?php 
            _e('Create the site menu', 'reach');
            ?>
</a></li>
					<li><a href="http://demo.wpcharitable.com/reach/documentation/adding-widgets/?utm_source=reach-welcome-page&amp;utm_medium=wordpress-dashboard&amp;utm_campaign=documentation"><?php 
            _e('Set up widget areas', 'reach');
            ?>
</a></li>
					<li><a href="http://demo.wpcharitable.com/reach/documentation/how-to-use-the-child-theme/?utm_source=reach-welcome-page&amp;utm_medium=wordpress-dashboard&amp;utm_campaign=documentation"><?php 
            _e('How to use the child theme', 'reach');
            ?>
</a></li>
				</ul>
				<p><strong><a href="http://demo.wpcharitable.com/reach/documentation/?utm_source=reach-welcome-page&amp;utm_medium=wordpress-dashboard&amp;utm_campaign=documentation" alt="<?php 
            _e('Online documentation', 'reach');
            ?>
" title="<?php 
            _e('Online documentation', 'reach');
            ?>
"><?php 
            _e('More online documenation', 'reach');
            ?>
</a></strong></p>
				<hr />
				<h2><?php 
            _e('Contribute to Reach', 'reach');
            ?>
</h2>
				<p><?php 
            printf(__('Found a bug? Want to contribute a patch or create a new feature? <a href="%s">GitHub is the place to go!</a> Or would you like to translate Reach into your language? <a href="%s">Get involved on WordPress.org</a>.', 'reach'), 'https://github.com/Charitable/Reach', 'https://translate.wordpress.org/projects/wp-themes/reach');
            ?>
				</p>
			</div>    
		</div>
	</div>

	<?php 
        }
コード例 #5
0
ファイル: template-tags.php プロジェクト: Charitable/Reach
 /**
  * Add the media element to display before the campaign summary.
  *
  * @param   Charitable_Campaign $campaign
  * @return  void
  * @since   1.0.0
  */
 function reach_template_campaign_media_before_content(Charitable_Campaign $campaign)
 {
     $media = reach_get_theme()->get_theme_setting('campaign_media_placement', 'featured_image_in_summary');
     if ('video_in_summary' == $media) {
         reach_template_campaign_featured_image($campaign, 'content');
     } elseif (function_exists('charitable_videos_template_campaign_video')) {
         charitable_videos_template_campaign_video($campaign);
     }
 }
コード例 #6
0
 /**
  * Load the theme-customizer.js file.
  *
  * @return  void
  * @access  public
  * @since   1.0.0
  */
 public function load_theme_customizer_script()
 {
     wp_register_script('theme-customizer', get_template_directory_uri() . '/js/admin/theme-customizer.js', array('jquery', 'customize-preview'), reach_get_theme()->get_theme_version(), true);
     wp_enqueue_script('theme-customizer');
 }
コード例 #7
0
 /**
  * Returns a block of CSS to change the colour of text in the header.
  *
  * @return  string
  * @access  private
  * @since   1.0.0
  */
 private function get_header_text_colour_css()
 {
     $colour = esc_attr(reach_get_theme()->get_theme_setting('header_text_colour'));
     if (!strlen($colour)) {
         return '';
     }
     $output = ".social a, .account-links a, .account-links a:before, .account-links .button.button-alt { color: {$colour}; }";
     return $output;
 }
コード例 #8
0
 /**
  * Register scripts required for crowdfunding functionality.
  *
  * @param   array       $dependencies
  * @return  array
  * @access  public
  * @since   1.0.0
  */
 public function setup_script_dependencies($dependencies)
 {
     $dependencies[] = 'raphael';
     $dependencies[] = 'jquery-masonry';
     wp_register_script('raphael', get_template_directory_uri() . '/js/vendors/raphael/raphael-min.js', array('jquery'), reach_get_theme()->get_theme_version(), true);
     if ('campaign' == get_post_type()) {
         wp_register_script('countdown-plugin', get_template_directory_uri() . '/js/vendors/jquery-countdown/jquery.plugin.min.js', array('jquery'), reach_get_theme()->get_theme_version(), true);
         wp_register_script('countdown', get_template_directory_uri() . '/js/vendors/jquery-countdown/jquery.countdown.min.js', array('countdown-plugin'), reach_get_theme()->get_theme_version(), true);
         $dependencies[] = 'countdown';
     }
     return $dependencies;
 }
コード例 #9
0
ファイル: helper-functions.php プロジェクト: Charitable/Reach
/**
 * Based on a single key, retrieve the data for a particular image, including whether it is retina and its dimensions.
 *
 * @param   string $key
 * @return  false|array     False if not set, or array if set.
 * @since   1.0.0
 */
function reach_get_customizer_image_data($key)
{
    $data = array();
    $key_value = esc_url(reach_get_theme()->get_theme_setting($key));
    if (!strlen($key_value)) {
        return false;
    }
    $data['width'] = absint(reach_get_theme()->get_theme_setting($key . '_width'));
    $data['height'] = absint(reach_get_theme()->get_theme_setting($key . '_height'));
    if (reach_get_theme()->get_theme_setting($key . '_is_retina')) {
        /* Retrieve the post ID of the logo, then get the non-retina version */
        $data['id'] = absint(get_theme_mod($key . '_id'));
        $data['image'] = get_post_meta($data['id'], '_non_retina', true);
        $data['retina_image'] = $key_value;
    } else {
        $data['image'] = $key_value;
    }
    return $data;
}