Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Drupal 8 is really beautiful… but if you don’t know how to develop a website, you can use WordPress.

    Use WP_Query to get the data from the Data base:
    https://codex.ww.wp.xz.cn/Class_Reference/WP_Query

    Make a template for the page or single in that you can see the data.
    Page Templates
    https://developer.ww.wp.xz.cn/themes/template-files-section/page-templates/

    Here is another option to build the Query:

    Template Tag

    Just place both functions in your functions.php file. Then adjust the 1st function and add your custom table name. Then you need some try/error to get rid of the current user ID inside the resulting array (see comment).

    /**
     * Get "Leaders" of the current user
     * @param int $user_id The current users ID
     * @return array $query The leaders
     */
    function wpse50305_get_leaders( $user_id )
    {
        global $wpdb;
    
        return $wpdb->query( $wpdb->prepare(
            "
                SELECT <code>leader_id</code>, <code>follower_id</code>
                FROM %s
                    WHERE <code>follower_id</code> = %s
                ORDERBY <code>leader_id</code> ASC
            ",
            // Edit the table name
            "{$wpdb->prefix}custom_table_name"
            $user_id
        ) );
    }

    How to extend WP_Query to include custom table in query?
    http://wordpress.stackexchange.com/questions/50305/how-to-extend-wp-query-to-include-custom-table-in-query

    With: Version 1.0.2

    Warning: include_once(/home/mysite/public_html/amde/wp-content/plugins/intergeo-maps/templates/iframe/extra.php): failed to open stream: No such file or directory in /home/mysite/public_html/amde/wp-content/plugins/intergeo-maps/templates/iframe/form.php on line 32

    Warning: include_once(): Failed opening ‘/home/mysite/public_html/amde/wp-content/plugins/intergeo-maps/templates/iframe/extra.php’ for inclusion (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/mysite/public_html/amde/wp-content/plugins/intergeo-maps/templates/iframe/form.php on line 32

Viewing 2 replies - 1 through 2 (of 2 total)