The landing page displays nothing

Maybe I missed something but after setting-up the plugin and especially to redirect to some temporary landing page (for testing), nothing is displayed, neither on the category listing page nor on the site listing page. Although I assigned some blogs to a site category.

Am I doing something wrong?

N.B. The server cache was refreshed before testing.

  • Jack Kitterhing
    • Code Norris

    Hi there @Cyril Cambournac

    I hope you are well today, I'm well too thank you :slight_smile:

    I've taken a look at the page in question with nothing displaying, and there are 34 errors on that page, mostly cloudflare errors, but also other jQuery errors. Could you switch to the twenty twelve theme and then see if the content shows? I don't believe it will, but I'd like to see what/if any errors this gets rid off.

    With regards the getting the categories, I'm not 100% on that, let see if @Paul can shed some light on that :slight_smile:

    Thanks for being a WPMU DEV member!

    Kind Regards
    Jack.

  • Cyril Cambournac
    • WPMU DEV Initiate

    Hi Jack and thank for the reply.

    Indeed I cannot switch to 2012 theme because it is a production site with quite a lot of trafic.

    Any chance we could do something else to troubleshoot the issue? I wait for @Paul return.

    By the way, could you also help for the way to retrieve the categories a blog belongs to outside the loop inside my theme files? WP get_categories function is actually good on the main site but not on blogs. Tried get_terms and wp_get_object_terms with no success.

  • Paul
    • The Green Incsub

    @Cyril Cambournac,

    Greetings. So the Site Categories plugin adds a hook on the filter 'the_content'. This is how/when the page is rendered it just adds the needed Site Categories output to the bottom of the content.

    You might have some other plugin blocking the Site Category filter. What theme are you running? Also what other plugins?

    One other thought it make sure you save the Site Categories settings. Also if you have changed your site permalinks you need to re-save the Site Categories configuration.

    Speaking of permalinks the plugin does setup some rewrite rules. Though the landing page is not part of that. The rewrite rules are only for the category pages.

    As for the theme switch. Try installing our Advanced Theme Switcher plugin. This will let you switch the theme but not effect your users.

    On you other question By the way, once inside a blog through the WP switch_to_blog() function, how is it possible to retrieve the categories the blog belongs to? I mean inside a .php file.
    So just for clarification. The plugins creates a custom Taxonomy 'bcat' on the primary blog. This is where all information related to the display and the site categories are stored. So using you call switch_to_blog() to the primary blog you can then use normal WP functions to query the terms of the taxonomy.

    So for example if you want to retrieve the terms associated with a specific blog_id you can use the WP function:

    $terms = wp_get_object_terms( $blog_id, SITE_CATEGORIES_TAXONOMY);

    There is also a helper function as part of the plugin. Given a taxonomy term you can retrieve all the sites associated with that term

    $site_categories->get_taxonomy_sites($term_id);

  • Cyril Cambournac
    • WPMU DEV Initiate

    Hi Paul and surry for the late reply.

    Thank you very much for your answers which will helpfor sure.

    1. As regards the blank page issue, we are using Gonzo theme with a bunch of plugins (tomany to list...). I will definitly try the Theme switcher you suggest and try to have a look at the correct hooking in 2013 theme.

    2. Thank you also for guiding on the correct way to use the wp_get_object_terms() together with the helper function.This will definitly help me doing my code. I assume the $site_categories you mention is obtained from the get_categories() WP function and is not a global variable.

    Will let you know about the advancement of both problems.

    Regards,
    Cyril

  • Cyril Cambournac
    • WPMU DEV Initiate

    Hi Paul,

    As regards point 2. I had to instanciate class SiteCategories in order to use the helper method get_taxonomy_sites() and have my routine work.

    Nevertheless, I am wondering whether creating a new object for that (through SiteCategories class) is the good way to achieve my will.

  • Paul
    • The Green Incsub

    @Cyril Cambournac.

    2. Thank you also for guiding on the correct way to use the wp_get_object_terms() together with the helper function.This will definitly help me doing my code. I assume the $site_categories you mention is obtained from the get_categories() WP function and is not a global variable.

    The $site_categories reference its to the global instance of the plugin object. When the WP engine starts and loads the plugin this global object is created for you. If you are working within your own function you need to add the following at the top to bring in that global to your local. Then you don't need to create a new instance.

    global $site_categories

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.