Support » Plugin: Image Wall » Add image_wall via function.php

  • Resolved Justin Fletcher


    Hi Parakoos,

    This is a great looking plugin and I’d like to use it with an add_filter( 'the_content', ... to stop changes from the admin side breaking things. Its pulling the images for the wall in but not styling correctly, its not below the footer and the wall background remains the bar at the top of the wall. Is this possible?

    The site isn’t live yet but my code is ..

    /* add image wall plugin to the bottom of the home page */
    function add_imagewall_plugin_to_home_page( $content ) {
        if ( is_front_page() ) {
            $custom_content = "[image_wall background_color='#58514E' include_categories='featured' move_to_end='true' column_width='200' include_categories='Featured, home_image_wall' include_pages='false']";
            $custom_content .= $content;
            return $custom_content;
        } else {
            return $content;
    add_filter( 'the_content', 'add_imagewall_plugin_to_home_page' );

    Thanks for your work with this.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Parakoos



    I’ve never tried to add the shortcode using the content filter. And I didn’t really understand why you wanted to do that either…. Why not just add the shortcode to the page you want the image wall on?

    And without seeing the problem, it is hard to diagnose. Does the plugin do what you want it to do if you don’t go through the content filter?

    Hi Parakoos,
    Thanks for replying!

    Well yes if it’s in the page content edit box everything works well. It’s only when attempting to add via the content filter hook that it has the wall doesn’t go below the footer and the css is lost (e.g. the pictures are not tiled neatly and the background for the wall stays as the bar above the images.
    I was attempting to tie the image_wall to the theme and so nobody could delete the short code from the content edit box and break it.

    So I was wondering if anyone has done this before, if I get the site live relatively soon I’ll let you know.

    Thanks though great work!

    Plugin Author Parakoos


    Ok, I know what this is. Basically, the plugin looks ahead at the content of a page to see if the image wall shortcode is there. If it is there, it will add on the required javascript and CSS files. If it is not there, it won’t. This is because on most sites, only one page will actually need those files, so to save the site from requiring the download of more files, it skips it on the 99% of pages that is not the image wall.

    But if you add on the image wall shortcode programmatically, it will miss it.

    Sorry, but I don’t consider this a bug but rather an unusual and unsupported feature request. I’m quite busy right now as well, so don’t think I’ll be looking into if there is a way I can make it work with the filter. Simply too much unpaid work for a use case that you alone (so far) requires.

    So… wait. You want to add it to the theme? You’re not putting an image wall on every page are you?

    Hi Parakoos,

    “So… wait. You want to add it to the theme? “
    I guess you could say that yes, trying to make it robust and on the home page e.g. robust so that it can’t be broken by an editor role.

    and what you have explained makes sense I’m seeing the same result in function.php and in a template file, and changing the priority of the filter doesn’t help.

    “You’re not putting an image wall on every page are you?”
    No just one page.

    I’ll continue to use the shortcode in the page unless you have any suggestions.



    Plugin Author Parakoos


    Ji TickTock,

    Yeah, I’m sorry but I don’t think I’ll be ‘fixing’ this anytime soon. It is a useful feature to have the code look ahead to see if the shortcode is there, and although anything can be worked around with enough time, well, I don’t have that time. So, sorry. You’re gonna have to live with using the shortcode in the main content like everybody else…

    except…. Maybe you could in the theme manually add the required bits that the image wall plugin adds in when it finds the image wall shortcode? Here is the code that does ‘my magic’.

    function tmn_iw_enqueue() {
    	global $post;
    	if (   preg_match('/(?<!\[)\[image_wall.*?\]/', $post->post_content) ) {
    		wp_register_script ( 'infinitescroll', plugins_url( 'jquery.infinitescroll.js'  , __FILE__ ), array(), '2.0b2.120519', true );
    		wp_enqueue_script  ('tmniwjs', plugins_url( 'image-wall.js'  , __FILE__ ), array('jquery', 'jquery-masonry', 'infinitescroll'), '2', true);
    		wp_enqueue_style ('tmniwcss', plugins_url( 'image-wall.css' , __FILE__ ), array(), '1');
    // You don't really need this as this function should already be around if you have the plugin activated.
    function tmn_iw_body_class($classes) {
    	$classes[] = 'image-wall';
    	return $classes;
    add_action('wp_enqueue_scripts', 'tmn_iw_enqueue');

    You’d have to manipulte it a bit to get the URLs of the files correct, and it may be a bit brittle of I change any of this later, but it is better than nothing.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Add image_wall via function.php’ is closed to new replies.