Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #290506

    Hi,

    I am using the magazine module to show posts from a category and want to display a custom message if their are no posts found in the query. I understand, I will have to edit the magazine.php file and create in my child theme but am unsure where to edit to make this appear. Any assistance you can provide would be much appreciated

    #290705

    Hey df50!

    Thank you for using the theme.

    Please edit magazine.php, find this code on line 512:

    if($loop !== 1 && !empty($this->atts['first_big_pos'])) $output .= "</div>";
    				
    				$output .= "</div>";
    			}
    			
    			return $output;

    Below, add this code:

    if($loop !== 1 && !empty($this->atts['first_big_pos'])) $output .= "</div>";
    				
    				$output .= "</div>";
    			} else {
    				
    				$output .= "<div class='av-magazine-group {$css}'>";
    			
    				echo "My awesome message here";
    				
    				$output .= "</div>";
    			}
    			
    			return $output;
    

    Cheers!
    Ismael

    #290759

    Hi Ismael,

    Thanks for your response, great service as always. That got the function working, but it is not rendering the message in the right place

    If you have a look at http://www.norths.com.au/wordpress/?page_id=40 the message appears before the rest of the content and should bve appearing on the right hand sude under Positions Available.

    My magazine.php file is currently

    Edited: You can use pastebin.com to show codes. :)

    • This reply was modified 10 years, 4 months ago by Ismael.
    #291383

    Hi!

    Thank you for the info.

    Where do you like to place the message? Please give us a screenshot or the actual link to the page.

    Cheers!
    Ismael

    #291385

    Hi Ismael,

    The site is now live, so can provide the actual link which is http://www.norths.com.au/about-us/employment/

    On the right hand side under the heading Positions available is a magazine module. Currently there are no posts matching the query, so I would like to show a small message underneath that heading, something like ‘No jobs currently available’

    Thanks

    Daniel

    #291391

    Hi!

    Thank you for the link.

    Alright. Please replace the this line of code:

    echo "My awesome message here";
    

    with this:

    echo "<div class='jobs-message'>No jobs available.</div>";
    

    Add this on Quick CSS or custom.css:

    div.jobs-message {
    position: absolute;
    bottom: 25px;
    }

    Regards,
    Ismael

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.