• help with code

    <?php include_once("pars/id.php") ?>

    instead id.php was the post ID .

    for example:

    <?php include_once("pars/100.php") ?>
    <?php include_once("pars/351.php") ?>
    <?php include_once("pars/103.php") ?>

    the function get_the_ID(); in the code is not working

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    HI sava94!

    What exactly are you trying to do? get_the_ID() works inside of the WordPress loop. Are you trying to load a specific template for a post? If that is the case, you may want to look into using the template hierarchy to your advantage on this. If you are not familiar with this, read:
    https://developer.wordpress.org/themes/basics/template-hierarchy/

    Thread Starter sava94

    (@sava94)

    HI Jose Castaneda!
    I’m trying to connect to each individual post grabber , which will be located in the right column

    Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    What do you mean by “post grabber”?

    Are you talking about using a WP_Query and then loading the post’s file?

    Please, explain as to what you are tying to achieve a little more.

    Thread Starter sava94

    (@sava94)

    Grabber ( parser ) this is the code which pulls any needed information from other sites .

    Here is an example code:

    <?php
    function parse($p1, $p2, $p3) {
    $num1 = strpos($p1, $p2) ;
    if ($num1 === false) return 0;
    $num2 = substr($p1, $num1);
    return strip_tags(substr($num2, 0, strpos($num2, $p3)));
    }
    
    $String = file_get_contents('https://wordpress.org/');
    echo parse($String, '<h5>', '</div>');
    ?>

    Here is some example output:

    WordPress 4.4.1 Security and Maintenance Release WordPress 4.4.1 is now available. This is a security release for all previous versions and we strongly encourage you to update your sites immediately. WordPress versions 4.4 and earlier are affected by a cross-site scripting vulnerability that could allow a site to be compromised. This was reported by Crtc4L. There were also several non-security bug fixes: Emoji […]

    can’t make a conclusion in sidebar.php . In each record

    tried to quote the code shows error.
    tell me how this code worked, using quotes
    I’m sorry I’m writing through a translator

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

The topic ‘help with code’ is closed to new replies.