Category: CMS

  • WordPress: Responsive video (mp4 video inserted from media library)

    Changed the wordpress wp-includes/media.php file. Probably not the best way to do this.
    Ref: https://codex.wordpress.org/Video_Shortcode

    At around line 2504, comment out the following:

    $html_atts = array(
    	'class'    => $atts['class'],
    	'id'       => sprintf( 'video-%d-%d', $post_id, $instance ),
    	'width'    => $atts['width'],
    	//'width'    => absint( $atts['width'] ),
    	//'height'   => absint( $atts['height'] ),
    	'poster'   => esc_url( $atts['poster'] ),
    	'loop'     => wp_validate_boolean( $atts['loop'] ),
    	'autoplay' => wp_validate_boolean( $atts['autoplay'] ),
    	'preload'  => $atts['preload'],
    );

    At around line 2565, comment out the following and add code:

    if ( ! empty( $atts['width'] ) ) {
    //	$width_rule = sprintf( 'width: %dpx; ', $atts['width'] );
    	$width_rule = '';
    }

    Added additional CSS styles to make it work.

    video {
      width: 100%    !important;
      height: auto   !important;
    }

    Source: https://css-tricks.com/NetMag/FluidWidthVideo/Article-FluidWidthVideo.php
    https://coolestguidesontheplanet.com/videodrome/youtube/

    While we’re at it, also centralize the video with this CSS

    .wp-video { display:block; margin: 0 auto; }
  • WordPress: Redirect after Login on WordPress

    Source: http://stackoverflow.com/questions/8127453/redirect-after-login-on-wordpress

    Add the following to child theme’s functions.php

    function admin_default_page() {
    return ‘/new-dashboard-url’;
    }

    add_filter(‘login_redirect’, ‘admin_default_page’);

  • Easy Fancybox: Solution for Iframe no-scroll issue in mobile

    Source: https://alucard-blog.blogspot.sg/2016/06/how-to-fix-fancy-boxeasy-fancybox.html

    How to fix fancy box scroll not working in mobile. Using wordpress plugin https://wordpress.org/plugins/easy-fancybox/

    In Easy Fancybox, you will see these 2 lines in the jquery.fancybox-1.3.7.js: (do a folder search for id=”fancybox-content” to get better idea of how it looks like)

    <div id=”fancybox-content”……..>
    <iframe id=”fancybox-frame” name……………

    Apply to fancybox-content, not fancybox-frame

    So in your custom/child theme CSS, it should be:

    #fancybox-content{
    overflow: scroll !important;
    -webkit-overflow-scrolling: touch !important;
    }

  • Visual Composer: Remove Visual Composer Tab from Dashboard Menu

    Add this following code to your themes functions.php

    function custom_menu_page_removing() {
        remove_menu_page('vc-general'); //vc
    }
    add_action( 'admin_menu', 'custom_menu_page_removing' );

    This is how to find out for the next time:

    The link for Visual-Composer main page is admin.php?page=vc-general if you want to hide a link from an plugin in the admin backend, simply use everything behind the ?page= in this case it’s vc-general

    Source: http://wordpress.stackexchange.com/questions/227593/remove-visual-composer-tab-from-dashboard-menu

     

  • Visual Composer: edit google font list

    https://wpbakery.atlassian.net/wiki/display/VC/How+to+Manage+List+of+Google+Fonts

    Remove the list of fonts from
    wp-content/plugins/js_composer_theme/include/params/google_fonts
    google_fonts.php

    Or To change this list use add_filters(‘vc_google_fonts_get_fonts_filter’,’your_custom_function’); and change array
    vc_filter: vc_google_fonts_get_fonts_filter

  • WordPress: Disable product arrow pop-out (woocommerce, custom posts, Jupiter theme)

    Source: https://wordpress.org/support/topic/woocommerce-disable-product-arrow-pop-out

    Affects all custom posts

    Question:

    Hi,

    I’m using WooCommerce (latest) with my Jupiter theme plugin.

    I can’t find the option to disable WooCommerce recommending other items on the side of the page.

    See this screenshot for an example.

    Can anyone help me remove this option? Thanks

    Removed this by going to my wp-content/themes/jupiter/framework/functions/general-functions.php and adding this link to the end to remove the $output content.

    $output = ”; //added to remove the prev/next post navigation

    /**
    * Adds Next/Previous post navigations to single posts
    *
    */

    function mk_post_nav($same_category = true, $taxonomy = ‘category’)
    {

    global $mk_options;

    if(is_singular(‘portfolio’) && $mk_options[‘portfolio_next_prev’] != ‘true’) return false;

    if(is_singular(‘post’) && $mk_options[‘blog_prev_next’] != ‘true’) return false;

    $options = array();
    $options[‘same_category’] = $same_category;
    $options[‘excluded_terms’] = ”;

    $options[‘type’] = get_post_type();
    $options[‘taxonomy’] = $taxonomy;

    if(!is_singular() || is_post_type_hierarchical($options[‘type’]))
    $options[‘is_hierarchical’] = true;
    if($options[‘type’] === ‘topic’ || $options[‘type’] === ‘reply’)
    $options[‘is_bbpress’] = true;

    $options = apply_filters(‘mk_post_nav_settings’, $options);
    if(!empty($options[‘is_bbpress’]) || !empty($options[‘is_hierarchical’]))
    return;

    $entries[‘prev’] = get_previous_post($options[‘same_category’], $options[‘excluded_terms’], $options[‘taxonomy’]);
    $entries[‘next’] = get_next_post($options[‘same_category’], $options[‘excluded_terms’], $options[‘taxonomy’]);

    $entries = apply_filters(‘mk_post_nav_entries’, $entries, $options);
    $output = “”;

    foreach ($entries as $key => $entry)
    {
    if(empty($entry)) continue;

    $post_type = get_post_type($entry->ID);

    $icon = $post_image = “”;
    $link = get_permalink($entry->ID);
    $image = get_the_post_thumbnail($entry->ID, ‘thumbnail’);
    $class = $image ? “with-image” : “without-image”;
    $icon = ($key == ‘prev’) ? ‘‘ : ‘‘;
    $output .= ‘‘;

    $output .= ‘‘;
    $output .= ‘‘;

    $icon = ‘‘.$icon.’‘;

    if($image) {
    $post_image = ‘‘.$image.’‘;
    }

    $output .= $key == ‘next’ ? $icon.$post_image : $post_image.$icon;
    $output .= “”;

    $output .= ‘

    $output .= ‘‘.get_the_title($entry->ID).’‘;

    if($post_type == ‘post’) {
    //$output .= ‘‘.get_the_category_list( ‘, ‘, ‘single’, $entry->ID ).’‘;

    } elseif ($post_type == ‘portfolio’) {
    $terms = get_the_terms($entry->ID, ‘portfolio_category’);
    $terms_slug = array();
    $terms_name = array();
    if (is_array($terms)) {
    foreach($terms as $term) {
    $terms_name[] = $term->name;
    }
    }
    $output .= ‘‘.implode(‘, ‘, $terms_name).’‘;
    } elseif ($post_type == ‘product’) {
    $terms = get_the_terms($entry->ID, ‘product_cat’);
    $terms_slug = array();
    $terms_name = array();
    if (is_array($terms)) {
    foreach($terms as $term) {
    $terms_name[] = $term->name;
    }
    }
    $output .= ‘‘.implode(‘, ‘, $terms_name).’‘;
    } elseif($post_type == ‘news’){
    $terms = get_the_terms($entry->ID, ‘news_category’);
    $terms_slug = array();
    $terms_name = array();
    if (is_array($terms)) {
    foreach($terms as $term) {
    $terms_name[] = $term->name;
    }
    }
    $output .= ‘‘.implode(‘, ‘, $terms_name).’‘;
    }
    $output .= “”;
    $output .= ”

    “;
    $output .= “”;
    $output .= “”;
    }
    echo $output;
    }
    add_action( ‘wp_footer’, ‘mk_post_nav’ );

    function mk_get_fontfamily( $element_name, $id, $font_family, $font_type ) {
    $output = ”;
    if ( $font_type == ‘google’ ) {
    if ( !function_exists( “my_strstr” ) ) {
    function my_strstr( $haystack, $needle, $before_needle = false ) {
    if ( !$before_needle ) return strstr( $haystack, $needle );
    else return substr( $haystack, 0, strpos( $haystack, $needle ) );
    }
    }
    wp_enqueue_style( $font_family, ‘//fonts.googleapis.com/css?family=’ .$font_family.’:300italic,400italic,600italic,700italic,800italic,400,300,800,700,600′ , false, false, ‘all’ );
    $format_name = strpos( $font_family, ‘:’ );
    if ( $format_name !== false ) {
    $google_font = my_strstr( str_replace( ‘+’, ‘ ‘, $font_family ), ‘:’, true );
    } else {
    $google_font = str_replace( ‘+’, ‘ ‘, $font_family );
    }
    $output .= ‘

    ‘;

    } else if ( $font_type == ‘fontface’ ) {

    $stylesheet = FONTFACE_DIR.’/fontface_stylesheet.css’;
    $font_dir = FONTFACE_URI;
    if ( file_exists( $stylesheet ) ) {
    $file_content = file_get_contents( $stylesheet );
    if ( preg_match( “/@font-face\s*{[^}]*?font-family\s*:\s*(‘|\”)$font_family\\1.*?}/is”, $file_content, $match ) ) {
    $fontface_style = preg_replace( “/url\s*\(\s*[‘|\”]\s*/is”, “\$font_dir/”, $match[0] ).”\n”;
    }
    $output = “\n

    ‘;
    }

    } else if ( $font_type == ‘safefont’ ) {
    $output .= ‘

    ‘;
    }

    return $output;
    }

  • Prestashop: contentBox HTML module

    Description: contentBox is a very simple, very intuitive and very powerful Prestashop Module. With contentBox you can add html blocks to prestashop, JAVASCRIPT + CSS blocks anywhere you want inside Prestashop 1.5 or Prestashop 1.6.

    Link: http://contentbox.org/

    Works great for adding content to prestashop, like organising CMS links in footer etc.

  • WordPress plugins: downloading old versions

    Go to the plugin page hosted at wordpress.org

    https://wordpress.org/plugins

    Click on the Developer tab and you’ll find the list of previous releases.

  • Prestashop: Free modules

    A list of useful sites that provide free modules. List will be updated as and when I find new ones.

    From Prestashop community
    1) [Free module] display multilingual HTML texts everywhere
    http://www.prestashop.com/forums/topic/172429-free-module-display-multilingual-html-texts-everywhere/

    List of valuable and proven free modules for PrestaShop
    http://www.prestashop.com/forums/topic/233442-free-modules-list-only-valuable-and-proven-solutions-31032014/

    Websites:

    http://www.presto-changeo.com/en/7-prestashop-free-modules
    http://nemops.com/prestashop-101-series/
    http://store.nemops.com/5-free-modules
    http://nemops.com/category/tutorials/tips/

    http://www.prestascope.com/en/
    1) Slideshow LITE
    Link: http://www.prestascope.com/en/free-prestashop-modules/11-slideshow-lite.html
    Description: This Prestashop free module display a simple slideshow on your homepage. Demonstration available on product page.

    2) WordPress in Prestashop
    Link: http://www.prestascope.com/en/free-prestashop-modules/18-module-wordpress-in-prestashop.html
    Description: Module to display in a side block of your shop a customized list of the last articles from a WordPress blog. Best solution to easily create content for your shop and improve your SEO.

    3) Newsletter block subscribers
    Link: http://www.prestascope.com/en/free-prestashop-modules/20-module-newsletter-subscribers.html
    Description: List, manage and export all visitors that have subscribe to your newsletter via the front-office block

    4) Last customers block
    Link: http://www.prestascope.com/en/free-prestashop-modules/21-prestashop-last-customers-block.html
    Description: This module displays a block listing your last customers. Module parametrizable in your shop administration (format of each customer line, optional country flag)

    5) PDF Invoice Plus
    Link: http://www.prestascope.com/en/free-prestashop-modules/24-pdf-invoice-plus.html
    Description: Administration module to add a custom text (plain or HTML) at the bottom of all your PDF invoices or PDF delivery slips. It’s an easy way, for example, to add legal notes to all your invoices.

    6) Shop Scheduler LITE
    Link: http://www.prestascope.com/en/free-prestashop-modules/25-shop-scheduler-lite.html
    Description: There is a free version of this module Shop Scheduler LITE and a paid version Shop Scheduler PRO. This modules allows you to schedule the display of multi-languages HTML texts anywhere in your store. You can also copy complex visual items from your theme like column blocks, product pages tabs, … A must-have to communicate with your visitors: announce special operations, add visual elements or simply tell them you are on vacation!

    7) Clean carts
    Link: http://www.prestascope.com/en/free-prestashop-modules/12-clean-carts.html
    Description: Clean unused carts from database to speed-up web pages display. Check carts contents using multi-criteria search (customer, amount, number of products, carrier, dates, …) Convert carts into validated orders to finalize orders in error (sometimes, bad validations could happen with payment modules)

    8) Pack export
    Link: http://www.prestascope.com/en/non-free-prestashop-modules/23-pack-export-customers-orders.html
    Description: The best pack to export your orders and customers datas as CSV files to be used in Excel.