Forum Replies Created

Viewing 14 replies - 1 through 14 (of 14 total)
  • WillxD

    (@willxd)

    WillxD

    (@willxd)

    You should use Chrome Developer Tools or firebug if you use firefox to fix your problem.
    In the case of your logo, it is showed more than once because in the css you don’t specific “no-repeat”. Another problem is that you don’t define the width of some elements.
    I recommend you, read more about css.

    WillxD

    (@willxd)

    What is the content of your sidebar.php file?

    WillxD

    (@willxd)

    I’m sorry, I hadn’t tried the previous code. Well, here is the new code. I hope it helps.

    add_action('publish_post', 'remove_cat_gen');
    
    function remove_cat_gen() {
    		global $post;
    		wp_schedule_single_event(time()+604800, 'clean_my_post', array($post->ID) );
    }
    
    add_action('clean_my_post','remove_cat_from_post');
    
    // the function that removes the category from the post
    function remove_cat_from_post($post_id) {
        global $wpdb;
    		$cat_id = get_cat_ID('new this week');
    		$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->term_relationships WHERE object_id = $post_id AND term_taxonomy_id = $cat_id" ) );
    }
    WillxD

    (@willxd)

    Hello,

    That code should work fine..
    Well, if you need always remove the category “new this week” after 7 days. You can try this code (in your functions.php).

    add_action('save_post', 'save_Featured_Removal_options');
    
    function save_Featured_Removal_options($post_id) {
        // check autosave
        if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
            return $post_id;
        }
    		//create scheduled event (7 days)
    		$time = time() + 604800;
    		wp_schedule_single_event($time, 'clean_my_featured',$post_id);
        }
    }
    
    /* hook removal event function */
    add_action('clean_my_featured','remove_post_from_featured');
    
    // the function that removes a post form a category and sets a new one
    function remove_post_from_featured($post_id) {
        $cat_id = get_cat_ID('new this week');
        wp_set_post_terms( $post_id, $cat_id, 'category');
    }

    WillxD

    (@willxd)

    This won’t be possible with css, an image is a square (if it is png or not), and so the shadow will be the shadow of a square.

    If you need the shadow in your image, the easiest way would be to use an image editor to apply the shadow.

    WillxD

    (@willxd)

    If your dev environment is localhost, you can try to replicate the multisite using your real domain to avoid changing the url in the db and add the new site. https://devpress.com/blog/how-to-setup-subdomains-for-a-local-wordpress-network/

    Cheers.

    Thread Starter WillxD

    (@willxd)

    Thanks but when I’m trying to set up the network with sub-directory, I only have this option:
    mysite.com/site1 and mysite.com/site2

    How can I custom these option to blogs.mysite.com/site1
    considering that the main site is mysite.com.

    Best Regards.

    Hello,

    Why don’t you create a new file CSS and separate the style of code?

    The structure of the site is messy.

    <div id="wrap">
    <div id="header">
     your code here..
    </div>
    
    <div id="container">
    
    <div id="content">
     your code here..
    </div><!-- end content -->
    
    <div id="sidebar">
     your code here..
    </div><!-- end sidebar-->
    
    </div> <!-- end container -->
    
    <div class="clear"></div>
    
    <div id="footer">
    your footer code...
    </div><!--end footer-->
    </div><!-- end wrap -->

    and create a style.css

    #wrap{
       width:1024px;
       margin:auto;
       }
    #header{
       .....
       }
    
    #content{
       padding:20px;
       ....
    }
    
    .clear{
       clear:both;
       }
    
    #footer{
     ....
    }

    If you do a good structure of your site, its easier to find any mistake.

    Hello,
    You can check the file style.css at line 369 and change the background color from #000 to #fff.

    Thread Starter WillxD

    (@willxd)

    I made a mistake. The correct code is:

    <?php
    $parent = $post->post_parent;
    $id = $post->ID;
    $total_attachments = $wpdb->get_var("SELECT COUNT(ID) FROM {$wpdb->prefix}posts WHERE post_type = 'attachment' AND post_parent = $parent");
    $imgnum = $wpdb->get_var("SELECT menu_order FROM {$wpdb->prefix}posts WHERE post_type = 'attachment' AND post_parent = $parent AND ID = $id");
    ?>
    Image <?php echo $imgnum;?> of <?php echo $total_attachments;?>

    You can list the latest post of all categories like this:

    <?php
    $categories = get_categories();
    foreach ($categories as $cat) : ?>
    	<div class="wrap_cat">
    	<?php
    	// get most recent post in cat
    	query_posts('posts_per_page=1&cat='.$cat->cat_ID);
    	if (have_posts()) : while (have_posts()) : the_post();
    	?>
    	<h2><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    	<?php the_content('continue reading...'); ?>
    	<?php endwhile; endif; wp_reset_query();
    	// get 4 most recent posts in cat offset by 1
    	query_posts('posts_per_page=4&offset=1&cat='.$cat->cat_ID);
    	if (have_posts()) : ?>
    	<ul class="moreposts">
    	<?php while (have_posts()) : the_post(); ?>
    		<li><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
    	<?php endwhile; ?>
    	</ul> <!-- .moreposts -->
    	<?php endif; wp_reset_query();?>
    	</div> <!-- .wrap_cat -->
    <?php endforeach; ?>

    Thread Starter WillxD

    (@willxd)

    I’ve just found solution to my problem. What I miss was to add the order number in the admin panel, and for this the row menu_order was 0.

    If someone has the same problem as me, here I leave the code.

    <?php
    $id = $post->post_parent;
    $total_attachments = $wpdb->get_var("SELECT COUNT(ID) FROM {$wpdb->prefix}posts WHERE post_type = 'attachment' AND post_parent = $id");
    $imgnum = $wpdb->get_var("SELECT menu_order FROM {$wpdb->prefix}posts WHERE post_type = 'attachment' AND post_parent = $id");
    ?>
    
    Image <?php echo $imgnum;?> of <?php echo $total_attachments;?>

    Hello, you can check this page https://codex.www.ads-software.com/Function_Reference/has_post_thumbnail

    On your theme, you should put a condition if the post had a thumbnail.

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