Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  • Thread Tools
  • Rate This Thread
  1. #1
    New to the CF scene
    Join Date
    Mar 2016
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question How to put code in Loop?

    Hello.

    It would be great if someone here could help me because I keep looking and looking but can’t find a solution since I’m new to WordPress. I need to put a plugin’s code inside the theme’s loop but I don’t know where exactly I should place it. I don’t even know which theme file contains the loop. Is it the style.css?

    Anyway, the plugin is for displaying featured images inside the posts and it’s this one:

    https://wordpress.org/plugins/featured-image/

    Until now I have been putting manually the shortcode before each post but I want it to be automated. The creator of the plugin says this is the code that must be placed inside Theme Loop:

    <?php if ( function_exists(‘get_featured_img’) ) get_featured_img(); ?>

    I tried to contact him but unfortunately he has not replied.

    I hope you could help me!
    Thanks.

  2. #2
    Master Coder sunfighter's Avatar
    Join Date
    Jan 2011
    Location
    Washington
    Posts
    6,251
    Thanks
    30
    Thanked 859 Times in 857 Posts
    You are in the HTML section asking about PHP.

    If your site ends in .html your code does not work. The site must end in.php.
    Evolution - The non-random survival of random variants.
    Physics is actually atoms trying to understand themselves.

  3. #3
    New to the CF scene
    Join Date
    Mar 2016
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    But the site does end in php.

  4. #4
    Regular Coder Synaptic's Avatar
    Join Date
    Apr 2015
    Location
    Las Vegas
    Posts
    127
    Thanks
    2
    Thanked 12 Times in 12 Posts
    Quote Originally Posted by Doom_87 View Post
    But the site does end in php.
    Either way, you're asking a PHP question. Also, without providing your code, we can't help you pinpoint where you should be adding that.

  5. #5
    $object->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Jun 2003
    Posts
    3,192
    Thanks
    2
    Thanked 30 Times in 30 Posts
    FYI - I've moved this thread to the PHP forum.
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    SNAP to it!

  6. #6
    New to the CF scene
    Join Date
    Mar 2016
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok, which php file's code should I share here? single.php?

  7. #7
    Regular Coder Synaptic's Avatar
    Join Date
    Apr 2015
    Location
    Las Vegas
    Posts
    127
    Thanks
    2
    Thanked 12 Times in 12 Posts
    Unfortunately, I'm not able to answer that confidently. I generally don't like using Wordpress, as my projects are generally more custom oriented programs, than a regular website. What the author of the plugin means when he says, "The Loop". Is the code that generates the post. So, when you are in the back-end of Wordpress, and you have entered in your title and content and all that happy stuff; When you hit submit, a script is running that takes all the information you just input and then inserts it into a database so that it can consistently draw on that information and show that specific post for each user that visits your site.

  8. #8
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,822
    Thanks
    8
    Thanked 1,121 Times in 1,112 Posts
    Do the featured images appear on every page, or every post, or only pages with posts, or only the main page?

    Is there only 1 featured image for each post?

    We have no idea what your rules are for featured images, or what your website is supposed to look like.

    My idea of featured images are images that appear on pages, unrelated to posts.

    ???? What are they in your world?

  9. #9
    New Coder
    Join Date
    Jan 2016
    Location
    pakistan
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by sunfighter View Post
    You are in the HTML section asking about PHP.

    If your site ends in .html your code does not work. The site must end in.php.
    nice comment
    largest cities in the world Click abcnewspoint.com to see the latest updates of your required category.

    new hip hop songs Please check this website links.


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •