Search the Community
Showing results for tags 'php function'.
-
Hi All, I am having an issue with my image rotating PHP function code which I have attached below. 1% of the time it can rotate through 3 of the 10 pics before stopping. 99% of the time it doesn't work at all. The issue that is popping up in the Developer console of Firefox is "[12:25:28.802] Image corrupt or truncated: http://www.mywebsite.com/wp-content/uploads/script-thumbs/79/7979_5.jpg @ http://www.mywebsite.com/wp-content/uploads/script-thumbs/79/7979_5.jpg". It is not specific to Firefox. Any assistance would be appreciated. function script_thumb($prefix,$title){ $saved_thmb = get_post_meta( get_the_ID(),'saved_thmb',true); $subPath = tubeace_sub_dir_path(get_the_ID()); $upload_dir = wp_upload_dir(); $thumb_url = $upload_dir[baseurl]."/script-thumbs/".$subPath."/"; if($saved_thmb==1){ $thumb = $thumb_url."/".get_the_ID()."_1.jpg"; } elseif($saved_thmb>1) { $def_thmb = get_post_meta( get_the_ID(),'def_thmb',true); $thumb = $thumb_url."/".get_the_ID()."_".$def_thmb.".jpg"; $rotate_thumbs = "onmouseover=\"thumbStart('$prefix-".get_the_ID()."', $saved_thmb, '$thumb_url');\" onmouseout=\"thumbStop('$prefix-".get_the_ID()."', '$thumb_url', '$def_thmb');\""; } else { return; } $thumb = "<img class=\"img-responsive\" src=\"$thumb\" $rotate_thumbs id=\"$prefix-".get_the_ID()."\" alt=\"".esc_attr($title)."\">"; return $thumb; } Cheers, Shaun
-
PHP Warriors, Please help I am trying to write a function in the genesis framwork that would allow me to add before_content_sidebar_wrap only on page_blog.php for my slider but can't seem to get it to work! I notice that the wrap and hook are added successefully but they display in every page instead of the blog only. Any help would be greatly appreciated. Here is my function add_action('genesis_before_content_sidebar_wrap', 'child_before_content_sidebar_wrap'); if ( ! ( is_page_template( ‚page_blog.php‚ ) ) ) return; and here is my website I am displaying the slider on. It should be only on the blog page; mainlinerealtors.com/blog/ Thanks a lot,
- 4 replies
-
- php function
- genesis
-
(and 2 more)
Tagged with:
-
Below is a function to add a user to my database that signs in from facebook. What I don't understand is why my on duplicate key update isn't working. When a user signs in from facebook it continues to add in rows in the DB for that user. Please advise. public function facebook_add_user($uid, $email, $name, $oauth_provider) { $uid = (int)$uid; $email = mres(trim($email)); $name = mres(trim($name)); $oauth_provider = (int)$oauth_provider; if (strlen($email) >= 6) { $sql = "INSERT INTO `users` ( `oauth_provider`, `oauth_uid`, `name`, `email` ) VALUES ( '${oauth_provider}', ${uid}, '${name}', '${email}' ) ON DUPLICATE KEY UPDATE `oauth_uid` = VALUES(oauth_uid)"; $q = sql::q($sql); } $sql = "SELECT `id`, `email`, `name`, `oauth_uid`, `oauth_provider` FROM `users` WHERE `oauth_uid` = '${uid}' AND `oauth_provider` = 1"; $q = sql::q($sql); return sql::f_assoc($q); }