Forum Replies Created

Viewing 15 replies - 1 through 15 (of 21 total)
  • dingguya, while I didn’t find a solution to this problem I found an alternative:

    https://wp.tutsplus.com/tutorials/theme-development/how-to-create-infinite-scroll-pagination/

    Works like a charm for me thankfully. You can also incorporate Masonry if you wish.

    Hey dingguya did you ever figure it out? I’m having the same error.

    Thread Starter Pressnoob

    (@pressnoob)

    That is what I found out but I was hoping there may be a better way because what if I have different excerpt templates for different kinds of posts?

    I’ll try to figure out a way to make the custom fields into an excerpt (I know you can do this) , then using the TYPES plugin I could assign the custom field to a custom post.

    Thank you for answering and happy New Year!

    Thread Starter Pressnoob

    (@pressnoob)

    Bah… I figured it out.

    I was really just looking for the excerpt function. For those noobs who also might be facing a similar problem.

    -In your index or home.php replace the_content(); with the_excerpt();
    -To enable the excerpt box line go in your admin panel click “Screen Options” near the top and tick the excerpt box.
    -To remove the 55 character limit of the excerpt (or to set your own) put this in functions.php

    <?php
    function custom_excerpt_length( $length ) {
    	return 20;
    }
    add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
    ?>

    To allow shortcodes to be used in excerpt put this as well:

    <?php
    add_filter('the_excerpt', 'do_shortcode');
    ?>

    And finally to remove that ugly […] add this:

    function trim_excerpt($text) {
      return rtrim($text,'[...]');
    }
    add_filter('get_the_excerpt', 'trim_excerpt');
    Thread Starter Pressnoob

    (@pressnoob)

    Sorry I forgot to post an example:

    https://www.takemypaycheck.com/

    It’s cool because the thumbnail is not just resized or anything. It takes the user to a page that’s completely different from the thumbnail post… How do they do that?

    Thread Starter Pressnoob

    (@pressnoob)

    Thanks for your input. One thing I can do is just make an image and use that as the background. But I don’t know if that is good design practice. I guess I should play around with different things and maybe ask around a web design forum as well.

    Thread Starter Pressnoob

    (@pressnoob)

    Thank you very much. I’m curious as well because rounded edges are so prominent in wp designs that cross browser support must’ve been meticulously hammered out a while ago. Or maybe they don’t display that well at all on certain browsers… I will check browser stack to test it later.

    Thread Starter Pressnoob

    (@pressnoob)

    Thanks for the link but I think the infinite scroll is the easy part, I’ll probably use some jquery script for that.

    I’m more curious about how exactly they post new content… Do they just use some sort of custom post type and custom page? When I try to post something in my custom theme I just get a blank page…. I must be missing a lot. Till now I’ve been using wordpress mainly as a cms for static pages. I’m gonna open up some themes and try to see how it works but do you have any suggestions on where to start or how that theme/website does it?

    Ohh… Right… I need to modify post.php and page.php in my theme… duh. I think I’ll go over the WP documentation and study the basic themes first before asking anymore questions.

    I did also find a free “pinboard” theme to study as well:

    https://www.onedesigns.com/wordpress-themes/pinboard

    Thread Starter Pressnoob

    (@pressnoob)

    Well it worked like a charm, I’m still trying to figure out the best way to style it but that should be really easy to do. For anyone else interested here’s the code:

    $get_amazon_api =   include("amazon_api_class.php");
    
     function get_product($atts) {
     extract(shortcode_atts(array(
     'asin' => ''
     ), $atts));
    global $get_amazon_api;
    
      $obj = new AmazonProductAPI();
    
        try
        {
            $result = $obj->getItemByAsin($asin);
        }
        catch(Exception $e)
        {
            echo $e->getMessage();
        }
    
    $LowestP = $result->Items->Item->OfferSummary->LowestNewPrice->Amount;
    $MSRP = $result->Items->Item->ItemAttributes->ListPrice->Amount;
    $Savings =  $MSRP - $LowestP; 
    
    $percent = $Savings / $MSRP;
    $percent2 = $percent * 100;
    $final_percent = number_format($percent2, 2) . "%";
    
    $LowestP2 = number_format($LowestP /100,2);
    $MSRP2 = number_format($MSRP /100,2);
    $Savings2 = number_format($Savings /100,2);
    
     return      "Save " . $final_percent ."<br>" . "Retail Price: $" . $MSRP2 .  "<br>" . "Lowest Price: $" . $LowestP2  . "<br>". "Total Savings: $" . $Savings2;
    
    }
    
    add_shortcode('get product', 'get_product');

    To use it just type [get product asin=”xxxxxxxx”]

    Thank you very much bcworkz.

    Thread Starter Pressnoob

    (@pressnoob)

    Ah that’s what I thought! I’ll try putting everything into one function, and putting include() into a global variable and then into that function. Thanks a lot!

    Thread Starter Pressnoob

    (@pressnoob)

    Before even adding attributes to the short code I came up against some trouble already. Is there any reason why the script would stop working as soon as I transplanted it into a plugin? I’m not understanding the short code API, why can’t I retrieve other variables?

    include("amazon_api_class.php");
    
        $obj = new AmazonProductAPI();
    
        try
        {
            $result = $obj->getItemByAsin(B0067HQL30);
        }
        catch(Exception $e)
        {
            echo $e->getMessage();
        }
    
    $LowestP = $result->Items->Item->OfferSummary->LowestNewPrice->Amount;
    $MSRP = $result->Items->Item->ItemAttributes->ListPrice->Amount;
    $Savings =  $MSRP - $LowestP; 
    
    function get_product() {
    return $MSRP;
    }
    
    add_shortcode('get product', 'get_product');
    ?>

    Thread Starter Pressnoob

    (@pressnoob)

    NM… Totally misread what you wrote, You’re saying make a plugin then add a shortcode at the end of it.

    How do you guys change all the images from local to the web url? I just found out that relative links don’t work in wordpress unless you make some changes or add a function. But is there an easier way to do it? I know there’s a search and replace plugin as well but that seems a little risky to me.

    Thread Starter Pressnoob

    (@pressnoob)

    Well if anyone is curious how best you can do this there’s this plugin called raw html and it copies your html as is without any parsing.

    Thread Starter Pressnoob

    (@pressnoob)

    I have a follow up question though… So let’s say my page design is done and I want to create a new wordpress page and insert the HTML without having to put it throught he wordpress html editor, what exactly do I do next? I add a page set it up, but then insert the HTML through command line or CODA?

    Images are still not working because I’m using the php function in the html.

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