Forum Replies Created

Viewing 15 replies - 1 through 15 (of 18 total)
  • Thread Starter redgroup

    (@redgroup)

    Really? Spam from informerfrk? Is there is a sledgehammer I can knock you over the head with?

    Thread Starter redgroup

    (@redgroup)

    Could really do with a response on this so bumping it up.

    Thread Starter redgroup

    (@redgroup)

    Just want to bump this one as I could really do with a reply. Looks like I didn’t post the code correctly either, adding it again to this post in case.

    <?php
    // Get Selected Posts From Meta
    $my_id = get_post_meta($post->ID, 'product_posts', true);
    if ($my_id) {
    // Loop through each item in Array
    foreach ( $my_id as $custom_post_id ) {
        // Get post object for each selected ID
        $current_post = get_post( $custom_post_id );
    
        // Print it or what ever you want
        echo '<div class="storycontent">';
        echo '<h1><a href="'.get_post_permalink($current_post).'">'.( $current_post->post_title ).'</a></h1>';
        echo do_shortcode( $current_post->post_content );
        echo '<div class="clear"></div>';
        echo '</div>';
    }
    }
    ?>
    Thread Starter redgroup

    (@redgroup)

    Hi Derek,

    Sorry for the delay, only saw the reply now.

    The actual post is using shortcodes, two columns. What I am doing on this page https://www.blueginger.co.uk/pexa/brands/scapa/ is adding a meta on the post editor to select other posts to display below the main content (the actual products of the brand in question). To get the shortcodes to work in this I am using the following code:

    <?php
    // Get Selected Posts From Meta
    $my_id = get_post_meta($post->ID, 'product_posts', true);
    if ($my_id) {
    // Loop through each item in Array
    foreach ( $my_id as $custom_post_id ) {
        // Get post object for each selected ID
        $current_post = get_post( $custom_post_id );
    
        // Print it or what ever you want
        echo '<div class="storycontent">';
        echo '<h1><a href="'.get_post_permalink($current_post).'">'.( $current_post->post_title ).'</a></h1>';
        echo do_shortcode( $current_post->post_content );
        echo '<div class="clear"></div>';
        echo '</div>';
    }
    }
    ?>

    [Moderator Note: Please post code & markup between backticks (not single quotes) or use the code button. Your posted code may now have been damaged by the forum’s parser.]

    Thread Starter redgroup

    (@redgroup)

    Hi Derek,

    I actually found the solution, but I think this needs a clearer explanation.

    I am using OptionTree in two parts, the first is the Theme Options in the standard fashion as a plugin, the second using meta boxes inside the theme as described in the Documentation, i.e. adding the meta-boxes.php file to the theme and then the line of code to the functions.php file. That line of code being:

    load_template( trailingslashit( get_template_directory() ) . 'includes/meta-boxes.php' );

    There is some method to my madness. I wanted to keep the plugin as a plugin so that the client could update it, but needed to also implement the meta boxes, so I didn’t want to activate theme mode for this reason. The problem came in when updating the plugin, during the process it deactivates the plugin and once it had updated it couldn’t reactivate because it was was giving an error due to the code for the meta boxes. So I just added some code to check if the plugin was active or not, if not, don;t do anything with the meta boxes, if it is then implement the meta boxes. This allows enough time for the plugin to deactivate, update and then activate again:

    include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
    if ( is_plugin_active( 'option-tree/ot-loader.php' ) ) {
      load_template( trailingslashit( get_template_directory() ) . 'includes/meta-boxes.php' );
    }

    Not sure if it was you had in mind, but it does work.

    Thanks,
    Lee

    Thread Starter redgroup

    (@redgroup)

    Indeed it does. Why is that? I have other WP sites that do not have the www in front and they work fine. This is the first I am working on that is hosted on godaddy.

    Thread Starter redgroup

    (@redgroup)

    Well I finally got this working, although I still don’t understand what is going on. I created new databases, played around with settings, and finally completely removed WP and started from scratch. Still, every time I go to …/wp-admin, it will not go through to the Dashboard after login.

    By chance, I went to …/wp-login.php and guess what…it worked.

    I’m still confused.

    Actually I think Alchymyth’s method would be a whole lot better, and considerably easier.

    Well it does appear that the Classic Theme was used as a basis to create a child theme and with the Classic Theme the sidebar is called in the footer.php file unlike most other themes that call it in the index.php file. However if the proper php call for the get_sidebar is there it should call the dynamic sidebar.

    I did try changing the Classic theme myself some time back and had to move the get_sidebar function to the index.php file.

    Hm, maybe I should have had a look at your site first :o) Do you have <?php get_sidebar(); ?> anywhere in your files? Because you are using the Classic Theme it should be in the footer.php but check in the index.php also.

    There may be an easier way to do this, but here’s my take.

    Open style.css and save as other.css (or whatever you want to call it), make the relevant css changes.

    Open header.php and save as header2.php and change the stylesheet setting to call the other.css file.

    Open index.php and save as other.php and then instead of <?php get_header(); ?>

    use:

    <?php
    /**
    *Template Name: Other
    **/
    include (TEMPLATEPATH . ‘/header2.php’); ?>

    and then use that Other template on your page.

    Good point Chip. Removing the header would also disable the CSS file, etc.

    Try the following, this is the standard code in the Classic theme function.php file:

    <?php
    /**
    * @package WordPress
    * @subpackage Classic_Theme
    */

    add_theme_support( ‘automatic-feed-links’ );

    if ( function_exists(‘register_sidebar’) )
    register_sidebar(array(
    ‘before_widget’ => ‘<li id=”%1$s” class=”widget %2$s”>’,
    ‘after_widget’ => ”,
    ‘before_title’ => ”,
    ‘after_title’ => ”,
    ));

    ?>

    Notice that your automatic_feed_links(); is different to add_theme_support( ‘automatic-feed-links’ );

    See if that works.

    Stop the bus. Just the reiterate, when I said rename the index.php file I should add COPY the index.php and rename that copied file. You still need the index.php file.

    Unfortunately it needs a little code knowledge. The easiest way to do this is to create a new template page. So, take your index.php file and rename it, something like other.php. Then open that file and at the top you should see <?php get_header(); ?>

    Replace that with:

    <?php
    /**
    *Template Name: Other
    **/
    ?>

    That will remove the header completely and create a new template. Then on your pages that you don’t want the header go to Quick Edit and under the Template drop-down menu, select Other.

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