/* ADD WELCOME TO THE BLOG HOMEPAGE
==================================================== */
if (!function_exists(‘unblock_welcome_intro’)) :
function unblock_welcome_intro($before = ”, $after = ”)
{
// Prints HTML with welcome text.
$welcome_intro_page_id = absint(get_theme_mod(‘welcome_intro_page_id’));
$output = ”;
if (!$welcome_intro_page_id)
return;
if (has_post_thumbnail($welcome_intro_page_id)) {
$output .= sprintf(‘<div class=”unblock-welcome-intro-thumbnail”>%s</div>’, get_the_post_thumbnail($welcome_intro_page_id, ‘thumbnail’));
}
$welcome_intro_page = get_post($welcome_intro_page_id);
$welcome_intro_title = apply_filters(‘the_title’, $welcome_intro_page->post_title, $welcome_intro_page_id);
if ($welcome_intro_title)
$output .= sprintf(‘<h1 class=”entry-title”>%s</h1>’, $welcome_intro_title);
$welcome_intro_content = apply_filters(‘the_content’, $welcome_intro_page->post_content);
$welcome_intro_content = str_replace(‘]]>’, ‘]]>’, $welcome_intro_content);
if ($welcome_intro_content)
$output .= sprintf(‘<div id=”page-intro”>%s</div>’, $welcome_intro_content);
if ($output)
printf(‘%s%s%s’, ‘<header id=”page-header”>’, $output, ‘</header>’);
}
endif;
// Welcome Intro Content
if (!function_exists(‘unblock_welcome_intro_content’)) :
function unblock_welcome_intro_content()
{
if (is_front_page() && get_theme_mod(‘display_welcome_intro_only_on_homepage’, 0)) {
unblock_welcome_intro(‘<div class=”unblock-welcome-intro”>’, ‘</div>’);
} elseif (is_home()) {
unblock_welcome_intro(‘<div class=”unblock-welcome-intro”>’, ‘</div>’);
}
}
endif;
add_action(‘unblock_blog_home_heading’, ‘unblock_welcome_intro_content’);
Can also be looked at here if easier for you: [https://github.com/xVicissitudex/WordPress-Themes/blob/94066711fe6d105f8412613a5c69853eab094595/unblock/inc/template-functions.php#L140])
1) `unblock_welcome_intro($before = ”, $after = ”)` where are the $before and $after parameters used again in the function definition? I can’t see them anywhere else, what is the point of stating these parameters if you aren’t going to use them again?
2) `absint(get_theme_mod(‘welcome_intro_page_id’))` what exactly is welcome\_intro\_page\_id? It’s not anywhere else in the theme, it appears to be a page that contains a logo, tittle, and brief description. Is this a standard word press filter that you can hook on to whenever you allow theme modifications by the user?
3) `get_theme_mod(‘display_welcome_intro_only_on_homepage’, 0))` For get\_theme\_mod, is there somewhere where I can get a list of all the possible values that can go in the first argument? They don’t seem to be present in WordPress codex.
[ad_2]