Forum Replies Created

Viewing 15 replies - 1 through 15 (of 16 total)
  • Thread Starter pultz

    (@pultz)

    was a error about it not being able to show more then 100

    Thread Starter pultz

    (@pultz)

    Thanks so much for the help @rajanit2000, if anyone need help ask him.

    Here is the result that made it work for me.

    my function.php code:

    add_action( 'admin_init', 'my_admin_portfolio' );
    function my_admin_portfolio() {
        add_meta_box( 'portfolio_meta_box', 'Programs used', 'display_portfolio_meta_box','Portfolio', 'normal', 'high' );
    }
    function display_portfolio_meta_box( $portfolio ) {
        ?>
        <h4>2D Programs</h4>
        <table width="100%">
        <tr>
            <td style="width: 25%">Photoshop</td>
            <td><input type="checkbox" style="width:425px;" name="meta[Photoshop]" value="True" <?php if( get_post_meta( $portfolio->ID, 'Photoshop', true ) == "True" ) {?>checked<?php }?> />
            </td>
        </tr>
        <tr>
            <td style="width: 25%">Illustrator</td>
            <td><input type="checkbox" style="width:425px;" name="meta[Illustrator]" value="True" <?php if( get_post_meta( $portfolio->ID, 'Illustrator', true ) == "True" ) {?>checked<?php }?> />
            </td>
        </tr>
    
    </table>
    <?php
    }
    add_action( 'save_post', 'add_portfolio_fields', 10, 2 );
    function add_portfolio_fields( $portfolio_id, $portfolio ) {
        if ( $portfolio->post_type == 'portfolio' ) {
             if (  $_POST['meta']['Photoshop'] == "True" ) {
                update_post_meta( $portfolio_id, 'Photoshop', 'True' );
            }else{
    			update_post_meta( $portfolio_id, 'Photoshop', 'False' );
    		}
        }
    }

    this is my single.php code (where i print it):

    <?php
    			if (get_post_meta(get_the_ID(), 'Photoshop', 'Illustrator', 'Maya', 'zbrush', 'sDesigner', 'After', 'Premiere', 'Nuke') == null) {
    				echo "<div class='nosoftware'><h3>No software has been picked!</h3></div>";
    			}
    			else
    			{
    
    			if (get_post_meta( get_the_ID(), 'Photoshop', true ) == "True")
    			{
    				echo "<div class='software'><img src='"; ?><?php bloginfo('template_directory'); ?><?php echo "/img/logos/Photoshop.png' /><h3>Photoshop</h3></div>";
    
    			}
    
    			if (get_post_meta(get_the_ID(), 'Illustrator', true) == "True")
    			{
    				echo "<div class='software'><img src='"; ?><?php bloginfo('template_directory'); ?><?php echo "/img/logos/ill.png' /><h3>Illustrator</h3></div>";
    
    			}
    }

    Thread Starter pultz

    (@pultz)

    @anevins just so you know. but even though you redacted the mail i still got it in my mail ?? so is that something the forum should look into maybe?

    Thread Starter pultz

    (@pultz)

    here is the link til my function file

    Function file

    and the link til my single file

    single file

    Thread Starter pultz

    (@pultz)

    well that kinda worked i can see on my front end that it change to false but the dropdown still puts it on true even when its false.

    and really want it to be a checkbox if you have a way to things this problem for the checkbox ??

    Thread Starter pultz

    (@pultz)

    thanks it’s almost there the only problem i have left now is i can’t uncheck and update it. then it will always remember that it was checked ad stay checked.

    what am i doing wrong there?

    Thread Starter pultz

    (@pultz)

    here is the function as said i made it work now i just need to be able to have more then one and get the checked vale on my single.php

    Paste bin

    this is my single.php code

    <?php 
    
    		if (have_posts() ):
    
    			while(have_posts() ) : the_post(); ?>
    
    		<h3><?php the_title(); ?></h3>
    		<p><?php the_content(); ?></p>
    		<?php echo get_post_meta( get_the_ID(), 'check_1', true );?>
    Thread Starter pultz

    (@pultz)

    i fixed it my bad. now i just need a way to make the if statment on my single.php

    like
    if(check_1 == checked)
    do something
    else
    dont do it.

    do you have anything?

    Thread Starter pultz

    (@pultz)

    the issue is that when i check the box and then press update. it’s unchecked again

    Thread Starter pultz

    (@pultz)

    first think i still cant get it to save on my admin page. if i update the product after checking it it goes back to not checked.

    2nd i dont get the <?php echo get_post_meta( get_the_ID(), ‘check_1’, true );?>

    could you maybe make it in to an if

    like

    if(check_1 == checked)
    do something
    else
    dont do it.

    something like that?

    Thread Starter pultz

    (@pultz)

    LoL my bad. but now i have the problem i had a long time ago.

    when i update my item it wont stay checked so guess there’s something in the save option that needs to be change?

    and can you send me some code that so i can print it out on the front page?

    if its check i want to be able to do something els do nothing like that?

    i appreciate all your help.

    Thread Starter pultz

    (@pultz)

    think there is something wrong with this line

    <input type="checkbox" style="width:425px;" name="meta[check_1]" value="True" <?php if( get_post_meta( $car->ID, 'check_1', true ) == "True" ) {?>checked<?php}?> />

    it give me an error that says

    unexpected end of file

    and tried it out it something abou the {?>checked<?php}?> that does not work

    Thread Starter pultz

    (@pultz)

    i tryed your code and it gives me text fields and text fields are not my problem, its that i need it to be check boxes and how to see if its true or false on my single.php page.

    here is what i get with your code.

    Picture of it

    Thread Starter pultz

    (@pultz)

    i might have forgotten to say that my code is my function.php file. but gonna try that code

    Thread Starter pultz

    (@pultz)

    i solved it my self

Viewing 15 replies - 1 through 15 (of 16 total)