Viewing 15 replies - 16 through 30 (of 88 total)
  • PHP code goes in PHP files, not in CSS files. If you try to add any PHP code into your CSS file, it just won’t work.

    It sounds like you don’t know much about programming yet, and that’s OK – we all have to start somewhere.

    I’d suggest that you take a while and look through the codex pages to find out more information, and think about some starter tutorials for PHP, CSS and WordPress.

    Thread Starter mndo123

    (@mndo123)

    ok i will thank you

    try header.php

    still, you will need to add some style (css) to get it to look like you want. But first get it to show up.

    after you get it to show up, give us a link to your site and perhaps someone will volunteer some style that you can paste into style.css.

    Keep in mind, anything you add or change in your theme files will be over written when you update, so learn about child themes so you don’t have to remember what you did and re-add it every time you update.

    Thread Starter mndo123

    (@mndo123)

    something important how can i put the codes beside them
    see the pic https://www.designsmarketplace.com/wp-content/uploads/2015/08/loop.jpg

    Again…

    Oh, and by the way… the forum volunteers here (myself included) don’t just write code blocks for free. ?? To get a good response the best thing to do is try it for yourself, and them come back here if something doesn’t work, and let us know what errors your facing from the code that you’ve written. Do that and we’ll be able to give you a whole lot more help.

    If you can’t do it yourself, you should consider hiring someone to do it for you. We are more than happy to help out with any problems that you have with code that you’ve written, but we are not here to write your code for you.

    If you are trying to get this in one line, instead of a vertical list, here’s a simple example, note the <div class=”my-totals> added to the PHP.

    In “header.php”, probably after </header> tag, but you’ll to have experiment with placement.

    <div class="my-totals">
    <?php
    global $wpdb;
    $user_count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->users" );
    echo "<p>User count is {$user_count}</p>";
    ?>
    </div>
    
    <div class="my-totals">
    <?php
    $args = array( 'post_type' => 'product', 'post_status' => 'publish', 'posts_per_page' => -1 );
    $products = new WP_Query( $args );
    echo $products->found_posts . 'total';
    ?>
    </div>

    then, at the very bottom of your theme’s style.css,

    .my-totals
    {
    float:left;
    margin-right:20px;
    }

    “my-totals” is your rule, while “float:left;” and “margin-right:20px;” are the properties added to the rule. You’ll want to learn how to add more, especially an image property.

    also, if you want to use the ecommerce shortcode you’ll have to learn how to wrap the shortcode with php, so you can put it in your header, normally shortcodes only work in post and page content.

    <?php echo do_shortcode("[shortcode]"); ?>

    This should get you started, there’s a lot to learn with this but if you are up for it see what you can do and come on back and show us what you got! Good Luck!

    Otherwise if you are in a hurry, definitely hire someone. This could take you a very long time to do on your own.

    also, MAKE SURE you can access your server and your wp folder for your site. You’ll definitely crash your site many times learning how to do this stuff, you won’t be able to log in, so you’ll want to know how to get to those same theme files as they exist on your server, so you can remove the bad code.

    Thread Starter mndo123

    (@mndo123)

    ok thank you

    see my last edit, very important.

    really only applies to functions.php, but you’ll likely find yourself there eventually..

    Thread Starter mndo123

    (@mndo123)

    ok do u know that i need the 4 icons in home page only ?

    Yes, but first you have to upload the images you want to use to your media library, then get their urls. Do you know what I mean by that?

    Then you have to add the images via css, as a property.

    you have add

    background-image: url("https://yourwebsite/your-image-location");

    to this

    .my-totals
    {
    float:left;
    margin-right:20px;
    }

    like this

    .my-totals
    {
    float:left;
    margin-right:20px;
    background-image: url("https://yourwebsite/your-image-location");
    }

    but my example won’t work, you have to add the correct image url.

    then, you have to add more properties to style the size and position of the images.

    Thread Starter mndo123

    (@mndo123)

    that means tthe image will be above the text right ?
    and yes i did uploaded them

Viewing 15 replies - 16 through 30 (of 88 total)
  • The topic ‘what is the code for that ?’ is closed to new replies.