• Resolved Sumo1

    (@sumo1)


    Hi,

    I’m trying to create short code to use in the wordpress admin content editors. Not sure if I’m using the correct row in the db, and I can’t find anything in your documentation showing where the data is inserted in wpdb.

    So far I have this, but it’s not working:

    $results = $wpdb->get_row($sql,ARRAY_A);
          $surfschool_name = $results['display_name'];
          $surfschool_email = $results['user_email'];
          $surfschool_logo = $results['author_image'];

    Then I’m using an array like this:

    array(
         'surfschool' => $surfschool_name,
         'surfschoolemail' => $surfschool_email,
         'surfschoollogo' => $surfschool_logo
          )

    Both [surf school] and [surfschoolemail] work perfectly as short code but [surfschoollogo] does not.

    Have you got any suggestions?

    Thanks

    https://wordpress.org/plugins/sem-author-image/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Mike Koepke

    (@mike_koepke)

    The plugin does not use the database for the image location. Instead it uses a uses a folder in wp-content and checks for the existance of an image file for the given author.

    Thread Starter Sumo1

    (@sumo1)

    Actually it does, I worked it out. This returns the file name.

    $sql_author_image = "SELECT meta_value FROM wp_usermeta WHERE user_id =  $user_id AND meta_key = 'author_image' ";
    
    $author_image = $wpdb->get_var($sql_author_image);

    Then all you have to do is create an add_shortcode function.

    Plugin Author Mike Koepke

    (@mike_koepke)

    4.9 version supports [author-image] shortcode for displaying in th epost/page content.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Help with creating short code’ is closed to new replies.