Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #356018
    #356561

    Hey camtay!

    Thank you for using Enfold.

    Please use these plugins to control the menu visibility:

    https://wordpress.org/plugins/menu-items-visibility-control/
    https://wordpress.org/plugins/zen-menu-logic/

    Since, you’re trying to show different menu items for a custom post type, the is_singular() conditional will surely help. Regarding the logo, you can add this on functions.php:

    add_filter('avf_logo','new_logo_url');
    function new_logo_url($use_image){
    if(is_singular('sp')) {
    $use_image = "http://kriesi.at/wp-content/themes/kriesi/images/logo.png";
    }
    return $use_image;
    }

    You might need to change the custom post type id.

    Best regards,
    Ismael

    #357297

    Hi Ismael,

    Wonderful, I will use one of these plugins, thanks!

    As for the logo, can I add pages to this code, like this?

    add_filter(‘avf_logo’,’new_logo_url’);
    function new_logo_url($use_image){
    if(is_singular(‘sp’); (is_page(42)); (is_page(68)) {
    $use_image = “http://kriesi.at/wp-content/themes/kriesi/images/logo.png”;
    }
    return $use_image;
    }

    #357856

    Hey Ismael,
    I tried the code and it doesn’t change the url. What did you mean by “you might need to change the custom post type id”?
    Thanks!

    #358401

    Hi!

    On this line,

    if(is_singular('sp')) {
    

    You’ll need to change “sp” to the slug of your custom post type. See here for more info, http://codex.wordpress.org/Function_Reference/is_singular.

    If you want to add pages then you can do this.

    if( is_singular('sp') || is_page( array( 1, 2, 3 ) ) ) {
    

    Where 1, 2, 3 are the ID’s of your pages.

    Regards,
    Elliott

    #358421

    Hi Eliott, I tried that but when I try to load a custom post, I get an error:
    Parse error: syntax error, unexpected ‘}’ in /home/content/34/11243234/html/wp-content/themes/enfold-child/functions.php on line 68

    Here’s the code I pasted in (‘spicypresentations’ is the slug of my custom post) and line 68 is the last line:
    add_filter(‘avf_logo’,’new_logo_url’);
    function new_logo_url($use_image){
    if(is_singular(‘spicypresentations’)) {
    $use_image = “http://nutsandboltsspeedtraining.com/wp-content/uploads/2014/11/sp-logo-rough.png”;
    }
    return $use_image;
    }

    If it helps, here’s my site: http://www.nutsandboltsspeedtraining.com

    In case it helps, here are the other things I’ve put in the functions.php or my child theme:
    <?php

    @ini_set(‘display_errors’, 0);

    add_action(‘woocommerce_thankyou’, ‘affiliate_tracking’);

    function affiliate_tracking( $order_id )
    {
    global $wpdb;

    $order = new WC_Order( $order_id );
    $order_total = $order->get_order_total();
    $shipping = $order->order_shipping;
    $total = $order_total – $shipping;
    $coupon = $wpdb->get_var($wpdb->prepare(“SELECT order_item_name FROM wp_woocommerce_order_items where order_id = ‘$order_id’ and order_item_type = ‘coupon'”));

    echo ““;
    }

    // Hook in
    add_filter( ‘woocommerce_checkout_fields’ , ‘custom_override_checkout_fields’ );

    // Our hooked in function – $fields is passed via the filter!
    function custom_override_checkout_fields( $fields )
    {
    $fields[‘billing’][‘billing_email’][‘label’] = ‘Email (will also be used as your username)’;
    $fields[‘account’][‘billing_email’] = $fields[‘billing’][‘billing_email’];
    $fields[‘account’] = array_reverse($fields[‘account’]);
    unset($fields[‘billing’][‘billing_email’]);
    unset($fields[‘order’][‘order_comments’]);
    $fields[‘billing’][‘billing_company’][‘required’] = false;
    $fields[‘billing’][‘billing_phone’][‘required’] = false;
    return $fields;
    }

    add_filter (‘add_to_cart_redirect’, ‘woo_redirect_to_checkout’);

    function woo_redirect_to_checkout() {
    global $woocommerce;
    $checkout_url = $woocommerce->cart->get_checkout_url();
    return $checkout_url;
    }

    add_filter(‘avf_blog_style’,’avia_change_archive_blog_layout’, 10, 2);
    function avia_change_archive_blog_layout($layout, $context){
    if($context == ‘archive’) $layout = ‘single-big’;
    return $layout;
    }

    add_filter( ‘post-format-standard’, ‘avia_category_content_filter’, 15, 1);
    function avia_category_content_filter($current_post)
    {
    if(!is_single())
    {
    $current_post[‘content’] = get_the_excerpt();
    $current_post[‘content’] .= ‘<div class=”read-more-link”>‘.__(‘Read more’,’avia_framework’).'<span class=”more-link-arrow”> →</span></div>’;
    }
    return $current_post;
    }

    add_filter(‘avf_logo’,’new_logo_url’);
    function new_logo_url($use_image){
    if(is_singular(‘spicypresentations’)) {
    $use_image = “http://nutsandboltsspeedtraining.com/wp-content/uploads/2014/11/sp-logo-rough.png&#8221;;
    }
    return $use_image;
    }

    Thanks,
    Camille

    #358427

    I tried again just now. I cleared my cache, re-typed in the following:
    add_filter(‘avf_logo’,’new_logo_url;);
    function new_logo_url($use_image){
    if(is_singular(‘spicypresentations’)) {
    $use_image=”http://nutsandboltsspeedtraining.com/wp-content/uploads/2014/11/sp-logo-rough.png&#8221;;
    }
    return $use_image;
    }

    And I got this message:
    Parse error: syntax error, unexpected T_STRING in /home/content/34/11243234/html/wp-content/themes/enfold-child/functions.php on line 64

    Line 64 is this: if(is_singular(‘spicypresentations’)) {

    #358480
    This reply has been marked as private.
    #358854

    Hey!

    I don’t see anything wrong with the code. Please replace it with this:

    add_filter('avf_logo','avf_new_logo_url');
    function avf_new_logo_url($use_image){
    if(is_singular('spicypresentations')) $use_image = "http://nutsandboltsspeedtraining.com/wp-content/uploads/2014/11/sp-logo-rough.png";
    return $use_image;
    }

    Regards,
    Ismael

    #358876

    Hm, still not working. Just tried your latest code and got:
    Parse error: syntax error, unexpected ‘:’ in /home/content/34/11243234/html/wp-content/themes/enfold-child/functions.php on line 64

    Must just be conflicting with a plugin or other code somewhere…

    Thanks anyway for your help!

    #359401

    Hi!

    What is line 64 on your editor? The code doesn’t even have a colon symbol on it. Please get the code here: http://pastebin.com/KZsVBh5r

    Best regards,
    Ismael

    #359847

    Hi Ismael, it just worked!!! I must have done something wrong last time!

    Is there any way to control the size of this image?

    Thanks so much!

    #360212

    Hey!

    Try adding this to Quick CSS:

    .single-spicypresentations .logo img {
        width: 220px;
        height: 120px !important;
        max-height: none !important;
    }

    Change as needed.

    Regards,
    Josue

    #362589

    Great, thank you!

Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘Different Main Navigation Menu and Logo for Custom Post Type?’ is closed to new replies.