Join the Soledad Facebook Users Group here
for Share, assistance, discussion, and Updates related to Soledad WordPress Theme.

If you can't create a new ticket - you can send us an email via our contact form and we will get back to you.

Okay
  Public Ticket #2816762
advertising
Closed

Comments

  • bonus17 started the conversation

    I would like a different advertising banner to appear in each category.

    Example: Category 1 has a sponsor number 1 - this sponsor's ads are displayed only for Category 1. Category 2 has a different sponsor, so other ads are needed there. How does any html code anywhere on a category page? Do I have to create an elementor template or is there a faster way to do it?

  •  2,615
    PenciDesign replied

    Hi,

    Please access your dashboard, then go to Posts → Categories, click edit on the category you want to insert custom ads, then put the Ads code at Add Google Adsense/Custom HTML Code below this category field.

    image.png

    Regards,
    PenciDesign.


  • bonus17 replied

    I tried this way but it doesn't work, the screen shows my settings and here is the link

    https://www.sektorkolejowy.pl/category/wydarzenia/

  •  2,615
    PenciDesign replied

    Hi,

    By default, the category ads code only display on the magazine template, if you want to display it on the category page, please go to Appearance → Theme Editor, open file functions.php, find line 2973:

    if ( ! function_exists( 'penci_render_google_adsense' ) ) {
        function penci_render_google_adsense( $option ) {
            if( ! get_theme_mod( $option ) )
                {return '';}
            return '<div class="penci-google-adsense '. $option .'">'. do_shortcode( get_theme_mod( $option ) ) .'</div>';
        }
    }

    Replace with this content:

    if ( ! function_exists( 'penci_render_google_adsense' ) ) {
        function penci_render_google_adsense( $option ) {
            $ads_code = get_theme_mod( $option );
            if ( is_category() && 'penci_archive_ad_above' == $option  ) {
                $cat_id    = get_queried_object()->term_id;
                $cat_meta  = get_option( "category_$cat_id" );
                $ads_code  = isset( $cat_meta['mag_ads'] ) ? stripslashes( $cat_meta['mag_ads'] ) : $ads_code;
            }
            if ( $ads_code ) {
                return '<div class="penci-google-adsense '. $option .'">'. do_shortcode( $ads_code ) .'</div>';
            } else {
                return false;
            }
        }
    }

    Update file then reload your site.

    Regards,
    PenciDesign.