Jump to content
Dan Haddock

continue_reading_link not showing icon

Recommended Posts

Dan Haddock

DMS: Latest Version

Running a Child Theme

Wordpress: 4.8.3

Plugins:

Akismet Anti-Spam 
Coming Soon Page & Maintenance Mode by SeedProd
Contact Form 7
Cookie Law Info
DMS Professional Tools    
Enhanced Media Library
Flamingo
Google Analytics for WordPress by MonsterInsights
Google XML Sitemap    
Jetpack by WordPress.com
Legull
Loginizer   
MailChimp for WordPress
PageLines Updater
Really Simple SSL
Schema App Structured Data
Sucuri Security - Auditing, Malware Scanner and Hardening  
Uber reCaptcha
Yoast SEO

Problem Below

Hi Team,

I am looking to style the Continue Reading Button with the PHP you provided in an earlier ticket here: 

 

I put the PHP code into my site, however I do not get my Icon back, I just get back Read More >>

I have attached a screenshot of the code in place on my site along with the output.

Interested to know what I may be doing wrong? - I am very new to PHP so a bit apprehensive on this.

The Images: https://drive.google.com/open?id=0B0i4JJXa2jdQN2xoakZNRUdmaU0

Let me know if you need any more information from me.

 

Share this post


Link to post
Share on other sites
Dan Haddock

Hi Edgar,

Yeah I did think the Font Awesome could be the reason, so I tried that PHP without the icon, and it still has not updated the text.

Is there any reason why it may not have updated

Share this post


Link to post
Share on other sites
Dan Haddock

Hi Edgar,

Thank you for answering last week!

I have implemented the better font awesome you suggested and unfortunately the PHP and Font Awesome Icons fail to render.

I have also added the CDN URL from FA to my header section, however this does not seem to have fixed the problem.

Do you have anything else I could try instead? It is not a major thing but would be good to have if possible.

Kind regards,

Dan

Share this post


Link to post
Share on other sites
edgarcheverier

Hey again Dan, 

