Jump to content

Wordpress Gallery - Linking images with story - Help Needed Badly!


mr_man000

Recommended Posts

Hi Guys,

 

I am having a lot of trouble with this gallery on my home page.  It is not linking up with the images that I upload to each article.  The article shows up, but it only shows the default image.  Can someone please explain to me how to link it up?  The images are in the uploads folder in different sizes. 

Here is the code, the file is slide.php (for slideshow):

<?php
/*
File Name: Widget
Version: 1.02
*/

require('../../../../wp-blog-header.php');
// IMPORTANT :
// if you don't put this file in your blog root (where your index.php is)
// then modify the path to wp-blog-header.php above
if (!headers_sent()) {
header('Expires: Mon, 23 Mar 1972 07:00:00 GMT');
header('Cache-Control: no-cache, must-revalidate');
header('Pragma: no-cache');
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>Slideshow</title>
	<link rel="stylesheet" href="css/layout.css" type="text/css" media="screen" charset="utf-8" />
	<link rel="stylesheet" href="css/jd.gallery.css" type="text/css" media="screen" charset="utf-8" />
	<script src="scripts/mootools.v1.11.js" type="text/javascript"></script>
	<script src="scripts/jd.gallery.js" type="text/javascript"></script>
</head>
<body>
	<script type="text/javascript">
		function startGallery() {
			var myGallery = new gallery($('myGallery'), {
				timed: true
			});
		}
		window.addEvent('domready',startGallery);
	</script>
	<div class="content">
		<div id="myGallery">
			<?php 
			$my_query = new WP_Query('showposts=8');//new WP_Query('showposts='. ;
			$fas = 1;
			while ($my_query->have_posts()) : $my_query->the_post();
				$do_not_duplicate = $post->ID; 
				if ( get_post_meta($post->ID, 'image', true) ) { 
					$g = get_bloginfo("template_directory") . "/thumb.php?src=" . get_post_meta($post->ID, "image", true) . "&h=297&w=394&zc=1&q=100";
				}else{
					$g = get_bloginfo("template_directory") . "/images/demo/demo-tabs.gif";
				}
			?>
			<div class="imageElement">
				<h3><span><?php the_time("F jS, Y");?></span><?php the_short_title(45);?></h3>
				<p> </p>
				<a href="<?php the_permalink();?>" title="Open Post" class="open" target="_parent"></a>
				<img src="<?php echo $g;?>" class="full" />
				<img src="<?php echo $g;?>" class="thumbnail" />
			</div>				
			<?php
			endwhile;
			?>
		</div>
	</div>
</body>
</html>

There is also a functions.php that I think is used to hook up the images to the thumbs (which I'm also trying to figure out).:

<?php

define ("blogdir", get_bloginfo("template_directory"));
define ("pubid", get_option('ti_pubid'));
define ("home", get_bloginfo('url'). "/");

function modifyText  ($text, $excerpt_length=20, $strip="<a><p><strong>",$echo=1){
$text = apply_filters('the_content', $text);
$text = str_replace(']]>', ']]>', $text);
//$text = strip_tags($text);
$words = explode(' ', $text, $excerpt_length + 1);
if (count($words) > $excerpt_length) {
	array_pop($words);
	//array_push($words, '[<a href="'. get_permalink() . '">...</a>]');
	$text = implode(' ', $words);
}
if ($echo==1){
	echo strip_tags($text,$strip);
}else{
	return strip_tags($text,$strip);
}
}
function modifyTextPost  ($excerpt_length=20, $strip="<a><strong>",$echo=1){
global $post;
$text = $post->post_content;
$text = apply_filters('the_content', $text);
$text = str_replace(']]>', ']]>', $text);
//$text = strip_tags($text);
$words = explode(' ', $text, $excerpt_length + 1);
if (count($words) > $excerpt_length) {
	array_pop($words);
	//array_push($words, '[<a href="'. get_permalink() . '">...</a>]');
	$text = implode(' ', $words);
}
if ($echo==1){
	echo strip_tags($text,$strip);
}else{
	return strip_tags($text,$strip);
}
}
function blogname (){
$blogname = get_bloginfo("name");
$exp = explode(" ", $blogname);
$tot = count($exp);
$lastword = end($exp);

$left = implode(" ", array_slice($exp,0, count($exp)-1));

echo $left . " <em>" . $lastword . "</em>";
}

function the_short_title($limit=40,$echo=1,$title=''){
if (empty($title)){
	$title = strip_tags(the_title('','',false));
}
if (strlen($title)<=$limit){
}else{
	$title = strip_tags(substr_replace(the_title('','',false),' ...',$limit));
}
if ($echo==1){
	echo $title;
}else{
	return $title;
}
}


function get_post_image(){
global $post;
$image = get_post_meta($post->ID, 'image', true);
if ( $image ) { 
	$g = blogdir . "/thumb.php?src=" . str_replace(wroot, "", $image) . "&h=81&w=109&zc=1&q=100";
}else{
	$g = blogdir . "/images/demo/demo-post.gif";
}
echo $g;
}

function get_tab_image(){
global $post;
$image = get_post_meta($post->ID, 'image', true);
if ( $image ) { 
	$g = blogdir . "/thumb.php?src=" . str_replace(wroot, "", $image) . "&h=81&w=107&zc=1&q=100";
}else{
	$g = blogdir . "/images/demo/demo-tabs.gif";
}
echo $g;
}


function getTopCommentators(){
global $wpdb;
$commenters = $wpdb->get_results("
	SELECT COUNT(comment_author) AS comment_comments, comment_author, comment_author_url, comment_author_email
	FROM $wpdb->comments
	WHERE comment_type != 'pingback'
	AND comment_author != ''
	AND comment_approved = '1'
	GROUP BY comment_author
	ORDER BY comment_comments DESC, comment_author ASC limit 5
	");
//print_r($commenters);

if (is_array($commenters)){
	$counter = 1;
	foreach($commenters as $commenter){
?>
<li class="rc_item" id="tc_item_<?php echo $counter?>">
        <div class="rc_avatar rc_left">
        <?php echo get_avatar($commenter->comment_author_email, '32', "")?>
        </div>
        <div class="rc_info">
            <span class="author_name"><a href="<?php echo $commenter->comment_author_url!="http://"?$commenter->comment_author_url:"#";?>" rel="nofollow"><?php echo $commenter->comment_author;?></a></span>
        </div>
        <div class="rc_excerpt">
            Total <em><?php echo $commenter->comment_comments;?></em> Comments... 
        </div>
    </li>
<?php
	}
}
}



////////////////////////////////////////////////////////////////////////////////
// Comment and pingback separate controls
////////////////////////////////////////////////////////////////////////////////

$bm_trackbacks = array();
$bm_comments = array();

function split_comments( $source ) {

    if ( $source ) foreach ( $source as $comment ) {

        global $bm_trackbacks;
        global $bm_comments;

        if ( $comment->comment_type == 'trackback' || $comment->comment_type == 'pingback' ) {
            $bm_trackbacks[] = $comment;
        } else {
            $bm_comments[] = $comment;
        }
    }
}


function getEditorPost ($slice=10, $offset=0, $w=165, $h=94, $ex=10, $str=""){
global $wpdb, $post;
    $my_wpdata = $wpdb->get_results("SELECT  * FROM $wpdb->posts where post_status='publish' and post_type='post' order by ID desc");
foreach ($my_wpdata as $mpdi=>$mpdv){
	$market = "";
	$featured = get_post_meta($mpdv->ID, 'is_ec', true);
	if ( get_post_meta($mpdv->ID, 'image', true) ) { 
		$g = blogdir . "/thumb.php?src=" . get_post_meta($mpdv->ID, "image", true) . "&h=$h&w=$w&zc=1&q=100";
	}else{
		$g = blogdir . "/images/demo/demo-featured.gif";
	}
	if ($featured==1){
		$market["permalink"] = get_permalink($mpdv->ID);
		$market["image"] = $g;
		$market["description"] = modifyText  ($mpdv->post_content, $ex, $str,0);
		$market["title"] = substr(strip_tags($mpdv->post_title),0,40); //strip_tags($mpdv->post_title),0,40);
		$market["longtitle"] = $mpdv->post_title;
		$featuredPosts[] = $market;
	}
}
if (is_array($featuredPosts)){
	return array_slice($featuredPosts,$offset,$slice-1);
}else{
	return "";
}
}


function getPopularPost ($slice){
global $wpdb, $post;
    $my_wpdata = $wpdb->get_results("SELECT  * FROM $wpdb->posts where post_status='publish' and post_type='post'");
foreach ($my_wpdata as $mpdi=>$mpdv){
	$market = "";
	$featured = get_post_meta($mpdv->ID, 'post-counter', true);
	if ($featured!=""){
		$featuredPosts[$mpdv->ID] = $featured;
	}
}

if (is_array($featuredPosts)){
	arsort($featuredPosts, SORT_NUMERIC);	
}

if ($featuredPosts){

foreach ($featuredPosts as $id=>$vid){
	if ( get_post_meta($id, 'image', true) ) { 
		$g = blogdir . "/thumb.php?src=" . get_post_meta($id, 'image', true) . "&h=94&w=151&zc=1&q=100";
	}else{
		$g = blogdir . "/images/demo/demo-featuredPost.gif";
	}
	$market["permalink"] = get_permalink($id);
	$market["image"] = $g;
	$market["description"] = substr(strip_tags(getPostContent ($id)),0,45) . " ...";
	$market["title"] = substr(strip_tags(getPostName ($id)),0,20) . " ..."; //strip_tags($mpdv->post_title),0,40);
	$market["longtitle"] = getPostName ($id);
	$newfeaturedPosts[] = $market;
}
}
//return $post_title[0]->post_title;
//$key_1_value = get_post_meta(76, 'key_1', true);
if (is_array($newfeaturedPosts)){
	return array_slice($newfeaturedPosts,0,$slice-1);
}else{
	return "";
}

}

function getPostName ($postid){
global $wpdb, $post;
    $post_title = $wpdb->get_results("SELECT  * FROM $wpdb->posts WHERE ID = '$postid'");
return $post_title[0]->post_title;
}
function getPostContent ($postid){
global $wpdb, $post;
    $post_title = $wpdb->get_results("SELECT  * FROM $wpdb->posts WHERE ID = '$postid'");
return $post_title[0]->post_content;
}

////////////////////////////////////////////////////////////////////////////////
// THEME OPTION FOR AUTOSLUG
////////////////////////////////////////////////////////////////////////////////


$themename = "Blog";
$shortname = "ti";

$wp_dropdown_rd_admin = get_categories('hide_empty=0&orderby=name');
$wp_getcat = array();
$wp_getcat[" "] = "Select One";
foreach ($wp_dropdown_rd_admin as $category_list) {
$wp_getcat[$category_list->cat_ID] = $category_list->cat_name;
}
$wp_listposts = array(2,4,6,8,10,12,14,16);

function mytheme_bz_admin() {
global $themename, $shortname, $options, $wp_getcat, $wp_listposts;
if ( $_REQUEST['saved'] ) echo '<div id="message" class="updated fade"><p><strong>'.$themename.' settings saved.</strong></p></div>';
if ( $_REQUEST['reset'] ) echo '<div id="message" class="updated fade"><p><strong>'.$themename.' settings reset.</strong></p></div>';
?>


<div id="custom-wrap">
<div id="custom-container">
	<form method="post" id="option-mz-form">

		<div class="option-box">
			<h5>Blog Advertisments Settings</h5>
			<div class="pwrap">
				<p>Publisher ID:</p>
				<p><input name="<?php echo $shortname?>_pubid" class="ops-select" id="<?php echo $shortname?>_pubid" type="<?php echo $value['type']; ?>" value="<?php echo get_settings( $shortname . "_pubid" );?>" /></p>
			</div>
		</div>
            
            <div class="option-box">
			<h5>FeedBurner Settings</h5>
			<div class="pwrap">
				<p>FeedBurner ID:</p>
				<p><input name="<?php echo $shortname?>_feedburnerid" class="ops-select" id="<?php echo $shortname?>_feedburnerid" type="<?php echo $value['type']; ?>" value="<?php echo get_settings( $shortname . "_feedburnerid" );?>" /></p>
			</div>
		</div>

		<div class="option-box">
			<h5>Feature Categories</h5>
			<?php 
				$my_cat_array = unserialize(get_settings($shortname . "_featured_cats"));
				if (!is_array($my_cat_array)){ $my_cat_array = array("-1"); }
			?>
			<div class="pwrap">
				<p>Featured Categories:</p>
				<p>
					<?php foreach ($wp_getcat as $optionid=>$option) { ?>
					<input type="checkbox" name="<?php echo $shortname?>_featured_cats[]" value="<?php echo $optionid; ?>"<?php if ( in_array($optionid,$my_cat_array)==1) {?> checked="checked"<?php }?>> <?php echo $option; ?><br />
					<?php } ?>
				</p>
			</div>
		</div>
            
		<div class="option-box">
			<h5>Other Settings</h5>
                <div class="pwrap">
				<p>Latest News:</p>
				<p>
					<select name="<?php echo $shortname?>_news" class="ops-select" id="<?php echo $shortname?>_news">
					<?php foreach ($wp_getcat as $optionid=>$option) { ?>
						<option<?php if ( get_settings($shortname . "_news") == $option) { echo ' selected="selected"'; }  ?>><?php echo $option; ?></option>
					<?php } ?>
					</select>
				</p>
			</div>
                <div class="pwrap">
				<p>Quick Tab 1:</p>
				<p>
					<select name="<?php echo $shortname?>_qtab1" class="ops-select" id="<?php echo $shortname?>_qtab1">
					<?php foreach ($wp_getcat as $optionid=>$option) { ?>
						<option<?php if ( get_settings($shortname . "_qtab1") == $option) { echo ' selected="selected"'; }  ?>><?php echo $option; ?></option>
					<?php } ?>
					</select>
				</p>
			</div>
			<div class="pwrap">
				<p>Quick Tab 2:</p>
				<p>
					<select name="<?php echo $shortname?>_qtab2" class="ops-select" id="<?php echo $shortname?>_qtab2">
					<?php foreach ($wp_getcat as $optionid=>$option) { ?>
						<option<?php if ( get_settings($shortname . "_qtab2") == $option) { echo ' selected="selected"'; }  ?>><?php echo $option; ?></option>
					<?php } ?>
					</select>
				</p>
			</div>
		</div>

		<p class="submit">
		<input name="save" type="submit" class="saveme" value="Save changes" />
		<input type="hidden" name="action" value="save" />
		</p>
	</form>
</div>
</div>



<?php
}

function mytheme_add_bz_admin() {
global $themename, $shortname;
$ti_pubid = $_REQUEST['ti_pubid'];
$ti_feedburnerid = $_REQUEST['ti_feedburnerid'];
$ti_featured_cats = $_REQUEST['ti_featured_cats'];
$ti_news = $_REQUEST['ti_news'];
$ti_qtab1 = $_REQUEST['ti_qtab1'];
$ti_qtab2 = $_REQUEST['ti_qtab2'];

$page = $_GET['page'];
$action = $_REQUEST['action'];

if ( $page == basename(__FILE__) ) {
	if ( 'save' == $action ) {
		if ($ti_pubid != ""){
			update_option( $shortname . "_pubid", $ti_pubid);
		}
		if ($ti_news != ""){
			update_option( $shortname . "_news", $ti_news);
		}
		if ($ti_qtab1 != ""){
			update_option( $shortname . "_qtab1", $ti_qtab1);
		}
		if ($ti_qtab2 != ""){
			update_option( $shortname . "_qtab2", $ti_qtab2);
		}
		if($ti_feedburnerid!=""){
			update_option($shortname."_feedburnerid",$ti_feedburnerid);
		}
		if (is_array($ti_featured_cats)){
			$my_set_vcal = serialize($ti_featured_cats);
			update_option( $shortname . "_featured_cats", $my_set_vcal);
		}
		if ($ti_news!=""){
			update_option( $shortname . "_news", $ti_news);
		}
		header("Location: admin.php?page=functions.php&saved=true");
		die();
	}elseif ( 'reset' == $action ) {
		delete_option( $shortname . "_pubid");
		delete_option( $shortname . "_feedburnerid");
		delete_option( $shortname . "_featured_cats");

		delete_option( $shortname . "_news");
		delete_option( $shortname . "_qtab1");
		delete_option( $shortname . "_qtab2");
		header("Location: admin.php?page=functions.php&reset=true");
		die();
	}
}
//add_theme_page($themename." Options", "Configure Theme", 'edit_themes', basename(__FILE__), 'mytheme_bz_admin');
add_menu_page('Configure Theme', 'Configure Theme', 'edit_themes', basename(__FILE__), 'mytheme_bz_admin');
}





////////////////////////////////////////////////////////////////////////////////
// add theme cms pages
////////////////////////////////////////////////////////////////////////////////

function mytheme_wp_bz_head() { ?>
<link href="<?php bloginfo('template_directory'); ?>/admin/bz-admin.css" rel="stylesheet" type="text/css" />
<?php }

add_action('admin_head', 'mytheme_wp_bz_head');
add_action('admin_menu', 'mytheme_add_bz_admin');



?>
<?php
if ( function_exists('register_sidebar') )
    register_sidebar(array(
        'before_widget' => '',
        'after_widget' => '',
        'before_title' => '<div class="title">',
        'after_title' => '</div>',
    ));
?>

 

Now I need help ASAP as I was supposed to have this done by Friday (now it's Saturday  :'( )

THANK YOU SO MUCH FOR HELPING!!!!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.