%PDF- %PDF-
| Direktori : /var/www/drt.com.mx/wp-content/themes/Molti/ |
| Current File : /var/www/drt.com.mx/wp-content/themes/Molti/functions.php |
<?php
//Getting all styles and scripts
///// Gettings CSS
function my_theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
///// Gettings JS
function mycustomscript_enqueue() {
wp_enqueue_script( 'custom-scripts', get_stylesheet_directory_uri() . '/js/scripts.js', array( 'jquery' ));
}
add_action( 'wp_enqueue_scripts', 'mycustomscript_enqueue' );
//END
// Every Divi Layout as Shortcode with the Below Code
add_filter( 'manage_et_pb_layout_posts_columns', 'sj_create_shortcode_column', 5 );
add_action( 'manage_et_pb_layout_posts_custom_column', 'sj_shortcode_content', 5, 2 );
// register new shortcode
add_shortcode('sj_layout', 'sj_shortcode_mod');
// New Admin Column
function sj_create_shortcode_column( $columns ) {
$columns['sj_shortcode_id'] = 'Module Shortcode';
return $columns;
}
//Display Shortcode
function sj_shortcode_content( $column, $id ) {
if( 'sj_shortcode_id' == $column ) {
?>
<p>[sj_layout id="<?php echo $id ?>"]</p>
<?php
}
}
// Create New Shortcode
function sj_shortcode_mod($sj_mod_id) {
extract(shortcode_atts(array('id' =>'*'),$sj_mod_id));
return do_shortcode('[et_pb_section global_module="'.$id.'"][/et_pb_section]');
}
// One click demo import activation
require_once get_stylesheet_directory() . '/auto-install/class-tgm-plugin-activation.php';
add_action( 'tgmpa_register', 'molti_register_required_plugins' );
// Register the required plugins for this theme
function molti_register_required_plugins() {
$plugins = array( // Include the One Click Demo Import plugin from the WordPress repo
array(
'name' => 'One Click Demo Import',
'slug' => 'one-click-demo-import',
'required' => true,
) ,
);
$config = array(
'id' => 'molti', // Unique ID for hashing notices for multiple instances of TGMPA.
'default_path' => '', // Default absolute path to bundled plugins.
'menu' => 'tgmpa-install-plugins', // Menu slug.
'parent_slug' => 'themes.php', // Parent menu slug.
'capability' => 'edit_theme_options', // Capability needed to view plugin install page, should be a capability associated with the parent menu used.
'has_notices' => true, // Show admin notices or not.
'dismissable' => true, // If false, a user cannot dismiss the nag message.
'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag.
'is_automatic' => true, // Automatically activate plugins after installation or not.
'message' => '', // Message to output right before the plugins table.
);
tgmpa($plugins, $config);
}
// Import all the files
function ocdi_import_files() {
return array(
array(
'import_file_name' => 'Molti Demo Import',
'import_file_url' => 'https://molti-et.samarj.com/wp-content/uploads/2021/01/content-et.xml',
'import_widget_file_url' => 'https://molti-et.samarj.com/wp-content/uploads/2021/01/widgets-et',
'import_customizer_file_url' => 'https://molti-et.samarj.com/wp-content/uploads/2021/01/customizer-et.dat',
'import_notice' => __( 'Please wait for a few minutes, do not close the window or refresh the page until the data is imported.', 'molti' ),
),
);
}
add_filter('pt-ocdi/import_files', 'ocdi_import_files');
// Reset the standard WordPress widgets
function ocdi_before_widgets_import($selected_import) {
if (!get_option('acme_cleared_widgets')) {
update_option('sidebars_widgets', array());
update_option('acme_cleared_widgets', true);
}
}
add_action('pt-ocdi/before_widgets_import', 'ocdi_before_widgets_import');
function ocdi_after_import_setup() {
$main_menu = get_term_by( 'name', 'Main Menu', 'nav_menu' );
$secondary_menu = get_term_by( 'name', 'Secondary Menu', 'nav_menu' );
set_theme_mod( 'nav_menu_locations', array(
'primary-menu' => $main_menu->term_id,
'secondary-menu' => $secondary_menu->term_id,
)
);
// Assign home page and posts page (blog page).
$front_page_id = get_page_by_title( 'Home' );
update_option( 'show_on_front', 'page' );
update_option( 'page_on_front', $front_page_id->ID );
}
add_action( 'pt-ocdi/after_import', 'ocdi_after_import_setup' );
// Disable plugin branding
add_filter('pt-ocdi/disable_pt_branding', '__return_true');
function my_custom_js() { ?>
<script type = "text/javascript" > ///Jquery for Pricing Table COLUMN 1 on homepage
jQuery(document).ready(function() {
jQuery('#reveal').hide();
jQuery('.reveal-button').click(function(e) {
e.preventDefault();
jQuery("#reveal").slideToggle();
jQuery('.reveal-button');
});
});
</script>
<script type = "text/javascript" > //Jquery for Pricing Table COLUMN 2 on homepage
jQuery(document).ready(function() {
// Hide the div
jQuery('#reveal-1').hide();
jQuery('.reveal-button-1').click(function(e) {
e.preventDefault();
jQuery("#reveal-1").slideToggle();
jQuery('.reveal-button-1');
});
});
</script>
<script type = "text/javascript" > //Jquery for Pricing Table COLUMN 3 on homepage
jQuery(document).ready(function() {
// Hide the div
jQuery('#reveal-2').hide();
jQuery('.reveal-button-2').click(function(e) {
e.preventDefault();
jQuery("#reveal-2").slideToggle();
jQuery('.reveal-button-2');
});
});
</script>
<script type = "text/javascript" > ///JQUERY FOR Custom Dropdown in Header
jQuery(document).ready(function() {
jQuery('.molti-custom-menu-text').show();
jQuery('.molti-custom-menu').click(function(e) {
e.preventDefault();
jQuery(".molti-custom-menu-text").toggle();
});
});
</script>
<script type = "text/javascript" >
jQuery(document).ready(function() {
jQuery('.molti-custom-dropdown-content').hide();
jQuery('.molti-custom-menu').click(function(e) {
e.preventDefault();
jQuery(".molti-custom-dropdown-content").toggle();
});
});
jQuery(document).ready(function() {
jQuery('#et-main-area').on('click', function(event) {
jQuery('.molti-custom-dropdown-content').hide(0);
});
});
///END HERE FOR Custom Dropdown in Header
</script>
<script>/// Molti Testimonial - Active Image Switcher for Services Page
///Image 1 Click
jQuery(document).ready(function() {
jQuery(".molti-testimonial-image-1").click(function(){
jQuery(".molti-testimonial-image-1").addClass("active-img");
});
jQuery(".molti-testimonial-image-1").click(function(){
jQuery(".molti-testimonial-image-2, .molti-testimonial-image-3, .molti-testimonial-image-4").removeClass("active-img");
});
});
///Image 2 Click
jQuery(document).ready(function() {
jQuery(".molti-testimonial-image-2").click(function(){
jQuery(".molti-testimonial-image-2").addClass("active-img");
});
jQuery(".molti-testimonial-image-2").click(function(){
jQuery(".molti-testimonial-image-1, .molti-testimonial-image-3, .molti-testimonial-image-4").removeClass("active-img");
});
});
///Image 3 Click
jQuery(document).ready(function() {
jQuery(".molti-testimonial-image-3").click(function(){
jQuery(".molti-testimonial-image-3").addClass("active-img");
});
jQuery(".molti-testimonial-image-3").click(function(){
jQuery(".molti-testimonial-image-1, .molti-testimonial-image-2, .molti-testimonial-image-4").removeClass("active-img");
});
});
///Image 4 Click
jQuery(document).ready(function() {
jQuery(".molti-testimonial-image-4").click(function(){
jQuery(".molti-testimonial-image-4").addClass("active-img");
});
jQuery(".molti-testimonial-image-4").click(function(){
jQuery(".molti-testimonial-image-1, .molti-testimonial-image-2, .molti-testimonial-image-3").removeClass("active-img");
});
});
</script>
<script>/// Molti Testimonial - Text Switches for active testimonial
///Image 1 Click
jQuery(document).ready(function() {
jQuery(".molti-testimonial-image-1").click(function(){
jQuery(".molti-testimonial-text-1").addClass("active-text");
});
jQuery(".molti-testimonial-image-1").click(function(){
jQuery(".molti-testimonial-text-2, .molti-testimonial-text-3, .molti-testimonial-text-4").removeClass("active-text");
});
});
///Image 2 Click
jQuery(document).ready(function() {
jQuery(".molti-testimonial-image-2").click(function(){
jQuery(".molti-testimonial-text-2").addClass("active-text");
});
jQuery(".molti-testimonial-image-2").click(function(){
jQuery(".molti-testimonial-text-1, .molti-testimonial-text-3, .molti-testimonial-text-4").removeClass("active-text");
});
});
///Image 3 Click
jQuery(document).ready(function() {
jQuery(".molti-testimonial-image-3").click(function(){
jQuery(".molti-testimonial-text-3").addClass("active-text");
});
jQuery(".molti-testimonial-image-3").click(function(){
jQuery(".molti-testimonial-text-1, .molti-testimonial-text-2, .molti-testimonial-text-4").removeClass("active-text");
});
});
///Image 4 Click
jQuery(document).ready(function() {
jQuery(".molti-testimonial-image-4").click(function(){
jQuery(".molti-testimonial-text-4").addClass("active-text");
});
jQuery(".molti-testimonial-image-4").click(function(){
jQuery(".molti-testimonial-text-1, .molti-testimonial-text-2, .molti-testimonial-text-3").removeClass("active-text");
});
///All of them
jQuery(".molti-testimonial-image-2").click(function(){
jQuery(".molti-testimonial-text-1").addClass("not-active-text");
});
jQuery(".molti-testimonial-image-3").click(function(){
jQuery(".molti-testimonial-text-1").addClass("not-active-text");
});
jQuery(".molti-testimonial-image-4").click(function(){
jQuery(".molti-testimonial-text-1").addClass("not-active-text");
});
});
</script>
<script>/// Single Job Page - Tabs
jQuery(document).ready(function() {
jQuery(".molti-careers-application-link").click(function(){
jQuery(".molti-careers-application-link").addClass("active-link-application");
jQuery(".molti-careers-overview-link").removeClass("active-link");
});
jQuery(".molti-careers-overview-link").click(function(){
jQuery(".molti-careers-overview-link").addClass("active-link");
jQuery(".molti-careers-application-link").removeClass("active-link-application");
});
});
</script>
<script>/// Single Job Page - Working of tabs
jQuery(document).ready(function() {
jQuery(".application").hide();
jQuery(".molti-careers-application-link").click(function(){
jQuery(".application").show();
jQuery(".role-overview").hide();
});
jQuery(".molti-careers-overview-link").click(function(){
jQuery(".role-overview").show();
jQuery(".application").hide();
});
});
</script>
<script>/// Molti Pricing page - Pricing Switcher for Yearly and Monthly Button
///Image 1 Click
jQuery(document).ready(function() {
jQuery(".yearly-button").click(function(){
jQuery(".yearly-button").addClass("molti-active-switch-button");
jQuery(".monthly-button").removeClass("molti-active-switch-button");
});
jQuery(".monthly-button").click(function(){
jQuery(".monthly-button").addClass("molti-active-switch-button");
jQuery(".yearly-button").removeClass("molti-active-switch-button");
});
});
</script>
<script>/// Pricing Page - Pricing Switcher - Working of Tables
jQuery(document).ready(function() {
jQuery(".yearly-pricing").hide();
jQuery(".yearly-button").click(function(){
jQuery(".yearly-pricing").show();
jQuery(".monthly-pricing").hide();
});
jQuery(".monthly-button").click(function(){
jQuery(".monthly-pricing").show();
jQuery(".yearly-pricing").hide();
});
});
</script>
<script>/// Molti - Single Service Page - Custom Tabs
jQuery(document).ready(function() {
jQuery(".molti-custom-tab-1").click(function(){
jQuery(".molti-custom-tab-1").addClass("active-tab");
jQuery(".molti-custom-tab-2").removeClass("active-tab");
jQuery(".molti-custom-tab-3").removeClass("active-tab");
jQuery(".molti-custom-tab-4").removeClass("active-tab");
});
jQuery(".molti-custom-tab-2").click(function(){
jQuery(".molti-custom-tab-2").addClass("active-tab");
jQuery(".molti-custom-tab-3").removeClass("active-tab");
jQuery(".molti-custom-tab-4").removeClass("active-tab");
});
jQuery(".molti-custom-tab-3").click(function(){
jQuery(".molti-custom-tab-3").addClass("active-tab");
jQuery(".molti-custom-tab-2").addClass("active-tab");
jQuery(".molti-custom-tab-4").removeClass("active-tab");
});
jQuery(".molti-custom-tab-4").click(function(){
jQuery(".molti-custom-tab-4").addClass("active-tab");
jQuery(".molti-custom-tab-2").addClass("active-tab");
jQuery(".molti-custom-tab-3").addClass("active-tab");
});
});
</script>
<script>/// Molti Custom tabs - Single Service Page - For Content
jQuery(document).ready(function() {
jQuery(".molti-custom-tabs-content-2").hide();
jQuery(".molti-custom-tabs-content-3").hide();
jQuery(".molti-custom-tabs-content-4").hide();
jQuery(".molti-custom-tab-1").click(function(){
jQuery(".molti-custom-tabs-content-1").show();
jQuery(".molti-custom-tabs-content-2, .molti-custom-tabs-content-3, .molti-custom-tabs-content-4").hide();
});
jQuery(".molti-custom-tab-2").click(function(){
jQuery(".molti-custom-tabs-content-2").show();
jQuery(".molti-custom-tabs-content-1, .molti-custom-tabs-content-3, .molti-custom-tabs-content-4").hide();
});
jQuery(".molti-custom-tab-3").click(function(){
jQuery(".molti-custom-tabs-content-3").show();
jQuery(".molti-custom-tabs-content-1, .molti-custom-tabs-content-2, .molti-custom-tabs-content-4").hide();
});
jQuery(".molti-custom-tab-4").click(function(){
jQuery(".molti-custom-tabs-content-4").show();
jQuery(".molti-custom-tabs-content-1, .molti-custom-tabs-content-2, .molti-custom-tabs-content-3").hide();
});
});
</script>
<script>///For Blog Module with Text Overlay
(function ($) {
$(document).ready(function () {
$(".molti-blog-latest .et_pb_post").each(function () {
$(this).find(".entry-title, .post-meta, .post-content ").wrapAll('<div class="molti-blog-content"></div>');
});
});
})(jQuery);
</script>
<script>/// Molti -> Advanced Blog Page - Post Switcher
jQuery(document).ready(function() {
jQuery(".recent-button").click(function(){
jQuery(".recent-button").addClass("active-blog");
jQuery(".featured-button").removeClass("active-blog");
});
jQuery(".featured-button").click(function(){
jQuery(".featured-button").addClass("active-blog");
jQuery(".recent-button").removeClass("active-blog");
});
});
</script>
<script>///Working of the Switcher - To Switch content
jQuery(document).ready(function() {
jQuery(".recent").hide();
jQuery(".recent-button").click(function(){
jQuery(".recent").show();
jQuery(".featured").hide();
});
jQuery(".featured-button").click(function(){
jQuery(".featured").show();
jQuery(".recent").hide();
});
});
</script>
<script>///Single Post Page Tabs
jQuery(document).ready(function() {
jQuery(".molti-discussion").click(function(){
jQuery(".molti-discussion").addClass("active-link-discussion");
jQuery(".active-link-read").removeClass("active-link-read");
});
jQuery(".molti-read").click(function(){
jQuery(".molti-read").addClass("active-link-read");
jQuery(".molti-discussion").removeClass("active-link-discussion");
});
});
</script>
<script>///Single Post Page Working of tabs to change content
jQuery(document).ready(function() {
jQuery(".molti-comments").hide();
jQuery(".molti-read").click(function(){
jQuery(".molti-article").show();
jQuery(".molti-comments").hide();
});
jQuery(".molti-discussion").click(function(){
jQuery(".molti-comments").show();
jQuery(".molti-article").hide();
});
});
</script>
<script>/// To Collapse Submenu in Mobile Menu
(function($) {
function setup_collapsible_submenus() {
// mobile menu
$('.mobile_nav .menu-item-has-children > a').after('<span class="menu-closed"></span>');
$('.mobile_nav .menu-item-has-children > a').each(function() {
$(this).next().next('.sub-menu').toggleClass('hide',1000);
});
$('.mobile_nav .menu-item-has-children > a + span').on('click', function(event) {
event.preventDefault();
$(this).toggleClass('menu-open');
$(this).next('.sub-menu').toggleClass('hide',1000);
});
}
$(window).load(function() {
setTimeout(function() {
setup_collapsible_submenus();
}, 0);
});
})(jQuery);
</script>
<script>///Code For Showcase Page
jQuery(document).ready(function() {
jQuery(".options").hide(0);
jQuery(".buy").click(function(){
jQuery(".options").show(300);
});
jQuery(".close").click(function(){
jQuery(".options").hide(200);
});
});
</script>
<script type = "text/javascript" >
jQuery(document).ready(function() {
jQuery('.info-content').hide(0);
jQuery('.info-btn').click(function(e) {
e.preventDefault();
jQuery(".info-content").slideToggle(0);
});
});
</script>
<script>
jQuery('.info-btn').on('click', function(e) {
jQuery('.info-btn').toggleClass("info-button open");
e.preventDefault();
});///END HERE
</script>
<?php }
add_action('wp_footer', 'my_custom_js', 100);
//======================================================================
// CUSTOM DASHBOARD
//======================================================================
// ADMIN FOOTER TEXT
function molti_remove_footer_admin () {
echo "Go On 2.0 Child theme by SamarJ";
}
add_action('wp_dashboard_setup', 'molti_my_custom_dashboard_widgets');
function molti_my_custom_dashboard_widgets() {
global $wp_meta_boxes;
wp_add_dashboard_widget('molti_custom_help_widget', 'Molti Child Theme', 'molti_custom_dashboard_help');
}
function molti_custom_dashboard_help() {
echo '<p>Thank you for Purchasing <strong>Molti</strong> Child Theme by SamarJ. If you have any problem while using it use the links below for Support:
<ul>
<li><a href="https://docs.samarj.com/" target="_blank">Documentations</a></li>
<li><a href="https://www.facebook.com/groups/samarj" target="_blank">Facebook Group - For a bit fast reply!</a></li>
<li><a href="https://samarj.com/contact" target="_blank">Contact Us</a></li>
</ul></p>';
}
//END
?>