• Hi,

    Is there a tool or method to change gallery info like this: .[gallery columns="4" link="file" ids="15571,15573,15575,15577,15579,15581,15583,15585,15588,15589,15591,15593,15595,15597,15599,15601"]

    so that the images are linked in the page and thus the page can more easily be translated to other platforms? With the gallery code as it is, there is no reference to the image names or anything else that I could parse in an xml file to a new path etc.

    Thanks,

    Adnan

Viewing 7 replies - 1 through 7 (of 7 total)
  • If you don’t have a huge number of pages, you can manually do it.
    Open the page in your browser and use the browser View Source command. Find the content area and copy the HTML for the gallery. Paste that into the editor in place of the gallery shortcode.
    Or use the RSS feed to get the content isolated.
    Or write a plugin that does it for you.

    Thread Starter adnanmg

    (@adnanmg)

    thanks Joy. Unfortunately it is a lot of pages. Hmmm. I wonder if there is a plugin like that.

    It could be as simple as

    query all posts
    for each post
      expanded = do_shortcode( get_the_content() )
      wp_update_post with expanded content
    Thread Starter adnanmg

    (@adnanmg)

    Hi Joy,

    thanks again for this information. I was wondering if I could contact you about a plugin for this purpose. I was unable to contact you via the form on your website.

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    I was wondering if I could contact you about a plugin for this purpose. I was unable to contact you via the form on your website.

    @adnanmg Don’t. Off forum contact is discouraged and these forums are not for that. If you need support then please use the forums.

    Thread Starter adnanmg

    (@adnanmg)

    ok, in that case, can I please get some help creating a wordpress plugin for this purpose?

    Thread Starter adnanmg

    (@adnanmg)

    from the site: https://www.wpexplorer.com/writing-simple-wordpress-plugin/

    I got this as a start:

    
    <?php
    /**
     * Plugin Name: mgexpgcode
     * Plugin URI: https://www.mywebsite.com/my-first-plugin
     * Description: The very first plugin that I have ever created.
     * Version: 1.0
     * Author: Your Name
     * Author URI: https://www.mywebsite.com
     */
    
    /*
    
    function renym_content_replace( $content ) {
    	$search  = array( 'wordpress', 'goat', 'Easter', '70', 'sensational' );
    	$replace = array( 'WordPress', 'coffee', 'Easter holidays', 'seventy', 'extraordinary' );
    	return str_replace( $search, $replace, $content );
    }
    add_filter( 'the_content', 'renym_content_replace' );
    
    */
    
    function mgexpgcode( $content ) {
        query all posts
        for each post
          expanded = do_shortcode( get_the_content() )
          wp_update_post with expanded content
    }
    

    I write python code myself, but this is new to me. I need to do something similar to search and replace the gallery code with expanded html content of the image links. Help please.

    Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Changing WordPress Galleries to Image Links’ is closed to new replies.