Jump to content

Archived

This topic is now archived and is closed to further replies.

touchtalk

Adding CSS Button as read-more link

Recommended Posts

touchtalk

Hi guys,

I know there had been a topic in the past but unfortunately that didn't answer my question entirely.

 

I only know basics in CSS and nothing in PHP. 

 

I'd like to replace the "read more" text permanently by some CSS Button (like the ones generated with http://www.cssbuttongenerator.com/). Now, I don't know where to place the code this generator is giving me within the PHP files. 

 

I understand I'd need to both place the CSS in some file within my theme and also some code in another (PHP) file in order to point Pagelines to use the new code to display the button instead just the text.

 

Would be great if you had some tips how to resolve this as I didn't find any plugin or other info to resolve it myself :-(

Share this post


Link to post
Share on other sites
batman

Hi touchtalk

 

You can try add in
PageLines > Site Options > Custom Code > CSS Rules
or in
Pagelines Customize (plugin)
(I copy my web button with CSS)
 
/*--Button read-more--*/
#page a.continue_reading_link {
  display: inline-block;
  .ie7-inline-block();
  padding: 4px 10px 4px;
  margin-bottom: 0; // For input.btn
  font-size: @buttonFontSize;
  font-family: @buttonFontFamily;
  line-height: 10px;
  color: white;
  text-align: center;
  text-shadow: 0 -1px 0 rgba(0,0,0,.25);
  vertical-align: middle;
  border: 1px solid @btnBorder;
  .border-radius(4px);
  @shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);
  .box-shadow(@shadow);
  cursor: pointer;
  .buttonBackground(@btnPrimaryBackground, @btnPrimaryBackgroundHighlight);
font-size: 12px;
 
&:hover {  
text-shadow: 0 -1px 0 rgba(0,0,0,.25);
@shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);
color: white;
text-decoration: none;
background-color: darken(white, 10%);
border: 1px solid @btnBorder;}
 
&:active {
color: rgba(255,255,255,.75);}}
 
/*--adjust size text Button as read-more--*/
.continue_reading_link{font-size: 70%;}
 
My exemplary code is not necessarily applicable as written, to your site, so please adjust accordingly.
 
It is advisable to learn how to do this on your own too.  
Check out 
 
If you need more CSS help, make sure you've downloaded Firebug for Firefox
and check out W3 Schools for more info. 

Life is too short to remove USB safely ...

Share this post


Link to post
Share on other sites
touchtalk

Thanks a lot for your answer!

I've added the code to the CSS section. 

 

I'm assuming somewhere I'd need to tell pagelines to use this class when displaying the read-more link? Because right now it does not appear on the site... ?

Share this post


Link to post
Share on other sites
Rob

The classes Batman recommended should already exist.  May we have a link to your site?


Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites
touchtalk

Ah ok.. well, the site in Question is http://www.macmaniacs.at. I currently am using the text "WEITER LESEN...". But I feel I'd need a button, something more visible in order to keep users reading... 

Share this post


Link to post
Share on other sites
Rob

Try

.a-more-link {

background-image:url('thefullURLfortheimage');

}

 

This will place a specific image behind the link. It doesn't replace the text.  That can be done in settings via Dashboard > PageLines > Site Options > Blog And Posts, which doubtlessly you know.

 

There's more info here on using background images: http://www.w3schools.com/css/css_background.asp


Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites
Rob

I apologize.  Try .a.more-link instead of .a-more-link.


Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites
touchtalk

Unfortunately still no success. Tried it with both Safari and Chrome and also again reset cache...

Share this post


Link to post
Share on other sites
James B

Hi there

 

You'll only need to apply the background to the .more-link class

 

.more-link {
    backgroundurl("your full url goes here") ;
}

Kindly search the forum and read the documentation before posting. It will help you resolve many issues.

For CSS help be sure to check out W3Schools first and be sure to download FireBug for FireFox for troubleshooting.

James B

Share this post


Link to post
Share on other sites
touchtalk

OK, now this lead to loading the graphic; but it'd need more space around it as it's cut off...

 

I had replaced " by ' though.

 

screenshot1.png

Share this post


Link to post
Share on other sites
James B

You can adjust the padding/margin to position the text inside the image better and adjust the spacing.

 

example {padding: 10px;}

 

If you make the changes directly in firebug so you can get the positioning correct on the button, then you can copy/paste the entire correct code back into the framework.


Kindly search the forum and read the documentation before posting. It will help you resolve many issues.

For CSS help be sure to check out W3Schools first and be sure to download FireBug for FireFox for troubleshooting.

James B

Share this post


Link to post
Share on other sites
touchtalk

I'll check on that later today; so far using "padding" looks quite promising. 

 

