Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1483941

    I know I am reaching here and there may not be a solution. I have 300+ pages in my website. Is there any way to identify which pages I have icons on without going through the torture of page by page?

    They seemed to have stopped working. Switching them is extremely time consuming.

    thank you

    #1484057

    Hey extraeyes,

    Thank you for the inquiry.

    Try to add this code in the functions.php file to return a list of pages containing icon elements:

    add_action('wp_head', function () {
        global $wpdb;
    
        $shortcodes = ['av_iconlist', 'av_icongrid', 'av_icon_circles', 'av_font_icon'];
    
        $like_clauses = array_map(function ($sc) use ($wpdb) {
            return $wpdb->prepare("post_content LIKE %s", '%' . $sc . '%');
        }, $shortcodes);
    
        $where = implode(' OR ', $like_clauses);
    
        $query = "
            SELECT ID FROM $wpdb->posts
            WHERE post_type = 'page'
            AND post_status = 'publish'
            AND ($where)
        ";
    
        $results = $wpdb->get_col($query);
    
        echo '<pre style="background: #fff;">';
        var_export($results);
        echo '</pre>';
    });
    

    In the frontend, this should return a list of pages that may look like this:

    View post on imgur.com

    Best regards,
    Ismael

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.