• [ Moderator note: moved to Fixing WordPress. Please do not use Developing With WordPress for these topics. ]

    HI,
    I’ve copied/pasted codes of google search engine into my page, why it didn’t appear?

    https://cse.google.com/cse/create/getcode?cx=016421109276741999796%3Ai3yjskygpmc

    http://alexleduc.net

    Thanks

Viewing 10 replies - 1 through 10 (of 10 total)
  • Are you trying to integrate Google analytics on your site?

    Thread Starter kopenhagen

    (@kopenhagen)

    no, do you know google search engine toolbar?

    Moderator bcworkz

    (@bcworkz)

    The code that is appearing on your About page? It’s apparently missing the tags needed for it to be treated as code and not content. It could be you didn’t quite copy the entire code, or your WP user does not have unfiltered HTML capability, which causes such tags to be stripped out.

    Page content may not be the best place for that kind of code. It may be better on a template file somewhere. There’s a number of variables to consider for how and where it’s placed.

    Is the toolbar supposed to appear only on one page or all pages? Where does Google suggest it be placed?

    JavaScript code shouldn’t be added with the page editor, it should be added to the theme’s code or to a separate plugin’s code. If you don’t know how to do that, you could use a plugin like Header and Footer Scripts to add the code to the footer of the entire website or of an individual page.

    Thread Starter kopenhagen

    (@kopenhagen)

    it should be added to the theme’s code or to a separate plugin’s code

    HI there,
    so I’m in edit header/ footer script, where do I insert this code from google search?
    Thanks for your help
    Alex

    Hi,
    It’s best to put the code in the footer, you could edit the footer.php file of the theme and put the code there. If you don’t want to mess with editing the theme directly, you could use the Header and Footer Scripts plugin https://wordpress.org/plugins/header-and-footer-scripts/ to add the code.

    Thread Starter kopenhagen

    (@kopenhagen)

    HI Ciprian,
    I’ve copied at the footer of header/footer srcipt.
    I’ve got this error
    “Parse error: syntax error, unexpected ‘var’ (T_VAR) in /home2/alexledu/public_html/wp-content/plugins/header-and-footer-scripts/shfs.php on line 364”
    the code :
    <script>
    (function() {
    var cx = ‘016421109276741999796:i3yjskygpmc’;
    var gcse = document.createElement(‘script’);
    gcse.type = ‘text/javascript’;
    gcse.async = true;
    gcse.src = ‘https://cse.google.com/cse.js?cx=&#8217; + cx;
    var s = document.getElementsByTagName(‘script’)[0];
    s.parentNode.insertBefore(gcse, s);
    })();
    </script>

    <gcse:search></gcse:search>

    do you know why there is Fatal error ?
    Thanks
    Alex

    What about using a plugin instead?

    https://wordpress.org/plugins/wp-google-search/

    Thread Starter kopenhagen

    (@kopenhagen)

    thanks for the WP google search, it seems a bit easier to use but I’m in edit plugin, where do I insert the search engine ID ?

    THANKS
    Alex

    Thread Starter kopenhagen

    (@kopenhagen)

    I’ve inserted my engine ID, but the search fails to provide any result besides “not found”
    Thanks
    Alex

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

The topic ‘why google search engine not shown?’ is closed to new replies.