Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • +1

    In my case, I was replacing a file with different dimensions and a different name. After clicking on upload, the same image is still displayed. I tried refreshing the browser, disabling the cache in dev console, viewing the page in a different browser. Nope, it’s still the old file. No caching plugins on the server either.

    Works fine with the Replace Image plugin.

    Thread Starter steevm

    (@steevm)

    OK, I entered the ID and it works now!

    So yeah, something went awry with the human-readable names.

    But at least I can work now, because I can live with using the numeric ID.

    Thank you very much for your help.

    Thread Starter steevm

    (@steevm)

    Ok I just noticed that if I use the format
    [smartblock id=XXX] I get a different return value (presumably because I know have passed an ID).

    However it doesn’t seem to identify the correct block. Do you know how to find out the smart block’s ID? 🙂

    Thread Starter steevm

    (@steevm)

    Do you mean the name of the block (e.g. “guidance-note”) when you say shortcode?

    I take it the associated function is swboc_shortcode, defined in swboc-front.php.

    What I’ve noticed having added a bit of code to the swboc-front.php file is that the id seems to be empty. The swboc_shortcode function has an if statement:
    if ( $id != "" )
    followed by a series of steps that process the posts (AFAICT).
    If I add

    else
        {
        $content="NO ID";
        }

    after this if statement’s closing bracket, the content of my smartblocks is always returned as “NO ID” (you can see this on the test page right now).

    Seeing as the $content is initialised to an empty string and is the return value, and $content is processed in the if statement, I assume this is where the issue lies and why the content is empty.

    I’ve had a look at https://developer.ww.wp.xz.cn/reference/functions/do_shortcode/ but I’m not really sure what to do with that information 🙁

    Just for clarity: we haven’t changed anything with the plugin (apart from now). It was working fine until the upgrade to WP 4.3 using the format I posted above. In other words, the fact that the content isn’t included in the pages any more shouldn’t be caused by changes to the plugin itself, but by the new version of WP. Especially seeing as it was the WP update that broke the working plugin.

    Thread Starter steevm

    (@steevm)

    I tried replacing the widget.php file before, and it worked in the sense that I had no errors. However, it doesn’t seem to fix the issue with inline smart blocks.

    I’ve set up a quick test page to illustrate what I mean. This is the code on the page:

    <p>SMART BLOCK 1</p>
    [smartblock slug=guidance-note]
    
    <p>SMART BLOCK 2</p>
    [smartblock slug=upcoming-training]

    This is the resulting HTML displayed in my browser:

    <div class="entry">
    
        <p>SMART BLOCK 1</p>
    
        <p>SMART BLOCK 2</p>
    
    </div>

    (extra empty lines are present in the generated HTML source after each smart block paragraph)

    Here is a link to the page:
    http://www.specflow.org/test-page-for-content-blocks/

    As you can see, the smart blocks aren’t included in the output.

    The smart blocks aren’t empty – they contain content – and were in use on the site for a few years until the WP update meant they stopped working. I therefore assume that the code I have used to embed them is fine.

    What it looks like to me is that the content of the smart blocks simply isn’t being included in the generated HTML page. I’m unfortunately not sure where in the PHP code to look to try and figure out where the problem is. Is the xxx-widget.php file exclusively for the widget, or does it also handle the inline smart blocks?

    Thread Starter steevm

    (@steevm)

    Thanks for your post. However, I can’t seem to get it to work with your code. Here are my observations:

    It looks like the code you linked to is for the class-swboc-widget.php file (the code starts with “class SWBOC_Widget” ).

    If I copy the contents to class-swboc-common.php, I get an error about the missing SWBOC_Common class (which is defined in class-swboc-common.php, and is obviously missing when I replace the content with code that doesn’t include the class).

    I have tried adding the code to class-swboc-widget.php, but that makes no difference to the inline smartblocks. I actually got the widget to work with the old version, but we are using smartblocks to share content between pages, rather than as content in a widget and that isn’t working.

    Could it be that you accidentally uploaded the wrong file (class-swboc-widget.php) rather than class-swboc-common.php?

    I have taken a quick look at the PHP code myself, but the last time I used PHP was in 2000 and I have no experience with WP plugins, so it’s all a bit over my head 🙂

Viewing 6 replies - 1 through 6 (of 6 total)