-
Get attachments from posts/pages
hi to the community,
i'm building a gallery using wordpress and i try to get all images included in a page,
so i have build an admin options page and from there i get the pages in a drop down and i have a problem filtering the content,
if anyone have a solution on this i will be very thankful,
thanks a lot,
Philip
Last edited by artdev; 08-12-2010 at 08:40 AM.
-
ok i figure out how to make a call to db:
$mypage_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_name = '$get_gallery1'");
everything is working now!
-
You may want to look into the parameter escaping functions built into WordPress.
http://codex.wordpress.org/WordPress...SQL_statements
I don't know where you're getting the value for $get_gallery1, but there's always the danger that it could contain a SQL injection that could give somebody unauthorized access to your database. Escaping it eliminates that threat.
-
thanks a lot for your reply itsananderson,
i have to take a look, i'm a newbie so i have to take a closer look.
the value $get_gallery1 cames from the theme options page to find a page and filter the attachments,
i have make it work but i have to see this about sql injections.
also my problem now is that the html content from the text areas comes with some slashes (//) and i have echoed like this,
<?php if ( get_settings( $value['id'] ) != "") { echo stripslashes(get_settings( $value['id'] )); } else { echo stripslashes($value['std']); } ?>
i try to find a solution for this now also,
thanks a lot for the time you spend to help me,
all the best!!!
Philip
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules