• hello
    im want to display my blog feed on my website
    i would like to disable links that lead back to blog
    i dont want paying clients to leave website & get lost in blog

    so i want to diable links to blogs or all link within rss feed
    im using “RSS 2 HTML” to display feeds on my site they offer 3 way to display feed

    PHP code – this option will only work if your webpage is already coded in PHP.
    JavaScript code – this option is best if you want to style the embedded feed.
    HTML code that generates an iframe

    ive tried all three & have settled for the “HTML code that generates an iframe”
    only becuase i have had sucsess blocking the links within the iframe. This would be great if every post was going to be the same size but they are not. the problem is that by disabling abilty to click on the iframe – i cant scroll to see all content.

    here is the page the iframe is on ( at bottom of page ) this page is not complete !!! its a work in progress ..
    https://www.psychic3000.com/doomsday/last-day.html

    /*
    Child Theme: twenty child 1
    Theme URI: https://www.psychic3000.com/
    Description: Child theme for the Twenty Eleven theme
    Author: Creed masters
    Author URI: https://www.psychic3000.com/
    Template: twentyeleven
    Version: 3.4.2
    */

    My blog > https://www.psychic3000.com/wordpress

    here is the code im using

    <script>
    window.onload = function () {
        var iframes = document.getElementsByTagName('iframe');
        for (var i = 0, l = iframes.length; i < l; i++) {
            var iframe = iframes[i],
            d = document.createElement('div');
            d.style.width = iframe.offsetWidth + 'px';
            d.style.height = iframe.offsetHeight + 'px';
            d.style.top = iframe.offsetTop + 'px';
            d.style.left = iframe.offsetLeft + 'px';
              d.style.position = 'absolute';
            d.style.opacity = '0';
            d.style.filter = 'alpha(opacity=0)';
            d.style.background = 'black';
            iframe.offsetParent.appendChild(d);
        }
    };
    </script>

    i dont know how to get it to allow scrolling & disable links
    i will be thankful for any and all help !!!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    You could modify your blog templates to suppress certain link output if a particular URL parameter is present. Then ensure all your iframe src attributes have this parameter added. Thus no need to suppress clicks in the iframe.

    Thread Starter creed3000

    (@creed3000)

    modify your blog templates to suppress certain link output if a particular URL parameter is present.

    thats sounds bettter than what ive been trying however
    im new to coding … Could you give me an outline or example
    thank you for sharing this info !!!

    Moderator bcworkz

    (@bcworkz)

    The HTML for your iframe would look something like this:
    <iframe src="https://www.example.com/myblog/index.php?links=false"></iframe>

    You then will want to grab the URL parameter ‘links’ fairly early and set a global variable as a true boolean (‘links’ actually has a string value of ‘false’) so the state can be accessed anywhere and code where it is used is more readable. In functions.php:

    add_action('init', 'check_links');
    function check_links() {
       global $show_links;
       if(isset($_GET['links')) { //without this, next line throws an error if parameter is missing
          'false'== $_GET['links']?$show_links = false:$show_links = true;
       } else {
          $show_links = true;
       }
    }

    In your theme’s header.php, declare the global:
    global $show_links;

    On your theme templates, find any portion that outputs undesirable links. For example, here is template code with a permalink to the post’s single page in the title of the post, from content.php of the twentytwelve theme:
    <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?></a>

    Rewrite like so:

    <?php if($show_links) { echo '<a href="' . the_permalink() . '" title="' . esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ) . '" rel="bookmark">';}
    the_title();
    <?php if($show_links) echo '</a>'; ?>

    Which always outputs a title, but it is only wrapped by a tags if the ‘links’ url parameter is missing or does not equal ‘false’. Note how the ?php block was expanded to accommodate the if(){} structure, requiring what was formerly normal HTML to need to be echoed out in the modified code.

    This is all written on the fly at one go without any testing what so ever, so syntax errors are likely, but should illustrate the concept well.

    You will want to create a child theme to contain your modified templates and functions.php so when your theme is updated, your changes do not get overwritten.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Disable links from blog content shown on my website’ is closed to new replies.