change the text in blog posts (older post and newer post).

Nikos
Nikos Member Posts: 11

Hello everybody

We're looking for a way to change the text in blog posts (older post and newer post). That would be great if you could change that somehow, e.g. in (older project - newer project) is there a script that overrides this? After hours of trying I want to ask you guys :)

so we could use the blog more versatile e.g. for portfolio etc.

-Niko

Tagged:

Best Answer

  • Elizabeth_Fedak
    Elizabeth_Fedak Member Posts: 106 MVP
    Answer ✓

    This looks possible, at least while testing using Chrome devtools, but you'll need CSS knowledge and DevTools knowledge to get the right ID for each link. Here is an example from my site. Please note that the value of each ID is unique and this code will do nothing on your site as the ID value is unique to my website. You'll have to replace the number string (i.e. 1170774986) with your own IDs. That said, I'm only testing w/ dev tools currently as I don't want to publish this on my site, so you'll have to get the right ID, add the JavaScript in a <script> tag to your blog post template page in Developer mode using the blog-head-section.html file and publish it to fully verify. It says the selector is null in editor mode and only appears to work on the live site, which I think is related to the page being dynamically rendered.

    I recommend reading a Chrome dev tools tutorial if you are going to try to implement this so you get the right ID from the page's HTML.


Answers

  • Aj_Cre8
    Aj_Cre8 Member Posts: 630 MVP

    What exactly do you mean by Change The Text? Why would you need a Script to do that?

    Your description is a little vague.

  • Nikos
    Nikos Member Posts: 11

    hello AJ_Pfeil

    what i mean is this. in the case of a blog post, you have <older post or newer post> at the bottom as link texts. I would like that instead of < older post e.g. < older project - replace the word "post" with "project" . I can't adjust that in duda.

    sorry my english is not very good :)

  • Nikos
    Nikos Member Posts: 11

    thank you Elisabeth 😀

    yes i think thats the way:)

    i think maybe with JavaScript String replace() it will work:)

    Thank you very much for your detailed answer! I really appreciate it.I just need to search for some "parent" id and then replace javascript should hopefully work. otherwise I have to do that for every blog post

  • Elizabeth_Fedak
    Elizabeth_Fedak Member Posts: 106 MVP
    edited April 2022

    Hi @Nikos use the code I provided and replace the ID from my website with your own ID and don't modify the rest of the line (I am a JavaScript developer). Do not use string replace--you need to manipulate the DOM. The function I pasted in 'innerText' will change the text and not mess up the link. String replace is more so for code where you are replacing strings attached to a variable and not manipulating a DOM element.


    For clarity, here is a use case for using the String object method replace() on a String object assigned to a variable.


  • Elizabeth_Fedak
    Elizabeth_Fedak Member Posts: 106 MVP

    If you paste your live blog here I can just give you the parent IDs

  • Nikos
    Nikos Member Posts: 11

    Thanks very much!!

    oh I didn't know about the java string :) good to know

    I would like to try your instructions.

    I just started blogging on a new client site. As soon as I have it, I'll be happy to send you the link!

    Many thanks for your support! very nice of you

  • improve
    improve Member Posts: 1

    Can you please guide me, where can I change this texts? I think it should be a part of core product, because when clients language is another like english, there is no way how to change the text from english and buttons < Older Post Newer Post remains in english.


    Did somebody solved this problem?