WordPress.org

Forums

WordPress pages vs custom pages (8 posts)

  1. jackiekaiwei
    Member
    Posted 2 years ago #

    The custom non-blog webpages can be created either within WordPress or using regular PHP pages.

    Which method is better? popular? or easy to use?

    I guess the custom pages can use WP users/cookies/themes/templates as well, right?

    For MySQL query, is it good to use WP $wpdb class or not?

    Any advice is appreciated.

  2. esmi
    Forum Moderator
    Posted 2 years ago #

    I guess the custom pages can use WP users/cookies/themes/templates as well, right?

    Correct.

    For MySQL query, is it good to use WP $wpdb class or not?

    What for?

  3. jackiekaiwei
    Member
    Posted 2 years ago #

    Below is the URL of WP $wpdb class.

    http://codex.wordpress.org/Class_Reference/wpdb

    It provides the function to query MySQL tables. e.g. $myrows = $wpdb->get_results( "SELECT id, name FROM mytable" );

    We can also query tables using the native PHP mysql_query() function.

    Which way is better? any pron and cons of each one?

    Thanks.

  4. jackiekaiwei
    Member
    Posted 2 years ago #

    BTW, for WordPress pages vs custom pages. Which one is more popular or better to use? Thanks.

  5. esmi
    Forum Moderator
    Posted 2 years ago #

    Which way is better?

    Using wpdb - although, depending upon what table you are querying and what data you are looking for, there may be even better functions to use. Personally, I've only ever used wpdb when querying tables that aren't native to WordPress. Using in-built WP functionality should decrease the likelihood of you having to carry out any remedial work if the WP database structure changes in the future.

    Which one is more popular or better to use?

    Not sure that you mean by "custom pages"? Do you mean pages created outside of WordPress?

  6. jackiekaiwei
    Member
    Posted 2 years ago #

    Hi esmi, thanks for reply. You are right, I mean pages/PHP files created outside of WordPress when I say "custom pages". Do you have any idea?

    I'd like to query my own tables. If I understand you correctly, you mean you use wpdb to query the tables other than WordPress tables, right?

  7. esmi
    Forum Moderator
    Posted 2 years ago #

    Personally, I prefer to create all pages through WordPress. If you use custom page templates, you can query your own tables without any problem via the template's code.

  8. jackiekaiwei
    Member
    Posted 2 years ago #

    Thanks esmi.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.