ansonphong / postworld

Wordpress Theme Development Framework
GNU General Public License v2.0
7 stars 0 forks source link

pw_get_post_meta() PHP Method - Creation #6

Closed ansonphong closed 11 years ago

ansonphong commented 11 years ago

Hi Haidy, Here is a function which will be really helpful while creating the get_post_data() function which I am working on right now. This might also work well as a meta-function for any other functions which access this data.

Do you think that would affect performance?

Here is the function, it is also listed in the documentation. https://www.evernote.com/shard/s275/sh/7fd5bb62-0902-4050-9889-338f847d044c/5fe6f3da3510557663e8693251ac8557

pw_get_post_meta( $post_id ) • Get an Associative Array of all columns in the wp_postworld_post_meta table • Keys are column names, values are values return : Array 'post_id' => {{integer}} 'author_id' => {{integer}} 'post_class' => {{string}} 'post_format' => {{string}} 'link_url' => {{string}} 'post_points' => {{integer}} 'rank_score' => {{integer}}

ansonphong commented 11 years ago

OK, I created the function no problem. in /php/postworld_meta.php

hmikhail commented 11 years ago

Phong, It won't affect the performance because all the fields are placed in one table wp_postworld_post_meta. no joins or views. Note that we added author_id to table wp_postworld_post_meta not in wp_postworld_post_points

ansonphong commented 11 years ago

OK thank you, that is good to know. I went ahead and made the function - it's very simple but useful.