Title: Devotion's Replies | WordPress.org

---

# Devotion

  [  ](https://wordpress.org/support/users/devotion/)

 *   [Profile](https://wordpress.org/support/users/devotion/)
 *   [Topics Started](https://wordpress.org/support/users/devotion/topics/)
 *   [Replies Created](https://wordpress.org/support/users/devotion/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/devotion/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/devotion/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/devotion/engagements/)
 *   [Favorites](https://wordpress.org/support/users/devotion/favorites/)

 Search replies:

## Forum Replies Created

Viewing 15 replies - 1 through 15 (of 35 total)

1 [2](https://wordpress.org/support/users/devotion/replies/page/2/?output_format=md)
[3](https://wordpress.org/support/users/devotion/replies/page/3/?output_format=md)
[→](https://wordpress.org/support/users/devotion/replies/page/2/?output_format=md)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Article List Manager (arlima)] Image size in list?](https://wordpress.org/support/topic/image-size-in-list/)
 *  Thread Starter [Devotion](https://wordpress.org/support/users/devotion/)
 * (@devotion)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/image-size-in-list/#post-3655989)
 * Example: [http://s14.postimg.org/4yt9h4lbl/Sk_rmavbild_2013_04_20_kl_01_47_13.png](http://s14.postimg.org/4yt9h4lbl/Sk_rmavbild_2013_04_20_kl_01_47_13.png)
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Article List Manager (arlima)] Image size in list?](https://wordpress.org/support/topic/image-size-in-list/)
 *  Thread Starter [Devotion](https://wordpress.org/support/users/devotion/)
 * (@devotion)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/image-size-in-list/#post-3655988)
 * Yep. But I managed to solve it.
 * Then another issue showed up. When inserting articles as half-width into a list,
   the image height is different for each article. Sure, I could use Scissors Continued
   to correct it, but shouldn’t there be a standard size for when displaying half-
   width, sort of?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Article List Manager (arlima)] Image size in list?](https://wordpress.org/support/topic/image-size-in-list/)
 *  Thread Starter [Devotion](https://wordpress.org/support/users/devotion/)
 * (@devotion)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/image-size-in-list/#post-3655985)
 * I insert the list using shortcode and a PHP code widget. But the image doesn’t
   fit the width of the list. :S
 * Image: [http://s7.postimg.org/63lfthmmz/Sk_rmavbild_2013_04_19_kl_10_00_15.png](http://s7.postimg.org/63lfthmmz/Sk_rmavbild_2013_04_19_kl_10_00_15.png)
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Article List Manager (arlima)] Image size in list?](https://wordpress.org/support/topic/image-size-in-list/)
 *  Thread Starter [Devotion](https://wordpress.org/support/users/devotion/)
 * (@devotion)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/image-size-in-list/#post-3655982)
 * Man, I’m really trying to figure out how to adjust it using that filter. Not 
   getting there.
 * I also meant the width, not the height. My bad. :/
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Article List Manager (arlima)] Plugin activation fails – despite correct PHP version.](https://wordpress.org/support/topic/plugin-activation-fails-despite-correct-php-version/)
 *  Thread Starter [Devotion](https://wordpress.org/support/users/devotion/)
 * (@devotion)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/plugin-activation-fails-despite-correct-php-version/#post-3228403)
 * Hm, weird, according to our web host we do infact have PHP 5.3. :S
 * I’ll contact them again.
 * Can’t wait to get this plugin going!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Diamond MultiSite Widgets] [Plugin: Diamond MultiSite] It only shows the FIRST post?!](https://wordpress.org/support/topic/it-wont-show-latest-post-only-shows-the-first-post/)
 *  Thread Starter [Devotion](https://wordpress.org/support/users/devotion/)
 * (@devotion)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/it-wont-show-latest-post-only-shows-the-first-post/#post-2114885)
 * I’ve changed the file permissions, too – no difference.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WPBook] WPBook Custom Post Types?](https://wordpress.org/support/topic/wpbook-custom-post-types/)
 *  Thread Starter [Devotion](https://wordpress.org/support/users/devotion/)
 * (@devotion)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/wpbook-custom-post-types/#post-1704577)
 * It works!
    Very grateful.
 * How do I add on more post types if I create any in the future?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WPBook] WPBook Custom Post Types?](https://wordpress.org/support/topic/wpbook-custom-post-types/)
 *  Thread Starter [Devotion](https://wordpress.org/support/users/devotion/)
 * (@devotion)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/wpbook-custom-post-types/#post-1704546)
 * Man, I can’t get it to work.
 * This snippet is correct, right? See below.
 *     ```
       }
           if(get_post_type($my_post->ID) != 'post, nyheter') { // only do this for posts
             return;
           }
       ```
   
 * The two post types being **post** and **nyheter**.
 * I’m not getting any errors or so, it’s just not publishing.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WPBook] WPBook Custom Post Types?](https://wordpress.org/support/topic/wpbook-custom-post-types/)
 *  Thread Starter [Devotion](https://wordpress.org/support/users/devotion/)
 * (@devotion)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/wpbook-custom-post-types/#post-1704520)
 * John, thank you for this! You guys are awesome.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [Publish to multiple Facebook walls import comments?](https://wordpress.org/support/topic/publish-to-multiple-facebook-walls-import-comments/)
 *  Thread Starter [Devotion](https://wordpress.org/support/users/devotion/)
 * (@devotion)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/publish-to-multiple-facebook-walls-import-comments/#post-1690235)
 * Cool. I’ll be waiting. 🙂
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [EMERGENCY! I need help!](https://wordpress.org/support/topic/emergency-2/)
 *  Thread Starter [Devotion](https://wordpress.org/support/users/devotion/)
 * (@devotion)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/emergency-2/#post-1689438)
 * Oh, wait, I forgot to add – this is how I solved it. I “simply” added this to
   my themes **functions.php**:
 *     ```
       function get_post_image ($post_id=0, $width=0, $height=0, $img_script='') {
       	global $wpdb;
       	if($post_id > 0) {
   
       		 // select the post content from the db
   
       		 $sql = 'SELECT post_content FROM ' . $wpdb->posts . ' WHERE id = ' . $wpdb->escape($post_id);
       		 $row = $wpdb->get_row($sql);
       		 $the_content = $row->post_content;
       		 if(strlen($the_content)) {
   
       			  // use regex to find the src of the image
   
       			preg_match("/<img src\=('|\")(.*)('|\") .*( |)\/>/", $the_content, $matches);
       			if(!$matches) {
       				preg_match("/<img class\=\".*\" title\=\".*\" src\=('|\")(.*)('|\") .*( |)\/>/U", $the_content, $matches);
       			}
       			$the_image = '';
       			$the_image_src = $matches[2];
       			$frags = preg_split("/(\"|')/", $the_image_src);
       			if(count($frags)) {
       				$the_image_src = $frags[0];
       			}
   
       			  // if src found, then create a new img tag
   
       			  if(strlen($the_image_src)) {
       				   if(strlen($img_script)) {
   
       					    // if the src starts with http/https, then strip out server name
   
       					    if(preg_match("/^(http(|s):\/\/)/", $the_image_src)) {
       						     $the_image_src = preg_replace("/^(http(|s):\/\/)/", '', $the_image_src);
       						     $frags = split("\/", $the_image_src);
       						     array_shift($frags);
       						     $the_image_src = '/' . join("/", $frags);
       					    }
       					    $the_image = '<img alt="" src="' . $img_script . $the_image_src . '" />';
       				   }
       				   else {
       					    $the_image = '<img alt="" src="' . $the_image_src . '" width="' . $width . '" height="' . $height . '" />';
       				   }
       			  }
       			  return $the_image;
       		 }
       	}
       }
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WPBook] [Plugin: WPBook] Comments Facebook avatar](https://wordpress.org/support/topic/plugin-wpbook-comments-facebook-avatar/)
 *  [Devotion](https://wordpress.org/support/users/devotion/)
 * (@devotion)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-wpbook-comments-facebook-avatar/#post-1674929)
 * Don’t worry – I solved it.
    And also managed to get some css assignments in there,
   too. By doing this:
 *     ```
       function get_fb_avatar($email,$url) {
       if(preg_match("@^(?:http://)?(?:www\.)?facebook@i",trim($url))){
               $parse_author_url = (parse_url($url));
               $parse_author_url_q = $parse_author_url['query'];
                   if(preg_match('/id[=]([0-9]*)/', $parse_author_url_q, $match)){
                       $fb_id = "/".$match[1];}
                   else{ $fb_id = $parse_author_url['path'];
                   }
               $grav_url= "http://graph.facebook.com".$fb_id."/picture?type=square";
               }
               else{
                   $grav_url = "http://www.devotionmagazine.se/wp-content/themes/deadline/images/gravatar.png";
               }
           $grav_img = "<img src='".$grav_url." ' align='left' class='entry_author_image'/>";
               return $grav_img;
   
           }
       ```
   
 * Like I said – thanks for your help. Been scratching my head a lot regarding this
   lately.
 *   Forum: [Your WordPress](https://wordpress.org/support/forum/your-wordpress/)
   
   In reply to: [Magazine layout – feedback appreciated](https://wordpress.org/support/topic/magazine-layout-feedback-appreciated/)
 *  Thread Starter [Devotion](https://wordpress.org/support/users/devotion/)
 * (@devotion)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/magazine-layout-feedback-appreciated/#post-1686199)
 * Alright – it’s working again.
    Now look. 🙂
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [EMERGENCY! I need help!](https://wordpress.org/support/topic/emergency-2/)
 *  Thread Starter [Devotion](https://wordpress.org/support/users/devotion/)
 * (@devotion)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/emergency-2/#post-1689362)
 * Solved!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WPBook] [Plugin: WPBook] Comments Facebook avatar](https://wordpress.org/support/topic/plugin-wpbook-comments-facebook-avatar/)
 *  [Devotion](https://wordpress.org/support/users/devotion/)
 * (@devotion)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-wpbook-comments-facebook-avatar/#post-1674928)
 * You’re a absolute genius.
    It’s working – and it looks good.
 * Just one thing. How can I make it show our own default avatar whenever there’s
   no Facebook avatar to show?
 * Which is this one:
    [http://www.devotionmagazine.se/wp-content/themes/deadline/images/gravatar.png](http://www.devotionmagazine.se/wp-content/themes/deadline/images/gravatar.png)
 * For now, it shows the standard, official Gravatar gravatar. (If you know which
   one I mean.)
 * I know some PHP and edit a lot of code on a daily basis but a “hack” like this
   is a bit out of my range of knowledge. I really – really – appreciate your help!

Viewing 15 replies - 1 through 15 (of 35 total)

1 [2](https://wordpress.org/support/users/devotion/replies/page/2/?output_format=md)
[3](https://wordpress.org/support/users/devotion/replies/page/3/?output_format=md)
[→](https://wordpress.org/support/users/devotion/replies/page/2/?output_format=md)