Forum Replies Created

Viewing 15 replies - 1 through 15 (of 16 total)
  • Hi there, I think this is it

    • This reply was modified 6 years, 4 months ago by Wahtel.
    Thread Starter Wahtel

    (@wahtel)

    This is two shortcodes which creating this table

    add_shortcode( 'tld', 'deco_tld_tabs_shortcode' );
    function deco_tld_tabs_shortcode( $attr = array() ) {
    	$id = $attr['id'];
    
    	$service_tabs = get_field( 'deco_tld_type_service', $id );
    
    	ob_start();
    	?>
    	<div class="wrap">
    
    		<div class="dp-heading">
    
    			<div class="dph-price">
    
    				<?php _e( '<!--:ru-->Стоимость услуг<!--:--><!--:ua-->Стоимость услуг<!--:--><!--:en-->Стоимость услуг<!--:-->' ); ?>:
    
    				<div class="dp-lang-drop">
    					<span>UAH</span>
    
    					<ul>
    						<li class="current" data-c="ua">UAH</li>
    						<li data-c="en">USD</li>
    					</ul>
    				</div>
    
    			</div>
    
    			<div class="face-tabs">
    				<a class="current" href="#" data-tab="f1"><?php _e( '<!--:ru-->Для физ.лиц<!--:--><!--:ua-->Для физ.лиц<!--:--><!--:en-->Для физ.лиц<!--:-->' ); ?></a>
    				<a href="#" data-tab="f2" id="f2"><?php _e( '<!--:ru-->Для юр.лиц<!--:--><!--:ua-->Для юр.лиц<!--:--><!--:en-->Для юр.лиц<!--:-->' ); ?></a>
    			</div>
    
    		</div>
    
    		<ul class="dp-nav">
    			<?php
    			$i = 0;
    			foreach ( $service_tabs as $item ) {
    				foreach ( $item['type_domain_zone'] as $item2 ) {
    					$i ++;
    					?>
    
    					<li>
    						<a data-tab-scroll="<?php echo $i; ?>"
    							<?php echo ( $i == 1 ) ? 'class="current"' : ''; ?> href="#">
    							<?php echo $item2['tab_zone_name']; ?></a>
    					</li>
    				<?php
    				}
    				break;
    			} ?>
    		</ul>
    
    		<div class="domain-tab">
    
    			<ul class="dp-tab-nav">
    				<?php
    				$i = 0; //print_r($service_tabs);
    				foreach ( $service_tabs as $item ) {
    					$i ++;
    					?>
    					<li><a href="#"
    					       data-tab-show="t<?php echo $i; ?>"
    							<?php echo $i == 1 ? 'class="current"' : ''; ?>><?php echo $item['service_tab_title']; ?></a>
    					</li>
    				<?php } ?>
    			</ul>
    
    			<div class="dp-tab-content">
    
    				<div class="dptc-item active" data-tab-show="f1">
    					<?php deco_tld_echo_html_for_fiz_or_yur_mens( 'fiz', $service_tabs ); ?>
    				</div>
    
    				<div class="dptc-item" data-tab-show="f2">
    					<?php
    					deco_tld_echo_html_for_fiz_or_yur_mens( $type = 'yur', $service_tabs ); ?>
    
    				</div>
    
    			</div>
    
    		</div>
    
    	</div>
    	<?php
    	$res = ob_get_contents();
    	ob_end_clean();
    
    	return $res;
    }
    
    function deco_tld_echo_html_for_fiz_or_yur_mens( $type = 'fiz', $service_tabs = array() ) {
    
    	$i = 0; //print_r($service_tabs);
    	foreach ( $service_tabs as $item ) {
    		$i ++;
    		?>
    
    		<div class="dp-dts<?php echo $i == 1 ? ' active' : ''; ?>" data-tab-show="t<?php echo $i; ?>">
    
    			<table class="dptc-head">
    				<tr>
    					<th><?php echo $item['service_title_in_table']; ?></th>
    					<th>1+</th>
    					<th>20+</th>
    					<th>50+</th>
    				</tr>
    			</table>
    			<?php
    			$type_domain_zone_num = 0;
    			foreach ( $item['type_domain_zone'] as $item2 ) {
    				$type_domain_zone_num ++;
    				?>
    				<div class="dp-trigger<?php echo $type_domain_zone_num == 1 ? ' active' : ''; ?>" data-tab-scroll="<?php echo $type_domain_zone_num; ?>">
    					<span><?php echo $item2['toggle_zone_name']; ?></span>
    				</div>
    				<div class="dp-table">
    					<table>
    						<?php foreach ( $item2['zone_and_cost'] as $item3 ) { ?>
    							<tr>
    								<td class="dp_f">
    									<?php echo $item3['domain_name']; ?>
    									<?php if ( $item3['discount'] ) { ?>
    										<span class="tip-akciya">
    										<?php _e( '<!--:ru-->Акция<!--:--><!--:ua-->Акцiя<!--:--><!--:en-->Discount<!--:-->' ); ?>
    										</span>
    									<?php } ?>
    								</td>
    								<td>
    									<?php
    									echo ( $type == 'fiz' ) ? $item3['cost_1_fiz'] : $item3['cost_1_yur'];
    									?>
    								</td>
    								<td><?php
    									echo ( $type == 'fiz' ) ? $item3['cost_20_fiz'] : $item3['cost_20_yur'];
    									?>
    								</td>
    								<td>
    									<?php
    									echo ( $type == 'fiz' ) ? $item3['cost_50_fiz'] : $item3['cost_50_yur'];
    									?>
    								</td>
    							</tr>
    						<?php } ?>
    					</table>
    				</div>
    			<?php } ?>
    		</div>
    	<?php }
    
    }
    Thread Starter Wahtel

    (@wahtel)

    Thanks digitalbhavinб recently saw this mistake)

    Thanks for your answer funkjedi, hope it will help;)

    I’ve got an error in console ‘Uncaught TypeError: Cannot read property ‘extend’ of undefined’ by this way ‘/acf-qtranslate/v5/assets/input.js’
    seems like bacuse of this error i can’t update chages in my page, more precisely i can update changes but my site got 3 languages, and when i pressing on one of my links to give name in another language and then press update it is gonna updating forever till i refresh the page.

    This is the line where error:

    acf.fields.qtranslate_wysiwyg = acf.field.extend({

    and here is the full function with error:

    (function ($) {
    
        acf.fields.qtranslate_wysiwyg = acf.field.extend({
            type: 'qtranslate_wysiwyg',
            $el: null,
            $textarea: null,
            toolbars: {},
    
            actions: {
                'ready': 'initialize',
                'append': 'initialize',
                'remove': 'disable',
                'sortstart': 'disable',
                'sortstop': 'enable'
            },
    
            focus: function () {
    
                // update vars
                this.$el = this.$field.find('.wp-editor-wrap.current-language').last();
                this.$textarea = this.$el.find('textarea');
    
                // settings
                this.settings = acf.get_data(this.$el);
                this.settings.id = this.$textarea.attr('id');
            },
    
            initialize: function () {
    
                // bail early if no tinymce
                if (typeof tinyMCEPreInit === 'undefined') {
    
                    return false;
    
                }
    
                // vars
                var mceInit = this.get_mceInit(),
                    qtInit = this.get_qtInit();
    
                // append settings
                tinyMCEPreInit.mceInit[mceInit.id] = mceInit;
                tinyMCEPreInit.qtInit[qtInit.id] = qtInit;
    
                // initialize mceInit
                if (this.$el.hasClass('tmce-active')) {
    
                    try {
    
                        tinymce.init(mceInit);
    
                    } catch (e) {
                    }
    
                }
    
                // initialize qtInit
                try {
    
                    var qtag = quicktags(qtInit);
    
                    this._buttonsInit(qtag);
    
                } catch (e) {
                }
    
            },
    
            get_mceInit: function () {
    
                // reference
                var $field = this.$field;
    
                // vars
                var toolbar = this.get_toolbar(this.settings.toolbar),
                    mceInit = $.extend({}, tinyMCEPreInit.mceInit.acf_content);
    
                // selector
                mceInit.selector = '#' + this.settings.id;
    
                // id
                mceInit.id = this.settings.id; // tinymce v4
                mceInit.elements = this.settings.id; // tinymce v3
    
                // toolbar
                if (toolbar) {
    
                    var k = (tinymce.majorVersion < 4) ? 'theme_advanced_buttons' : 'toolbar';
    
                    for (var i = 1; i < 5; i++) {
    
                        mceInit[k + i] = acf.isset(toolbar, i) ? toolbar[i] : '';
    
                    }
    
                }
    
                // events
                if (tinymce.majorVersion < 4) {
    
                    mceInit.setup = function (ed) {
    
                        ed.onInit.add(function (ed, event) {
    
                            // focus
                            $(ed.getBody()).on('focus', function () {
    
                                acf.validation.remove_error($field);
    
                            });
    
                            $(ed.getBody()).on('blur', function () {
    
                                // update the hidden textarea
                                // - This fixes a bug when adding a taxonomy term as the form is not posted and the hidden textarea is never populated!
    
                                // save to textarea
                                ed.save();
    
                                // trigger change on textarea
                                $field.find('textarea').trigger('change');
    
                            });
    
                        });
    
                    };
    
                } else {
    
                    mceInit.setup = function (ed) {
    
                        ed.on('focus', function (e) {
    
                            acf.validation.remove_error($field);
    
                        });
    
                        ed.on('blur', function (e) {
    
                            // update the hidden textarea
                            // - This fixes a but when adding a taxonomy term as the form is not posted and the hidden textarea is never populated!
    
                            // save to textarea
                            ed.save();
    
                            // trigger change on textarea
                            $field.find('textarea').trigger('change');
    
                        });
    
                    };
    
                }
    
                // hook for 3rd party customization
                mceInit = acf.apply_filters('wysiwyg_tinymce_settings', mceInit, mceInit.id);
    
                // return
                return mceInit;
    
            },
    
            get_qtInit: function () {
    
                // vars
                var qtInit = $.extend({}, tinyMCEPreInit.qtInit.acf_content);
    
                // id
                qtInit.id = this.settings.id;
    
                // hook for 3rd party customization
                qtInit = acf.apply_filters('wysiwyg_quicktags_settings', qtInit, qtInit.id);
    
                // return
                return qtInit;
    
            },
    
            /*
             *  disable
             *
             *  This function will disable the tinymce for a given field
             *  Note: txtarea_el is different from $textarea.val() and is the value that you see, not the value that you save.
             *        this allows text like <--more--> to wok instead of showing as an image when the tinymce is removed
             *
             *  @type	function
             *  @date	1/08/2014
             *  @since	5.0.0
             *
             *  @param	n/a
             *  @return	n/a
             */
    
            disable: function () {
    
                try {
    
                    // vars
                    var ed = tinyMCE.get(this.settings.id),
                        txtarea_el = tinyMCE.DOM.get(this.settings.id);
                    val = txtarea_el.value;
    
                    // destory
                    ed.destroy();
    
                    // update value
                    if (this.$field.find('.wp-editor-wrap').hasClass('html-active')) {
    
                        txtarea_el.value = val;
    
                    }
    
                } catch (e) {
                }
    
            },
    
            enable: function () {
    
                // bail early if html mode
                if (this.$field.find('.wp-editor-wrap').hasClass('html-active')) {
    
                    return;
    
                }
    
                try {
    
                    tinyMCE.init(tinyMCEPreInit.mceInit[this.settings.id]);
    
                } catch (e) {
                }
    
            },
    
            get_toolbar: function (name) {
    
                // bail early if toolbar doesn't exist
                if (typeof this.toolbars[name] !== 'undefined') {
    
                    return this.toolbars[name];
    
                }
    
                // return
                return false;
    
            },
    
            /*
             *  _buttonsInit
             *
             *  This function will add the quicktags HTML to a WYSIWYG field. Normaly, this is added via quicktags on document ready,
             *  however, there is no support for 'append'. Source: wp-includes/js/quicktags.js:245
             *
             *  @type	function
             *  @date	1/08/2014
             *  @since	5.0.0
             *
             *  @param	ed (object) quicktag object
             *  @return	n/a
             */
    
            _buttonsInit: function (ed) {
                var defaults = ',strong,em,link,block,del,ins,img,ul,ol,li,code,more,close,';
    
                canvas = ed.canvas;
                name = ed.name;
                settings = ed.settings;
                html = '';
                theButtons = {};
                use = '';
    
                // set buttons
                if (settings.buttons) {
                    use = ',' + settings.buttons + ',';
                }
    
                for (i in edButtons) {
                    if (!edButtons[i]) {
                        continue;
                    }
    
                    id = edButtons[i].id;
                    if (use && defaults.indexOf(',' + id + ',') !== -1 && use.indexOf(',' + id + ',') === -1) {
                        continue;
                    }
    
                    if (!edButtons[i].instance || edButtons[i].instance === inst) {
                        theButtons[id] = edButtons[i];
    
                        if (edButtons[i].html) {
                            html += edButtons[i].html(name + '_');
                        }
                    }
                }
    
                if (use && use.indexOf(',fullscreen,') !== -1) {
                    theButtons.fullscreen = new qt.FullscreenButton();
                    html += theButtons.fullscreen.html(name + '_');
                }
    
                if ('rtl' === document.getElementsByTagName('html')[0].dir) {
                    theButtons.textdirection = new qt.TextDirectionButton();
                    html += theButtons.textdirection.html(name + '_');
                }
    
                ed.toolbar.innerHTML = html;
                ed.theButtons = theButtons;
    
            },
    
        });
    
    })(jQuery);

    I will appreciate if you will help;)
    Thanks.
    Paul.

    Thread Starter Wahtel

    (@wahtel)

    Thanks mate, you right better way is somehow recording automatically the timestamp of when that page was checked, but it is sound not easy, i should to think about it, but your advice about sorting

    'sort_column'    => 'post_modified',
     'sort_order'     => 'desc',

    is a realy great idea, it works almost like i need)

    Thread Starter Wahtel

    (@wahtel)

    My bad, it works almost fine, they display last checked page, but i can check 3 pages and it will display last one, but then i will check next random page, and they won’t display, cant understand why, another example, i can check page, then check another but they won’t display, goddamn, i don’t know how to debbug it.

    Thread Starter Wahtel

    (@wahtel)

    Thanks for your answer, yes i did it, i wrote ‘number’ => 1 instead of post_per_page, but tehy work strange, the display not last checked page, they display first checked page, i’m trying to fix it, but unresults.

    Thread Starter Wahtel

    (@wahtel)

    Or can somebody explain how can i get all pages with this checked meta field?

    Thread Starter Wahtel

    (@wahtel)

    Thnaks my friend)

    Thread Starter Wahtel

    (@wahtel)

    Thanks!
    Can you explain one more thing, how create widgets, this is a simple php file, which is filled content using wp_query?
    Or it got own syntax which will display this widgets in the admin panel?

    Thread Starter Wahtel

    (@wahtel)

    I solved this problem, had to rewrite class little bit.

    Thread Starter Wahtel

    (@wahtel)

    How can you see the reference to those JS/CSS files in my current site, if i’m trying to hook up this files in my admin panel on backend?

    Thread Starter Wahtel

    (@wahtel)

    My WordPress Address (URL) and Site Address (URL) is the same: https://host.ho.ua/wordpress.

    I’ve got a main folder of my site, htdocs, in there i installed folder WordPress, and yes you right, it comes in host.ho.ua and then redirect in
    host.ho.ua/wordpress/.

    Thread Starter Wahtel

    (@wahtel)

    I am trying to hook js files in my plugin, in backend.

    What i’m doing wrong?

    protected function onBackendInit()
    	{
    		add_action('admin_menu', 'themeOptionsPanelAction');
    		add_action('admin_print_scripts', 'onInitJsAction');
    		add_action('admin_print_styles', 'onInitCssAction');
    	} // end onBackendInit
    
    	public function onInitJsAction()
    	{
    		admin_enqueue_scripts('jquery');
    
    		admin_enqueue_scripts(
    			'deleteDiv',
    	        plugins_url('js/delete.js', __FILE__),
    			array('jquery')
    		);
    
    		admin_enqueue_scripts(
    			'addInput',
    	        plugins_url('js/addInputs.js', __FILE__),
    			array('jquery')
    		);
    
    	} // end onInitJsAction
Viewing 15 replies - 1 through 15 (of 16 total)