Are you the publisher? Claim or contact us about this channel

Embed this content in your HTML


Report adult content:

click to rate:

Account: (login)

More Channels


Channel Catalog

Channel Description:

WordPress › Support

older | 1 | .... | 411 | 412 | (Page 413)

    0 0
  • 08/31/16--04:54: mynde on "JS in main page"
  • Hello community im really stuck with this thing , maby you can help me out.
    I'm trying to add a small piece of java script from this project - to main main page that is running on buddypress , i was trying to add it in my header.php , index.php and so on , but no luck so far, as you can allready tell im a total beginner. this is the code that i need to add

    <script type="text/javascript">
      var introguide = introJs();
      // var startbtn   = $('#startdemotour');
        steps: [
          element: '.nav-bar',
          intro: 'This guided tour will explain the Hongkiat demo page interface.<br><br>Use the arrow keys for navigation or hit ESC to exit the tour immediately.',
          position: 'bottom'
          element: '.nav-logo',
          intro: 'Click this main logo to view a list of all Hongkiat demos.',
          position: 'bottom'
          element: '.nav-title',
          intro: 'Hover over each title to display a longer description.',
          position: 'bottom'
          element: '.readtutorial a',
          intro: 'Click this orange button to view the tutorial article in a new tab.',
          position: 'right'
          element: '.nav-menu',
          intro: "Each demo will link to the previous & next entries.",
          position: 'bottom'

    where should i put this? , P.s my website is

    0 0

    I have a company post type and a rounds table. The rounds table contains data about how much money each company raised and in how many rounds.
    The user can basically add and remove how many rounds that he want.
    A round looks like this -
    Round - 1, Amount - $100,000, date-'2016-08-31'.

    When the user hits save/update on the post I first delete all of the rounds and then add them again. Since I don't know if this is an update or an insert.
    Besides security can you please tell me if I'm doing it right? Is there a way maybe to insert them all in one query?
    I'm just used to ORM's and this is my first time writing plain SQL queries.

    Here is the code:

    global $wpdb;
    $amount_raised = $_POST["amount_raised"];
    $round_number  = $_POST["round_number"];
    $raised_date   = $_POST["raised_date"];
    //I can pick either field and the count will always be the same.
    $count = count( $amount_raised );
    $table_name = $wpdb->prefix . 'rounds';
    $wpdb->query( "DELETE FROM $table_name WHERE post_id = $post_id" );
    for ( $i = 0; $i < $count; $i++ )
    	$wpdb->query( "
    		INSERT INTO $table_name (post_id, amount_raised, round_number, raised_date)
    		VALUES ('$post_id', '$amount_raised[$i]', '$round_number[$i]', '$raised_date[$i]')
    	" );

    0 0

    I'm trying to add a sidebar to my archive pages, but only the archive pages for my custom post type 'teachings', and for the custom taxonomy pages that are correlated with that post type. I want to leave all the other pages and archives where a sidebar could go untouched, but I'm having a lot of difficulty.

    The best solution I could come up with was downloading a plugin that allows you to add sidebars to pages by shortcode (the one I ended up using is Stag Custom Sidebars), then adding that to the archive pages using my child theme's functions.php file. So, I entered this:

    add_action( 'pre_get_posts', 'filter_sidebar' );
    function filter_sidebar(){
    	if( is_post_type_archive('teachings') ) {
    		echo do_shortcode( '[stag_sidebar id='filter']' );

    but every time i apply this it breaks my site. I can't figure out what I'm doing wrong...

    The reason I want to use my child theme's functions.php is to avoid problems with updates to my theme in the future.

    Maybe there's a better way to go about this. Any suggestions would be greatly appreciated.
    Thank you so much for taking the time to read my question, and thank you in advance for your help!

    0 0

    Or are the browsers just too clever now, and they don't show the obfuscated code?

    Here's what I've got:

    function display_my_email() {
            return '<strong>' . antispambot( '' ) . '</strong>';
    add_shortcode( 'display_my_email', 'display_my_email' );

    I found a post that mentioned the Chrome dev tools will not show the scrambled version, so I did a view source in both Chrome and Firefox, and the email is plaintext, not encoded at all. Am I missing something here?

    EDIT: you can see it in action near the top of the page:

    0 0


    I want to upload files to an additional upload folder. All files with 'canada' in their name.

    I use upload_dir to create a custom upload folder:

    function custom_upload_dir( $custom_dir ) {
    	$dir = WP_CONTENT_DIR . '/userfiles';
    	$url = WP_CONTENT_URL . '/userfiles';
    	$bdir = $dir;
    	$burl = $url;
    	$custom_dir = array(
    		'path'    => $dir,
    		'url'     => $url,
    		'basedir' => $bdir,
    		'baseurl' => $burl,
    		'error'   => false,
    	return $custom_dir;
    add_filter( 'upload_dir', 'custom_upload_dir' );

    Now all uploaded files are listed in the userfiles directory.

    So I thought including this does the trick:

    $mystring = $_SERVER["REQUEST_URI"];
    $findme = 'canada';
    $pos = strpos($mystring, $findme);
    if ($pos === true) {

    But no!

    I notice this in codex:

    Using this, in conjunction with the wp_handle_upload_prefilter, you can dynamically determine which directory to upload to, based on the files you upload.

    But, how can I do that?


older | 1 | .... | 411 | 412 | (Page 413)