So there are two ways that a filter typically goes wrong... 

  1. the filter name might be wrong ...(so are you sure you're using the right name of the filter?)
  2. the filter is accidentally being run after the function is executed... (where are you adding your hooks?)

The other possibility may be that its working but Font Awesome isn´t loaded correctly? e.g. have you inspected the output to see if the html is there?

 

 

Share this post


Link to post
Share on other sites
edgarcheverier

actually i looked into this and the right filter name might be continue_reading_link

Share this post


Link to post
Share on other sites
Dan Haddock

Hi Edgar,

Thank you for that,

I have just had a check over the docs and according to Pagelines the Filter for the Link inside the Read More button is this:

add_filter( 'continue_reading_link_text', 'add_my_continue' );
function add_my_continue() {
    return '<i class="icon icon-coffee icon-2x"></i> Read On';
}

...and then to add the surrounding A href tag into a class to style it into a button, you can use this filter with the continue_reading_link:

add_filter( 'continue_reading_link', 'btn_reading_link' );
    function btn_reading_link( $link ) {
            $link = str_replace( 'class="', 'class="btn btn-success ', $link );
        return $link;
}

I am pretty stuck. I have had a look at the console and can see no attempt to add the icon in to the Read More Link.

How can I ensure that the filter name is correct? Pagelines don't seem to list their filters.

Thank you for your continued help on this.

Dan

Share this post


Link to post
Share on other sites
Dan Haddock

The Furthest I can get with it today is to actually get a Font Awesom Icon to render:

// Styling the Continue_Reading_Text 
add_filter( 'continue_reading_link', 'add_my_continue' );

 function add_my_continue() {

    return '<i class="icon icon-coffee icon-2x"></i> Read On';
}

Unfortunately this causes the Read more Link to cease being a link. I surrounded that with an a tag to nowhere as a quick test but that broke the site!

After backup, where can I go from here? The good news is that we have an icon. Bad news, now we have no link. :(

Thank you for your continued efforts.

Share this post


Link to post
Share on other sites
Dan Haddock

Hi Edgar,

I feel like I have tried everything on this,

I have tried all the variations I can find mention of in the main DMS php files, and just resorted to putting the text directly into the Edit box provided for the time being. 

Is there any way we could get the list of updated filter names from the Pagelines team perhaps to ensure that that is still correct?

Any further help you could offer would be greatly appreciated!

Share this post


Link to post
Share on other sites
edgarcheverier

Hi Dan,

Here you have a list of the filters in DMS:

apply_filters (pl_legacy_postloop)
apply_filters (pagelines_get_article_post_classes)
apply_filters (pl_newloop_author_shortcodes)
echo apply_filters (continue_reading_link)
apply_filters (pagelines_posts_404)
apply_filters (pagelines_full_width_archives)

I hope this can help you

Share this post


Link to post
Share on other sites
Dan Haddock

Hi Edgar,

Thank you so much for those links,

Where did you get that information from? - I think this is going to be a little more involved than first thought and I do not want to take up anymore of your time.

The code as it stands looks like this: 

// Styling the Continue_Reading_Text 
add_filter( 'continue_reading_link_text', 'continue_reading_text' );
    function continue_reading_text() {
    return 'Text Successfully Changed';
	}
add_filter( 'continue_reading_link', 'btn_reading_link' );
    function btn_reading_link( $link ) {
            $link = str_replace( 'class="', 'class="btn btn-success ', $link );
        return $link;
	}
echo apply_filters (continue_reading_link)

Is this the correct implementation for the echo function? - I am sort of new to PHP but have an understanding of Ruby and Javascript.

Kind regards,

Dan

Share this post


Link to post
Share on other sites
edgarcheverier

Hi Dan,

Don't worry :), this information is from the DMS folder unfortunately only the developers have it, they sent me this information, in the echo function, you are missing the  ' '.

Best Regards,

Share this post


Link to post
Share on other sites
Dan Haddock

Hi Edgar,

Thank you for sending that across,

I am interested to know, are you able to make this change to your Read More Button?

Kind regards,

Dan

P.S. I have only seen a difference in text if I lose the link to the related blogpost functionality.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Similar Content

    • jeomiland
      By jeomiland+
      Hi guys
      Hopefully an easy question. I have some custom code included in a Next section in a DMS site that I'm converting to platform5. What is the easiest way to insert my code into a "section" which I can easily add to my page structure with the platform5 page editor? I have the Embed extension but that takes javeascript, and my PHP test failed. Also have the Shortcodes extension, but looks like that only inserts objects into the WP-loop? and again, how to create a Hook that can go here?
      thanks...
    • KathleenAspenns
      By KathleenAspenns+
      I would like to upgrade my site to PHP 7, but there is an error warning in the PL Framework theme. I should think this should be fixed asap, I cannot be the only person trying to be up to date.
      1976 | ERROR | preg_replace() - /e modifier is deprecated since PHP 5.5 and removed since PHP 7.0
       
    • jagipson
      By jagipson+
      Should be a simple answer but not sure why its not doing this.  I have a child theme installed on pagelines 5 that has a hook so it will write over the theme css. Strange is that when I am on the frontend the code works but in the dashboard your theme takes over my code and its no where to be found. See examples attachments
      @Andrew @Danny


    • casseysdesigns
      By casseysdesigns+
      In the past I would use nextbox for this task. However, Platform 5 does not have nextbox. I will do my best to describe what I am trying to do.
      I am creating a template for coaches, each product has its own link but they all share a common coach id. I want to set up the templates with the links for each product with a variable for the coach id so that I can change the coach id for all the links on the site by just changing the value of the variable $coachId. To do this I'll need to do something like the following...
      <a href="salesite.com/productcodes/referringRepId=<?= $coachId ?>" target="_blank">Product Purchase Link</a> Is it possible to do this with Platform 5?
    • janpeeters
      By janpeeters
      I read a lot lately about how much faster PHP 7 is than older versions. Is PL5 compatible with 7?
      Does anyone have experience with running their whole PL5 site on PHP 7? Would love to hear your experiences.
      Thanks, Jan
×