Forum Replies Created

Viewing 13 replies - 1 through 13 (of 13 total)
  • doesn’t this ability (index of all download posts) presented in this plugin by default ?

    Hello and thank you for this plugin guys.
    I have a question related to this topic. How can I get an index link that shows all my downloads ? for example enter sitename.com/downloads and all download posts I created with this plugin showed on this link. How can I do that ?

    thanks in advance.

    Thread Starter M3N

    (@m3n)

    The problem is I don’t know how many categories my customer may have. I want to sell a theme to 10 person. One may have 4 category, others may have 9 category. I don’s know category ID’s, etc. How can I do that ?
    As I said before, I’m new to WP. If it’s possible to use WP_Query in this situation, I appreciate if you can provide a sample code for doing that.

    Thanks.

    Thread Starter M3N

    (@m3n)

    Thanks catacaustic.
    I read about Options API and worked a little with it.
    Now I can save the field’s content in the database and retrieve that using Options API.
    But I can’t figure out how I can show those data in my theme. I don’t talk about get_option(), I know about that.
    The thing is, in my index page, I want two sticky post above all of posts that stays there in ALL index pages (so sticky post is not an option). I don’t know how I can create those two or more posts that stays there all the time and I totally Lost here.
    When I figure out how to do this, retrieve the content from wp_option table using Options API isn’t so hard I think.

    Thanks…

    Thread Starter M3N

    (@m3n)

    Damn…I’m an Idiot.
    the $option_name in register_setting function should match the option ID, but those two, didn’t match in my codes. so that didn’t work for me.
    I changed $option_name argument in my register_setting & corresponding arguments in get_option, etc, and everything works just fine.
    Thanks.

    Thread Starter M3N

    (@m3n)

    I had big problem in my code that I solved, but still it doesn’t work.
    I didn’t write the form element itself!!
    Know the codes are like this:
    In functions.php

    function m3n_admin_menu_init() {
        add_menu_page( 'M3N Theme Options', 'M3N Settings', 'manage_options', 'm3n-theme-options', 'm3n_menu_init' );
    }
    add_action( 'admin_menu', 'm3n_admin_menu_init' );
    
    function m3n_menu_init() {
        echo '<div class="wrap">';
        echo '<h2>M3N Theme Settings</h2>';
          echo '<form action="options.php" method="POST">';
          settings_fields( 'm3n_settings_group' );
          do_settings_sections( 'm3n-theme-options' );
          submit_button();
          echo '</form>';
        echo '</div>';
    }
    
    function m3n_settings_init() {
        register_setting( 'm3n_settings_group', 'm3n_settings_name' );
        add_settings_section( 'section-one', 'General Settings', 'm3n_section_init', 'm3n-theme-options' );
        add_settings_field( 'field-one', 'Footer Settings', 'm3n_footer_field_init', 'm3n-theme-options', 'section-one' );
    }
    add_action( 'admin_init', 'm3n_settings_init' );
    
    function m3n_section_init() {
        echo '<p>Enter your text for Footer</p>';
    }
    function m3n_footer_field_init() {
        $options = get_option( 'm3n_settings_name' );
        echo '<textarea name="field-one" id="field-one" rows="3" value="' . $options . '"></textarea>';
    }

    In footer.php :
    <p><?php echo get_option( 'm3n_settings_name' ); ?></p>

    But as I said, it doesn’t work still.
    Any help would be appreciated.

    Thread Starter M3N

    (@m3n)

    Hello Catacaustic and thanks for your response.
    I think my real problem is in my functions.php. Look at my functions.php’s code please (specially last function ):

    function m3n_admin_menu_init() {
        add_menu_page( 'M3N Theme Options', 'M3N Settings', 'manage_options', 'm3n-theme-options', 'm3n_menu_init' );
    }
    add_action( 'admin_menu', 'm3n_admin_menu_init' );
    
    function m3n_menu_init() {
        echo '<div class="wrap">';
        echo '<h2>M3N Theme Settings</h2>';
        settings_fields( 'm3n_settings_group' );
        do_settings_sections( 'm3n-theme-options' );
        submit_button();
    }
    
    function m3n_settings_init() {
        register_setting( 'm3n_settings_group', 'm3n_settings_name' );
        add_settings_section( 'section-one', 'General Settings', 'm3n_section_init', 'm3n-theme-options' );
        add_settings_field( 'field-one', 'Footer Settings', 'm3n_footer_field_init', 'm3n-theme-options', 'section-one' );
    }
    add_action( 'admin_init', 'm3n_settings_init' );
    
    function m3n_section_init() {
        echo '<p>Enter your text for Footer</p>';
    }
    function m3n_footer_field_init() {
        $options = get_option( 'm3n_settings_name' );
        echo '<textarea name="m3n_settings_name" id="m3n_settings_name" rows="3" value="$options"></textarea>';
    }

    What’s wrong with my last function ?
    What should I write inside the value attribute ?

    Also I wrote what you said in my footer.php but it didn’t worked. I think the main problem is in my last function in functions.php which I referred to above.

    Thank You.

    Thread Starter M3N

    (@m3n)

    Thanks Will.
    The problem is I don’t want to prevent generating different sizes for ALL images.
    I want WP generate all sizes JUST for the first image in my posts(because it’s feature image & all generated sizes will be use on index), but NOT for other images.

    Any idea ?

    Hello.
    I have problems with custom fields and I appreciate if someone can help me on this.
    I created a Download Box using custom fields & styled it. the code is this :

    <div class="download-links">
     <ul>
      <?php $cf_var = get_post_meta( $post->ID, 'download', true );
       if( isset($cf_var) && !empty(cf_var) ) : ?>
        <li class="download">
         <a href="<?php echo get_post_meta( $post->ID, 'download', true ); ?>">Download HQ</a>
        </li>
       <?php endif; ?>
    
     <?php $cf_var = get_post_meta( $post->ID, 'download2', true );
        if( isset($cf_var) && !empty(cf_var) ) : ?>
         <li class="download">
          <a href="<?php echo get_post_meta( $post->ID, 'download2', true ); ?>">Download HQ</a>
         </li>
        <?php endif; ?>
    
     <?php $cf_var = get_post_meta( $post->ID, 'password', true );
        if( isset($cf_var) && !empty(cf_var) ) : ?>
         <li class="download">
           <p>Password: <span><?php echo $cf_var; ?></span></p>
         </li>
        <?php endif; ?>
     </ul>
    </div><!-- end of .download-links -->

    So I styled them in styles.css .
    The problem is whether the post has custom field assigned, or not, the Download Box is showing.

    After reading this topic, I end up with this in my functions.php :

    /**
     * Download box using Custom Fields
     */
    function display_download_box() {
    	if( !is_singular() ) {
    		return;
    	}
    	$custom_fields_array() = array(
    		'download'	=>	'download',
    		'download2'	=>	'download2',
    		'password'	=>	'password',
    	);
    	$output = custom_fields_iteration( $custom_fields_array );
    	if( strlen($output) > 0 ) {
    		echo '<div class="download-links">' . $output . '</div>';
    	}
    }
    function custom_fields_iteration( $custom_fields_array ) {
    	$output = '';
    	foreach( $custom_fields_array as $custom_field => $data ) :
    		$custom_field_value = get_post_meta( get_the_ID(), $custom_field, true );
    	$output .= ( strlen($custom_field_value) > 0 ? 'div class="download">
    		<span class="cf_label">' . $data . ': </span>' . $custom_field_value . '</div>' : '');
    	endforeach;
    	echo $output;
    }
    add_action ('__after_content_title', 'display_download_box');

    But it didn’t worked at all and cause Fatal Error.

    How can I find out if the post has custom field or not, and then the code run and styles applied ?
    I hope you guys can help me.
    thanks.

    Also maybe better to hide your comments as such.
    If you want to do that, you can use this selector :

    .post-comments {
    display: none;
    }

    use this selector :
    .post-meta {
    display: none;
    }

    …and I think you’ll get what you want.

    Can you provide a link to your website ?

    Hi Gunjesh Gaurav.
    You could set background for those headings using these selectors respectively :

    .widget-col-3 .widget_awpcp_search_widget .widget-title {
      background-image: url(path/to/image);
    }
    
    .widget-col-3 .widget_wpbdp_searchwidget .widget-title {
      background-image: url(path/to/image);
    }
    
    .widget-col-3 .login .widget-title {
      background-image: url(path/to/image);
    }

    I hope this work for you…

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