Support » Plugin: Super Cool Ad Manager Plugin » Categories & tags bug and solution

  • Resolved onlineforbusiness

    (@onlineforbusiness)


    Great idea for a plugin!

    Unfortunately there’s a bug with the targeting but I managed to find a solution. Currently the script executes in the footer and tries to obtain the categories using get_the_category() and tags using get_the_tags() but because the footer is outside The Loop, these just return a subset of all categories and tags.

    The fix is simple, for categories (around line 230) and tags (around line 247) in dfw-init simply access the wp_query and insert the ID as a parameter. The code should look something like:

    global $wp_query;
    $current_page_id = $wp_query->get_queried_object_id();
    $cats = get_the_category($current_page_id); // Existing line with param added
    ...
    global $wp_query;
    $current_page_id = $wp_query->get_queried_object_id();
    $tags = get_the_tags($current_page_id); // Existing line with param added

    I hope you keep working on this plugin because it’s a great idea and otherwise DFP is a headache to implement in WordPress without creating a Custom Theme or Child Theme.

    https://wordpress.org/plugins/doubleclick-for-wp/

  • The topic ‘Categories & tags bug and solution’ is closed to new replies.