• Posting here as the multisite element of my problem seems the most relevant. I’m using CKEditor with the MTC CKEditor Link Page plug-in. (I could query the plugin creators but it’s simple enough I can hack it myself if I can figure out what’s going on.) It’s supposed to easily allow you to grab a link to an existing Page on your site.

    It does this by creating a page using wp_list_pages(), then some short javascript to return the page URL when you click.

    The problem? The page generated by wp_list_pages() always seems to list the pages of the “main” site I created first, and not the site I’m currently logged in to and editing.

    Here’s the key bits of the plugin:

    window.onload = function() {
    			var atags = document.getElementsByTagName("a");
    			for(var x in atags) {
    				atags[x].onclick = addLink;
    			}
    		}
    	</script>
    </head>
    <body>
    <?php wp_list_pages(); ?>
    </body>

    Why would wp_list_pages() not return the pages of the site I’m actually working on? I’m stumped.

    FWIW, my site is http://www.rivendell-school.org/physed

    The “main site” is the root, http://www.rivendell-school.org/index.php (you need the .php because it’s sitting on top of the existing site and the index.html gets served up first).

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Looks like someone else had this issue: http://stackoverflow.com/questions/5241810/wp-list-pages-displaying-pages-from-a-specific-wordpress-site-network

    That’s … odd. It doesn’t act that way when used in a theme (and I would actually not use switch to blog myself)

    Thread Starter gkbenji

    (@gkbenji)

    My problem is actually the opposite… when I’m on a “sub” site, it’s actually listing the “main” site pages!
    Hmm… I do use the switch_to_blog(1) trick in my theme template header header.php, like so:

    <?php switch_to_blog(1); ?>
    				<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
    				<?php restore_current_blog(); ?>

    The page being generated in the plugin doesn’t use the templates at all, but could there be some strange interaction?

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    This plugin: http://wordpress.org/extend/plugins/mtc-ckeditor-link-page/

    Stupid question. With the normal add a link tool in WP, you can search for and add a page. Does that have the same problem?

    Thread Starter gkbenji

    (@gkbenji)

    Yes, that’s the plugin. The default WP editor does not have the issue–search for a page and it shows only the pages on the sub-site. TinyMCE did not cause the issue either, although I think it uses the default editor’s link function.

    Honestly, the MTC CKEditor Link Page function is pretty kludgy and I can live without it. I’m just mystified why it doesn’t work on a multisite installation.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Yeah, that’s a new one on me too. Nothing in the code looks like it should do that.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘wp_list_pages getting wrong site’ is closed to new replies.