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 | .... | 408 | 409 | (Page 410) | 411 | 412 | 413 | newer

    0 0

    I'm using Ninja forms Version and am wondering how I include the page the form is used on.
    I'm using the same form on several different pages and need to know which page the form was used on. Any help would be appreciated.

    0 0

    HEllo this is part of code of previous link

    $previous_post_link = get_previous_post_link( '%link', '<span class="meta-nav">' . esc_html( _x( '&larr;', 'Previous post link', 'et_builder' ) ) . '</span> ' . $previous_link_text, $in_same_term, '', $current_taxonomy );

    I need to add at the end of url #anchor

    so that link of previous post looks like

    Thansk in advance

    0 0

    Hi All,

    i'm looking for two pieces of code that can help me with the following:

    I got posts and pages with a custom menu. These posts/pages got a custom template activated. The templates contains the menu for the specific posts and pages. This way i can order pages/posts in two different categories.

    Now i like to change the search function; the search output should be based on the active custom menu category.

    I named menu 1: Benelux and menu 2: International

    1: First peace of code needs to be for the searchform.php
    The code should look at the current active menu(category) and the search result should be based on the active menu.

    If the menu is for example "Benelux" then the search result should only display pages/posts from the custom taxonomy that i made <input type="hidden" name="location" value="benelux" />
    Or if the active menu is "International" then display pages/posts from the custom taxonomy <input type="hidden" name="location" value="international" />

    I found the following code to get the menu category...not sure if this is useful..

    (wp_nav_menu( array(
        'menu' => 'benelux'
    ) )

    2: Second peace of code is needed for the search.php (header).
    Because if the output should work correctly than we also need to change the menu for this search result page. Default the search.php uses the main menu.

    So the following code needs to see if the pages/post contain taxonomy benelux or international and change the menu accordingly.

    It would just be really awesome if this is possible.


    0 0

    I'm so very close to being able to release a free plugin.

    Upon uploading media, my plugin automatically transfers audio and video files to an external server ( The part that I'm hung up on is the progress bar, showing the progress of transferring the file to But instead of a smoothly growing progress bar, it stays at 0% and then jumps to 100% once it's done.

    Relevant code from the plugin:

    // Set all the options if they don't exist yet
    function progressCallback( $download_size, $downloaded_size, $upload_size, $uploaded_size ){
        static $previousProgress = 0;
        if ( $upload_size == 0 )
            $progress = 0;
            $progress = round( $uploaded_size * 100 / $upload_size );
        if ( $progress > $previousProgress){
            $previousProgress = $progress;
    function aou_upload_file($file) {
    	$ias3accesskey = get_option('aou_accesskey',"");
    	$ias3secretkey = get_option('aou_secretkey',"");
    	$filename = str_replace(' ', '-', $file['name']);
    	$file_no_ext = preg_replace('/\\.[^.\\s]{3,4}$/', '', $filename);
    	$file_read = fopen($file['tmp_name'], 'r');
    	$upload_file_url = '' . $filename . '/' . $filename;
    	$headers = array(
    'Authorization: LOW ' . $ias3accesskey . ':' . $ias3secretkey,
    'x-archive-meta01-collection:opensource_' . $mediatype,
    'x-archive-meta-title:' . $file['name']
    	$ch = curl_init();
    	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    	curl_setopt($ch, CURLOPT_HEADER, true);
    	curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    	curl_setopt($ch, CURLOPT_URL, '' . $filename . '/' . $filename);
    	curl_setopt($ch, CURLOPT_PUT, true);
    	curl_setopt($ch, CURLOPT_INFILE, $file_read);
    	curl_setopt($ch, CURLOPT_INFILESIZE, filesize($file['tmp_name']));
    	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    	curl_setopt($ch, CURLOPT_VERBOSE, false);
    	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    	curl_setopt($ch, CURLOPT_NOPROGRESS, false );
    	curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, 'progressCallback');
    	curl_setopt($ch, CURLOPT_BUFFERSIZE, 25);
        return $file;
    function aou_css_head() {
    	global $pagenow;
    	if ($pagenow == 'media-new.php'){ ?>
    		<style type="text/css">
    		#aou_progress {
    		#aou_progress_bar {
    			var xhttp = new XMLHttpRequest();
    			xhttp.onreadystatechange = function() {
    				var progressElement = document.getElementById('aou_progress_bar');
    				if (xhttp.readyState == 4 && xhttp.status == 200 && progressElement.innerHTML != '100%') { = xhttp.responseText + '%';
    					progressElement.innerHTML = xhttp.responseText + '%';
    				};"GET", "http://<?php echo $_SERVER['SERVER_NAME']; ?>/wp-content/plugins/archiveorg-uploads/progress.php", true);
    			}, 125);
    add_action('admin_head', 'aou_css_head');
    function aou_progress_bar() {
        global $pagenow;
        if ($pagenow == 'media-new.php'){
    	    echo '<div id="aou_progress"> Uploads Progress<div id="aou_progress_bar">0%</div></div>';



    global $wpdb;
    echo $wpdb->get_var( "SELECT option_value FROM wp_options WHERE option_name='aou_progress'" );

    So, so basically, the callback of the upload updates the aou_progress option in the database, and this option is written via progress.php, which should be checked for changes every 1/8 second, and the progress bar should grow.

    But obviously I did something wrong here. I'm wondering if it can't check progress.php for a change while it's transferring the file via curl? If that's true, is there a way to get around it?

    0 0

    I want to display child page preview with excerpt on a parent page. The child page will always have the same title, but the parent will be different.

    At the moment Im using this code:

    $page = get_page_by_title( 'Child Title' );
     $page_excerpt = $page->post_excerpt;
    <header class="wpb_wrapper">
        <h4 class="gp-element-title xcpt">
            <a href="<?php echo esc_url( get_permalink( $page ) ); ?>">
                <?php echo $page_data->post_title; ?>
        <div class="gp-entry-content xcpt page-layout"><?php echo $page_excerpt; ?><br/>
            <a href="<?php echo esc_url( get_permalink( $page ) ); ?>">Read More...</a>

    This code sits in the parent page template and every time I create new parent page the parent link stays the same, but I want it take the slug from the new parent page. So for example now there is and when I create new parent page called "new parent" I want it to be

    Also the excerpt doesnt work and I have to manually enter the text into metabox in admin, is there a way to display the excerpt dynamically? Thanks for any help!

    0 0

    I am looking to create a website where user can add themselves as "present" in an event. This would be most practical (without my better knowledge) is a button which when an user presses, Wordpress adds the name of the user to a post/page, without user having to go to the editing mode and add it by hand.

    Basically my question boils down to adding stuff to posts without going to editing mode.
    Is this possible somehow with code or by a plugin?

    Thanks for all the help.

    0 0

    I'm trying to create a plugin that makes managing shortcodes much like managing posts, except (hopefully) much more intuitive. I have almost everything setup: admin page, general hooks (activation...), and a few other things. The issue I'm having, is that I can't figure out how to display the entries from the database as a HTML table like with plugins. I've tried several guides, but can't figure it out.

    I also need to design the page for editing or creating new shortcodes, but this, obviously, has to come first.

    0 0

    I'm using following code to force WordPress page to save post as draft, is there any callback function for it, I want to alert a text after it complete saving post as draft.

    if ( wp.autosave.server ) {

    0 0

    Hellow !!
    I researched a lot here in the forum and did not find a solution
    I have a post type called playlist. I wanted to include a filter for customization the media upload window that works only for this post type
    I've tried on in the functions.php:

    if ('playlists' == get_post_type ()) {
      add_filter( 'media_view_strings', 'custom_media_uploader' );

    I've tried too:

    is_singular ('playlist'))
    is_admin() && isset($request['post_type']) && $request['post_type']=='playlists'

    The custom post type code :

    function playlist_post_type() {
    // Set UI labels for Custom Post Type
    	$labels = array(
    		'name'                => _x( 'Playlists', 'Post Type General Name', 'metanuvem' ),
    		'singular_name'       => _x( 'Playlist', 'Post Type Singular Name', 'metanuvem' ),
    		'menu_name'           => __( 'Playlists', 'metanuvem' ),
    		'parent_item_colon'   => __( 'Parent Playlist', 'metanuvem' ),
    		'all_items'           => __( 'Todos Playlists', 'metanuvem' ),
    		'view_item'           => __( 'Ver Playlist', 'metanuvem' ),
    		'add_new_item'        => __( 'Adicionar Novo Playlist', 'metanuvem' ),
    		'add_new'             => __( 'Adicionar novo', 'metanuvem' ),
    		'edit_item'           => __( 'Editar Playlist', 'metanuvem' ),
    		'update_item'         => __( 'Atualizar Playlist', 'metanuvem' ),
    		'search_items'        => __( 'Procurar Playlist', 'metanuvem' ),
    		'not_found'           => __( 'Não encontrado', 'metanuvem' ),
    		'not_found_in_trash'  => __( 'Não encontrado no lixo', 'metanuvem' ),
    // Set other options for Custom Post Type
    	$args = array(
    		'label'               => __( 'Playlists', 'metanuvem' ),
    		'description'         => __( 'Playlist news and reviews', 'metanuvem' ),
    		'labels'              => $labels,
    		// Features this CPT supports in Post Editor
    		'supports'            => array( 'title', 'editor', 'revisions' ),
    		// You can associate this CPT with a taxonomy or custom taxonomy.
    		'taxonomies'          => array( 'genres' ),
    		'hierarchical'        => false,
    		'public'              => true,
    		'show_ui'             => true,
    		'show_in_menu'        => true,
    		'show_in_nav_menus'   => true,
    		'show_in_admin_bar'   => true,
    		'menu_position'       => 5,
    		'can_export'          => true,
    		'has_archive'         => true,
    		'exclude_from_search' => false,
    		'publicly_queryable'  => true,
    		'capability_type'     => 'page',
    	// Registering your Custom Post Type
    	register_post_type( 'Playlists', $args );
    add_action( 'init', 'playlist_post_type', 0 );

    Add the filter for custom media window:

    function custom_media_uploader( $strings ) {
         //unset( $strings['selected'] );
         unset( $strings['insertMediaTitle'] ); //Insert Media
         unset( $strings['uploadFilesTitle'] ); //Upload Files
         unset( $strings['mediaLibraryTitle'] ); //Media Library
         unset( $strings['createGalleryTitle'] ); //Create Gallery
         unset( $strings['setFeaturedImageTitle'] ); //Set Featured Image
         unset( $strings['insertFromUrlTitle'] ); //Insert from URL  wordpress
         unset( $strings['url'] );
         return $strings;

    0 0

    Hi all,

    I would like to customize the Revisions screen. For example, I don't want to see the revisions of a post that have been saved before post's publication: I only want the revisions from the publication date.
    It's very easy to modify the function 'wp_get_post_revisions' in the file wp-includes\revision.php, and to remove the "draft revisions" from the $revisions list, but I would prefer not to modify WP core files, of course...

    Does anyone have an idea on how to customize the 'wp_get_post_revisions' function?


    0 0

    add values of a variable with string, within another variable that also contains string, but insert in the middle of the text, eg
    I have a text with 100 words, and I have another variable also with a string value, say a word, as I put that word in this text, and text in the center. say there position by 49 or 50 or 51 etc ...Thanks :)

    0 0


    I'd like your help with a question.

    I use wordpress is I have several category

    I wonder if it is possible to determined a category to a "post-type" specific?


    the category

    Sports in a post-type Sport

    I ask this because I have a post plugins that filter types -> Articles and page.

    I would like the added post-type Sport



    0 0

    I have two questions. I am trying to authenticate WordPress users against an external database.
    When I am able to authenticate against the external database, I cannot access the admin users. I would like to use WordPress login authentication for admins but external logins for members.
    Also when I successfully authenticate against the external database, must I always create a specific user in Wordpress? Is it possible to create a generic user for all authenticated members?

    0 0

    So I use the "PreimumPress" Classifieds Blue child theme, and the code I have below will check if there is a “bad word” entered into the Keywords input/field and alerts the user about it once they click on the Save Listing button. The problem though is that it ONLY alerts the user when there is just ONE of the specified “bad words” in that field. It won’t trigger the alert when the “bad word” is found within a whole sentence. So I need help with two things…

    – Can anyone help me tweak this code so that it will trigger the alert when the “bad word” is found ANYWHERE within that field, even if there are other words.
    – Can anyone help me have this “alert” happen when the specified “bad words” are in ANY field, not just the “keywords” field.

    *For reference, my website is


    jQuery(function() {
    jQuery("#MainSaveBtn").on("click",function() {
        var name = jQuery("input:text[name='custom[post_tags]']").val();
            var badwords = ["word1", "word2", "bad word3"];
            if(jQuery.inArray(name, badwords) !==-1)
                    alert("Your Listing Contains Bad Words, Please Remove Them Before Proceeding");
                    return false;

    0 0

    Hi all,

    My apologies if this is in the wrong place, or has already been covered. I did a quick search and couldn't find anything that matched my query.

    I am looking to modify the default text of our site's "Password Protection page", and I know it's possible thanks to this FAQ, but my query is a little more specific. I would like to place a Form I have specially created into the page, to act as a kind of form-gate for us. Essentially a visitor will be required to fill in the form, and I can then forward them the password to progress further into the site.

    For starters, is this even possible? And secondly, assuming it is possible, does anybody know if the confirmation will show properly, or will it freak out slightly due to the nature of the Password Protection page.

    Many thanks for your responses in advance!

    0 0

    Using the WordPress the_content tag, I am running a custom function to search for all images that do not have a width and height attribute set and insert the proper dimensions. Below is the function:

    add_filter( 'the_content', 'add_img_dimensions' );
    function add_img_dimensions( $image_no_dimensions ) { // Insert width & height to images missing dimensions
        if ( preg_match_all( '/<img [^>]+>/i', $image_no_dimensions, $result ) ) {
            // print_r( $result ); // DEBUG: print all images that don't have a dimension
            preg_match_all( '/(alt|title|src)=("[^"]*")/i', $image_no_dimensions, $img );
            list( $width, $height, $type, $attr ) = getimagesize( str_replace( "\"", "" , ( $img[2][0] ) ) );
            $imgname = str_replace( "\"", "" , ( $img[2][0] ) );
        return sprintf( '<img src="%s" width="%dpx" height="%dpx" />', str_replace("\"", "" , ( $img[2][0] ) ), $width, $height );

    For example, if there is an image on one of my pages that looks like the following:

    <img src="" alt="Image Title" />

    It will then insert the width and height of the actual image:

    <img width="150" height="50" src="" alt="Image Title" />

    This functions works as expected. However, the images that already have a width and height set disappear on the page for some reason. As you can see on line three of my code, I've added an if statement to run the function only to images with no dimensions set:

    if ( preg_match_all( '/<img [^>]+>/i', $image_no_dimensions, $result ) )

    Except I am having trouble figuring out the regular expression (regex) to use to have preg_match_all identify only images with no dimensions set.

    What is the regex that I would need to use to identify images with no dimensions in my if statement? If there is a better way to identify it, please provide me your input.


    0 0


    I am using the Connection plug-in to import an excel file with 100's of entires for display on a website. While the plug-in is working properly, alphabetical pagination would make it easier for visitors to find an entry.

    I know Connections offers premium templates that have pagination but I'd rather not pay for the integration since Connection supports it natively (if you know how to code).

    I have the Connections plug-in on a page called with shortcode. All I need to do now is somehow place a paginated filter or even a show-hide when selecting letters at the top of that page that will sort them properly.

    Thank you in advance.

    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

    I am relatively new to getting using jquery, but a client wanted something where when you hover over a child div, the parent divs background would change. A rudimentary version of what I came up with for a solution can be found here jsfiddle.

    But when I took the code and tried adding it to my site, it just will not work. I am not sure if I am missing something very simple, or something is way wrong with the code I was using. I have tried adding the script in the header, and also adding it as an external js file.

    The site in question can be found here with the section "Explore" where the code is being used -

    0 0

    Hello everyone!

    I want to customize default search query in wordpress

    I want search default data in another database.

    Now I have 2 databases , one for wordpress and another base with copy of wp_posts content.

    I want to change search query to secondary database.

    How to do it via function?

older | 1 | .... | 408 | 409 | (Page 410) | 411 | 412 | 413 | newer