1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Can someone help me hack magaize basic? php help please!

Discussion in 'Blogging' started by Bostoncab, Oct 1, 2011.

  1. Bostoncab

    Bostoncab Elite Member

    Joined:
    Dec 31, 2009
    Messages:
    2,255
    Likes Received:
    514
    Occupation:
    pain in the ass cabbie
    Location:
    Boston,Ma.
    Home Page:
    I need some help altering Magazine basic. I know enough to know it is some simple PHP changes but I do not know how to make them.

    PROBLEM #1

    I want the the Latest story pic to be larger. This seems to be a common request for this theme. The theme maker has a bit about it on his support forums but not specific instructions for someone as dumb as I am.

    Code:
    The code I have included in the loop.php file to change the size of the thumbnails is commented out. You will see /* before and */  after it. I just placed it there so that people could copy this file  over to their child theme and uncomment that code and then comment out  the original code above.
    The .php he is talking about in the loop.php file is
    Code:
       if(theme_option('excerpt_content')!=2) {
                                if(function_exists('has_post_thumbnail') && has_post_thumbnail()) { 
                                    echo '<a href="'.get_permalink().'">';
                                    the_post_thumbnail('thumbnail', array('class' => 'alignleft'));
                                    echo '</a>';
                                } else { 
                                    echo resize(get_option('thumbnail_size_w'),get_option('thumbnail_size_h')); 
                                }
                                /*if(function_exists('has_post_thumbnail') && has_post_thumbnail()) { 
                                    echo '<a href="'.get_permalink().'">';
                                    if($x==1) {
                                      the_post_thumbnail(array(150,150), array('class' => 'alignleft'));
                                    } elseif($x>1 && $x<4) {
                                      the_post_thumbnail(array(100,100), array('class' => 'alignleft'));
                                    } else {
                                      the_post_thumbnail(array(80,80), array('class' => 'alignleft'));
                                    }        
                                    echo '</a>';
                                } else { 
                                    if($x==1) {
        echo resize(400,400)
    } elseif($x>1 && $x<4) {
        echo resize(100,100); 
    } else {
        echo resize(80,80); 
    } 
                                    }                                
                                }*/
                                theme_excerpt($wordlimit);
                            } else {
                                the_content(__('Read more »', "magazine-basic"));
    Can someone tell me what I have to alter or better yet alter it and post it in a reply so I can copy and paste it in? I know I am asking tons.. I of course offer rep and thanks for the help.

    PROBLEM # 2

    I deployed this theme here
    Code:
    http://advocatenews.net
    I want to put a space into the theme where I can place an ad if I want to. Something like a banner I would sell people. I have quick adsense installed so I can easily have ads appear in the body of the post but I want a space so that it appears below my header on every page. I have no idea where I would even begin to adjust code. In the .css stylesheet I imagine? I don't suppose there is a caring soul out there willing to do this for me?
     
  2. nesterdwarf

    nesterdwarf Regular Member

    Joined:
    May 30, 2008
    Messages:
    276
    Likes Received:
    539
    Location:
    State of Misery...er, Missouri...
    Problem #1 -

    Replace what you have above with this -

    Code:
    
    f(theme_option('excerpt_content')!=2) {
                                /*if(function_exists('has_post_thumbnail') && has_post_thumbnail()) { 
                                    echo '<a href="'.get_permalink().'">';
                                    the_post_thumbnail('thumbnail', array('class' => 'alignleft'));
                                    echo '</a>';
                                } else { 
                                    echo resize(get_option('thumbnail_size_w'),get_option('thumbnail_size_h')); 
                                }*/
                                if(function_exists('has_post_thumbnail') && has_post_thumbnail()) { 
                                    echo '<a href="'.get_permalink().'">';
                                    if($x==1) {
                                      the_post_thumbnail(array(150,150), array('class' => 'alignleft'));
                                    } elseif($x>1 && $x<4) {
                                      the_post_thumbnail(array(100,100), array('class' => 'alignleft'));
                                    } else {
                                      the_post_thumbnail(array(80,80), array('class' => 'alignleft'));
                                    }        
                                    echo '</a>';
                                } else { 
                                    if($x==1) {
        echo resize(400,400)
    } elseif($x>1 && $x<4) {
        echo resize(100,100); 
    } else {
        echo resize(80,80); 
    } 
                                    }                                
                                }
                                theme_excerpt($wordlimit);
                            } else {
                                the_content(__('Read more »', "magazine-basic"));
    
    
    Problem 2 -

    You'll want to edit the header.php file (don't mess with your CSS) and include your ad code in there. The most likely place to add it for what you are trying to accomplish would be between this line -

    Code:
    <div id="description" class="aligncenter">
            781-286-8500 | info@advocatenews.net | The leading online news journal for Revere Massachusetts    </div>  
    and this one -

    Code:
    <div class="main-navigation"><ul class="sf-menu"><li><a href="http://advocatenews.net">Home</a></li>
    And just from a design standpoint, you really need to redo your header graphic at the correct size, as opposed to just scaling up a smaller graphic...that's why it's so blurry...

    If you need real help, feel free to hit me up. But I don't work free ;)

    HTH
    ND
     
    • Thanks Thanks x 1
  3. Bostoncab

    Bostoncab Elite Member

    Joined:
    Dec 31, 2009
    Messages:
    2,255
    Likes Received:
    514
    Occupation:
    pain in the ass cabbie
    Location:
    Boston,Ma.
    Home Page:
    Bro,

    Thank you so so much. +REP and Thanks coming your way. I am about to deploy the changes right now.

    I know what you mean. The graphic is fuzzy. I didn't actually know why I just knew it was fuzzy.

    I put this together for my friend who is trying to keep that small town paper alive fucking place is about to go under. I figured WP + his 15 years of content thrown up online would help him out a bit in the way of adsense. The idea here is basically we are hoping he eventually gets his online ad revenue high enough so that it completely offsets his weekly printing costs and it rescues his business. I think it is a lofty goal but it is a doable goal.


    He has an in house graphics guy who is there to do all the setup and design for the ads but the kid has no clue about how to put up sites or anything like that. I am starting to see that he is not even a good graphic designer either. He made that shit not me. I wish I could do graphics I would have his job in about 2 seconds.

    Hey I had one more if anyone else can help

    PROBLEM # 3

    I want to start adding his older content but not have it appear as new content. I remember there being a plugin where you could reset the date to a post so it appeared in the earlier archives but I can not recall the name of the plugin. Anyone?
     
  4. nesterdwarf

    nesterdwarf Regular Member

    Joined:
    May 30, 2008
    Messages:
    276
    Likes Received:
    539
    Location:
    State of Misery...er, Missouri...
    I fell your pain about the in-house guy...print people hardly ever know how to create graphics for the web...ask him if the logo is saved as an .EPS, .AI, or anything vector really...have him resize that to the correct size for the page and then save it...should come out a lot crisper than what you've got now. If they don't have that, try having him resize it 5-10% at a time, instead of all at once, until it is the right size...that works sometimes, but I wouldn't hold my breathe...

    Regarding the monetization of the old material, build him a paywall. If people want to access the old materials, have them pay $1-2 per story. Assuming that he has photographs, obits, and all the other trappings of a newspaper, he can probably find a decent number of people that might be looking for the material...hell, you have one of the few 'legitimate' uses for content locking right there...

    Problem #3 -

    Just predate the posts, it's a built-in function of Wordpress. When you go to publish the post, click on the Edit link at the end of the Published line and change it to what ever date you want.

    Also, the plugin that you may be looking for is called Postie - it'll let you email all the posts, set the date, add tags, and a some other cool stuff...just a little setup at the beginning and you can get the "graphic designer" doing something he might be good at...copy and pasting stuff into emails :D.

    HTH
    ND
     
  5. Bostoncab

    Bostoncab Elite Member

    Joined:
    Dec 31, 2009
    Messages:
    2,255
    Likes Received:
    514
    Occupation:
    pain in the ass cabbie
    Location:
    Boston,Ma.
    Home Page:
    OK...

    PROBLEM #1
    Si I tried to copypasta that in and it broke the theme and was saying there was an error in line 172. Any chance you can try again? Here is the entire loop.php file. Can you make the changes and repost please?!?!?! I implore you kind sir.

    Code:
    <?php 
    $x = 1;
    if(is_home()) { 
        $options = get_option("widget_sideFeature");
         $numberOf = $options['number'];
        $category = $options['category'];
        $category = "&cat=" . $category;
        $showposts = "posts_per_page=" . $numberOf . $category ;
        $featuredPosts = new WP_Query();
        $featuredPosts->query($showposts);
        while ($featuredPosts->have_posts()) : $featuredPosts->the_post(); 
            $notin[] = $post->ID;
        endwhile;
        
        $posts = theme_option('number_posts');
        if(empty($posts)) $posts = 6;
        $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
        if (is_active_widget('widget_myFeature')) {
            $args = array(
               'post__not_in'=>$notin,
               'posts_per_page'=>$posts,
               'paged'=>$paged
               );
        } else {
            $args = array(
               'posts_per_page'=>$posts,
               'paged'=>$paged
               );
        }           
        query_posts($args);
        if(theme_option('latest_story')=="on" && $paged < 2) { echo '<h5 class="latest">'.__('Top Revere News', "magazine-basic").'</h5>'; }
    }
    ?>
    <?php if(!have_posts()) : ?>
        <div id="post-0" class="post error404 not-found">
            <h1><?php _e( 'Not Found', "magazine-basic" ); ?></h1>
            <div class="entry-content">
                <p><?php _e( 'No results were found for your request.', "magazine-basic" ); ?></p>
            </div><!-- .entry-content -->
        </div><!-- #post-0 -->
    <?php endif; ?>
    
    <?php 
    if(is_search()) {
        $mySearch =& new WP_Query("s=$s & showposts=-1");
        $num = $mySearch->post_count;
        echo '<h1 class="catheader">'.$num. __(' search results for', "magazine-basic").' "'; the_search_query(); echo '"</h1>';
    }
    ?>
    <?php while ( have_posts() ) : the_post(); ?>
        <?php
        $optionlayout = theme_option('post_layout');
        $classes = '';
        $wordlimit = theme_option('excerpt_one');
        
        if($optionlayout==2 && $paged < 2 && is_home()) {
            if($x==2) { echo '<div id="twocol">'; $i=1; }
            if($x>1) {
                $classes = 'twopost twopost'; 
                if($i==5) { $i = 3; } 
                $classes .= $i; 
                $i++;
                $wordlimit = theme_option('excerpt_two');
            }
        }
        
    if($optionlayout==3 && $paged < 2 && is_home()) {
        if($x==2) { echo '<div id="twocol">'; $i=1; }
        if($x>1 && $x<4) {
            $classes = 'twopost twopost'; 
            if($i==5) { $i = 3; } 
            $classes .= $i; 
            $i++;
            $wordlimit = theme_option('excerpt_two');    
        }
        if($x==4) { echo '</div><div class="mainhr"></div><div id="threecol"><div id="threecol2">'; $i=1; }
        if($x>3) {
            $classes = 'threepost threepost'; 
            if($i==7) { $i = 4; }
            $classes .= $i; 
            $i++;
            $wordlimit = theme_option('excerpt_three');
        }
    }    
    
        if($optionlayout==4 && $paged < 2 && is_home()) {
            if($x==2) { echo '<div id="threecol"><div id="threecol2">'; $i=1; }
            if($x>1) {
                $classes = 'threepost threepost'; 
                if($i==7) { $i = 4; }
                $classes .= $i; 
                $i++;
                $wordlimit = theme_option('excerpt_three');
            }
        }
        ?>
        <div id="post-<?php the_ID(); ?>" <?php post_class($classes); ?>>
            <?php 
            if(is_singular()) {
                if(function_exists('has_post_format') && has_post_format('aside')) { // new aside post format
                    echo '<div class="entry">';
                        the_content();
                    echo '</div>';
                } else {
                    ?>
                    <h1><?php the_title(); ?></h1>
                    <?php
                    echo '<div class="meta">';
                        if(theme_option('dates_posts')=='on') { echo '<div class="date">'; the_time(get_option('date_format')); echo '</div>'; }
                        if(theme_option('authors_posts')=='on') { _e("By", "magazine-basic"); echo ' '; the_author_posts_link(); }
                    echo '</div>';
                    echo '<div class="entry">';
                        $subtitle = get_post_meta($post->ID, 'subtitle', true);
                        if($subtitle) echo '<p class="sub">'.$subtitle.'</p>';
                        the_content(__('Read more »', "magazine-basic"));
                        wp_link_pages(array('before' => '<p><strong>'.__('Pages', "magazine-basic").':</strong> ', 'after' => '</p>', 'next_or_number' => 'number'));
                        the_tags(__('<p class="tags"><small><strong>Tags:</strong> ', "magazine-basic"), ', ', '</small></p>'); 
                    echo '</div>';
                }
            } else { 
                if(function_exists('has_post_format') && has_post_format('aside')) { // new aside post format
                    echo '<div class="entry">';
                        theme_excerpt($wordlimit);
                    echo '</div>';
                } elseif(function_exists('has_post_format') && has_post_format('link')) { // new link post format
                    echo '<div class="entry">';
                        the_content(__('Read more »', "magazine-basic"));
                    echo '</div>';
                } else {
                    ?>
                    <h2><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', "magazine-basic" ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
                    <?php
                    echo '<div class="meta">';
                    if(is_home()) {
                        if(theme_option('dates_index') == 'on') { echo '<div class="date">'; the_time(get_option('date_format')); echo '</div>'; }
                        if(theme_option('authors_index') == 'on') { _e("By", "magazine-basic"); echo ' '; the_author_posts_link(); }
                    } else {
                        if(theme_option('dates_cats') == 'on') { echo '<div class="date">'; the_time(get_option('date_format')); echo '</div>'; }
                        if(theme_option('authors_cats') == 'on') { _e("By", "magazine-basic"); echo ' '; the_author_posts_link(); }
                    }
                    echo '</div>';
                    echo '<div class="entry">';
                    if(function_exists('has_post_format') && has_post_format('gallery')) { // new gallery post format
                        $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
                        if ( $images ) :
                            $total_images = count( $images );
                            $image = array_shift( $images );
                            $image_img_tag = wp_get_attachment_image( $image->ID, 'full' );
                        ?>
                        <a class="gallery-thumb" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
                        <p><em><?php printf( _n( 'This gallery contains <a %1$s>%2$s photo</a>.', 'This gallery contains <a %1$s>%2$s photos</a>.', $total_images, "magazine-basic" ),
                                'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', "magazine-basic" ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
                                number_format_i18n( $total_images )
                            ); ?></em>
                        </p>
                        <?php endif; ?>
                        <?php 
                    } else {
                        if(function_exists('has_post_format') && (has_post_format('video') || has_post_format('image') || has_post_format('audio'))) { // new video || image || audio post format
                            echo '<div class="pformat">';
                            the_content(__('Read more »', "magazine-basic"));
                            echo '</div>';
                        } else {
                            if(theme_option('excerpt_content')!=2) {
                                if(function_exists('has_post_thumbnail') && has_post_thumbnail()) { 
                                    echo '<a href="'.get_permalink().'">';
                                    the_post_thumbnail('thumbnail', array('class' => 'alignleft'));
                                    echo '</a>';
                                } else { 
                                    echo resize(get_option('thumbnail_size_w'),get_option('thumbnail_size_h')); 
                                }
                                /*if(function_exists('has_post_thumbnail') && has_post_thumbnail()) { 
                                    echo '<a href="'.get_permalink().'">';
                                    if($x==1) {
                                      the_post_thumbnail(array(150,150), array('class' => 'alignleft'));
                                    } elseif($x>1 && $x<4) {
                                      the_post_thumbnail(array(100,100), array('class' => 'alignleft'));
                                    } else {
                                      the_post_thumbnail(array(80,80), array('class' => 'alignleft'));
                                    }        
                                    echo '</a>';
                                } else { 
                                    if($x==1) {
        echo resize(400,400)
    } elseif($x>1 && $x<4) {
        echo resize(100,100); 
    } else {
        echo resize(80,80); 
    } 
                                    }                                
                                }*/
                                theme_excerpt($wordlimit);
                            } else {
                                the_content(__('Read more »', "magazine-basic"));
                            }
                        }
                    }
                    echo '</div>';
                } 
            } 
            ?>
        </div><!-- #post-## -->
           <?php comments_template(); ?>
        <?php 
        $x++; // counter 
        ?>   
    <?php endwhile; ?>
    <?php if(($optionlayout==2 || $optionlayout==3 || $optionlayout==4) && $x>1 && $paged < 2 && is_home()) echo '</div>'; ?>
    <?php if($optionlayout==3 && $x>3 && $paged < 2 && is_home()) echo '</div>'; ?>
    <?php if($optionlayout==4 && $x>1 && $paged < 2 && is_home()) echo '</div>'; ?>
    <?php if(!is_single()) if(function_exists('pagination')) { pagination(); } ?>
     
  6. nesterdwarf

    nesterdwarf Regular Member

    Joined:
    May 30, 2008
    Messages:
    276
    Likes Received:
    539
    Location:
    State of Misery...er, Missouri...
    Ok, just checked the site again, and I'm going to offer one more suggestion :D

    You need to resize the pictures to fit the page...I clicked on the first story and the image was taking FOREVER to load...create a thumbnail of the large picture to use in the post and then link to the larger one if absolutely necessary...but really even that one is WAY too large for using on the web.

    ND
     
  7. Bostoncab

    Bostoncab Elite Member

    Joined:
    Dec 31, 2009
    Messages:
    2,255
    Likes Received:
    514
    Occupation:
    pain in the ass cabbie
    Location:
    Boston,Ma.
    Home Page:
    I actually already was a .jpg files. If you look at that site it is actually 4 sites. If you click the name of another city Malden,Everett or Saugus it brings you to a new WP build running in a subdomain. The logos the kid did in the other builds are crisp.

    Since he has 4 local editions (killed off another and sold one more in the interest of cost cutting) He did not want the content mixing together.. I figured this was the best solution. It was either that or have WP running in multiple instances in subfolders like advocatenews.net/Malden

    I figured this was better?