Forum Replies Created

Viewing 15 replies - 31 through 45 (of 91 total)
  • Thread Starter chaseman

    (@chaseman)

    Nice one, thank you, I didn’t even know it works with an array.

    Thread Starter chaseman

    (@chaseman)

    Thank you a BUNCH Mike, that will make my code look more concise I’ll have to write all the if statements.

    Thread Starter chaseman

    (@chaseman)

    I’ve already solved it with this options, thanks for the tip.

    What I did was I got the values with get_option, then inserted the variable into the input field tag, and echo’d out “checked” if condition is true. If condition is not true, then it will not echo it out, and the check box will be unchecked.

    Did you try get_the_content? AFAIK it will simply take the raw text. Give it a try, and don’t forget to echo it out. ??

    Are you just letting us know about your situation or are you asking a specific question? I can’t really tell.

    Anyway, I’m sorry to hear about your loss and I’m wondering how do you actually tell when your site gets attacked, what would I have to look out for?

    Thread Starter chaseman

    (@chaseman)

    Ok I found it out, for everybody who is interested:

    <?php global $more;
    	  $more = false;
    	  echo get_the_content('Read more'); ?>

    Set the global $more to false before fetching the content.

    Thread Starter chaseman

    (@chaseman)

    Well thanks for the heads up about the standard navigation.

    It is a great suggestion to have them automatically hidden, something I already thought about.

    But here’s the reason why I didn’t do it that way. For example, maybe the user wants to write a lengthy About Us page beyond the short blurb on the front page, he’d simply break the text with a read more button. So when visitors read the intro text in the blurb they’d click on read more and then they’d get let to the About Us page.

    So from a functionality perspective this is a big PLUS and makes the theme more valuable ??

    Thread Starter chaseman

    (@chaseman)

    Ohh the solution was that simple, I didn’t realize that I can always use update_option, even if the option doesn’t exists. I just rewrote my script and it works GREAT!.

    Though I realize I may not have chosen the most efficient solution, since you mentioned arrays, I could have used arrays as well. What I rather did was I simply appended all the pages with a foreach loop and space between the page ID’s to ONE option and then it will be inserted into the database like this.

    64 57 16

    And then I take those values with get_option in the header file and split them with the php explode function and then I implode them while separating them with a comma. The imploded string gets inserted into a variable, and that variable gets inserted into the “exclude” attribute of wp_list_pages.

    To me, this is a very straight forward solution, it’s not quite bad for the fact that I’m only programming since 4 month.

    This way the user can:
    – hide selected pages
    – make selected pages visible again
    – or reset everything (make every page visible)

    The reason why I need this functionality is because I have blurbs on the front page, where the user can enter text like “about blog” or “about author”, and those blurbs are entered by creating a page. The blurbs simply take the title and the plain text with get_the_content.

    Since the pages will show in the navi bar, it’s good to simply let the user tick them off.

    I will look into those WP standard navigation menus, I never got seriously into them. After I explained everything, do you think I could have accomplished the same thing with that too?

    Though I will leave everything as it is, because I need a unique functionality for my theme to have it accepted by market places. Besides this functionality I really don’t have much more to offer, it’s a quite simple though nice looking theme.

    Thanks for your help.

    Thread Starter chaseman

    (@chaseman)

    And what would I do if the value field of the option is empty in the database?

    Maybe I should explain what I’m doing to make this clearer.

    I’m developing a theme and I want the user to tick off/on pages from the navi bar.

    Now if the option does NOT exist, I’d have to add it with add_option, but if it DOES exist and the value field is empty (maybe because the user hid pages before and then made them visible again), then I’d have to update the options row with update_option.

    And now I need a way to check if the options row exists or not, even if the value field is empty. As far as I could understand, your example would work if I have a value.

    Or am I mistaking?

    Thread Starter chaseman

    (@chaseman)

    Ipstenu,

    to clear the confusion up, when I said in my first post “I’m working on a WordPress theme” I meant that I’m developing one, as in creating one myself so I can put it on market places.

    It’s nice a idea that there are already widgets for these type of things available, though I think I may not be able to bundle them with the theme, so I’d have to create my own functions. I may be able to do that, though I’m not quite sure how to implement that into the admin panel, so the user knows to which bar he’s adding the widget.

    Thread Starter chaseman

    (@chaseman)

    Ipstenu,

    how would the user tell in the admin panel, to which sidebar he’s adding the widgets?

    Thread Starter chaseman

    (@chaseman)

    I managed to do it this way by following an example in the documentation:

    <form method='POST' action=''>
    <select name="page-dropdown">
     <option value="">
    <?php echo attribute_escape(__('Select page')); ?></option>
     <?php
      $pages = get_pages();
      foreach ($pages as $pagg) {
      	$option = '<option value="'. $pagg->ID .'">';
    	$option .= $pagg->post_title;
    	$option .= '</option>';
    	echo $option;
      }
     ?>
    </select>
    <input type='submit' name='drop_submit' />
    </form>
    Thread Starter chaseman

    (@chaseman)

    I figured that the wp_list_pages function has a $current_page variable.

    Is there any way I could fetch it out of it?

    global $wp_query;
    		if ( is_page() || is_attachment() || $wp_query->is_posts_page )
    			$current_page = $wp_query->get_queried_object_id();
    		$output .= walk_page_tree($pages, $r['depth'], $current_page, $r);

    Thread Starter chaseman

    (@chaseman)

    Thank you a lot, going through all plugins fixed it, interestingly it was one of the plugins that I developed myself when following a book.

    Thread Starter chaseman

    (@chaseman)

    Ok found it out, you simply use it the same way how you’d use the normal navigation function, here’s an example:

    wp_list_pages("exclude=64", array("link_before" => "<li><img src='$dir/images/arrow.png' /></li>", "theme_location" => "primary-menu"));

Viewing 15 replies - 31 through 45 (of 91 total)