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 | .... | 352 | 353 | (Page 354) | 355 | 356 | .... | 413 | newer

    0 0

    I have a client who is using an external piece of software to provide replicated sites for their members. This software provides a subdomain in the form of the members name that shows their specific content on the pages the scrips are added to. Everything works fine on all pages except the home page. If you try and enter the subdomain in front of the URL it just gets stripped and defaults back to the regular URL, in turn, stripping the members content as well.

    I am wondering if there is a way to set it up so these dynamically created subdomains will not get stripped from the home page url?

    I have simply used relative urls on all other pages and links so the subdomain is passed around but when they click back home then it gets removed.

    Any help would be greatly appreciated.


    0 0

    I'm working on integrating a theme with the Customizer and run into a weird issue.

    Any SVG in the theme itself that contains a gradient or a filter vanishes when the theme is opened in the WP Customizer. This happens regardless of how I embed the SVG (use+xlink, svg fragments).

    Happens in current Mac Chrome, Safari and Firefox -- but again, ONLY in the customizer. They're perfectly fine outside of the customizer. My only guess is that the customizer is somehow breaking or re-writing ID's.

    Anyone have any suggestions or is it time to file a bug report?

    Example SVG.
    https://gist.github.com/aut0poietic/f95e3c53bfba77b58984


    0 0

    I'm wanting to refresh a table when new data is added to the database, without having to reload the entire page.

    I have tried using the jQuery setInterval snippet to reload the table from a separate php file into a div element. I have tried the onClick/onSubmit method. I can't seem to get this to work. The only way I have it somewhat working is by using javascript to reload the entire page after a change to the database has been submitted.

    I have played around with the Black Cherry and DataTables examples. These work fine outside of WordPress. Getting it all to work within WordPress has become a nightmare.

    I'm sure it's something simple that I'm missing. I would greatly appreciate it if someone that has a script to do this, can explain how it is done within WordPress.

    Thank you.


    0 0



    0 0

    Hi,

    I am trying to pull the barcode from a plugin which adds a custom field called barcode and use it as GTIN for a product feed in my functions.php

    the code below works for simple products but not variable - any idea's?

    function add_barcode_as_gtin ( $elements, $product_id) {
        $product = get_product($product_id);
        if ( ! $product )
            return $elements;
               // Get barcode for variable product
    	        if('variation' == $product->product_type):
                    $barcode = get_post_meta($product->variation_id, '_barcode', true);
    
                // Get barcode for simple product
                elseif ('simple' == $product->product_type):
                    $barcode = get_post_meta($product->id, '_barcode', true);
    
                endif;
        if ( empty( $barcode ) )
    	return $elements;
        $elements['gtin'] = array( $barcode );
        return $elements;
    }
    
    add_filter( 'woocommerce_gpf_elements', 'add_barcode_as_gtin', 11, 2 );

    0 0

    I have two different actions being triggered. I need to store some results from the first action before the second action is triggered because I'm comparing the two.

    Not sure how I should go about doing this? I've read it's a bad idea to use $_GLOBAL or $_SESSION.

    Any help is appreciated.

    Thanks!

    add_action ('trigger_1','function_1');
    
    function function_1($user_id){
       $var1 = get_user_meta( $user_id, 'custom_meta', 'true' );
    }
    
    /// User meta is changed before second action triggers ///
    
    add_action ('trigger_2','function_2');
    function function_2($user_id){
       $var1 = get_user_meta( $user_id, 'custom_meta', 'true' );
       if ($var1 != $var2) {
         wp_mail( 'test@localhost.local', 'subject', 'meta changed' );
       }
    }

    0 0

    Hi, i'm not a coder. But i made function to append total post count to the menu on multisite. I'm seeing rather high load on the VPS so i want to know if this function could be the culprit or not and if so, how can i optimize it?
    This is the code:
    http://pastebin.com/7QBie8Cj

    Please remember i'm not a coder and what i'm doing is probably ridiculous but i don't know any other way to achieve same result. If you do please let me know.
    Thanks in advance.


    0 0

    Hi.
    Can somebody please help me.
    I would like to do the following changes in my navigation bar:
    1) Change the text color
    2) Center my navigation bar
    3) Freeze the navigation bar.

    Thank you in advance. :)


    0 0

    Hi all,

    I am creating a custom post type plugin for my blog and I'm using the Google Maps Javascript API (v3) to let plugin users specify some location info. To achieve this, I have implemented this example into the HTML section of a meta box. However, I noticed some unwanted behaviour when loading the script while the meta box content is hidden from view.

    Please refer to this image. Notice the small triangle in the top right. When you click it, the meta box content (in this case, the "Secure post" and "Secure child post") gets hidden from view.

    Now, when I load my plugin page while the meta box content containing the Maps script is not hidden, everything works like a charm. When I load my plugin page while the meta box content containing the Maps script is hidden, and I proceed to click the small triangle to reveal the map, the entire map is completely greyed out. The autocomplete function (explained in the code sample mentioned above) still works, and the script still puts markers on the 'map' (which is now a grey area).

    Does anyone know what causes this? I think the script does not get invoked/executed if it is hidden from view. I tried removing the async defer attributes for the <script> tag, but that didn't solve anything.

    Thanks for replying!


    0 0

    I made a Custom Post Type with their own Custom Taxonomies.

    My question is, how do I list the custom taxonomies in "the sidebar for an example", when I am under my Custom Post Type?

    I tried with this, but this only get all the current posts categories by "$post->ID" it finds, if I search or click on category it messes up the categories and only shows the categories from the posts it finds instead of ALL categories from the custom post type:
    $terms = get_the_terms( $post->ID , 'genre' );

    Hope this makes a little sense, I really do appreciate help.. It's really rare, anyone replies in here anymore..


    0 0

    Hi,

    I am working on a WordPress theme based on Foundation. I have installed WooCommerce, however, I have a problem with the shop page and Foundation off-canvas menu.

    The problem is that the content for the page has to be loaded within the tags:
    <div class="off-canvas-content" data-off-canvas-content></div>
    If use load_template() to load the shop page, it works but woocommerce loads it again after that.

    if (is_shop()) {
      $woo_file = 'archive-product.php';
    }
    $template = WC()->plugin_path() . '/templates/'. $woo_file;
    load_template( $template, false );

    I've tried adding the wrapping tags to the wrapper-start.php and wrapper-end.php templates but it's not working.

    I can't seem to find a way to prevent WooCommerce from automatically loading the archive template after I call it within the offcanvas content tags. Any help is appreciated. Thanks


    0 0

    Hello!

    I spent the last two days reading tons of tutorials for WordPress plugin architecture. The fact that WordPress has been heavily used for so many years results, as you will probably know, in a ton of outdated tutorials. This is not made better by the fact that PHP has evolved from PHP 4.x to now PHP 7.

    Long story short: I am a bit unsure whether what I figured out works for the plugin project I have is really the best way to write a plugin. Creating small but complex bits of code is no problem, but getting the whole "architecture" set up is something I still struggle with. Anyway, I wanted to try to create my complete own system instead of copying together pieces of code from somewhere else. If you could take a look on what I figured out so far and tell me what you think could be improved (or remade), I would be more than happy!

    A small side-information: The plugin will only extend the admin interface functionality.

    File Structure (in plugin-folder):

    • admin
      • partials
        • partial.header.php
        • partial.footer.php
      • screens
        • screen.overview.php
        • screen.anotherpage.php
        • screen.settings.php
      • templates
        • template.overview.php
        • template.anotherpage.pgp
        • template.settings.php
    • includes
      • class.Demoname.php
      • class.DemonamePath.php
      • class.DemonameScreen.php
    • languages
      • demoname-de_DE.mo
      • demoname-de_DE.po
      • ...
    • demoname.php

    Here is what happens:

    demoname.php in the root-folder does nothing more than include the class.Demoname.php from the "includes"-folder. The class Demoname { } is a singleton-class (I've read about the pros and cons and decided to use a singleton). The demoname.php also calls Demoname::getInstance() the first time to 'create' the plugin.

    This main classes constructor hooks many of its sibling functions to the corresponding WordPress actions. So Demoname::internationalization for example is hooked to 'plugins_loaded' and executes load_plugin_textdomain().

    The function Demoname::createAdminScreens(), hookd to 'init', automatically includes all files from admin/screens/ and automatically creates an object for the class contained in each file.

    Those screen.*.php files contain a class looking like this:

    class ScreenOverview extends DemonameScreen {
        protected function setup() {
            $this->setTitle(__('Overview', 'demoname'));
            $this->setSlug('overview');
        }
    }

    The DemonameScreen class, which every screen extends, looks like this:

    abstract class DemonameScreen {
        private $name;
        private $slug;
    
        final public function __construct() {
            $this->setup();
    
            add_action('admin_menu', array($this, 'createMenuPage');
        }
    
        abstract protected function setup();
    
        final protected function setTitle($newTitle) { $this->title = $newTitle; }
    final protected function setSlug($newSlug) { $this->slug = $newSlug; }
    
        final protected function createMenuPage() {
            add_submenu_page( ** Use $this->name and $this->slug to create submenu-page of my plugins main menu page slug, callback is array($this, 'show') ** );
        }
    
        final public function show() {
            ** include partial header **
            ** include template/template. $this->slug .php **
            ** include partial footer
        }
    }

    Parts in stars are pseudo-code since I know it is working and I wanted to simplify it to be understandable without the rest of my code.

    The whole code is working right now, I can add "screens" to my plugin and the templates are loaded and shown on the admin backend accordingly. But yet it doesn't "feel good" and I can't tell why. Do you have any suggestions for improvement?

    Thanks a lot in advance for your help!


    0 0

    Hello,

    I have a problem. I want to inlcude different slides on different pages. with a code in header.php. The following code gives an error

    <?php if ( is_page('home')  ){
    					// Top Slider Part
    					if( $gdl_top_slider_type == 'Layer Slider' ){
    						echo '<div class="gdl-top-slider">';
    						echo '<div class="gdl-top-slider-wrapper ' . $full_slider . '">';
    						putRevSlider("homeslider");
    						echo '<div class="clear"></div>';
    						echo '</div>';
    						echo '</div>';
    						}
    
    else if ( is_page('contact')  ){
    					// Top Slider Part
    					if( $gdl_top_slider_type == 'Layer Slider' ){
    						echo '<div class="gdl-top-slider">';
    						echo '<div class="gdl-top-slider-wrapper ' . $full_slider . '">';
    						putRevSlider("contactslider");
    						echo '<div class="clear"></div>';
    						echo '</div>';
    						echo '</div>';
    						}
    
    else if( empty($gdl_top_slider_type) || $gdl_top_slider_type == 'Title' || $gdl_top_slider_type == 'No Slider' ){
    						$page_caption = get_post_meta($post->ID, 'page-option-caption', true);
    						print_page_header(get_the_title(), $page_caption);
    					}else if ( $gdl_top_slider_type != "None"){
    						echo '<div class="gdl-top-slider">';
    						echo '<div class="gdl-top-slider-wrapper ' . $full_slider . '">';
    						$slider_xml = "<Slider>" . create_xml_tag('size', 'full-width');
    						$slider_xml = $slider_xml . create_xml_tag('slider-type', $gdl_top_slider_type);
    						$slider_xml = $slider_xml . $gdl_top_slider_xml;
    						$slider_xml = $slider_xml . "</Slider>";
    						$slider_xml_dom = new DOMDocument();
    						$slider_xml_dom->loadXML($slider_xml);
    						print_slider_item($slider_xml_dom->documentElement);
    						echo '<div class="clear"></div>';
    						echo '</div>';
    						echo '</div>';
    					}

    Someone who can help me with this?


    0 0

    Hello everybody!

    First of all, thank you for reading this :)

    So i've got this situation in my company. We have a media page where we have all of our media ressources (Logos, graphics, and so on), the main page it's linking directly links to the child pages), it would be something like this:

    --> Main media page
    |----> Logo
    |----> Guidelines
    |----> Another thing

    And like this, i've reached like 40 childs of the main media page.

    The thing is, i need all those childs to be password protected, and i don't know how to manage it.

    How could i do to make those child pages inherit the parent password, or something like this? i could password protect each of them manually, but this would be slow and not really usefull when in the future we add more child pages...

    So, any of you have a idea? I'm already looking for something for the las 3 days...

    Thank you everybody if you readed til here!

    Cheers,
    Daniel


    0 0

    Dear all,

    My website went to a white screen all of a sudden. This means nothing good if I read up on the topic. My host said it was a virus in the js. files. I'm trying to figure out, as a non expert, where and what the hell is ff'ing about with my website.

    Any suggestions on how to tackle this? Is there a way for me to scan the files? I have tried several online ones but they all came back with nothing.

    My site btw is: http://www.bastarto.com

    Hope you guys can shine light on this dark matter! Thanks in advance!

    Chris


    0 0

    Hi,

    I have an event list which can be added on a page and in a sidebar.

    I would like to be able to hide certain elements (such as date and time) in sidebar, because of the available space.

    So I have created an options page containing several checkboxes to hide date and time. These are 'options'.

    I now hide the elements in widget using custom css:

    function custom_css() {
    	$widget_date = esc_attr(get_option( 'setting-1' ));
    	$widget_time = esc_attr(get_option( 'setting-2' ));
    
    	if ($widget_date == 'yes' || $widget_time == 'yes' ) {
    		echo '<style type="text/css">' . "\n";
    
    		if ($widget_date == 'yes') {
    			echo '.widget_class .date {display:none;}' . "\n";
    		}
    		if ($widget_time == 'yes') {
    			echo '.widget_class .time {display:none;}' . "\n";
    		}
    
    		echo '</style>' . "\n";
    	}
    }
    add_action( 'wp_head', 'custom_css' );

    Works fine.

    But it's cleaner to do this with php, via an if statement I guess.
    But how can I execute code ONLY in a widget area? Any suggestions?

    Guido


    0 0

    I have a form which processes and stores the information in my database. I then call the information back and store it as a variable to display in the value of the input, so it can be edited and updated. For testing I am also echoing the the variable directly after text area for comparison.

    Description: <textarea name="description" rows="5" cols="40"><?php echo $description;?></textarea>
    
    <?php echo $description;?>

    When the echos print the one in the testarea has a </br> which isn't present in the other echo.

    The textarea text prints as follows

    Test paragraph one.
    Test paragraph two.

    Where as the regular echo prints as follows.

    Test paragraph one.
    Test paragraph two.

    This is a problem because if someone say updates their email address and doesn't change the description and clicks save. It gets saved with the <br /> in there.

    What do I need to do to prevent the <br /> from being added?


    0 0

    Hi guys,

    I am searching a way to display different posts conditioned on a kind of global variable. Like on multilanguage sites. When you press the flag the page changes the language and some images.
    That's what I am looking for. But not with languages. I want it in general.

    I want to have a landing page where the user klicks on one city. Conditioned on which city he choose he has other images and some other posts.

    I do not know how to call it. Therefore I was not able to google it.
    Do anyone know an elegant way?

    thanks and best regards


    0 0

    Hi,

    I'm trying to display the 5 most recent posts in single.php using this:

    <ul>
    <?php
    $latest = get_posts('numberposts=5');
    foreach( $latest as $post ):
    ?>
    <li><?php the_time(get_option('date_format')); ?> | <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    <?php endforeach ?>
    </ul>

    Is it ok to use this code in single.php to display multiple posts?

    Also, if it's ok, is it possible to hide the current post from showing up in the list over the most recent posts??

    Thanks.


    0 0

    Hello,

    There is this post about the difference between comments_template() and comment_form.

    That makes sense, from a hierarchical standpoint I'm not sure though. I'm creating my own WP template but the default fields that the form return are good enough for me. So I don't need to do any customization, I just use CSS to style the default one, suing its classes and JS to add the ones that I want to add. I tried using the following in my single.php:

    // we display comments
    				$comments = get_comments(array(
    											// 'status' => 'approve',
    
    										   ));
    				$args = array(
    							'reverse_top_level' => false
    						);
    				wp_list_comments($args, $comments);
    
    				//we display the comments template
    				comment_form(); we use this as opposed to comments_template();

    This works partially, the only problem is that, it will display all my comments in every single post page. Not the comments that belong to a particular post. Can anyone provide more insights in why this is happening? I feel that I'm missing something. And also, if one could expand more on comments_template() vs comment_form() it will be highly appreciated it.

    Thanks!


older | 1 | .... | 352 | 353 | (Page 354) | 355 | 356 | .... | 413 | newer