Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Forum: Hacks
    In reply to: Custom Registration Page

    Try adding another hook like the example below.

    function _start(){ ob_start(); }
    add_action( ‘login_init’, ‘_start’ );

    BTW. You might want to check your variables as well 🙂

    Forum: Hacks
    In reply to: Plugin install Page Templates

    If it’s a plugin then your templates should reside within your plugin directory. Here’s a helpful code to make your plugin templates work.

    add_action( ‘wp_loaded’, ‘add_my_templates’ );
    function add_my_templates(){
    if( is_admin() ){
    global $wp_object_cache;
    $current_theme = wp_get_theme();
    $template = $current_theme->get_page_templates();
    $hash = md5( $current_theme->theme_root . ‘/’. $current_theme->stylesheet );
    $templates = $wp_object_cache->get( ‘page_templates-‘. $hash, ‘themes’ );
    $templates[‘mytemplates/test-template.php’] = __(‘Your Template Name’);
    wp_cache_replace( ‘page_templates-‘. $hash, $templates, ‘themes’ );
    }
    else {
    add_filter( ‘page_template’, ‘get_my_template’, 1 );
    }
    }

    function get_my_template( $template ){
    $post = get_post();
    $page_template = get_post_meta( $post->ID, ‘_wp_page_template’, true );
    if( $page_template == ‘mytemplates/test-template.php’ ){
    $template = YOUR_PLUGIN_DIRECTORY . “/mytemplates/test-template.php”;
    }
    return $template;
    }

    Good luck!

    Forum: Plugins
    In reply to: Custom Lists

    Yes your so right. That’s the best way to keep your codes. It will not be affected by updates either.

    Try deactivating your theme by adding return; at the top most of your functions.php file then scan your functions.php file see if there’s a code wp_enqueue_script. If there’s any, comment it or remove it.

    Go to Settings -> Permalinks then choose Post Name then update.

    Forum: Hacks
    In reply to: function override

    You can’t override any existing function. But you can check the code inside the function if it uses some hooks then use it to change the result of that function.

    @garfy

    If you have access on your themes function.php you can add the code below.

    if( ! function_exists( ‘change_excerpt_length’ ) ){
    function change_excerpt_length( $length ){
    return 10;
    // Change 10 to your desired length. Remember that the number indicates the number of words not the number of characters.
    }
    add_filter( ‘excerpt_length’, ‘change_excerpt_length’, 1 );
    }

Viewing 7 replies - 1 through 7 (of 7 total)