• Resolved Dawn33

    (@dawn33)


    Hello there and thank you for a great plugin!

    I love the plugin the only pain I have with it is that it moves all my sidebars/widgets to be positioned undernath the article list on the frontpage and I have no clue how to change it :/

    I would very much appreciate if you could help me ??

    I am no expert by far and has close to no experience in coding so it would be really helpful if you could also add excactly where in the theme one should plug in the various codes you provide in the “other notes” and the readme file ??

    Kind regards

    Dawn

    https://www.ads-software.com/extend/plugins/arlima/

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author victor_jonsson

    (@victor_jonsson)

    I’m guessing that the list is to wide for your theme. I’f you have no knowledge about coding it might be hard to fix, could you give me a link to your website?

    If you haven’t changed the code in page-arlima.php (located in your theme directory) you should take a look at line 21 in that file. There you will see define(‘TMPL_ARTICLE_WIDTH’, 480);. The width probably has to be lowered a bit, how much is hard to say without having seen your page.

    All the code examples seen on the page “Other notes” is meant to be added in the file functions.php, located in your theme directory.

    Thread Starter Dawn33

    (@dawn33)

    Thank you for replying so fast!

    My website is https://www.r-stof.dk

    my sidebar is supposed to be on the right but keeps moving to underneath the arlima article list as you can see ??

    In regards to the codes where in themes function.php exactly do I put them in? I have tried various methods but I end up with funny code being written on my frontpage o.0 So if you could point me to a section within function.php I would be very happy and hopefully it will work ??

    Thread Starter Dawn33

    (@dawn33)

    Ok so I figured out most of the codes and where to put them in!

    I am thinking it might be in the jQuery templates my problem lies? If I configure them it might work..IF however you can guide me id be very happy ??

    Plugin Author victor_jonsson

    (@victor_jonsson)

    The jquery templates is not the issue. You have to change some things in the file page-arlima.php located in your theme.

    If you haven’t changed the code in page-arlima.php you can replace it with the following code:

    <?php
    /**
     * Template Name: Article List Page
     * -------------------------------------
     * This is an example template that displays a single arlima article list.
     * In this file we will go through all the different callbacks that you can
     * hook into during the rendering of the article list.
     *
     * @package Arlima
     */
    
    get_header();
    ?>
    <div class="art-layout-cell art-content clearfix">
            <?php
    
            // Define the width of our list. This is later used to crop article images
            // This width is also defined in /plugins/arlima/css/template.css, so make
            // sure you change on both places if you need to change the width
            define('TMPL_ARTICLE_WIDTH', 480);
    
            // Get id of current page
            $page_id = false; while ( have_posts() ) : the_post(); global $post; $page_id = $post->ID; endwhile;
    
            // Get arlima slug added to this pages in a custom field
            $arlima_slug = get_post_meta($page_id, 'arlima', true);
            if( !$arlima_slug ) {
                echo '<p>'.__('No list slug is defined. Please add custom field "arlima" to this page with the slug name of the list that you want to display', 'arlima').'</p>';
            }
            else {
    
                // Load the arlima list
                $version = isset( $_GET['arlima-preview'] ) && is_user_logged_in() ? 'preview':'';
                $list = new ArlimaList($arlima_slug, $version);
                if( !$list->exists ) {
                    echo '<p>'.__('It does not exist any arlima list with the slug', 'arlima').' "'.$arlima_slug.'"</p>';
                }
                else {
    
                    // Show a link that takes logged in users directly to wp-admin
                    // where current list can be edited
                    arlima_edit_link($list);
    
                    // Initiate template renderer that's responsible of
                    // rendering current arlima list.
                    $arlima_renderer = new ArlimaListTemplateRenderer($list);
    
                    // Callback for article image
                    $arlima_renderer->setGetImageCallback(function($article) {
    
                        if( !empty($article['image_options']) && !empty( $article['image_options']['attach_id'] ) ) {
    
                            $attach_meta = wp_get_attachment_metadata($article['image_options']['attach_id']);
                            if( !$attach_meta )
                                return false;
    
                            $article_width = empty($article['parent']) || $article['parent'] == -1 ? TMPL_ARTICLE_WIDTH : round(TMPL_ARTICLE_WIDTH * 0.5);
    
                            switch($article['image_options']['size']) {
                                case 'half':
                                    $width = round($article_width * 0.5);
                                    $size = array($width, round( $attach_meta['height'] * ($width / $attach_meta['width'])));
                                    break;
                                case 'third':
                                    $width = round($article_width * 0.33);
                                    $size = array($width, round( $attach_meta['height'] * ($width / $attach_meta['width'])));
                                    break;
                                case 'quarter':
                                    $width = round($article_width * 0.25);
                                    $size = array($width, round( $attach_meta['height'] * ($width / $attach_meta['width'])));
                                    break;
                                default:
                                    $size = array($article_width, round( $attach_meta['height'] * ($article_width / $attach_meta['width'])));
                                    break;
                            }
    
                            $img_class = $article['image_options']['size'].' '.$article['image_options']['alignment'];
                            $img_alt = htmlspecialchars( $article['title'] );
                            $attach_url = wp_get_attachment_url( $article['image_options']['attach_id'] );
                            $img_url = WP_PLUGIN_URL . '/arlima/timthumb/timthumb.php?q=90&w='.$size[0].'&h='.$size[1].'&src=' . urlencode($attach_url);
    
                            return sprintf('<img src="%s" width="%s" height="%s" alt="%s" class="%s" />', $img_url, $size[0], $size[1], $img_alt, $img_class);
                        }
    
                        return false;
                    });
    
                    // Callback used when a future posts comes up in the list
                    $arlima_renderer->setFuturePostCallback(function($post, $article) {
                        if( is_user_logged_in() ) {
                            ?>
                            <div class="future-post">
                                Hey dude, <a>ID) ?>" target="_blank">this post</a>
                                will not show up in the list until its published, unless you're not logged in that is...
                            </div>
                            <?php
                        }
                    });
    
                    // Modify text content
                    $arlima_renderer->setTextModifierCallback(function($article, $is_post, $post) {
                        $article['text'] = apply_filters('the_arlima_content', $article['text']);
                        return arlima_link_entrywords(trim($article['text']), $article['url']);
                    });
    
                    // Callback for related posts
                    $arlima_renderer->setRelatedPostsCallback(function($article, $is_post) {
                        return $is_post ? arlima_related_posts('inline', null, false) : '';
                    });
    
                    // Callback taking place before every article is rendered
                    $arlima_renderer->setBeforeArticleCallback(function($article_counter, $article) {
                        // ...
                    });
    
                    // Callback taking place after every article is rendered
                    $arlima_renderer->setAfterArticleCallback(function($article_counter, $article) {
                        // ...
                    });
    
                    // The list doesn't have any articles :(
                    if( !$arlima_renderer->havePosts() ) {
                        echo '<p><em>'.__('Please feed me some articles, I\'m hungry').'</em></p>';
                    }
    
                    // Let the magic happen...
                    else {
                        $arlima_renderer->renderList();
                    }
                }
            }
            ?>
    
    <?php get_sidebar(); ?>
    
    </div>
    
    <?php get_footer(); ?>
    Thread Starter Dawn33

    (@dawn33)

    Tak Victor! Now my arlima list is aligned perfect but the sidebars are still moved to underneath the list.. ??

    Thread Starter Dawn33

    (@dawn33)

    PS jeg har fors?gt med andre temaer og templates men problemet er det samme :/

    Plugin Author victor_jonsson

    (@victor_jonsson)

    Hm.. I think you should move the sidebar out of the div that its contained by. Cut out the code <?php get_sidebar(); ?> and place it right above <?php get_footer() ?>. The end of the file (page-arlima.php) should then look like

    </div>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    I would also suggest that you open the file template.css (that you have copied to your theme) and remove line 8 where it says max-width: 480px;. Then everything looks fine to me.

    / vic

    Plugin Author victor_jonsson

    (@victor_jonsson)

    You could also change the code define('TMPL_ARTICLE_WIDTH', 480); to define('TMPL_ARTICLE_WIDTH', 672); (in page-arlima.php) if you want full scale images to have the same width as the content div.

    Plugin Author victor_jonsson

    (@victor_jonsson)

    Regarding custom templates and streamers. Could you paste in the code that you have in the file functions.php (in your theme directory).

    Thread Starter Dawn33

    (@dawn33)

    Victor du er en engel! Thx so much for helping a newbie out ?? Here is the code:

    [ 715 lines of code moderated, that’s just way too much. For that many lines of code please use pastebin.com instead. ]

    Plugin Author victor_jonsson

    (@victor_jonsson)

    The code looks okey, you have added actions for custom CSS file, streamer background colors and custom jquery templates. I can alo see that the css-files used for the articles is https://r-stof.dk/wp-content/themes/magicgry/template.css. What exactly is your problem?

    Thread Starter Dawn33

    (@dawn33)

    Right now I have none! The advise you gave me in previous posts sorted the problems I had out. So thank you very much!

    ??

    Plugin Author victor_jonsson

    (@victor_jonsson)

    Ok, then I’m marking this topic as resolved!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘[Plugin: Article List Manager (arlima)] Arlima moving my sidebar position’ is closed to new replies.