Last active
March 12, 2020 16:42
-
-
Save Fobiya/e2901c609626649f0d0f4959c8fdb99f to your computer and use it in GitHub Desktop.
Manual in WP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$categories = get_the_category(); echo name categories | |
if ( !empty( $categories ) ) { | |
$caty = esc_html( $categories[1]->name ); | |
} | |
-> echo $caty; | |
echo name categories | |
https://developer.wordpress.org/reference/functions/get_the_category/ | |
$id__page = get_the_ID(); | |
// The Query | |
$the_query = new WP_Query( array('category_name' => 'blog,Market Analysis', 'posts_per_page' => 6, 'post__not_in'=>array($id__page) ) ); | |
if ( get_post_type( get_the_ID() ) == 'lp' ) { } | |
<?php echo do_shortcode('[cta class="btn btn-primary btn-xs" title_not_logged="Register & Use"]'); ?> | |
<?php echo get_home_url(); ?> link home | |
<img src="<?php echo get_template_directory_uri(); ?>/images/phone_icon.png" alt="phone_icon"> // IMG URL | |
<?php the_field('slogan_p', 'option'); ?> // slogan_p ACF | |
* | |
<?php echo qtranxf_generateLanguageSelectCode('text') ?> // Lang shortcode echo | |
* | |
<?php echo do_shortcode("[featured-video-plus]"); ?> // eatured-video-plus shortcode echo | |
* | |
<?php echo do_shortcode("[Shortcode]"); ?> // shortcode echo | |
/* | |
* Blog Pages (Definitive__Guide) | |
* @package WordPress | |
* @subpackage | |
* Template Name: Definitive__Guide | |
* Template Post Type: post, page, product // Includ Post Type: post, page, product | |
*/ | |
<?php $content = get_the_content(); echo mb_strimwidth($content, 0, 400, '...');?> | |
if ( is_page_template('landings/assetLP.php') || is_page_template('landings/bonusLP.php') || is_page_template('landings/brandLP.php') || is_page_template('landings/mt4LP.php') || is_page_template('landings/toolsLP.php') ) { | |
} else { | |
} | |
if ( is_singular( 'l' ) ) { | |
} | |
<?php | |
$client_agreement = do_shortcode('[brand var=client_agreement]'); | |
$client_agreement_text = addslashes(str_replace('%client_agreement%', $client_agreement, __('I am over 18 years of age and I accept the %client_agreement%.', 'brand'))); | |
?> | |
<script> | |
jQuery("label[for='registration-accept']").html('<?php echo ($client_agreement_text); ?>'); | |
</script> | |
function.php | |
function cl_acf_set_language() { | |
return acf_get_setting('default_language'); | |
} | |
function get_global_option($name) { | |
add_filter('acf/settings/current_language', 'cl_acf_set_language', 100); | |
$option = get_field($name, 'option'); | |
remove_filter('acf/settings/current_language', 'cl_acf_set_language', 100); | |
return $option; | |
} | |
function brand_config($atts) | |
{ | |
switch ($atts['var']) { | |
case "email": | |
return get_global_option('brand_email', 'options'); | |
//return '<a href="mailto:'. get_field('brand_email', 'options').'">'. get_field('brand_email', 'options').'</a>'; | |
break; | |
case "email_link": | |
return '<a href="mailto:' . get_field('brand_email', 'options') . '">' . get_field('brand_email', 'options') . '</a>'; | |
break; | |
case "address": | |
return get_field('brand_address', 'options'); | |
break; | |
case "phone": | |
return get_field('brand_phone', 'options'); | |
break; | |
case "risk_disclaimer": | |
add_filter('acf/settings/current_language', 'cl_acf_set_language', 100); | |
$link = get_field('risk_disclaimer', 'options'); | |
if ($link) : | |
$link_url = $link['url']; | |
$link_title = $link['title']; | |
$link_target = $link['target'] ? $link['target'] : '_self'; | |
$link_html .= '<a class="button" href="' . $link_url . '" target="' . $link_target . '">' . __($link_title, 'brand') . '</a>'; | |
endif; | |
remove_filter('acf/settings/current_language', 'cl_acf_set_language', 100); | |
return $link_html; | |
break; | |
case "risk_disclaimer_url": | |
add_filter('acf/settings/current_language', 'cl_acf_set_language', 100); | |
$link = get_field('risk_disclaimer', 'options'); | |
if ($link) : | |
$link_html = $link['url']; | |
endif; | |
remove_filter('acf/settings/current_language', 'cl_acf_set_language', 100); | |
return $link_html; | |
break; | |
case "client_agreement": | |
add_filter('acf/settings/current_language', 'cl_acf_set_language', 100); | |
$link = get_field('client_agreement', 'options'); | |
if ($link) : | |
$link_url = $link['url']; | |
$link_title = $link['title']; | |
$link_target = $link['target'] ? $link['target'] : '_self'; | |
$link_html .= '<a class="button" href="' . $link_url . '" target="_blank">' . __($link_title, 'brand') . '</a>'; | |
endif; | |
remove_filter('acf/settings/current_language', 'cl_acf_set_language', 100); | |
return $link_html; | |
break; | |
case "privacy_policy": | |
add_filter('acf/settings/current_language', 'cl_acf_set_language', 100); | |
$link = get_field('privacy_policy', 'options'); | |
if ($link) : | |
$link_url = $link['url']; | |
$link_title = $link['title']; | |
$link_target = $link['target'] ? $link['target'] : '_self'; | |
$link_html .= '<a class="button" href="' . $link_url . '" target="_blank">' . __($link_title, 'brand') . '</a>'; | |
endif; | |
remove_filter('acf/settings/current_language', 'cl_acf_set_language', 100); | |
return $link_html; | |
break; | |
case "risk_number": | |
add_filter('acf/settings/current_language', 'cl_acf_set_language', 100); | |
return get_field('risk_number', 'options'); | |
remove_filter('acf/settings/current_language', 'cl_acf_set_language', 100); | |
break; | |
case "phones": | |
add_filter('acf/settings/current_language', 'cl_acf_set_language', 100); | |
if (have_rows('brand_phones', 'options')) : | |
// global $post; | |
$html = '<ul class="phones_numbers">'; | |
while (have_rows('brand_phones', 'options')) : the_row(); | |
$html_country = get_sub_field('country'); | |
$html_number = get_sub_field('phone_number'); | |
$html .= '<li><span class="country_name">'; | |
$html .= __($html_country, 'brand') . ' :</span> <a title="' . __($html_country, 'brand') . '" href="tel:' . $html_number . '">' . $html_number . '</a>'; | |
$html .= '</li>'; | |
endwhile; | |
$html .= '</ul>'; | |
endif; | |
// Set language to current | |
remove_filter('acf/settings/current_language', 'cl_acf_set_language', 100); | |
return $html; | |
break; | |
case "login_url": | |
return get_permalink(get_field('login_page', 'options')); | |
break; | |
case "registration_url": | |
return get_permalink(get_field('registration_page', 'options')); | |
break; | |
case "contact_us_page_url": | |
return get_permalink(get_field('contact_us_page_url', 'options')); | |
break; | |
default: | |
return get_permalink(get_field('login_page', 'options')); | |
} | |
} | |
add_shortcode('brand', 'brand_config'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment