Forums

Change core select query for posts (2 posts)

  1. futuro
    Member
    Posted 2 weeks ago #

    hi, i have question, i insert in to table wp_post column name sur and i need show on web posts where is sur = 1. So i need to know where is function which selecting posts from database and change the SQL query. Thanks and sorry for my very bad english...

  2. stvwlf
    Member
    Posted 2 weeks ago #

    Hi

    You don't need to add a column to the table for what you are doing. There is an approach built into WordPress called Custom Fields.
    http://codex.wordpress.org/Custom_Fields

    20+ Tutorials and Resources for Working with Custom Fields in WordPress
    http://vandelaydesign.com/blog/wordpress/custom-fields/

    Add a custom field called sur with a value of 1 to all posts you would otherwise mark in the database.

    In your templates use query_posts to select posts with that custom field set to 1
    http://codex.wordpress.org/Template_Tags/query_posts#Custom_Field_Parameters

Reply

You must log in to post.

About this Topic