Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter mac2net

    (@mactwonet)

    I want to also post to Reddit from another custom post type.
    Mine has links to other posts that I curate from RSS feeds.
    While my solution isn’t user perfect, I just modified publish.php to add the meta box and preview-endpoint.php and publish-endpoint.php to eliminate the warnings.

    You could also offer the ability to customise the template per CPT.

    While it was much more difficult to setup the this plugin for X, setting aside the temporary bug, Xposter does a good job with this.

    Cheesrs
    Mike

    Thread Starter mac2net

    (@mactwonet)

    Thank you for fixing this.
    I was quite frustrated because the error was triggered on the Reddit side and I went on a wild goose chase there to try to figure out what was going wrong and posted the issue here in desperation.

    FWIW, I hacked the plugin a bit to let it post from a custom post type. Seems to work OK until there is another update.

    Thread Starter mac2net

    (@mactwonet)

    Actually GitHub works both with and without / in front of _images.

    The problem is in the plugin code which hardcodes the / in parsedown.php in the following code

        public function inlineImage( $excerpt ){
    
            $image_data = parent::inlineImage( $excerpt );
    
            if( empty( $image_data ) ){
                return $image_data;
            }
    
            $image_url = $image_data[ 'element' ][ 'attributes' ][ 'src' ];
    
            // Check if the image URL is relative to the root and is under the _images directory
            $first_character = substr( $image_url, 0, 1 );
    
            if( $first_character == '/' ){
    
                $parts = explode( '/', $image_url ); // Expecting a path like /_images/pic1.jpg
    
                if( count( $parts ) < 3 ){ // If less than 3 parts then continue with original URL
                    return $image_data;
                }
    
                if( $parts[1] != '_images' ){ // If the directory is not _images then continue with original
                    return $image_data;
                }
                
                /**
                 * Uploaded images key contains the full relative path of the image file and does NOT start with slash.
                 * Removing the prefix slash in $image_url to fetch the details.
                 */
                $image_url = ltrim( $image_url, '/' );
    
                // Get the attachment URL from the uploaded images cache list
                if( array_key_exists( $image_url, $this->uploaded_images ) ){
                    $image_data[ 'element' ][ 'attributes' ][ 'src' ] = $this->uploaded_images[ $image_url ][ 'url' ];
    
                    // Add the image ID class to mimic default behavior
                    $image_id_class = 'wp-image-' . $this->uploaded_images[ $image_url ][ 'id' ];
                    if( array_key_exists( 'class', $image_data[ 'element' ][ 'attributes' ] ) ){
                        $image_data[ 'element' ][ 'attributes' ][ 'class' ] .= ' ' . $image_id_class;
                    }else{
                        $image_data[ 'element' ][ 'attributes' ][ 'class' ] = $image_id_class;
                    }
                }
    
            }
    
            return $image_data;
    
        }
    
    • This reply was modified 1 year, 5 months ago by mac2net.
    Thread Starter mac2net

    (@mactwonet)

    I sort of solved the problem.

    My Markdown editor – Zettir – doesn’t want a forward slash in front of _images so I altered the code in parsedown.php to ignore he missing /

    Maybe you should add an option for this.

    I like Zettir for Markdown because unlike other apps I tested, like Bear and MWeb, it stores files in the file system instead of a proprietary format or database.

    • This reply was modified 1 year, 5 months ago by mac2net.

    It seems that enabling Font Awesome librarys below eliminated the error.

    Settings for loading libraries
    
    Please specify which libraries to load in your web site front-end
    
    Load Font Awesome library in your site frontend	
    • This reply was modified 1 year, 8 months ago by mac2net.
    Thread Starter mac2net

    (@mactwonet)

    Bonus response.
    Here is a video with the original designer of the Mac’s first bitmap fonts as well as the icons, created over 40 years ago and many we still use today.

    Thread Starter mac2net

    (@mactwonet)

    Thanks and sorry for the delay in responding.
    When it comes to digital fonts there have been 40 years of new tricks.
    Back in the day with the Mac, I started with FONT, FOND and NFONT and then we added POSTSCRIPT EMBEDDED, DOWNLOADABLE POSTSCRIPT FONTS, TYPE TWO FONTS, TRUETYPE, ATM.

    Thread Starter mac2net

    (@mactwonet)

    Sorry. I would have but I didn’t see a Contact link, but now I just found the floating white toast on the bottom right. I think it would be a good idea just to go with an old-fashioned link for people like me who are blind to that stuff.

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