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


Embed this content in your HTML

Search

Report adult content:

click to rate:

Account: (login)

More Channels


Channel Catalog


Channel Description:

WordPress › Support

older | 1 | .... | 373 | 374 | (Page 375) | 376 | 377 | .... | 413 | newer

    0 0

    Hi,

    I've been trying to Google how to add support for another lightbox plugin in Visual Composers Grid Builder. And the closest to an answer I've come is that I need to overwrite prettyphoto by adding prettyPhoto() in your functions.php and call another lightbox.

    Can anyone point my in the right direction of how to do this and call another lightbox preferable WP Featherlight.

    I've been looking at the enqueueing documentations, but I'm afraid I'm still lost.

    Has anyone done this? And wannna share their insights?
    Thanks


    0 0

    How can I get data from my own datatable to profi search plugin . I want my date "from date" and "to date" to be called by this plugin. Please help me..I really need your help...


    0 0

    I am calling for the featured image on the post page of my site and want that image to be full width of the browser, so I am uploading a 2000px or larger images. Yet with the new responsive image feature in 4.4 Clifford, the srcset limits the highest width image to 1024px wide, no matter if I change the settings in the media settings. ie:

    <img width="2400" height="1060" src="img.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" srcset="img-300x133.jpg 300w, img-1024x452.jpg 1024w" sizes="(max-width: 2400px) 100vw, 2400px">

    I am having issues with the codex of this new feature. Does anyone have a way to hack this new feature so that that the 1024w image is the full image?


    0 0

    I have a client that needs to display data on the front end in the form of charts/graphs.

    Requirements are that they upload a CSV file in the admin panel that contains data sets relative to users (i.e., each user will have different value outputs). This data needs to be displayed on the front end in the form of graphs/charts once user logs in.


    0 0

    I have a site that I've been working on. The homepage is a template from Themler. I'm trying to get the homepage to only show the 4 most recent posts and the blog page show whatever I choose to set in the Reading section of settings.

    Here's the code I found for the blog_4.php it's pulling it from. I did find the is_home section and I'm assuming it needs to go in there.

    start code ______________________

    <?php
    function theme_blog_4() {
    global $post;
    $need_reset_query = false;
    if (is_page()) {
    $page_id = get_queried_object_id();
    if (theme_get_meta_option($page_id, 'theme_show_categories')) {
    $need_reset_query = true;
    query_posts(
    wp_parse_args(
    'category_name=' . theme_get_meta_option($page_id, 'theme_categories'),
    array(
    'paged' => get_query_var('paged', get_query_var('page', 1))
    )
    )
    );
    }
    }

    if (!$need_reset_query && theme_is_preview()) {
    global $theme_current_template_info;
    if (isset($theme_current_template_info)) {
    $template_name = $theme_current_template_info['name'];
    $ids = theme_get_option('theme_template_' . $template_name . '_query_ids');
    if ($ids) {
    $need_reset_query = true;
    $ids = explode(',', $ids);

    query_posts(array(
    'post_type' => 'any',
    'post__in' => $ids,
    'paged' => get_query_var('paged', get_query_var('page', 1)),
    ));
    }
    }
    }
    ?>
    <div class=" bd-blog-4">

    <?php
    if ( is_home() && 'page' == get_option('show_on_front') && get_option('page_for_posts') ){
    $blog_page_id = (int)get_option('page_for_posts');
    $title = '' . get_the_title($blog_page_id) . '';
    echo '<h2 class=" bd-container-23 bd-tagstyles bd-custom-blockquotes bd-bootstrap-btn bd-btn-warning">' . $title . '</h2>';
    }
    ?>

    <?php
    if (have_posts()) { ?>
    <div class=" bd-grid-7">
    <div class="container-fluid">
    <div class="separated-grid row">
    <?php while (have_posts()) {
    the_post();

    $id = theme_get_post_id();
    $class = theme_get_post_class();
    ?>

    <div class="separated-item-24 col-md-6 ">

    <div class="bd-griditem-24">
    <article id="<?php echo $id; ?>" class=" bd-article-5 clearfix <?php echo $class; ?>">
    <?php
    if (!is_page() || theme_get_meta_option($post->ID, 'theme_show_page_title')) {
    $title = get_the_title();
    if(!is_singular()) {
    $title = sprintf('%s', get_permalink($post->ID), strip_tags($title), $title);;
    }
    if (!theme_is_empty_html($title)) {
    ?>
    <h2 class=" bd-postheader-5">
    <div class="bd-container-inner">
    <?php echo $title; ?>
    </div>
    </h2>
    <?php
    }
    }
    ?>

    <?php echo theme_get_post_thumbnail(array('imageClass' => ' bd-imagestyles-17', 'class' => ' bd-postimage-4')); ?>

    <?php
    if (theme_is_preview() && is_singular()) {
    $editor_attrs = 'data-editable-id="post-' . theme_get_the_ID() . '"';
    } else {
    $editor_attrs = '';
    }
    ?>
    <div class=" bd-postcontent-9 bd-tagstyles bd-custom-blockquotes bd-bootstrap-btn bd-btn-warning <?php if (theme_is_preview()) echo ' bd-post-id-' . theme_get_the_ID(); ?>">
    <div class="bd-container-inner" <?php echo $editor_attrs; ?>>
    <?php echo(is_singular() ? theme_get_content() : theme_get_excerpt()); ?>
    </div>
    </div>
    </article>
    <?php
    global $withcomments;
    if (is_singular() || $withcomments){ ?>
    <?php
    if (theme_get_option('theme_allow_comments')) {
    comments_template('/comments_4.php');
    }
    ?>
    <?php } ?>
    </div>
    </div>
    <?php
    }
    ?>
    </div>
    </div>
    </div>
    <?php
    } else {
    ?>
    <div class="bd-container-inner"><?php theme_404_content(); ?></div>
    <?php
    }
    ?>

    </div>
    <?php
    if($need_reset_query){
    wp_reset_query();
    }
    }

    ______________ end code


    0 0

    Can some one tell me how do I add this support to my theme ?


    0 0

    I'm still learning PHP, so I apologize if this is a dumb question.

    I've been trying to figure out how to make a form that will allow to view posts only from a specific year. I know that WP_Query has the ability to do this using "year", but how do you do it through a URL? For instance, like going to http://site.com/custom-post-type/?orderby=date&order=DESC&year=2015 would show all posts from 2015, in descending order by date. Is this not how it should work?
    So, I want a select dropdown that gets populated with all of the posts from a specific custom post type's years. There are currently only posts from 2015 and 2016 in this CPT, so 2015 and 2016 should be in the dropdown. And when you click 2016, and submit, it should then display only the CPT posts from 2016.

    $args = array(
        				'post_type' => array('plant'), // display only Plants; otherwise, every post type is shown
        				'orderby' => $order_by, // this comes from a select, options of date, title, menu_order, and random currently
        				'order' => $order, // this comes from a select, ASC and DESC are the options
        				'posts_per_page' => $posts_per_page,
        				'paged' => $paged,
        				'year' => $year, // here lies the issue. If I hard code in 2015 here, it works on the page itself but not through the URL. How to pass into this through the URL?
      				);
    
      				// The Loop
      				$loop = new WP_Query( $args );
        			if ( $loop->have_posts() ) : ?>

    The form (currently broken for the year):

    <form action="" method="get">
                	<div class='post-filters'>
                  	Sort by:
                  	<select name="orderby">
                    	<?php
                    		$orderby_options = array(
                      		'menu_order' => 'Default Sort',
                    			'date title' => 'Date', // 'post_date' => 'Order by Date',
                    			'title' => 'Title', // 'post_title' => 'Order by Title',
                    			'rating' => 'Rating',
                    			'company' => 'Company',
                    			'rand' => 'Random',
                    		);
                    		foreach ($orderby_options as $value => $label) {
                    			echo "<option ".selected( $_GET['orderby'], $value )." value='$value'>$label</option>";
                    		}
                    	?>
                  	</select>
                  	Order:
                  	<select name="order">
                    	<?php
                      	$order_options = array(
                        	'ASC' => 'Ascending',
                        	'DESC' => 'Descending',
                      	);
                      	foreach ($order_options as $value => $label) {
                        	echo "<option ".selected( $_GET['order'], $value )." value='$value'>$label</option>";
                      	}
    
                      ?>
                  	</select>
                  	Year:
                  	<select name="year">
                    	<option value="any">All</option>
                    	<?php
                    		global $post;
                                    // found this snippet elsewhere to populate the post years... is there a better method?
                    		$query = 'post_type=plant&numberposts=-1&orderby=date&order=DESC';
                    		$myposts = get_posts($query);
    
                    		foreach($myposts as $post) {
                    			$year = get_the_time('Y');
                    			$years[] = $year;
                    		}
    
                    		$years = array_values( array_unique( $years ) );
    
                    		foreach ( $years as $year => $label) {
                    			echo "<option ".selected( $_GET['year'], $year )." value='$year'>$label</option>";
                    		}
                  		?>
                  	</select>
                  	<input type="submit" value="Submit" />
                  </div>
              	</form>

    I'll probably take a break and come back later and it will slap me in the face... but I'm stumped.


    0 0

    Hi, I am making an autocomplete ..Here is my code:
    jQuery(********I DON'T KNOW HOW TO CALL THE DATA ON MY DATA TABLE**************).editableSelect({
    onSelect: function (element) {
    jQuery('fieldset[data-id="' + data_id_2 + '"] input').html($(this).val());
    }
    });

    I don't know if this is working. This is the only code I am dealing right now to retrieve my data from my data table.


    0 0

    I want to add surcharge on my weekend calendar..How can I do that..??or is that possible??I have this Jquery code, can it be done in here??

    jQuery( 'fieldset[data-id="' + data_id + '"] input' ).datepicker({
    beforeShowDay: function(date){
    var formattedDate = $.fn.datepicker.DPGlobal.formatDate(date, 'dd.mm.yyyy', 'pl');
    if ($.inArray(formattedDate.toString(), disabled_dates) != -1){
    return {
    enabled : false
    };
    }
    return;
    },
    defaultDate: "+1w",
    changeMonth: true,
    numberOfMonths: 1,
    dateFormat: "mm-dd-yy",
    onClose: function( selectedDate ) {
    jQuery( 'fieldset[data-id="' + data_id_1 + '"] input' ).datepicker( "option", "minDate", selectedDate );

    }
    });

    THANKS..


    0 0

    Hi,

    I'm trying to stop a video from autoplaying when the page is loaded. I need to use iframe tags because when I use <video> the video doesn't autoplay, but isn't responsive on mobile for some reason.
    I've tried a variety of possible fixes e.g. adding variations of autostart="0", autoplay="0", autoplay=false, autostart=false, using plugins but nothing seems to make it responsive and not autoplay at the same time.
    I've also tried using media queries when using video tags but those didn't seem to do anything.

    Does anyone have any other ideas about how this could be fixed?

    Here is the code I am using now:

    <iframe src="(video link)" controls="controls" width="425" height="250" &autoStart=false></iframe>


    0 0

    Hi, I am in need of help.

    I have a website, which has a form to fill out (simple form, that calls a PHP function and some other JQuery libraries). It is made in an ordinary HTML file, and works well on my servers.

    Now I have a new site made in WordPress. The site works great and everything, but the form does not. I do not have so much experience with WordPress to tell what is wrong. It does show, but it does not function properly. Can somebody please check it out? The biggest problem is the button, where you choose how to »pay«. It does actually redirect you, but it should happen twice, but it does not…

    This is the site: http://www.zivimo.zdravo-zivljenje.org/naravno/

    I just copied the code into the past of the site and of course I uploaded the required files to the server, so that it has all the files and functions that it needs.

    And this is the code that works completely fine in my normal HTML site:

    <script type="text/javascript" src="js/jquery.validate.min.js"></script>
    <style type="text/css">
    
            .dropdown {
              margin: 0 0 17px;
            }
            .dropdown dd, .dropdown dt, .dropdown ul { margin:0px; padding:0px; }
            .dropdown dd { position:relative; }
            .dropdown a {
              font-size: 16px;
            }
            .dropdown a, .dropdown a:visited { color:#000; text-decoration:none; outline:none; font-weight: bold;}
            .dropdown a:hover { color:#000;}
            .dropdown dt a:hover { color:#000; border: 2px solid #8CB63F;}
            .dropdown dt a {
              background:#F8F8F8 url(images/arrow.png) no-repeat scroll right center;
              display:block;
              padding-right:20px;
              border:2px solid #8CB63F;
              /*width:150px;*/
            }
            .dropdown dt a span {cursor:pointer; display:block; padding:5px 10px;}
            .dropdown dd ul {
              background:#F8F8F8 none repeat scroll 0 0;
              border:1px solid #8CB63F;
              color:#C5C0B0;
              display:none;
              left:0px;
              padding:5px 0px;
              position:absolute;
              top:2px;
              width:370px;
              min-width:170px;
              list-style:none;
              z-index: 10;
            }
            .dropdown span.value { display:none;}
            .dropdown dd ul li a { padding:5px 10px; display:block;}
            .dropdown dd ul li a:hover { background-color:#E2E2E2;}
    
            .dropdown img.flag { border:none; vertical-align:middle; margin-left:10px; }
            .flagvisibility { display:none;}
    
            .crossed {
              text-decoration: line-through;
            }
    
            #quantity_dropdown {
              position: absolute;
              left: -999999px;
            }
    
            .quantity_hidden_text_field {
                position: absolute;
                left: -999999px;
            }
        </style>
    <script type="text/javascript">
      $(document).ready(function(){
        $('#contactForm').validate({
          'rules': {
           "submission[ime_priimek]":{
              "required":true
           },
           "submission[ulica]":{
              "required":true
           },
           "submission[postna_stevilka]":{
              "required":true
           },
           "submission[kraj]":{
              "required":true
           },
           "submission[mobitel]":{
              "required":true
           },
           "submission[email]":{
              "required":true,
              "email":true
           },
           "submission[kolicina]":{
              "required":true
           }
        },
        'messages': {
            "submission[email]":{
            "email":'Geben Sie gültige E-Mail.'
          },
        },
        submitHandler: function(form) {
          // console.debug(form);
          form.submit();
        }});
    
        $(".order_buttons_wrap button").click(function(e){
    
          $("input[name='submission[nacin_placila]']").val($(this).attr('data-value'));
    
          $("#contactForm label.error").remove();
    
          if ($("#contactForm").valid()) {
            $("#contactForm").submit();
          };
    
          return false;
    
        });
      });
    </script>
    
    </head>
    
    <body>
        <div class="segment segment9" id="obrazec">
            <div class="wrap no-padding-bottom">
                <div class="right_half half">
                    <form id="contactForm" action="php/create.php" method="post">
                        <div class="contactForm">
                            <div class="form-wrap">
                                <input name="utf8" type="hidden" value="✓">
    							<div><label class="">Menge und Rabatt:</label>
                                <div>
                                  <input type="text" class="quantity_hidden_text_field" name="submission[kolicina]" value="">
                                  <dl id="quantity_dropdown_custom_box" class="dropdown">
                                    <dt><a href="#"><span>-- Menge und Rabatt --</span></a></dt>
                                    <dd>
                                        <ul>
                                            <li><a data-value="1" href="#">1x <em>Paket:</em> 59,90 € <em class="crossed">79,90 €</em></a></li>
                                            <li><a data-value="2" href="#">2x <em>Paket:</em> 107,82 € <em class="crossed">159,80 €</em></a></li>
                                            <li><a data-value="3" href="#">3x <em>Paket:</em> 152,75 € <em class="crossed">239,70 €</em></a></li>
    										</ul>
                                    </dd>
                                  </dl>
                                </div>
                                <div><label class="no-padding-top">Name und Nachname:</label>
                                    <input type="text" name="submission[ime_priimek]" id="name" class="txtFld" /></div>
                                <div><label class="">Adresse:</label>
                                    <input type="text" name="submission[ulica]" id="naslov" class="txtFld" /></div>
                                <div><label class="">Postleitzahl:</label>
                                    <input type="text" name="submission[postna_stevilka]" id="postna" class="txtFld" /></div>
                                <div><label class="">Ort:</label>
                                    <input type="text" name="submission[kraj]" id="posta" class="txtFld" /></div>
                                <div><label class="">Mobiltelefon:</label>
                                    <input type="text" name="submission[mobitel]" id="fon" class="txtFld" /></div>
                                <div><label class="">E-mail:</label>
                                    <input type="text" name="submission[email]" id="email" class="txtFld" /></div>
                                <input type="hidden" name="submission[nacin_placila]">
                            </div>
                        </div>
                        <div class="no-padding-top margin-rima order_buttons_wrap">
                            <button data-value="Paypal" class="submit btn_de" id="submit_button">Paypal / Kreditkarte</button> /
                            <button data-value="Sofort" class="submit btn_de" id="submit_button">Sofortüberweisung</button>
                        </div>
                        <script type="text/javascript">
                            jQuery(document).ready(function() {
                                jQuery('.show_other_payment_methods').on('click', function() {
                                    $('.other_payment_methods_link_wrap span').hide();
                                    jQuery('.other_payment_methods_wrap').fadeIn(500);
                                    $("html, body").animate({ scrollTop: $(document).height() }, "slow");
                                    return false;
                                });
                            });
                        </script>
                        <?php if (false): ?>
                        <?php endif ?>
                        <p style="padding-top:0.5em;"><a style="font-size:12px;color: rgba(0,0,0,0.4);" href="allgemeine-geschaeftsbedingungen.html" target="_blank">+ EUR 4,95 für Lieferungen nach Deutschland / Österreich</a></p>
                    </form>
                </div><div class="spacer"></div>
            </div>
        </div>
     </div>
    
    <script type="text/javascript">
      $(document).ready(function() {
                $('.dropdown dt a span').html($('.dropdown ul a[data-value="'+$('.quantity_hidden_text_field').val()+'"]').html())
    
                $(".dropdown img.flag").addClass("flagvisibility");
    
                $(".dropdown dt a").click(function() {
                    $(".dropdown dd ul").toggle();
                    return false;
                });
    
                $(".dropdown dd ul li a").click(function() {
                    var text = $(this).html();
                    $(".dropdown dt a span").html(text);
                    $(".dropdown dd ul").hide();
                    $('input[name="submission[kolicina]"]').val($(this).attr("data-value"));
                    return false;
                });
    
                $(document).bind('click', function(e) {
                    var $clicked = $(e.target);
                    if ($clicked.is('a') && $clicked.parents().hasClass("dropdown")) {
                      // do nothing
                    } else if ($clicked.is('a')) {
                      // do nothing
                    } else {
                      if (! $clicked.parents().hasClass("dropdown")) {
                        $(".dropdown dd ul").hide();
                      }
                      return false;
                    };
                });
            });
    </script>

    0 0

    Hi, I am in need of help.

    I have a website, which has a form to fill out (simple form, that calls a PHP function and some other JQuery libraries). It is made in an ordinary HTML file, and works well on my servers.

    Now I have a new site made in WordPress. The site works great and everything, but the form does not. I do not have so much experience with WordPress to tell what is wrong. It does show, but it does not function properly. Can somebody please check it out? The biggest problem is the button, where you choose how to »pay«. It does actually redirect you, but it should happen twice, but it does not…

    This is the site: http://www.zivimo.zdravo-zivljenje.org/naravno/

    I just copied the code into the past of the site and of course I uploaded the required files to the server, so that it has all the files and functions that it needs.

    And this is the code that works completely fine in my normal HTML site:
    http://pastie.org/10798862


    0 0

    In a plugin that I am writing, I would like to hide the content and display some other content on every page for non admins.

    function display()
    {
    if (! current_user_can('manage_sites' ) )
    {
    seems like a good start.

    Any suggestions much appreciated. No theme tweaking solutions please.


    0 0

    how to insert random widgits between every 5th post line post post post post widgit post post post post widgit


    0 0

    Hi,
    My website is listed in Google search results as : This site may be hacked.

    I verified with Google and they say the following links are hacked:
    1-http://maxcarehospice.com/2D7_shop_CT_098.html
    2-http://maxcarehospice.com/ds.php?p=xmh-bag-Puh-7825.html

    I assume that I have to delete all 2 files above so I tried to enter the folder to find them to delete and I recognized that in my website folder, there are numerous html files named *shopping*.html and some strange file.php.

    I deleted them all.

    Then I tried the links above again. The old content in the pages have been deleted. However, a new undesirable content is created, that is a login box. This is an example:

    http://maxcarehospice.com/2D7_shop_CT_098.html

    I searched again in my folder and found no such 2D7_shop_CT_098.html file, I typed in a random file name like http://maxcarehospice.com/abcd.html and it leads to the same undesirable login box.

    I assume that there is a code that redirect invalid file names to this website. However, I don't know where this code is placed.

    Can you give me some advice?

    Thank you!
    I have deleted them all. And then


    0 0

    Hello guys,

    do any of you know maybe how we can add some code to plugin and track on what domain is plugin installed? Any suggestions? Thank you in advance


    0 0

    I have a very simple website with small and working template. All necessary IDs and classes are defined in the template.

    So, what would be the easiest way to get rid of every class and id added by wp core?

    I like WP but I'd rather use it just for content (that's what CMS are for...)

    I don't understand why there has to be so much bloat. At least include an option to easily turn off all the useless stuff.


    0 0

    This error was stopping the wp site from loading on the hosting server.

    Would you be able to help spotting the syntax error? Many thanks!

    <?php

    $themecolors = array(
    'bg' => '000000',
    'text' => 'bfbfbf',
    'link' => 'ffffff',
    'border' => '000000'
    );

    // this varies but the single page content width seems to be 607px max
    $content_width = 600;

    class Hemingway
    {

    var $raw_blocks;
    var $available_blocks;
    var $style;
    var $version;

    function add_available_block($block_name, $block_ref)
    {

    $blocks = $this->available_blocks;

    if (!$blocks[$block_ref]){
    $blocks[$block_ref] = $block_name;
    update_option('hem_available_blocks', $blocks);
    wp_cache_flush();
    }

    }

    function get_available_blocks()
    // This function returns an array of available blocks
    // in the format of $arr[block_ref] = block_name
    {
    $this->available_blocks = get_option('hem_available_blocks');
    return $this->available_blocks;
    }

    function get_block_contents($block_place)
    // Returns an array of block_refs in specififed block
    {
    if (!$this->raw_blocks){
    $this->raw_blocks = get_option('hem_blocks');
    }
    return $this->raw_blocks[$block_place];
    }

    function add_block_to_place($block_place, $block_ref)
    {
    $block_contents = $this->get_block_contents($block_place);
    if (in_array($block_ref, $block_contents))
    return true;

    $block_contents[] = $block_ref;
    $this->raw_blocks[$block_place] = $block_contents;
    update_option('hem_blocks', $this->raw_blocks);
    wp_cache_flush(); // I was having caching issues
    return true;
    }

    function remove_block_in_place($block_place, $block_ref)
    {
    $block_contents = $this->get_block_contents($block_place);
    if (!in_array($block_ref, $block_contents))
    return true;
    $key = array_search($block_ref, $block_contents);
    unset($block_contents[$key]);
    $this->raw_blocks[$block_place] = $block_contents;
    update_option('hem_blocks', $this->raw_blocks);
    wp_cache_flush(); // I was having caching issues
    return true;
    }

    // Templating functions

    function get_block_output($block_place)
    {
    $blocks = $this->get_block_contents($block_place);
    foreach($blocks as $key => $block ){
    include (TEMPLATEPATH . '/blocks/' . $block . '.php');
    }
    }

    function get_style(){
    $this->style = get_option('hem_style');
    }
    }

    $hemingway = new Hemingway();
    $hemingway->get_available_blocks();
    $hemingway->get_style();

    $hemingway->version = "0.13";
    // Options

    $default_blocks = Array(
    'recent_entries' => 'Recent Entries',
    'about_page' => 'About Page',
    'category_listing' => 'Category Listing',
    'blogroll' => 'Blogroll',
    'pages' => 'Pages',
    'monthly_archives' => 'Monthly Archives'
    );

    $default_block_locations = Array(
    'block_1' => Array('about_page'),
    'block_2' => Array('recent_entries'),
    'block_3' => Array('category_listing'),
    'block_4' => Array(),
    'block_5' => Array(),
    'block_6' => Array()
    );

    if (!get_option('hem_version') || get_option('hem_version') < $hemingway->version){
    // Hemingway isn't installed, so we'll need to add options
    if (!get_option('hem_version') )
    add_option('hem_version', $hemingway->version, 'Hemingway Version installed');
    else
    update_option('hem_version', $hemingway->version);

    if (!get_option('hem_available_blocks') )
    add_option('hem_available_blocks', $default_blocks, 'A list of available blocks for Hemingway');

    if (!get_option('hem_blocks') )
    add_option('hem_blocks', $default_block_locations, 'An array of blocks and their contents');

    if (!get_option('hem_style') )
    add_option('hem_style', '', 'Location of custom style sheet');
    }
    // Ajax Stuff

    if ($_GET['hem_action'] == 'add_block'){

    $block_ref = $_GET['block_ref'];
    $block_place = $_GET['block_place'];

    $block_name = $hemingway->available_blocks[$block_ref];

    $hemingway->add_block_to_place($block_place, $block_ref);

    ob_end_clean(); // Kill preceding output
    $output = '

      ';
      foreach($hemingway->get_block_contents($block_place) as $key => $block_ref){
      $block_name = $hemingway->available_blocks[$block_ref];
      $output .= '
    • ' . $block_name . ' (remove)
    • ';
      }
      $output .= '
    ';
    echo $output;
    exit(); // Kill any more output
    }

    if ($_GET['hem_action'] == 'remove_block'){

    $block_ref = $_GET['block_ref'];
    $block_place = $_GET['block_place'];

    $hemingway->remove_block_in_place($block_place, $block_ref);

    ob_end_clean(); // Kill preceding output
    $output = '

      ';
      foreach($hemingway->get_block_contents($block_place) as $key => $block_ref){
      $block_name = $hemingway->available_blocks[$block_ref];
      $output .= '
    • ' . $block_name . ' (remove)
    • ';
      }
      $output .= '
    ';
    echo $output;
    exit(); // Kill any more output
    }

    if ($_POST['custom_styles']){
    update_option('hem_style', $_POST['custom_styles']);
    wp_cache_flush();
    $message = 'Styles updated!';
    }

    if ($_POST['block_ref']){
    $hemingway->add_available_block($_POST['display_name'], $_POST['block_ref']);
    $hemingway->get_available_blocks();
    $message = 'Block added!';
    }

    // Stuff

    add_action ('admin_menu', 'hemingway_menu');

    $hem_loc = '../themes/' . basename(dirname($file));

    function hemingway_scripts() {
    $dir = get_bloginfo('template_directory');
    wp_enqueue_script('prototype');
    wp_enqueue_script('dragdrop', $dir . '/admin/js/dragdrop.js', false, 1);
    wp_enqueue_script('effects', $dir . '/admin/js/effects.js', false, 1);
    }

    function hemingway_menu() {
    $page = add_submenu_page('themes.php', 'Opzioni', 'Opzioni', 5, $hem_loc . 'functions.php', 'menu');
    add_action('load-' . $page, 'hemingway_scripts');
    }

    function menu() {
    global $hem_loc, $hemingway, $message;
    ?>
    <!--
    Okay, so I don't honestly know how legit this is, but I want a more intuitive interface
    so I'm going to import scriptaculous. There's a good chance this is going to mess stuff up
    for some people :)
    -->
    <script type="text/javascript">
    function remove_block(block_place, block_ref){
    url = 'themes.php?page=functions.php&hem_action=remove_block&block_place=' + block_place + '&block_ref=' + block_ref;
    new Ajax.Updater(block_place, url,
    {
    evalScripts:true, asynchronous:true
    }
    )
    }
    </script>
    <style>
    .block{
    width:200px;
    height:200px;
    border:1px solid #CCC;
    float:left;
    margin:20px 1em 20px 0;
    padding:10px;
    display:inline;
    }
    .block ul{
    padding:0;
    margin:0;
    }
    .block ul li{
    margin:0 0 5px 0;
    list-style-type:none;
    }
    .block-active{
    border:1px solid #333;
    background:#F2F8FF;
    }

    #addables li{
    list-style-type:none;
    margin:1em 1em 1em 0;
    background:#EAEAEA;
    border:1px solid #DDD;
    padding:3px;
    width:215px;
    float:left;
    cursor:move;
    }
    ul#addables{
    margin:0;
    padding:0;
    width:720px;
    position:relative;
    }
    </style>

    <? if($message) : ?>
    <div id="message" class="updated fade"><p><?=$message?></p></div>
    <? endif; ?>

    <div class="wrap" style="position:relative;">
    <h2><?php _e('Hemingway Options'); ?></h2>

    <h3>Color Options</h3>
    <p>Choose a primary color for your site:</p>
    <form name="dofollow" action="" method="post">
    <input type="hidden" name="page_options" value="'dofollow_timeout'" />

    <p><label><input name="custom_styles" type="radio" value="none" <?php if ($hemingway->style == 'none') echo 'checked="checked"'; ?> />
    Black</label></p>
    <p><label><input name="custom_styles" type="radio" value="white.css" <?php if ($hemingway->style == 'white.css') echo 'checked="checked"'; ?> /> White</label></p>

    <input type="submit" value="Update Color »" />
    </form>

    <h3>Hemingway's Bottombar™</h3>
    <p>Drag and drop the different blocks into their place below. After you drag the block to the area, it will update with the new contents automatically.</p>

    <ul id="addables">
    <? foreach($hemingway->available_blocks as $ref => $name) : ?>
    <li id="<?= $ref ?>" class="blocks"><?= $name ?>
    <script type="text/javascript">new Draggable('<?= $ref ?>', {revert:true})</script>
    <? endforeach; ?>

    <div class="clear"></div>

    <div class="block" id="block_1">

      <?
      foreach($hemingway->get_block_contents('block_1') as $key => $block_ref) :
      $block_name = $hemingway->available_blocks[$block_ref];
      ?>
    • <?= $block_name ?> (');">remove)
    • <? endforeach; ?>

    </div>
    <script type="text/javascript">
    Droppables.add(
    'block_1', {
    accept:'blocks',
    onDrop:function(element){
    new Ajax.Updater('block_1', 'themes.php?page=functions.php&hem_action=add_block&block_place=block_1&block_ref=' + element.id,
    {
    evalScripts:true, asynchronous:true
    }
    )
    },
    hoverclass:'block-active'
    }
    )
    </script>

    <div class="block" id="block_2">

      <?
      foreach($hemingway->get_block_contents('block_2') as $key => $block_ref) :
      $block_name = $hemingway->available_blocks[$block_ref];
      ?>
    • <?= $block_name ?> (');">remove)
    • <? endforeach; ?>

    </div>
    <script type="text/javascript">
    Droppables.add(
    'block_2', {
    accept:'blocks',
    onDrop:function(element){
    new Ajax.Updater('block_2', 'themes.php?page=functions.php&hem_action=add_block&block_place=block_2&block_ref=' + element.id,
    {
    evalScripts:true, asynchronous:true
    }
    )
    },
    hoverclass:'block-active'
    }
    )
    </script>

    <div class="block" id="block_3">

      <?
      foreach($hemingway->get_block_contents('block_3') as $key => $block_ref) :
      $block_name = $hemingway->available_blocks[$block_ref];
      ?>
    • <?= $block_name ?> (');">remove)
    • <? endforeach; ?>

    </div>
    <script type="text/javascript">
    Droppables.add(
    'block_3', {
    accept:'blocks',
    onDrop:function(element){
    new Ajax.Updater('block_3', 'themes.php?page=functions.php&hem_action=add_block&block_place=block_3&block_ref=' + element.id,
    {
    evalScripts:true, asynchronous:true
    }
    )
    },
    hoverclass:'block-active'
    }
    )
    </script>

    <!-- Maybe later...

    <div class="clear"></div>

    <div class="block" id="block_4">
    Block 4

      <?
      foreach($hemingway->get_block_contents('block_4') as $key => $block_ref) :
      $block_name = $hemingway->available_blocks[$block_ref];
      ?>
    • <?= $block_name ?> (');">remove)
    • <? endforeach; ?>

    </div>
    <script type="text/javascript">
    Droppables.add(
    'block_4', {
    accept:'blocks',
    onDrop:function(element){
    new Ajax.Updater('block_4', 'themes.php?page=functions.php&hem_action=add_block&block_place=block_4&block_ref=' + element.id,
    {
    evalScripts:true, asynchronous:true
    }
    )
    },
    hoverclass:'block-active'
    }
    )
    </script>

    <div class="block" id="block_5">
    Block 5

      <?
      foreach($hemingway->get_block_contents('block_5') as $key => $block_ref) :
      $block_name = $hemingway->available_blocks[$block_ref];
      ?>
    • <?= $block_name ?> (');">remove)
    • <? endforeach; ?>

    </div>
    <script type="text/javascript">
    Droppables.add(
    'block_5', {
    accept:'blocks',
    onDrop:function(element){
    new Ajax.Updater('block_5', 'themes.php?page=functions.php&hem_action=add_block&block_place=block_5&block_ref=' + element.id,
    {
    evalScripts:true, asynchronous:true
    }
    )
    },
    hoverclass:'block-active'
    }
    )
    </script>

    <div class="block" id="block_6">
    Block 6

      <?
      foreach($hemingway->get_block_contents('block_6') as $key => $block_ref) :
      $block_name = $hemingway->available_blocks[$block_ref];
      ?>
    • <?= $block_name ?> (');">remove)
    • <? endforeach; ?>

    </div>
    <script type="text/javascript">
    Droppables.add(
    'block_6', {
    accept:'blocks',
    onDrop:function(element){
    new Ajax.Updater('block_6', 'themes.php?page=functions.php&hem_action=add_block&block_place=block_6&block_ref=' + element.id,
    {
    evalScripts:true, asynchronous:true
    }
    )
    },
    hoverclass:'block-active'
    }
    )
    </script>
    -->

    <div class="clear"></div>

    <?php
    $blocks_dir = @ dir(ABSPATH . '/wp-content/themes/' . get_template() . '/blocks');

    if ($blocks_dir) {
    while(($file = $blocks_dir->read()) !== false) {
    if (!preg_match('|^\.+$|', $file) && preg_match('|\.php$|', $file))
    $blocks_files[] = $file;
    }
    }
    if ($blocks_dir || $blocks_files) {
    foreach($blocks_files as $blocks_file) {
    $block_ref = preg_replace('/\.php/', '', $blocks_file);
    if (!array_key_exists($block_ref, $hemingway->available_blocks)){
    ?>
    <h3>You have uninstalled blocks!</h3>
    <p>Give the block <?=$block_ref ?> a display name (such as "About Page")</p>
    <form action="" name="dofollow" method="post">
    <input type="hidden" name="block_ref" value="<?=$block_ref?>" />
    <?=$block_ref ?> : <input type="text" name="display_name" />
    <input type="submit" value="Save" />
    </form>
    <?
    }
    }
    }
    ?>

    </div>

    <?php
    }


    0 0

    Not having much luck with Woo or Gravity, so thought I'd try here:

    I am using the Gravity Forms Product Add-ons plugin for WooCommerce. Woo confirms that the Admin Notification email isn't a feature when the form is used on a product:

    "Gravity Forms Add-Ons does not send email notifications when they are assigned to a product." (see FAQs: http://docs.woothemes.com/document/woocommerce-gravity-forms-product-addons/)

    While I understand that it seems redundant given the form fields are all included in the WooCommerce email confirmations, the form I'm adding to my products is quite comprehensive and I'd prefer to keep all that messy extra data separate to the WooCommerce order transaction by having the usual Gravity Forms Admin Notification send via email also (I plan to remove the add-on fields from the WooCommerce emails).

    Can anyone give me guidance on how to get the usual Gravity Forms Admin Notification email to send even when the form is assigned to a product, please?

    Many thanks.


    0 0

    I want author pages to be hidden except to the author who's page it is AND users with a defined user-role capability.

    e.g.

    author 4 can see their page xyz.net/?author=4
    author 23 can see their page xyz.net/?author=23
    author 15 can see their page xyz.net/?author=15

    author 4 can't see xyz.net/?author=23 or ?author=15
    author 23 can't xyz.net/?author=4 or ?author=15
    and so on
    author 4,23,15 all have the user-role capaibility of "xyz"
    author 77 can see the other author pages (?author=4,15,23) as he doesn't have the user-role capaibility of "xyz" and has a user-role capaibility of "abc"

    IF
    the current user is NOT the author of the author profile they are looking at
    AND
    the user has a user capability of "xyz"
    current_user_can('xyz')
    the user doesn't have a user capability of "abc"
    current_user_can('abc')
    THEN
    do this (hide the author meta)
    ELSE
    do this (show the author meta)


older | 1 | .... | 373 | 374 | (Page 375) | 376 | 377 | .... | 413 | newer