But isn't there a way to implement a real CSS button as a next step? If so, how?

Share this post


Link to post
Share on other sites
James B

Hi there, yes you can apply the button using css directly to the class or create your own.

 

.more-link {

    backgroundnone repeat scroll 0 0 blue;
    border1px solid black;
    border-radius5px 5px 5px 5px;
    padding5px;
    text-decorationnone;
}

Kindly search the forum and read the documentation before posting. It will help you resolve many issues.

For CSS help be sure to check out W3Schools first and be sure to download FireBug for FireFox for troubleshooting.

James B

Share this post


Link to post
Share on other sites
touchtalk

It worked! Now I managed to implement the CSS code and got a fine button. (you can see it at www.macmaniacs.at). CSS rocks.

 

Thanks so much for all the help and patience!!

Share this post


Link to post
Share on other sites
Rob

Thanks for your patience as well.


Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites
tamarpostma

Hello,

 

I'm trying  to style my more-link too. But not having any luck with above code which I added to the custom css in pagelines customize.

What am I doing wrong?

Share this post


Link to post
Share on other sites
Danny

tamarpostma - Can you provide a link to where you have your more link please.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
tamarpostma

Hi Danny,

 

It is in the feature slider, slide 2: http://i-english.nl/?page_id=3120

 

I've added some code i found here in the functions.php, but it's not taking. I tried btn-warning too, but to no avail.

Share this post


Link to post
Share on other sites
Danny

What code have you added to the functions.php file ?


Please search our forums, before posting!

Share this post


Link to post
Share on other sites

  • Similar Content

    • Michael Kummer
      By Michael Kummer+
      Hi guys!
      I have noticed that my primary sidebar becomes intermittently invisible when browsing through various blog articles on michaelkummer.com/blog.
      See:
      https://www.dropbox.com/s/z646sgoa3mfjl1j/Screenshot 2018-07-12 15.57.46.jpg?dl=0 and https://www.dropbox.com/s/vdledzzgginvwgv/Screenshot 2018-07-12 15.57.57.jpg?dl=0
      Upon refresh, the sidebar appears. I have been using the following CSS code to hide the sidebar on mobile without any issues. 
      @media only screen and (max-width: 993px) {
      /* hide sidebars */
           .plsb {
              display: none !important;
          }
      }
      I tried to add the following CSS to force the sidebar to show on screens that are wider than 994 pixels but to no avail. Any clue what could be causing this issue?
    • Michael Kummer
      By Michael Kummer+
      Hi guys!
      I am using the LESS/CSS Pagelines extension and tried to add the following code to make use of FontAwesome:
      a.c2a:before {
          content: "\f07a\00a0";
          font-family: "Font Awesome 5 Pro";
          Font-weight: 900;
          font-style: normal;
          font-weight: normal;
          text-decoration: inherit;
          padding-left: 4px;
      }
       
      The issue is that as soon as I have the CSS via the Custom Styling text box, Pagelines (or the extension) strips out the backslashes (\). As a result, I had to abandon the CSS/LESS extension and instead add all my CSS code to a separate .css file.
      Is there a fix or workaround for this?
      Thanks
      Michael
    • glyph.marketing
      By glyph.marketing+
      Hello, I am having a problem similar to that experienced by Michael Kummer here. We have pages that show this automatic scrolling issue (examples here and here) and it is sufficiently annoying that we have seen customers bounce while trying to convert. Strangely, it only happens at specific resolutions, so it can be difficult to reproduce. In general we can only consistently reproduce it on a 4k resolution with a browser width between 1517 and 1536px. 
      Thanks to Michael Kummer's help we were able to set the overflow-anchor property to none in the entire body, which fixed the issue as far as we can tell, but also obviously disabled scroll anchoring for the whole site. I tried applying it to the specific element that looked like it was being reloaded, which was the PL Meganav extension, but that was unsuccessful. 
      Can anyone help us figure out which element or ID we can apply this property to, so that we can fix the scrolling issue but not disable scroll anchoring for the entire site?
      Thank you - 
      Glyph Language Services
    • oseehys
      By oseehys+
      Of all the Items that is on Pagelines Shortcode, the Signup on the Settings page is the biggest miss, can anybody tell me how i can add the Signup Shortcode on a link my footer so that users can subscribe to my blog directly or better still to create the shortcode myself if thats possible, but instead of adding a new button somewhere down, i think its better to add the Signup shortcode to an existing link, Thanks
    • chamois_blanc
      By chamois_blanc+
      Hello,
      Shouldn't the image PL5 component be using the srcset/picture css directives to pick the correct size for an image? or it does already and I don't know how to use it? Thank you for any advice or enlightenment.
×